7 ms·
It's weird, I want pretty much the exact opposite of this: a language with the expressive type system and syntax of rust, but with a garbage collector and a run
by happens 3y ago
It's weird, I want pretty much the exact opposite of this: a language with the expressive type system and syntax of rust, but with a garbage collector and a runtime at the cost performance. Basically go, but with rusts type system.
I'm aware that there are a few languages that come close to this (crystal iirc), but in the end it's adoption and the ecosystem that keeps me from using them.
- sanderjd 3y agoTotally agree! But I think it's a "both and" rather than an "either or" situation. I can see why people are interested in the experiment in this article, and I think your and my interest in the other direction also makes sense.
- GardenLetter27 3y agoYeah, same for a scripting language too - something like Lua but as expressive as Rust. There is Rune, but like you mentioned the issue is adoption, etc.
- thegeekpirate 3y agoRight? One day... sigh
- quadrature 3y agoYou’ve just described scala.
- sanderjd 3y agoHa, no. Scala does contain this language the parent described, but alongside the huge multitudes of other languages it also contains.
- kaba0 3y agoScala is an absolutely small language. It is just very expressive, but its complexity is quite different than, say, Cpp’s, which has many features.
- sanderjd 3y agoIn my view you have compared it to the only other language for which it is small by comparison :) But different strokes for different folks! I have nothing against Scala, its multi-paradigm thing is cool and impressive, it just isn't for me except by way of curiosity.
- kaba0 3y agoCould you list all the features you are thinking of?
- sanderjd 3y agoI think all the links in the first two sections in the What Is Scala[0] docs give the flavor pretty well. It contains a full (and not small) set of OO language functionality, alongside an even more full-featured functional language. There are a lot of adjectives you can use to describe Scala - mostly good ones! - but "small" just isn't one of them. 0: https://docs.scala-lang.org/tour/tour-of-scala.html#what-is-scala https://docs.scala-lang.org/tour/tour-of-scala.html#what-is-...
- happens 3y agoIt's a personal preference but I'm not a big fan of JVM languages - big startup costs and not having one "true" runtime that is just compiled into the binary are my main reasons. I've spent so much time fiddling with class paths and different JRE versions...
- dartos 3y agoThat sounds… bad? The whole point of rusts type system is to try to ensure safe memory usage. Opinions are opinions, but if I’m letting my runtime handle memory for me, I’d want a lighter weight, more expressive type system.
- School-Cotton 3y agoI’m assuming by rust’s type system they mean without lifetimes. In which case it’s existed in lots of GC languages (OCaml, Haskell) but no mainstream ones. It isn’t really related to needing a GC or not.
- gpderetta 3y agoYou still want RAII and unique references, but rely on GC for anything shared, as if you had a builtin refererence counted pointer. I do also believe this might be a sweet spot for a language, but the details might be hard to reconcile.
- School-Cotton 3y agoI haven’t used Swift so I might be totally wrong but doesn’t it work sort of like you describe? Though perhaps with ARC instead of true GC, if it followed in the footsteps of Objective-C.
- gpderetta 3y agoPossibly, yes. I haven't used swift either though. Does it have linear/affine types? Edit: I would also prefer shared nothing parallelism by default so the GC can stay purely single threaded.
- dartos 3y agoWithout lifetimes, Pins, Boxes, Clone, Copy, and Rc (Rc as part of the type itself, at least)
- afavour 3y ago
- deleted 3y ago[deleted]
- cmrdporcupine 3y ago... so OCaml or StandardML then
- bradrn 3y agoOr Haskell!
- aloisdg 3y agoor F#
- sanderjd 3y agoOcaml, yes, but not haskell. It does include these things the parent wants, but similar to how Rust ends up being quite "captured" by its memory semantics and the mechanics necessary to make them work, haskell is "captured" by laziness and purity and the mechanics necessary to make those work. Also, syntax does actually matter, because it's the first thing people see, and many people are immediately turned off by unfamiliarity. Rust's choice to largely "look like" c++/java/go was a good one, for this reason.
- cmrdporcupine 3y agoI learned SML/NJ and OCaml a bit over 20 years ago and liked them, but when I tried my hand at Haskell my eyes glossed over. I get its power. But I do not like its syntax, it's hard to read. And yes, the obsession with purity.
- sanderjd 3y agoExactly right. I quite like haskell in theory, but in practice I quite dislike both reading and writing it. But I like ocaml both in theory and practice (also in part due to having my eyes opened to SML about 20 years ago).
- cmrdporcupine 3y ago
- malermeister 3y agoYou might like Kotlin. It'll also give you access to the entire JVM ecosystem.
- helsinki 3y agoIs that a blessing or a curse?
- mike_hearn 3y agoA blessing. Do you really want to write all the libraries from scratch for a new language? Do you want to come up with portable abstractions that work well on Windows? (and don't think you can skip that, people will ask). Most people don't. That's not the fun part of language design.
- happens 3y agoI've written a lot of kotlin and it does indeed come very close! Now if only it wasn't bound to java's bytecode under the hood... Whenever I've had to write kotlin for Android in the past I did quite enjoy it. It seems like the entire ecosystem is very enterprise-y when it comes to web though. Forced adherence to object orientedness and patterns like 100 files, 5 folders deep with 10 lines of code each keep cropping up in most kotlin projects I've seen.
- iainmerrick 3y agoTypeScript maybe?
- k__ 3y agoMaybe ReScript?
- actionfromafar 3y agoIf we are going that far, I suggest hopping off just one station earlier at Crystal-lang.
- sanderjd 3y agoYep, I think Crystal is the thing that is making a real go at essentially this suggestion. And I think it's a great language and hope it will grow.
- iainmerrick 3y agoDo you know how Crystal compares with Haxe? That's another one that might fit the requirements nicely.
- actionfromafar 3y agoI don't understand the Haxe documentation but it seems to also have some kind of algebraic data type.
- overstay8930 3y agoYou have awoken the ocaml gang
- galangalalgol 3y agoThat is probably the closest, especially if they add ownership. That was the rust inventor's original goal, not just safety at minimal performance cost. I think ownership should be a minimal requirement for any future language, and we should bolt it on to any that we can. Fine grained permissions for dependency trees as well. I like static types mostly because they let me code faster, not for correctness, strong types certainly help with that though. Jit makes static types have some of the same ergonomic problems as dynamic ones though. I think some sort of AGI enslaved to do type inference and annotate my code might be ok, and maybe it could solve ffi for complex types over the c abi while it is at it.
- color_me_not 3y agoThere's no ownership concept, but in the JaneStreet fork, there is something resembling lifetimes[1]. [1]: https://blog.janestreet.com/oxidizing-ocaml-locality/ https://blog.janestreet.com/oxidizing-ocaml-locality/
- sanderjd 3y agoYeah, ocaml is awesome! Frankly, if it had a more familiar syntax but the same semantics, I think its popularity would have exploded in the last 15 years. It's silly, but syntax is the first thing people see, and it is only human to form judgments during those moments of first contact.
- zozbot234 3y ago> Frankly, if it had a more familiar syntax but the same semantics That's what ReasonML is? Not quite "exploding" in popularity, but perhaps more popular than Ocaml itself.
- ericjmorey 3y ago
- rpeden 3y agoYou might enjoy F#. It's a lot like OCaml (which others have mentioned) but being part of the .NET ecosystem there are libraries available for pretty much anything you might want to do.
- jug 3y agoYes, F# is an often forgotten gem in this new, brighter cross-platform .NET world. :)
- asplake 3y ago:-) Is F# a contender outside the .NET world?
- posix_monad 3y agoThere aren't many languages that can do server-side and browser-side well. F# is one of them!
- asplake 3y agoNon .NET server-side?
- posix_monad 3y agoYou can do Node.js with F# But these days .NET is a great server-side option. One of the fastest around, with a bit of tuning.
- rpeden 3y agoFable compiles F# to Python, Rust, and Dart now, too, in addition to JS. I haven't tried Dart or Rust, but when I tried compiling its output to Python it was actually quite good!
- bmitc 3y ago
- gary17the 3y agoIf you do not want to mess with Rust borrow checker, you do not really need a garbage collector: you can rely on Rust reference counting. Use 1.) Rust reference-counted smart pointers[1] for shareable immutable references and 2.) Rust internal mutability[2] for non-shareable mutable references checked at runtime instead of compile time. Effectively, you will be writing kind of verbose Golang with Rust's expressiveness. [1] https://doc.rust-lang.org/book/ch15-04-rc.html https://doc.rust-lang.org/book/ch15-04-rc.html [2] https://doc.rust-lang.org/book/ch15-05-interior-mutability.html https://doc.rust-lang.org/book/ch15-05-interior-mutability.h...
- amw-zero 3y agoA language has a paved road, and when you go off of that road you are key with extreme annoyance and friction every step of the way. You’re telling people to just ignore the paved road of Rust, which is bad advice.
- dewbrite 3y agoI strongly disagree that smart pointers are "off the paved road". I don't even care to make specific arguments against that notion, it's just a terrible take.
- gary17the 3y agoNo, not really. Firstly, there is no significant "friction" to using Rust smart pointers and internal mutability primitives, as those constructs have been added to Rust for a reason: to solve certain borrow checker edge cases (e.g., multiply interconnected data structures), so they are treated by the Rust ecosystem as first-class citizens. Secondly, those constructs make a pretty good educational tool. By the time people get to know Rust well enough to use those constructs, they will inevitably realize that mastering the Rust borrow checker is just one book chapter away to go through out of passion or boredom.
- wredue 3y agoI find quite a lot of friction in being demanded to understand all of the methods, what they do, when you’d use them, why you’d choose one over another that does a slightly different thing, but maybe still fits. The method documentation alone in reference counting is more pages than some entire programming languages. That’s beside the necessary knowledge for using it.
- BoppreH 3y agoI've always wondered if global type inference wouldn't be a game changer. Maybe it could be fast enough with caching and careful language semantics? You could still have your IDE showing you type hints as documentation, but have inferred types to be more fine grained than humans have patience for. Track units, container emptiness, numeric ranges, side effects and idempotency, tainted values for security, maybe even estimated complexity. Then you can tap into this type system to reject bad programs ("can't get max element of potentially empty array") and add optimizations (can use brute force algorithm because n is known to be small). Such a language could cover more of the script-systems spectrum.
- bananapub 3y agoone of the other reasons global inference isn't used is because it causes weird spooky action at a distance - changing how something is used in one place will break other code.
- BoppreH 3y agoI've heard that, but never seen an example*. If the type system complains of an issue in other code after a local change, doesn't that mean that the other code indeed needs updating (modulo false positives, which should be rarer with granular types). Or is this about libraries and API compatibility? * I have seen examples of spooky-action-at-a-distance where usage of a function changes its inferred type, but that goes away if functions are allowed to have union types, which is complicated but not impossible. See: https://github.com/microsoft/TypeScript/issues/15114 https://github.com/microsoft/TypeScript/issues/15114
- nu11ptr 3y agoTry writing a larger OCaml program and not using interface files. It definitely happens.
- BoppreH 3y agoI've never used OCaml, so I'm curious to what exactly happens, and if language design can prevent that. If I download a random project and delete the interface files, will that be enough to see issues, or is it something that happens when writing new code?
- efficax 3y agouse scala
- naasking 3y agoIsn't that just the Boehm GC with regular Rust?
- bmitc 3y agoIsn't that F#?
- mattgreenrocks 3y agoKotlin scratches that itch well for me. My only complaints are exceptions are still very much a thing to watch, and ADT declarations are quite verbose when compared with more pure FP languages. Still, the language is great. Plus, it has Java interop, JVM performance, and Jetbrains tooling.
- keeperofdakeys 3y agoThe funny thing is that rust used to have things like garbage collection. For the kind of language Rust wanted to be, removing them was a good change. But there could always be a world where it kept them. https://pcwalton.github.io/_posts/2013-06-02-removing-garbage-collection-from-the-rust-language.html https://pcwalton.github.io/_posts/2013-06-02-removing-garbag...
- Georgelemental 3y ago> the kind of language Rust wanted to be That has changed through the years: https://graydon2.dreamwidth.org/307291.html https://graydon2.dreamwidth.org/307291.html
- iopq 3y agoThe @blah references were actually just Arc sugar
- lawn 3y agoTake a look at Gleam! For me it seems like the perfect match.
- geodel 3y ago> but in the end it's adoption and the ecosystem that keeps me from using them. Well, since you can't really use without high adoption even if something comes up with all features you want, you still won't be able to use it for decades or longer.
- weatherlight 3y agocheckout Gleam.
- posix_monad 3y agoThere are a bunch of languages that fit-the-bill already. F#, OCaml, Haskell and Scala all come to mind. You might have to lose a few parens though!
- pie_flavor 3y agoThe expressive type system of Rust is backed by use-site mutability; use-site mutability is backed by single ownership; single ownership is made usable by borrow checking. There's a reason no language before Rust has been like Rust without being a functional language (and if that's no object, then you can use OCaml).