12 ms·
This is the first justification of not using Rust that I actually agree with. Well written. I recommend reading Roc's FAQ too - it's got some really great poin
by IshKebab 2y ago
This is the first justification of not using Rust that I actually agree with. Well written.
I recommend reading Roc's FAQ too - it's got some really great points. E.g. I'm internally screaming YESSS! to this: https://www.roc-lang.org/faq.html#curried-functions https://www.roc-lang.org/faq.html#curried-functions
But then it has other weird features too, like they seem to be really emphasising "friendliness" (great!) but then it has weird syntax like `\` for anonymous functions (I dunno where that dumb syntax came from by Nix also uses it and it's pretty awful). Omitting brackets and commas for function calls is also a bad decision if you care about friendliness. I have yet to find a language where that doesn't make the code harder to read and understand.
- Skinney 2y agoThe syntax came from Elm, which got it’s syntax from Haskell (where Nix also got it from) which got its syntax from ML. It’s a syntax that’s several decades old at this point. It’s different, but not harder. If you learned ML first, you’d found Algol/C-like syntax equally strange.
- wk_end 2y ago(ETA: speaking strictly about anonymous functions; on rereading you might be talking about the absence of parens and commas for function application.) That's not ML syntax. Haskell got it from Miranda, I guess? In SML you use the `fn` keyword to create an anonymous function; in Ocaml, it's `fun` instead.
- throwaway17_17 2y agoI believe the `\` character for functions is original to Haskell. Miranda does not have anonymous functions as a part of the language.
- pezezin 2y agoThe \ is a simplified lambda, because most programmers can't type λ easily.
- robertlagrant 2y agoI would be very in favour of making λ a keyword, though. Maybe a linter could convert \ to λ.
- iso8859-1 2y agoit would be confusing since it's not part of UnicodeSyntax https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/unicode_syntax.html https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/unic...
- robertlagrant 2y agoWell, even better to add it to that! But I was thinking generally, to be honest. I really want Python to synonimise the keyword lamdba with the λ symbol so I can golf my Advent of Code code better.
- robertlagrant 2y agoArgh. Synonymise.
- needlesslygrim 2y agoWell, ML (or at least the first versions of it) used a λx • x syntax [1] for λ-abstractions, the same (excluding the use of • over .) notation as used with the Lambda Calculus, and I've always assumed \ was an ASCII stand in. [1]: https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/milner-type-polymorphism.pdf https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/... (can be spotted on page 353)
- wk_end 2y agoThat paper isn't showing real ML syntax itself; it's a mathematical presentation to demonstrate how the type system algorithm works. The actual original LCF/ML syntax would differ. I don't believe it used an actual lambda character, although for the life of me I can't find any evidence one way or another, not even in the LCF source code (https://github.com/theoremprover-museum/LCF77 https://github.com/theoremprover-museum/LCF77) But yes, the slash is just an ASCII stand-in for a lambda. ETA: I tracked down a copy of the Edinburgh LCF text and I have to eat crow. It doesn't use a lambda, but it does use a slash rather than a reserved word. The syntax, per page 22, is in fact, `\x. e`. Similar to Haskell's, but with a dot instead of an arrow. https://archive.org/details/edinburghlcfmech0000gord https://archive.org/details/edinburghlcfmech0000gord
- needlesslygrim 2y agoWell if you're going to eat crow, I may as well eat pigeon, for I didn't realise that paper wasn't showing real source. Thanks for the link to the LCF text though :^)
- xiaodai 2y agoR has that too.
- Iwan-Zotow 2y agoreally? thought it just function(x)
- mrkeen 2y agoIt's the closest you get to 'λ' on a US keyboard.
- LAC-Tech 2y agoI believe Haskell uses it as well.
- nemo1618 2y agomy hot take: the language should accept \, but formatters should replace it with λ
- IshKebab 2y agoLean does symbols very well. You can just type \r and it will replace it with a right arrow as you type.
- fuzztester 2y agoIIRC, Richard explain that in one of his videos about Roc. I have seen at least a handful of them.
- IshKebab 2y agoSo this assumes knowledge of an obscure theoretical programming language, and a dubious symbol replacement. Yeah...
- aylmao 2y agoIt doesn't assume it, it's syntax, you can just use it without knowing where it comes from. It's like english. You don't need knowledge in obscure proto-germanic linguistics to use articles in your sentences. But if you want to understand why we seem to randomly attach "a" before nouns— proto-germanic linguistics has the answer (probably, I just speak english I don't know where all its syntax originates).
- myaccountonhn 2y agoFunctional programming is common in university curriculum. Terrifying that it can still be considered obscure.
- hillcapital 2y agoThey recently changed the syntax to add parens, commas and use `|arg|` for closures :) https://github.com/roc-lang/roc/releases/tag/0.0.0-alpha2-rolling https://github.com/roc-lang/roc/releases/tag/0.0.0-alpha2-ro...
- anacrolix 2y agoBoooo
- masijo 2y agoJesus, why? This is a bummer.
- deleted 2y ago[deleted]
- hajile 2y agoPretty much all of those changes look bad to me.
- trescenzi 2y agooh wow it went from being a very clear language to looking more like a hodgepodge of a few different languages.
- IshKebab 2y agoAh great improvements! I don't know why the sibling comments are so negative; this is clearly better.
- tasuki 2y agoWhy? I'm used to \ meaning lambda. I understand you aren't, and that's fine. But it's just your weird opinion determined by what programming languages you've learned. Ultimately, it's just syntax and not so important. Semantics are important.
- 2y ago
- LAC-Tech 2y agoOpposite effect one, lost interest in Roc after reading that. If anything I don't think Haskell goes far enough the automatic currying, points free stuff. If you're going to be declarative, don't half ass it.
- hajile 2y agoI feel that he got a lot of pressure from the FP community and wrote a bunch of nonsense instead of being straightforward with them. The only relevant reason he lists is point-free, but he doesn't go far enough. Point-free very often turns into write-only balls of unmaintainable nastiness. Wanting to discourage this behavior is a perfectly reasonable position. Unfortunately, this one true argument is given the most tepid treatment of all the reasons. Everything else doesn't hold water. As he knows way better than most, Elm has auto-curry and has been the inspiration for several other languages getting better error messages. Any language with higher-order functions can give a function as a result and if you haven't read the docs or checked the type, you won't expect it. He left higher-order function in, so even he doesn't really believe this complaint. The argument about currying and pipe isn't really true. The pipe is static syntax known to the compiler at compile time. You could just decide that the left argument is applied/curried to the function before the right argument. I particularly hate the learning curve argument. Lots of great and necessary things are hard to learn. The only question is a value judgement about if the learning is worth the payoff. I'd guess that most of the Roc users already learned about currying with a more popular FP language before every looking at Roc, so I don't think this argument really applies here (though I wouldn't really care if he still believed it wasn't worth the learning payoff for the fraction of remaining users). To reiterate, I agree with his conclusion to exclude currying, but I wish he were more straightforward with his one good answer that would tick off a lot of FP users rather than resorting to a ton of strawman arguments.
- throwaway2037 2y agoNo trolling/nitpicking from me: You wrote <<The only relevant reason he lists is point-free>>. What do you mean by "point-free"... or did you write "point three" and it was auto-corrected on a mobile phone? I also tried Googling for that term (never heard before), and I found these: https://stackoverflow.com/questions/944446/what-is-point-free-style-in-functional-programming https://en.wikipedia.org/wiki/Tacit_programming If you really meant "point-free", can you tell me where in his post he mentions it? I would like to learn more.
- syockit 2y ago
- msla 2y ago> `\` for anonymous functions A one-character ASCII rendering of the Greek lowercase letter lambda: λ λx → x + 5 \x -> x + 5
- pmarreck 2y ago> \ for anonymous functions this didn't faze me in the least because it's just a more easily typed λ, the lambda character, which has for a long time now (many decades) been used to describe anonymous functions (i.e. "lambdas") did you never take any formal CS education? if not, that might explain it so before you jump to calling it "dumb", maybe next time lean on Chesterton's Fence for a bit. https://sproutsschools.com/chesterton-fence-dont-destroy-what-you-dont-understand/ https://sproutsschools.com/chesterton-fence-dont-destroy-wha... That said, granted, the fact that it's also the escape character is problematic. Maybe /\ might have been better but that's even harder to type.
- rtfeldman 2y agoWe recently changed Roc's lambda syntax from the syntax that languages like Elm and Haskell use... foo = \arg1, arg2 -> body ...to this: foo = |arg1, arg2| body The reason for this change was that we have a new and extremely well-received language feature (landed but not yet formally announced) which results in `->` and `=>` having different meanings in the type system. This made it confusing to have `->` in the syntax for anonymous functions, because it seemed to suggest a connection with the type-level `->` that wasn't actually there. The most popular syntax that mainstream languages use today for anonymous functions is something like `(arg1, arg2) => body` but of course that has the same problem with having an arrow in it, so changing to that wouldn't have solved the problem. Rust uses `|arg1, arg2| body` (and Ruby kinda uses it too for blocks), and we'd all had fine experiences using that syntax in Rust, so we chose it as the new lambda syntax. You can see the new syntax in the code example at the top of roc-lang.org.
- HackerThemAll 2y agoYeah Rust compiles slowly, so we need two more half-baked languages - Zig and Roc, both of which I couldn't care less. Rust's slow compilation comes from lots of features and an excellent generated machine code quality. Both Zig and Roc will be equally slow or slower if they match what Rust offers. If all they want is fast compilation, they can just try Pascal.