Threads for iddan

  1. 2

    Particularly if you what you want is “garbage collected Rust that’s not Go”, OCaml is a good choice.

    Rust and Go fits different purposes. And why should OCaml be chosen over Go? The main point of using Go is to get amazingly short compilation and test cycles, even for large projects.

    1. 8

      Rust and Go fits different purposes.

      Rust and Go are similar in that they’re some of the only memory-safe ahead-of-time compiled languages at our disposal.

      And why should OCaml be chosen over Go?

      The specific criteria that the author was using were these points:

      1. Is statically typed.
      2. Has a solid type system, by which I mean algebraic data types with exhaustiveness checking.
      3. Is garbage collected.
      4. Compiles to native.
      5. Has good out of the box performance.
      6. Is not too galaxy brained.
      7. Lets you mutate and perform IO to your heart’s content.
      8. Has a decent enough ecosystem.

      OCaml can be picked over Go if point 2 is more important than point 8 for your software.

      The main pont of using Go is to get amazingly short compilation and test cycles, even for large projects.

      It’s not discussed in the article, but the OCaml compiler is also fairly fast, particularly compared to the Rust compiler.

      1. 3

        the OCaml compiler is also fairly fast, particularly compared to the Rust compiler.

        The bytecode compiler is much faster than the native code compiler though. To the point where in some cases I found myself using the bytecode compiler because compilation times were dominating my otherwise short test cycle.

      2. 6

        With OCaml you get more safety and expressivity

        1. 1

          I agree. But is there measurably more safety than in Go, though, from a deployment/security perspective?

          1. 9


            Golang’s type system doesn’t even attempt to prevent nulls, which are the most common type error by a wide margin. There is an enormous difference.

            1. 1

              nulls is not a common type error in Go. I understand that it may look that way from a syntax perspective, but in practice, and from a deployment/security perspective, I don’t believe that this is the case.

              I wish there was statistics available on this for Go.

              1. 6

                While not a direct answer to your question, some of the concerns raised in this paper make me want to believe that you are much more likely to shoot yourself in the foot in Go, security and deployment wise.


                1. 5

                  nulls is not a common type error in Go

                  I’m not sure that’s the case. They seems pretty common to me and I’ve certainly encountered them in Go projects I’ve used.

          2. 2

            OCaml compilation and test cycles are not appreciably different from Go’s during development. I’ve used both. OCaml gives me much better type safety. In Go what I’m always wary of is the default emptiness of values which aren’t initialized for whatever reason. E.g. if I have a struct type and add a new field, the compiler doesn’t help me refactor my code in all places which work with this struct to ensure that the new field is handled. In OCaml it does.

            1. 1

              Rust and Go fits different purposes.

              I think the author agrees here : Rust and garbage collected Rust fit different purposes.

              That’s very subjective so probably not exactly what the author has in mind, but what I imagine a garbage collected Rust could be is a language whose design would de-emphasize performance a bit in favor of ease of use. So no lifetimes, no multiple variants of string, but the type safety story. And I imagine the performance would be in the same ballpark as Go, hence the mention.

            1. 2

              Finishing the implementation of a new formula engine for React Spreadsheet which supports dependant formulas and ranges.

              1. 2

                Are the Python and TypeScript type systems similar?

                1. 6

                  Yes and no. Python’s type system affects runtime in the sense that you can analyse it on runtime while TypeScript’s is build only and removed at build time. But both serve the same core goal of adding stricter typing to dynamic languages (Python and JavaScript) and they learn a lot from each other.

                  1. 4

                    No. Assuming we’re talking about mypy (Python doesn’t have a blessed type system, but type annotations), then mypy by default is nominally typed rather than Typescript’s structural typing (though Mypy has support for protocols, which look like structural typing)

                    Ultimately Python’s object model is very different from Javascripts due to descriptors, so it makes stuff like Django models hard to model. On top of that, mypy doesn’t have some extremely useful type system utilities like declared type guards and type intersections.

                    In my experience, mypy often feels like its approaching what many have experienced in OOP languages, whereas Typescript’s structural typing + type level programming aims to go much further.

                    That being said both tools have similar onboarding strategies and work reasonably well with a typed/untyped code mix.

                    1. 1

                      Don’t ES6 classes have descriptors (or at least getter / setters)?

                      And unless I’m misunderstanding what you mean, python does have typing.TypeGuard

                  1. 7

                    When I was working on Cayley it was very missing. Standard iterators in Go will make any stream processing work much easier to go about.

                    1. 3

                      Actually, not programming a lot. I’m working in a YC startup and the focus rn is on growth so I’m mostly writing sales emails and other prose. Last week I used some of my code smarts to find leads and enrich their data (small scripts in the Developer Tools + Excel can take you really far).

                      1. 2

                        I remember spending so much time installing different builds of Chromium OS and Android X86 on my netbook. This was the first time I encountered the terminal, BIOS, etc. I’m glad there’s an official solution if I would need to modernise an old computer of a friend

                        1. 1

                          Met some friends for speciality coffee and spent time with my family (It’s the end of the weekend in Israel)