Threads for iocompletion

  1. 4

    Interesting. It seems to me a good way to make this less common might be to write a tool that adds comments like // captures: a, b, c before any closures it analyzes. Of course, it has to be kept in sync, but it would make it clear when you’re accidentally including something you don’t mean to capture.

    1. 2

      On a similar note, I’ve often wondered how Rust would look if it made all moves explicit. I think they might have experimented with that back in the early days.

      1. 2

        Would only copies then be implicit?

    1. 4

      It seems we need, Rust - The Good parts book now :P Community consensus on how to write properly without using too much. Basically PEP 8 for Rust.

      1. 1

        Lol, “Effective C++” by Scott Myers used to be the poster child – the “morality guide” for a language. Telling you which parts to use and which not to.

        Heck, even “The Good Parts” is a pretty old historical throwback now.

        1. 1

          “Effective C++” by Scott Myers

          Ahh, those memories :P

      1. 17

        (Edit: removed about 90% of my original post b/c it was just whiny. Trying to leave the more focused comments.)

        I don’t personally feel like the problem with Haskell is the lack of documentation, even as high-quality book-length material. I tend to learn programming languages – and I’ve become at least somewhat proficient with at least 8-10 over my career, including other FP and FP-friendly ones – by reading code.

        Reading Haskell code makes me feel dumb. The use of custom operators, language extensions, and ever-changing algebras and abstractions – remember zippers? monad transformers? oh sorry, it’s free monads and optics all the way now – means I can’t jump in and have any clue what’s actually happening in most real-world Haskell code.

        It’s probably just that I’m a little too slow and a lot too impatient, but: after ~20 years of coming back to Haskell every year or two to see if I can finally get up to speed I’m more or less resigned to just never reaching that particular summit.

        Perhaps one of the books on the OP’s list would fix that. I dunno.

        1. 14

          Professional Haskeller here:

          With respect to the ever-changing abstractions comments, there’s always going to be new shiny things in blog posts. Most real applications don’t use these things and stick to the basics. “Simple Haskell” has mostly taken root in the haskell-for-business world. The basics have absolutely stuck around and stood the test of time with a few of those shiny new things making it through slowly.

          1. 11

            It would be awesome to see that subset of Haskell documented. It would be subjective so there would be different takes, and that’s ok. “Here’s a subset of haskell we’ve chosen for business app development and why we like it.”

            1. 5

              It is documented in books like ‘Haskell in Depth’ and ‘Production Haskell’. These books have chapters diving deep on solving actual problems.

            2. 3

              Interesting, I also think basic Haskell is what we should stick to, and it’s also not such a complicated language. Basically, it’s just lambda calculus with lazy evaluation and abstract data types.

              It’s a bit like in case of Lisp, where the core language is simple, but there are tons of abstractions because the core language constructs make it easy to build them and that has given Lisp a reputation of being hard to learn and maintain.

              May I ask what Haskell subset and what language extensions you use at work?

              1. 5

                It’s a lot to summarize. We have a whole style guide.

                I’ll maybe summarize with some libraries to give you a feel:

                • io-streams for streaming, unagi-chan/unagi-streams for queues
                • postgresql-simple and sqlite-simple for db
                • use good ol’ transformers, no mtl
                • maybe the one fancy thing is servant for web stuff, but servant gives you so much bang for your buck without headache that the complexity is worth it.

                I’d be happy to answer any other specific questions.

                1. 1

                  Thanks, this is really informative.

          1. 1

            Above average. Insightful. Recommended.

            1. 4

              We have unary negation in Go, it’s ^x, not ~x, also, the linked commit is about using ~ in type sets (for generics), it has nothing to do with bitwise operations. Also the blog post is about contributing to Go, but no such contribution has been made, it’s just clickbait.

              1. 11

                This seems brutally negative. Dude made a mistake in missing ^ but the article is clear and thorough.

                1. 6

                  I don’t think that’s even a mistake. I wrote about adding a print function to nginx when that already exists – the point is just to show off how you can even begin contributing to a large existing project. It’s a challenge for every kind of programmer and there are very few resources out there to help folks new to OSS get started hacking.

                  I love these kind of articles!

                  Edit: oh the linked commit is wrong, that was probably the mistake you were referring to.

                2. 10

                  It’s not clickbait at all. It’s a worked example of how to make a language change from proposal to completion. The author makes no pretense that they have submitted or even intend to submit the change.

                  1. 4

                    It’s definitely not to completion, since no effort at submission has even been made, and yet the post title certainly implies that. But more importantly, the author solves a problem that doesn’t exist because he doesn’t fully grasp the Go language which is the worst possible thing to do if you are trying to contribute to the Go language. And btw, if you want to contribute to the Go language, the first thing to do is not just to write, but more importantly to discuss a proposal, which is exactly what was not done in this case. The author jumped to implementation, and wrote his “proposal” like filing some kind of bureaucratic form. That’s not the point of the proposal process.

                    1. 2

                      “Clickbait” is a judgment laden term. It is definitely a poorly thought through article. Whether the poor thinking is because the author just wanted “clicks” or because the author was careless, I don’t know.

                      If you just want to show “here’s how to add an operator to a language” you can write that article, and that is almost what this article is. But the article purports to be “here’s how to contribute to Go” which this definitely is not because he opened an issue to contribute to Go a redundant operator, which wasted the time of the Go team to triage the non-issue. Opening a bogus issue to illustrate your blog post is uncool behavior, “clickbait” or not.

                    2. 2

                      It’s an outstanding article. Much appreciated. Definitely not clickbait.

                    1. 20

                      If you’re going to use (much more expensive) ref-counted heap objects instead of direct references, you might as well be using Swift. (Or Nim, or one of the other new-ish native-compiling languages.) Rust’s competitive advantage is the borrow checker and the way it lets you use direct pointers safely.

                      The author should at least have pointed out that there’s a significant runtime overhead to using their recommended technique.

                      1. 20

                        No, this a fatalistic take almost like “if you use dyn you may as well use Python”.

                        Swift’s refcounting is always atomic, but Rust can also use faster non-atomic Rc. Swift has a few local cases where it can omit redundant refcounts, but Rust can borrow Rc‘s content and avoid all refcounts within a scope, even if object’s usage is complex, and that’s a guarantee not dependent on a Sufficiently Smart Compiler.

                        Swift doesn’t mind doing implicit heap allocations, and all class instances are heap-allocated. Rust doesn’t allocate implicitly and can keep more things on the stack. Swift uses dynamic dispatch quite often, even in basic data structures like strings. In Rust direct inlineable code is the norm, and monomorphisation is a guarantee, even across libraries.

                        So there’s still a lot more to Rust, even if you need to use Arc in a few places.

                        1. 9

                          Uhu. It seems to me that there are two schools of thought here.

                          One says: .clone(), Rc and RefCell to make life easier.

                          The other says: the zen of Rust is ownership: if you express a problem as a tree with clear ownership semantics, then the architecture of your entire application becomes radically simpler. Not every problem has clean ownership mapping, but most problems do, even if it might not be obvious for the start.

                          I don’t know what approach is better for learning Rust. For writing large-scale production apps, I rather strongly feel that the second one is superior. Arcs and Mutexes make the code significantly harder to understand. The last example, a struct where every filed is an Arc, is a code smell to me: I always try to push arcs outwards in such cases, and have an Arc of struct rather than a struct of arcs.

                          It’s not that every Arc and mutex is a code smell: on the contrary, there’s usually a couple of Arcs and Mutexes at the top level which are the linch-pin of the whole architecture. Like, the whole rust-analyzer is basically an Arc<RwLock<GlobalState>> plus cancellation. But just throwing arcs and interior mutability everywhere makes it harder to note these central pieces of state management.

                          1. 3

                            I’ve always felt that the order of preference for new code is:

                            1. make it work
                            2. make it pretty
                            3. make it fast/resource-efficient

                            (some people may choose to wedge in “make it correct” somewhere there, but I think that’s either mostly a pipe dream or already part of 1.)

                            That would mean that you always use the easiest possible techniques in phases 1 and 2 and in phase 3 do something more clever but only if the easy techniques turned out to be a bottleneck.

                            I’m guessing the easiest technique in Rust terms would be copying a lot.

                            1. 2

                              I tend to agree about that ordering, but I’ve also found that heap allocation and copying is frequently a bottleneck, so much so that I keep it in mind even in steps 1-2. (Of course this applies to pretty low-level performance sensitive code, but that’s the kind of domain Rust gets used for.)

                            2. 3

                              I completely agree. If you don’t need precise control over memory, including the ability to pass around refs to memory safely, then the sane choice is to use a well-designed garbage collected language.

                              Maybe you’re building something where half needs to control memory and the other half doesn’t. I guess something like this could make sense then.

                              1. 2

                                Swift isn’t exactly “available” on many Linux distributions due to its overengineered build system. The same goes for dotnet. Both of these languages are extremely fickle and run many versions behind the latest stable release offered on the natively supported OS (macOS for Swift and Windows for dotnet).

                                To build Rust is comparatively sane and a breath of fresh air.

                                1. 1

                                  Well, there is OCaml of course. On Linux with a reasonable machine, compiling it from scratch with a C toolchain should take just a handful of minutes. Of course, setting up the OCaml platform tools like opam, dune, etc., will take a few minutes more.

                              1. 2

                                Outstanding article. I went down the oop road and got good at it. It declares one claim you must take on faith— that if you insist that “everything is an object”, it’s possible to find a nice set of objects to implement you’re system, and that’s the best way to do things.

                                Instead, what it does is tickles a developer’s brain in a super enjoyable way that feels fulfilling … in other words mental masturbation.

                                What i found is you often can find an elegant solution that consists of objects, and it will feel like a profoundly beautiful thing when you do. It will feel so right that it convinces many that, “this is the way.”

                                But in reality, it’s over-complicated. Your brain has a blast, but it was more about pleasuring your brain by making you work under a challenging limitation. Turns out you could drop that single dogmatic principle and wind up with a simpler solution faster, still elegant and maintainable (which is of course more fulfilling).

                                The one claim you had to take on faith, turns out, is exactly where the whole thing breaks down. And the incorrect illusion of “rightness” it gives to the puzzle solver’s brain is the engine that keeps it rolling.

                                1. 4

                                  Instead, what it does is tickles a developer’s brain in a super enjoyable way that feels fulfilling … in other words mental masturbation.

                                  I very much agree. I do see “every little thing is an encapsulated object that receives messages” as an artificial constraint which acts like a additional challenge akin to ones used in many games. “Complete game without killing anyone” in an RPG game and get a “pacifist” achievement, etc.

                                  Instead of actually solving the problem and working on solving constraints that are actually important, we tend to get stuck on puzzle solving that makes us feel smart. It’s not limited the OOP. The same kind of motive are e.g. people agonizing over expressing some universal taxonomy, overusing generics to provide “super clean universal abstraction”, or (in Rust) solving a borrow checker puzzle involving 3 lifetimes, just to shave off one data copy in some cold path.

                                  1. 3

                                    Very true, and a good pattern to be aware of (in yourself and others).

                                    That said, there is an upside to adding additional constraints: constraints can make things easier to reason about. The most obvious, famous example that comes to mind is maintaining referential transparency in functional programming, and isolating your mutations. Or, say, in React, the way you have actions that update a data model, and then a unidirectional flow of that updated model down into the re-rendered view. In these cases, too, (especially at first) it can be a “puzzle” to figure out how re-structure your problem so that it fits into the paradigm. But in both of these cases, at least imo, there is a huge net benefit.

                                    Which is to say that “artifical constraints” per se aren’t the problem. The problem is artificial constraints that are time-consuming but don’t pay you back.

                                    1. 1

                                      Which is to say that “artifical constraints” per se aren’t the problem. The problem is artificial constraints that are time-consuming but don’t pay you back.

                                      Agreed!

                                      1. 1

                                        I agree, except for semantics… if the constraint has an actual payoff (like “use only pure functions” does, for example), then it is no longer “arbitrary” or “artificial”.

                                        “Everything is an object” never had a real payoff… it was just dogmatic koolaid.

                                    2. 3

                                      I am by no means an OOP-first or an OOP-only and spent years being anti-OOP (but without knowing what OOP was or knowing what I preferred instead) – if I had to be pressed to “pick a paradigm” I would say I’m a functional programmer.

                                      However, I have seen (and written myself and tried to come back later) enough “big procedures of doom” to know that is not the way. Or at least not a way I want to have to touch unless for a lot of money. Of course “good procedural” exists just like “good OOP” does but really we should focus on what we (often) have in common, which is that a 50 line procedure with everything inline is (often) an unreadable mess two days later and (more often) gets worse with every edit and so it needs to be modeled somehow (and no, procedures named do_thing, do_second_thing don’t count). You can use polymorphism and call it OOP or you can use closures and call it functional or you can use modules with glue and call it procedural or what have you – the paradigm and the name doesn’t matter, only the result.

                                    1. 3

                                      Rust sounds like a good match (but i doubt that’s your choice because I think you tried it already). But see the recent post here about rust being as productive as kotlin.

                                      1. 11

                                        My money is on F#. He gets everything he likes from OCaml as well as proper multicore support. Plus he has the entire .NET ecosystem to fall back on when it comes to libraries, documentation etc.

                                        1. 5

                                          F#

                                          Looks like you were right:

                                          https://blog.darklang.com/new-backend-fsharp

                                          1. 2

                                            You nailed it!

                                          2. 4

                                            It sounds like Rust would be an awful choice, because most of his complaints are true for Rust as well, especially where the ecosystem is concerned.

                                            1. 3

                                              Rust has a much bigger ecosystem especially in terms of “cloud” and web stuff. You won’t have the “there’s no google cloud client library and the postgres client is incomplete” problem in Rust.

                                              1. 2

                                                Rust is approaching 50,000 crates (that’s 1/5th of nuget, and more than CPAN). It’s not as big as mainstream package repositories, but it’s definitely past being a niche language.

                                                1. 2

                                                  It doesn’t matter how many crates exist if none of them provide what you need

                                                  1. 5

                                                    That’s a meaningless tautology. It’s true when applied to any language.

                                              2. 3

                                                Rust doesn’t really have a good official google cloud sdk. I think the safest choice is Go if your aim is interfacing with google products.

                                                That being said, I wish someone made the equivalent of bucklescript/reasonml that compiles to go so you can just use ocaml with go’s extensive set of libraries.

                                                1. 8

                                                  That’s one of the reasons I don’t like Go—its ecosystem is a walled garden.

                                                  OCaml libraries are usable from other languages, you can write a shared library in it. Whether to link everything statically is a choice. With Go you don’t have that choice, if you write a library, no one but other Go users can ever benefit from it.

                                              1. 50

                                                Regardless of whether you currently think your existing tools need replacing, I urge you to try ripgrep if you haven’t already. Its speed is just amazing.

                                                1. 7

                                                  I’ll second this sentiment. Your favored editor or IDE probably has a plugin to use ripgrep and you should consider trying that too.

                                                  1. 6

                                                    As an experiment I wrote a tiny Go webservice that uses ripgrep to provide a regex aware global code search for the company I work at. The experiment worked so well over a code base of ~30GB that it will probably replace hound which we use for this purpose at the moment. I did not even use any form of caching for this web service, so there is still performance to squeeze out.

                                                    1. 5

                                                      https://github.com/phiresky/ripgrep-all comes with caching, it’s a wrapper around rg to search in PDFs, E-Books, Office documents, zip, tar.gz, etc

                                                    2. 3

                                                      ripgrep and fd have changed the way I use computers. I’m no longer so careful about putting every file in its right place and having deep, but mostly empty, directory structures. Instead, I just use these tools to find the content I need, and because they’re so fast, I usually have the result in front of me in less than a second.

                                                      1. 5

                                                        You should look into broot as well (aside, it’s also a Rust application). I do the same as you and tend to rotate between using ripgrep/fd and broot. Since they provide different experiences for the same goal sometimes one comes more naturally than the other.

                                                        1. 2

                                                          broot is sweet, thanks for mentioning it. Works like a charm and seems super handy.

                                                      2. 1

                                                        3 or 4 years ago it was announced that the vs code “find in files“ feature would be powered by ripgrep. Anyone know if that’s still the case?

                                                        1. 1
                                                      1. 7

                                                        I think what this comes down to is that there isn’t a great language for building languages :-/

                                                        OCaml is supposed to be that language, and I even wrote in ~2015 on my website that I would write all future language projects in OCaml. Yet I didn’t go down that path for Oil, and I don’t regret it.

                                                        Instead I came up with this somewhat weird Python + ASDL + multiple code generator combo, but it has worked out well, and compiles to nice C++.

                                                        It’s both low level and high level at the same time. Languages need both because they’re extremely repetitive tree matching on the one hand, and very performance sensitive on the other (which I learned the hard way).


                                                        A few more threads about metalanguages, with extensive comments on using Rust to implement languages:

                                                        https://old.reddit.com/r/ProgrammingLanguages/comments/bkohba/what_language_did_you_use_to_implement_your/

                                                        https://old.reddit.com/r/ProgrammingLanguages/comments/ays7d7/languages_used_to_implement_compilers/

                                                        https://notamonadtutorial.com/an-interview-with-the-creator-of-gleam-an-ml-like-language-for-the-erlang-vm-with-a-compiler-e94775f60dc7


                                                        This is the programmer’s version of Guy Steele’s computer science complaint: https://www.youtube.com/watch?v=7HKbjYqqPPQ

                                                        That is, that the language used for describing languages is horribly imprecise and inconsistent.

                                                        1. 5

                                                          I guess it is supposed to be Racket … and yet often it doesn’t seem to play out that way.

                                                          As an outside observer, I wonder why that is.

                                                          1. 7

                                                            Yes exactly, Racket is supposed to be a language for languages. A bunch of reasons that I see:

                                                            1. Performance. As mentioned, I learned the hard way how performance-sensitive languages are. Racket was a CPython-like interpreter in C until recently: https://blog.racket-lang.org/2020/02/racket-on-chez-status.html

                                                            I wrote Oil in Python and it was way too slow. Racket would have been also too slow, and even with the new runtime, I doubt it would be fast for parsing shell. JITs tend to speed up numeric workloads more than string workloads. String workloads are dominated by allocations and the JIT may not see through those.

                                                            1. Algebraic data types. I’m not up to date on what Racket offers here, but all the Lispy mechanisms I’ve seen fall somewhat short of the real thing. Algebraic data types really help when dealing with languages. They affect 50-80% of the lines of code. Compilers and interpreters are full of conditionals, and it’s a huge help to encode those as data rather than code you have to step through.

                                                            2. Static types help too. Oil started out dynamically typed and is now statically typed with MyPy.

                                                            3. Syntax. Racket does support syntax unlike other lisps, but I think it’s not culturally there, and the support for parsing is relatively weak. For example, the C ecosystem has re2c, which I used in Oil, etc. The Python ecosystem has a number of options for parsing as well.

                                                            4. Runtime dependencies (for interpreters). As far as I call, the Shill shell (a research project) was written with Racket. But then they switched to something else because the runtime got in the way.

                                                            5. Build time dependencies (for compilers). Compilers are often bootstrapped in a unique way – e.g. Go compilers in Go, Rust in Rust, Zig in Zig, Clang in C++, etc. Compiler writers want to use their own language, and not someone else’s.

                                                            So in all of those areas, OCaml and Rust beat Racket IMO. And on top of that, I agree with the downsides about both OCaml and Rust. (Not that my own solution doesn’t have a lot of downsides. The important thing is that they’re all fixable because the code is small and under my control!)

                                                            I think Racket is probably very nice for prototyping languages. I’m not sure it’s good for production quality implementations, at least when you’re talking about competitors to CPython, LLVM, rustc, Go, Julia, etc.

                                                            Julia was bootstrapped in femtolisp though, which is interesting. I hacked on it at the beginning of Oil, but decided I didn’t like that style.

                                                          2. 3

                                                            From my perspective, as someone who’s spent the past 5 years doing more pure functional programming (Elm and Haskell) professionally than anything else, and who’s been working on a compiler written in Rust outside work…I would gladly describe Rust as “great for building languages.”

                                                            The learning curve was substantial, but now that I’m comfortable with Rust, I don’t think anyone could sell me on OCaml or Haskell (or any other language I’ve heard of) as a better choice for building a compiler.

                                                            Granted, that’s in large part because execution speed is extremely important to me. I have very high standards for how fast I think a compiler should run!

                                                            1. 6

                                                              I have very high standards for how fast I think a compiler should run!

                                                              Kind of ironic, since you’re using Rust. (I kid, I kid!)

                                                              1. 1

                                                                Haha yeah rustc is definitely way below my bar!

                                                                1. 1

                                                                  To be fair it is doing some amazing things :)

                                                              2. 2

                                                                Purely opinion, based on looking at some code like

                                                                https://github.com/gleam-lang/gleam/blob/main/src/typ/expr.rs

                                                                (linked in the above threads)

                                                                It looks more concise than C++, but a lot more wordy than OCaml (or Elm). I’d be interested in seeing other idiomatic Rust code that implements languages (compilers, interpreters, runtimes).

                                                                1. 2

                                                                  I’m the author of this code. :)

                                                                  I did experiment with using OCaml to start with, and yes, the Rust version is a lot more verbose, especially when using shared mutable references (which are very concise in OCaml). Despite this I prefer the Rust experience, and I think it’s a more generally useful language to know.

                                                                  1. 2

                                                                    Yes I think we talked on the original Reddit thread which I quoted here

                                                                    https://lobste.rs/s/vmkv3r/first_thoughts_on_rust_vs_ocaml#c_v5ch1q (as well as your article)

                                                                    I think you said you prefer Rust there. That is a useful data point for sure. I’m not experienced with Rust but I can definitely see why it’s appealing for languages.

                                                                    I actually think that “procedural” / stateful code with algebraic data types is a pretty good combo. That’s basically how my Oil project is written, with statically typed Python + ASDL.


                                                                    I heard someone say that Rust shows you can “just mutate”. In other words, some languages like Clojure and Erlang rely on immutability for concurrency. But Rust relies on its type system for that, so you are safe with mutation.

                                                                    And I just read someone say something similar here:

                                                                    https://news.ycombinator.com/item?id=24295408

                                                                    Others sometimes don’t like to hear this, but IMO, Rust is not at all functional. … Rust is very much procedural

                                                                    Although not everyone agrees.

                                                                    I have come around to this viewpoint. I used to program in more of an immutable style, but now I favor local mutation and “principled” global mutation. It seems to work well for languages, e.g. lexing and parsing are inherently stateful. And that style does seems to be in line with Rust’s design.

                                                              3. 1

                                                                Thanks for these resources, will read them!

                                                              1. 17

                                                                Requires a sign-in to read. Unread.

                                                                1. 8

                                                                  Is there a way to filter content by domain? I never want to give medium.com my eyeballs

                                                                  1. 2

                                                                    Fair enough, and I agree.

                                                                    But if you like you can work around the problem by telling your browser not to accept cookies from medium.

                                                                    1. 2

                                                                      I opened this page both in Firefox for macOS and Firefox for Android, and both browsers showed me the full article without me having to sign in. I was able to view the article despite not even having a Medium account.

                                                                      Maybe your problem is related to this message I see at the top of the page:

                                                                      You have 2 free stories left this month. Sign up and get an extra one for free.

                                                                      Try opening the page in a Private Browsing window?

                                                                    1. 3

                                                                      So, you say, towards the end of the vdieo, that all structure is derivative, but I’m struggling to understand the implications of that beyond a general “every needs to be considered in context” sense.

                                                                      1. 2

                                                                        I was telling a friend online today that it’s a struggle trying to find the right pace for the material I have to cover. If I go too fast, people miss the point. Yet if I take my time and establish foundations, people complain it’s too slow. This is a good example of that.

                                                                        Basically there is a system to explain why structure is created, any structure from a database design to a bridge. Although I know that sounds overly-broad, understanding the system that creates structure allows us to start teasing it apart and optimizing it, looking at how we code and architect systems from the outside rather than as people down in the trenches in the heat of battle.

                                                                        Structure has to exhibit some desired behavior and conform to whatever rules you’re carrying around in your head when you create it. Most of these rules are invisible, unconscious even. For instance, I’ve been brought on to the beginnings of large systems being designed only to be given a list of things they’ve already decided to use, no negotiation. That kind of thing can have vast costs and cause vile and pernicious problems downstream … and the folks suffering through it would never know that the org brought this on themselves.

                                                                        Behavior is pretty easy to track. We have behavior we want and we have tests to validate that behavior. (The tests can be formal or just in your head). Rules/Values are another thing entirely. It’s possible to have tests here too, though! So a while later we’ll talk about infrastructure testing, where things like the simian army comes in. But we’ll only do that once we drive out more details about what exactly we mean by rules or values.

                                                                        So I had to start somewhere. One of the interesting things about “all structure is derivative” is how many senior programmers and architects that will dispute it! You have to sit down with them and take them through example-after-example, usually from their own work, for it to finally sink in. When we talk about the modern development environment being overly-complex and systems that are built far beyond what’s needed, the failure to understand this is where it all starts .. and where we can start fixing it.

                                                                        1. 3

                                                                          Expanded out just a hair, it makes a bit more sense. So, to make sure I understand the point, all structures (languages or tools) are shaped by the structure/context that led to their creation. We can take advantage of this knowledge by trying to apply some our systems knowledge one level back.

                                                                          To start with a trivial example, while you can do most tasks with most tools, choosing a tool that is a good fit makes for getting the task done easier. Hammering nails, rather than smashing a screwdriver or a fist into them (or, using Rails or PHP for a website rather than using C++ or CGI/Bash).

                                                                          Taken a level up, architecture choices in a software project, or how many people are working on a given product can have a big influence (Conway’s Law), or the like.

                                                                          Of course, the more levels up you go, the more you switch towards politics and a messy system of people. A messy system of code can come from one person, or from many.

                                                                          Why do you think so many senior software devs are resistant to the idea? Is it pride? Part of the consequences of the software industry having a myopic and incomplete view of its own history?

                                                                          1. 4

                                                                            It’s a weird thing because so much of it we are unable to see. It’s like the old “you can’t explain water to fish” thing.

                                                                            I believed, taught, and preached YAGNI for years. I can’t convey the shock I felt when I finally realized I wasn’t doing it. Yikes!

                                                                            You should be able to point to any piece of code or architecture in your solution and be able to explain why you were forced to have it there. Most of the time people think they can do this, but when pressed it’s just a lot of arm waving and talk about best practices and such.

                                                                            1. 2

                                                                              How did you realize that you weren’t practicing YAGNI? It’s something I’ll admit I don’t adhere to nearly perfectly, (but then, I also admit that I don’t follow any software principle perfectly).

                                                                              I’d like to think I’m somewhat self aware, but I will also admit that I struggle with a lot of patterns that recur and seem less than ideal. But then, I’ve also grown up in a cross cultural setting, so my water has been shifted a lot, which makes me more aware of it in general.

                                                                          2. 2

                                                                            So, are any of these reasonable ways to paraphrase what you mean by “all structure is derivative”?

                                                                            • “No part of a system should be present due to dogma. Every bit of it should be chosen based on reasoning from first principles.”
                                                                            • “No choice about how to design/build a system is inherently correct or incorrect. Rather, the key question is how suitable each choice is towards the desired outcomes.”

                                                                            I’m just trying to figure out whether I’m getting your point clearly. If not, maybe it would help if you were to provide a fictional example of a conversation with a senior programmer who starts out disputing you, and then is convinced as you talk through examples from their work.

                                                                            1. 2

                                                                              How about (in regards to coding): It is impossible for any line of code to be written unless the programmer is balancing what she wants the code to do against their own set of rules for how things should be coded. The behavior part is explicit and what everybody focuses on. The values/rules part is almost entirely hidden.

                                                                              If we want to write better code, we need to understand how coding happens. From there, we can “drive the train backwards”, taking coding situations where we have poor outcomes and looking at the desired behaviors and values the coders used when creating them.

                                                                              I’ve got a few concepts that this is the foundation for, such as Good Enough Programming, Incremental Strong Typing, and Code Budgets.

                                                                              From there, I’ve got a few examples of fun coding projects that apply them. I’m hoping to get there with these videos. But you gotta start somewhere. If folks don’t understand why code happens, the balancing act that is required, they’ll just get hung up further down the road.

                                                                        1. 5

                                                                          Do we have a lot of Lobsters on Windows? I keep debating doing a “Windows is Not Unix” guide for people who are moving to Windows + WSL2, but I keep convincing myself there’s no interest. The fact this is so high on the front page makes me wonder if I’m wrong.

                                                                          1. 4

                                                                            I use a Surface Book pretty regularly and run WSL2 on it. Although I also have a Linux desktop and a work-issued Macbook Pro.

                                                                            1. 2

                                                                              I use Windows at work.

                                                                              1. 2

                                                                                Ditto.

                                                                              2. 2

                                                                                I switched full-time to Windows about a year ago. I avoid WSL as much as possible, even going so far as to send PRs to open source projects that assume a Linux environment. I actually find it quite rewarding!

                                                                                1. 2

                                                                                  I do that but for BSD instead of Windows ;)

                                                                                2. 2

                                                                                  I’m interested. I use Linux as my primary desktop computing environment, but some things I do some of the time (e.g. building games for Unity) go better on Windows. And every time I try to adopt Windows for a few days, I’m a bit stymied. I feel like so many people use this, there must be something wrong with my workflow that’s making it feel so wrong to me.

                                                                                  This article is helpful and kind of sniffs around the edges. But I’d really be interested to learn more about what a really “Windows Native” workflow looks like and what people who use that all the time consider appealing about it. So if you post it, I hope it gets some attention here. Because even if I won’t ever be a “Windows person” I think I’m making myself suffer needlessly when I do use it, and I’d like to be educated about how to be more effective on it.

                                                                                  1. 1

                                                                                    For what it’s worth, I think your experience is very common (which is why ‘Windows’ gets followed immediately by ‘WSL’.)

                                                                                    As far as I can tell - and for no good reason - Linux users have a good command line and tend to use it, and Windows developers end up with a good IDE and tend to use it, and in both cases the thing not being used is neglected. So switching platforms is really about switching cultures and embracing a very different workflow. People going in both directions see the new platform as “inferior” because they’re judging the quality of tools used to implement their previous workflow.

                                                                                    As someone who really loves the command line, Windows has often felt like it required me to “suffer needlessly.” Personally I ended up writing my own command processor to incorporate a few things that the Linux command line environment “got right” and it ended up being extended with many interactive things. I haven’t felt like I’m suffering or missing out by using Windows after that, although clearly there’s a personal bias since those tools are designed for my workflow. If you don’t like mine, then it pays to learn Powershell, which is also a big cultural adjustment since the basic idioms are very different to textual Posix shells.

                                                                                    To me the most “appealing” part of being a Windows developer is WinDbg, which also has a steep learning curve but it’s far better than anything I’ve used on Linux and is much more capable than Visual Studio for systems level debugging. It’s one of those “best kept secret” type things that’s easy to get - once you know it exists and that it makes serious development much easier.

                                                                                  2. 1

                                                                                    I use Windows at work (though work is Microsoft Research, so that’s not very surprising). I use WSL1 and a FreeBSD VM. I don’t think WSL2 yet has the nice PTY and pipe integration in WSL1. With WSL, I can run cmd.exe in a *NIX shell (including something like Konsole in VcXsrv) and it works. More usefully, I can run the Visual Studio Command Prompt batch file to get a Windows build environment from my WSL environment. If a Windows program creates a named pipe in the WSL-owned part of the filesystem namespace, it is a Linux named pipe.

                                                                                    1. 1

                                                                                      I reluctantly use Windows, but I try to avoid it. There’s rarely anything I want to use that is only available on Windows with no viable alternative. Still, there are times I have to use it. I haven’t bothered with WSL2 but I would still read something like this if it existed.

                                                                                      1. 1

                                                                                        My work/play machine at home is Windows. Always has been. (Because games, obviously, and I don’t like dual boot.)

                                                                                        I detest working on Windows though and WSL hasn’t improved anything for me yet, that’s why I still do most of my work via PuTTY on a linux box if possible. (work means any ops/programming work I do in my free time).

                                                                                        Work machine is Linux and I’m actually glad I couldn’t work on Windows so no one can push me :P

                                                                                        1. 1

                                                                                          I’ve recently committed Linux apostasy :) partly on account of WSL2, and I’d definitely be interested in that. I haven’t used Windows, except to run putty to log in to a remote server, in a very, very long time (in fact, save for a brief period between 2011 and 2012, when I worked on a cross-platform tool, I haven’t really used it in 15+ years, the last version I used regularly was Windows 2000). I’m slowly discovering what’s changed since then but 15 years is a lot of time…

                                                                                          1. 1

                                                                                            I’m on Windows and routinely browse lobsters by looking at the ‘windows’ tag.

                                                                                            That said, I really don’t understand the point of moving to Windows to then run WSL2. Using WSL2 is using a Linux VM, and for the most part, the issues there are not about Windows. If you want a Linux VM, you can run one on any platform…

                                                                                            1. 4

                                                                                              Well, it’s a damn convenient VM :). I’ve tried it as an experiment for a month or so – I’m now on an “extended trial” of sorts, I guess, for 6 months (backups over the network, all Linux-readable – if I ever want to go back I just have to install Linux again). I use it for two reasons:

                                                                                              • It’s a good crutch – I’m sure everything I could do under Linux can be just as easily be done under Windows but 20 years of muscle memory don’t get erased overnight. It lets me do things I haven’t had time to figure out how to efficiently do under Windows in a manner that I’m familiar with. I could do all that with a VM, too, but it’s way better when it works out of the box and boots basically instantaneously.
                                                                                              • It gets me all the good parts of Linux – from mutt to a bunch of network/security tools and from ksh to my bag of scripts – without any of the bad parts. Of course, that can also be done with a VM – but like I said, this one works out of the box and boots instantaneously :).

                                                                                              I don’t use it too much – in the last two weeks I don’t think it’s seen six hours of use. I fire it up to read some mailing lists (haven’t yet found anything that handles those as well as mutt – even Pegasus Mail isn’t as cool as I remember it…), and I fiddle with one project inside it, mostly because it’s all new to me, and I want to work on it in a familiar environment (learning two things at a time never goes well).

                                                                                              I still haven’t made up my mind on keeping it, we’ll see about that in six months, but I’m pretty sure I’d have never even considered the experiment without WSL2.

                                                                                            2. 1

                                                                                              My monitor + video card setup is aimed at gaming and is almost entirely unusable on Linux period. I’m looking at replacing the graphics card in the future, but until that happens, Windows is the only tolerable OS.

                                                                                              1. 1

                                                                                                I like to play video games, which almost always means “you need windows”.

                                                                                                I used to dual boot Debian but nowadays I tend to just ssh into a cloudish instance thing that I use as a kind of remote workstation. That combined with vscode’s wonderful remote support means outside of work most of my personal-hacking-stuff still takes place through the window of… well, windows.

                                                                                              1. 3

                                                                                                I flagged as off-topic because there is no technical content in the video and the content is anecdotal reflections on social issues at best.

                                                                                                1. 3

                                                                                                  I think that’s the point. For the person doing the video, and people like him, they feel like they CAN’T level up on technical skills until they prove themselves in multiple other ways, often involving issues outside of work.

                                                                                                  This has been a longstanding thing with all areas of trying to increase diversity in our industry. Conway’s Law states that systems mirror the organizations that created them – this means that if your organization is exclusionary (even unintentionally), so will the things your organization creates.

                                                                                                  Look up the term “code-switching” to get a better idea of what he’s referring to for part of this video.

                                                                                                    1. 2

                                                                                                      Why?

                                                                                                    2. 1

                                                                                                      I’m disappointed.

                                                                                                      1. 1

                                                                                                        I think that’s the point. For the person doing the video, and people like him, they feel like they CAN’T level up on technical skills until they prove themselves in multiple other ways, often involving issues outside of work.

                                                                                                        This has been a longstanding thing with all areas of trying to increase diversity in our industry. Conway’s Law states that systems mirror the organizations that created them – this means that if your organization is exclusionary (even unintentionally), so will the things your organization creates.

                                                                                                        Look up the term “code-switching” to get a better idea of what he’s referring to for part of this video.

                                                                                                      1. 5

                                                                                                        Honestly, point # 8 should be directly in the Rust book. And the whole article is amazing.

                                                                                                        Corollary – has anyone ever explored the possibility of an editor plugin or code formatter that graphically, explicitly shows the lifetimes inferred by the compiler? (I imagine it would be much more complex than it sounds … maybe not even feasible).

                                                                                                        1. 3

                                                                                                          I have wanted this. If the error string can show you the borrow points, you should be able to get that data in the editor.

                                                                                                        1. 18

                                                                                                          Since nobody else has written about Rust yet, and you mentioned it, I’ll bite.

                                                                                                          I guess one of the problems of waxing poetic about Rust is that it has kind of already been beaten to death. Oodles of people are excited about Rust. Since it’s still growing, and since there is no zeal like the zeal of the newly converted, there are a lot of people singing its praises. To such an extent that an entire culture war has evolved around it, including right here on Lobsters. I’m a biased observer, and I get my hands dirty in it, but if I try to pop up a level, it really is an interesting phenomenon. But that’s a topic for a different day…

                                                                                                          I am not new to Rust, so I think if I was ever touched by the zeal of the newly converted, it has assuredly worn off by now. With that in mind, I’ll try to avoid just regurgitating the stuff other people say about Rust, but that’s hard.

                                                                                                          I think the Happy State of Rust is its entire package. I’ve written code in a lot of programming languages and ecosystems (with Windows and the APL lineage being at least two of my major blind spots), and I feel reasonably safe in the conclusion that Rust’s complete package is fairly unique. My main shtick is being relentless about being upfront about trade offs, and there are few ecosystems out there that let you express the range of trade offs offered by Rust. On the one hand, you can dip down deep into high performing generic data structures that benefit from the amazing work of optimizing compilers like LLVM, but on the other hand, you can also stay in the relative comfort of a high level application oriented language when you want to. The former might require arcane knowledge of what exactly is and isn’t undefined behavior while the latter might cause you to say, “UB? What’s that?”

                                                                                                          If you pop up a level, that’s a really impressive range to encapsulate in one ecosystem. It’s not like that range hasn’t been done before. Look at Python for example. The typical way you might see that range being expressed is with modules written in C with a nice, comfy and safe Pythonic API layered on top of it. But there’s just all sorts of trade offs there. First, there’s the friction of dealing with Python’s C module boundary. Second, there’s the inherent cost in providing that boundary in the frist place. And thirdly, there’s the cost of Python itself.

                                                                                                          I am perhaps running the risk of putting up a straw man, but that’s OK. The fact that “write low level code in C and wrap it up in a Python module” is a very popular approach to expressing the range of trade offs I’m referring to is I think enough. An example might help.

                                                                                                          Consider something as simple as counting the number of fields in a CSV file. The Python code is deliciously simple:

                                                                                                          import csv
                                                                                                          import sys
                                                                                                          
                                                                                                          count = 0
                                                                                                          for record in csv.reader(sys.stdin):
                                                                                                              count += len(record)
                                                                                                          print(count)
                                                                                                          

                                                                                                          The Rust code is a smidge bigger, but not materially so:

                                                                                                          fn main() -> Result<(), Box<dyn std::error::Error>> {
                                                                                                              let mut rdr = csv::ReaderBuilder::new()
                                                                                                                  .has_headers(false)
                                                                                                                  .from_reader(std::io::stdin());
                                                                                                              let mut count = 0;
                                                                                                              for result in rdr.byte_records() {
                                                                                                                  let record = result?;
                                                                                                                  count += record.len();
                                                                                                              }
                                                                                                              println!("{}", count);
                                                                                                              Ok(())
                                                                                                          }
                                                                                                          

                                                                                                          Running the program on a 445MB CSV file from the Open Policing project with the Python program:

                                                                                                          $ time python happy-state.py < /m/sets/csv/openpolicing/MA-clean.csv
                                                                                                          78620877
                                                                                                          
                                                                                                          real    5.844
                                                                                                          user    5.777
                                                                                                          sys     0.060
                                                                                                          maxmem  8 MB
                                                                                                          faults  0
                                                                                                          

                                                                                                          And now Rust:

                                                                                                          $ time ./target/release/happy-state < /m/sets/csv/openpolicing/MA-clean.csv
                                                                                                          78620877
                                                                                                          
                                                                                                          real    0.915
                                                                                                          user    0.873
                                                                                                          sys     0.040
                                                                                                          maxmem  6 MB
                                                                                                          faults  0
                                                                                                          

                                                                                                          Despite the fact that Python’s CSV parser is written in C, it just can’t compete. Rust’s CSV parser (disclaimer: I wrote it, I’m using an example I know well) is itself a very complex beast. But as in the Python ecosystem, all of this is well hidden from typical users of the library. It’s got some gnarly internals, but users are presented with an API that is at least close to the simplicity of Python’s API, except it’s also 6 times faster.

                                                                                                          And this is just the beginning. Since Rust’s range of trade offs can really be cashed in almost everywhere, you can make small tweaks to your program to make it run even faster, if you’re willing to put up with a bit more complexity:

                                                                                                          fn main() -> Result<(), Box<dyn std::error::Error>> {
                                                                                                              let mut rdr = csv::ReaderBuilder::new()
                                                                                                                  .has_headers(false)
                                                                                                                  .from_reader(std::io::stdin());
                                                                                                              let mut record = csv::ByteRecord::new();
                                                                                                              let mut count = 0;
                                                                                                              while rdr.read_byte_record(&mut record)? {
                                                                                                                  count += record.len();
                                                                                                              }
                                                                                                              println!("{}", count);
                                                                                                              Ok(())
                                                                                                          }
                                                                                                          

                                                                                                          And running it:

                                                                                                          $ time ./target/release/happy-state < /m/sets/csv/openpolicing/MA-clean.csv
                                                                                                          78620877
                                                                                                          
                                                                                                          real    0.769
                                                                                                          user    0.729
                                                                                                          sys     0.037
                                                                                                          maxmem  6 MB
                                                                                                          faults  0
                                                                                                          

                                                                                                          The speed boost is small, but things like this can add up as your data set grows. And keeping in mind this is just an example. The point is that you just can’t do stuff like this with Python because Python doesn’t really let you easily amortize allocation. You’d likely need to drop all the way back down into C to get these kinds of optimizations. That’s a lot of friction to pay for.

                                                                                                          OK, so why am I picking on Python? Surely, my point is not to say, “See, look, Rust is faster than Python!” That’s silly. My point is more holistic than that. It’s more like, “See, look, you can be in a comfy, safe high level language, but are also free to trade code complexity for faster programs without a lot of friction.”

                                                                                                          Other ecosystems like modern C++ start to approach this. But obviously there are some critical distinctions there. The main one being that C++ is “unsafe by default everywhere.” You don’t get that same assurance of a safe and comfy high level language that you do in Rust. IMO, anyway.

                                                                                                          And then there are all the other little things that Rust does well that makes me as a pragmatic programmer very happy. The built in unit testing and API documentation tooling is just lovely. It’s one of those things that Rust didn’t invent, of course, but it feels like I’m constantly missing it (in some form, to varying degrees) from almost every other language or ecosystem I use. There’s always some detail that’s missing or not done well enough or not ubiquitous.

                                                                                                          I think I’ll stop it here. I wrote this comment with rose tinted glasses. Rust is not a panacea and there are lots of things about it that are inferior to other languages. For example, I presented one particular example where Rust and Python code have similar levels of complexity, but obviously, that does not necessarily generalize. There are other things that make Rust inferior in certain cases, such as compile times, platform support and certification. Language complexity is hard to fix, but I largely see the other things as at least having the potential to improve significantly. And if they don’t—or don’t improve as much as folks hope—then that’s OK. Rust doesn’t have to be All Things to All People at All Times. The rosy picture I painted above can still be true for men(and hopefully many others) while not being true for others. Trade offs aren’t just purely technical endeavors; costs that may not matter as much to me might matter a lot more to others.

                                                                                                          1. 1

                                                                                                            Typo that gives the completely wrong idea: “ can still be true for men”

                                                                                                            I’m sure you meant “me” instead of “men”

                                                                                                            1. 2

                                                                                                              Hah, yes! Thanks for catching that. (The edit timeout has passed, otherwise I’d fix it.)

                                                                                                          1. 27

                                                                                                            So AFAICT this is the tradeoff the author consciously rejects, and the one that Svelte consciously chooses:

                                                                                                            • Choose writing in a JS framework that is compiled ahead of time, over writing in a JS framework that is interpreted at runtime.

                                                                                                            The disadvantages of this tradeoff that weigh on the author’s mind:

                                                                                                            • If your language is compiled, debugging is harder because the compiled code that is run does not resemble the source code you have to fix.
                                                                                                              • They also make the point that it’s confusing that Svelte code is Javascript, but it needs to be compiled to run it, which may change its behaviour. (To me that’s not that different from frontend framework code that is valid JS/HTML, but needs the framework runtime to run it, which may change its behaviour.)
                                                                                                            • If in the future more front-end-systems compile to Javascript instead of writing in it, it becomes harder to glue them together.

                                                                                                            I think it’s interesting to look how Elm solved these, because like Svelte, it is compiled ahead of time to small and fast JavaScript that doesn’t resemble the source code.

                                                                                                            Elm’s solution to ‘you have to choose between debugging the runtime JS or the source code’ is to go all-in on making it easy to debug the source code. In Elm’s case, it is an ML-family language with a type system that guarantees zero runtime errors (but won’t save you from domain mistakes, obv.), and with compilation error messages that are so helpful that they have inspired many other languages.

                                                                                                            Svelte, presumably, wants to remain Javascript, so a lot of error prevention becomes harder. They mentioned they want to add Typescript support. Or they could add source maps that relate compiled JS to the original Svelte code? Also, debugging compiled projects is a very old craft, it only really gets onerous if the problem is low-level or compilation is slow. I also note that Svelte compilation has a ‘dev’ flag that produces named functions, and also extra code that performs runtime checks and provides debugging info.

                                                                                                            Elm’s solution to the interoperation problem: an Elm module can expose ports (blog post, docs that external JS can send messages into, or that JS can subscribe to. So the ports form an Elm module’s public API.

                                                                                                            That still leaves the interop problem of styling the created components. If it’s you writing the Svelte, you can let Svelte do the styling (if Svelte is the whole system), or specify the right class names on the created DOM (if you’re writing the Svelte component as a subsystem). But if you’re reusing sombody else’s Svelte component, I’m not sure how easy it is to pass in the class names you’d like the component to use. Perhaps ‘support for caller-specified class names’ is even an open problem / blind spot in frontend frameworks in general?

                                                                                                            1. 8

                                                                                                              Good summary.

                                                                                                              In one sense, all of the hard-fought web knowledge that people may subconsciously pride themselves on knowing now becomes a stumbling block. Technologies like Svelte treat the underlying web runtime as something to be papered over and ignored. Much like compiled C, being able to debug the generated code is a needed skill, but the 1-to-1 correspondence between source code and generated code is not a guarantee, and it can be disconcerting to let go of that.

                                                                                                              I’m all for it. We largely ignore x86/x64 by using higher level languages and our code is better for it, even if slightly inefficient.

                                                                                                              Web devs love to talk of developer experience and progress in tooling. Something something…Cambrian explosion? ;)

                                                                                                              1. 10

                                                                                                                I think the author’s problem isn’t so much with it being compiled, but the fact that the source code looks like JS, but your assumptions don’t hold because there’s a lot happening to that JS so the end result isn’t anything like what you typed.

                                                                                                                1. 4

                                                                                                                  Reminds me very much of the Duck Test https://en.m.wikipedia.org/wiki/Duck_test. Svelte walks like JS and talks like JS but isn’t JS. This is typically seen as a positive for those who judge their tools, at least partly, based on familiarity.

                                                                                                                  1. 4

                                                                                                                    Yes, I agree. Elm is a language that has its own semantics which are adhered to by its compiler. But Svelte takes the semantics of an existing language (JS) and changes them.

                                                                                                                    I have that concern about Svelte too, though it’s not strong enough to change the fact that I’m still a fan and excited to see how Svelte evolves.

                                                                                                                    1. 1

                                                                                                                      That makes the article make more sense. That would be difficult to reckon with.

                                                                                                                  2. 6

                                                                                                                    Or they could add source maps that relate compiled JS to the original Svelte code?

                                                                                                                    Svelte creates JS and CSS source maps on compilation - https://svelte.dev/docs#svelte_compile

                                                                                                                    There’s also the @debug helper for templates - https://svelte.dev/docs#debug

                                                                                                                    In practice I’ve found debugging Svelte to be mostly trivial and sometimes difficult. Dev tools will help close the gap but they’re not mature.

                                                                                                                    For styling, style encapsulation is what I’ve seen the devs recommend, but nothing stops you from passing classes as props to components that accept them. (I do that a lot because I like utility CSS libraries like Tailwind) The biggest open RFC right now is about passing CSS custom properties (CSS vars) to components. https://github.com/sveltejs/rfcs/pull/13

                                                                                                                    1. 1

                                                                                                                      I think the tradeoff here isn’t about source mapping and the sort, but instead that if you take it as given that you’re going to compile your language, then you might as well through more language safety features in (a la Elm).

                                                                                                                      That might be true, but the other sacrifice is familiarity. Svelte can be learned by a frontend dev very quickly and without much “relearning” fear. Instead, you get the cognitive dissonance problem of it being almost what you expect but, then, not quite.

                                                                                                                      1. 4

                                                                                                                        if you take it as given that you’re going to compile your language, then you might as well through more language safety features in (a la Elm).

                                                                                                                        There’s a big leap from Svelte to Elm beyond just compiling the language. Elm has tremendous benefits, definitely, but it gives up seamless interop with the DOM, mutable web APIs, JS libraries, and future web standards. Elm has JS interop but only asynchronously through its ports. Purity and soundness are great but at what cost? (that’s a rhetorical holy war question, not worth discussing here IMO!)

                                                                                                                        I think TypeScript has been gaining so much adoption largely because it makes pragmatic compromises everywhere, not just because people are resistant to learning Elm/Reason/PureScript/Haskell/etc, and when support lands in Svelte I’ll be less shy about recommending it to people.

                                                                                                                        1. 3

                                                                                                                          Yeah, I think for most people in most cases, familiarity and ease are the bigger win. I’m not arguing one should use Elm, just laying out that continuum.

                                                                                                                          1. 2

                                                                                                                            Thanks for emphasizing that point. I think I underestimate the impact of familiarity and ease for many people.

                                                                                                                          2. 1

                                                                                                                            By seamless interop do you mean synchronous? I started trying out Svelte yesterday and found the dom interop to not be seamless as I was confused by the difference between <input value={val} /> and <input on:value={val} />

                                                                                                                            I think from memory that’s how you get an interactive input.

                                                                                                                            1. 3

                                                                                                                              I meant seamless but that’s overstating it. (except for mutable web APIs and JS libraries - interop there is generally seamless because of how Svelte extends JS) Anything that isn’t plain HTML/CSS/JS is going to have seams. Svelte minimizes them to a degree that some other frameworks don’t, like React and especially Elm. Vue is on similar footing as Svelte.

                                                                                                                              The nice thing about Svelte’s seams is they often reduce the complexity and verbosity of interacting with the DOM. In your example, it sounds like you want:

                                                                                                                              <input bind:value={val} />

                                                                                                                              (or simply <input bind:value /> if that’s the name)

                                                                                                                              At the same times Svelte gives you the flexibility to optionally use a “controlled input” like React:

                                                                                                                              <input value={val} on:input={updateValue} />

                                                                                                                              The equivalent in plain HTML/JS is not as pleasant. Elm abstracts away the DOM element and events.

                                                                                                                    1. 5

                                                                                                                      We are currently doing a mandatory WFH test run where our office is closed today and everyone is working from home. So far it’s been interesting, lots of zoom meetings (context: I work for Blend, our SF office is around 300 people).

                                                                                                                      We are also allowing people to electively WFH for the foreseeable future.

                                                                                                                      1. 10

                                                                                                                        Go you! So many places are all “I guess we’ll deal with it when it happens”, but there’s nothing like a test run.

                                                                                                                        1. 2

                                                                                                                          Similar. I work from home normally though, but part of a big office in London. We’ve been rotating departments the last week, each department testing their team working from home. We’re in public health though so we’re trigger happy mitigating anything that will mess with business continuity.

                                                                                                                          1. 2

                                                                                                                            I’m in ops, and our WFH game is 100% cos we have to be able to do our entire job from a laptop as needed when on call. Our devs are not on call, but they are similarly well set-up.

                                                                                                                            The rest of the company is being dragged into the present quite nicely! We have a shiny new OpenVPN setup that’s doing the job of connection.

                                                                                                                            The sticking point is phone meetings - suitable software (RingCentral sorta sucks; Google Hangouts really sucks; Slack’s audio is way better, but only tech is on Slack), and having the people in the room give a damn about making sure the microphone can hear them.

                                                                                                                            1. 3

                                                                                                                              Zoom any good? Their name seems to crop up in this context a lot.

                                                                                                                              1. 1

                                                                                                                                Zoom has been excellent the few times I’ve used it this year – far above all other solutions I’ve experienced besides Blue Jeans (I’d say they’re tied for top of the heap).

                                                                                                                                1. 1

                                                                                                                                  RingCentral is actually a fork of Zoom, I think. I’ve only used Zoom myself for podcast recording, and it was fine?

                                                                                                                                  1. 2
                                                                                                                            1. 2

                                                                                                                              This is impressive work. I’d love to find out more about how you approached using Python to metaprogram C++. If you talk about that anywhere, links would be much appreciated. And if not, just know you have an eager audience should you decide to!

                                                                                                                              1. 2

                                                                                                                                I was writing a lot about this early in the project, but I dropped it for lack of time. The three main code generators are ASDL, re2c, and now mycpp, but I haven’t written anything about mycpp.

                                                                                                                                Here is some portions:

                                                                                                                                http://www.oilshell.org/blog/2019/12/22.html#appendix-a-oils-lexer-uses-two-stages-of-code-generation

                                                                                                                                http://www.oilshell.org/blog/tags.html?tag=ASDL#ASDL

                                                                                                                                Your best bet is read Zulip, I post details there, and feel free to ask questions. There are a ton of threads about mycpp and the translation process, which I may link in the next post.

                                                                                                                                https://oilshell.zulipchat.com/#narrow/stream/121539-oil-dev/topic/Naming.20convention.20for.20metaprogramming (requires login)

                                                                                                                                As mentioned in the January blog posts, I’m cutting a lot out of the project because it got too big. But hopefully it will get reasonably done and then I can write more about it.

                                                                                                                                1. 1

                                                                                                                                  BTW I wrote a blog post that links some relevant threads. Feel free to ask questions on Zulip!

                                                                                                                                  http://www.oilshell.org/blog/2020/03/recap.html#mycpp-the-good-the-bad-and-the-ugly

                                                                                                                                  1. 3

                                                                                                                                    Thanks. I found that article’s worked example a bit too trivial, but it linked to a paper that has a more complex take on the topic, which I’m currently digesting: https://kataskeue.com/gdp.pdf