5 ms·
Gleam looks nice but if an F# comparisons was added, I think that would come out ahead based on the authors priorities.
by fire_lake 2y ago
Gleam looks nice but if an F# comparisons was added, I think that would come out ahead based on the authors priorities.
- cipehr 2y agoThe author links to a blog post talking about railway oriented programming in f#.. it might be fair to assume they are aware of f#
- munchler 2y agoAll the more reason to include it in the comparison.
- devmunchies 2y agoOne thing I dislike with erlang based languages (both gleam and elixir) is that they use “<>” for string concatenation. In F#, “<>” is the equivalent of “!=“. Postgres also uses <> for inequality so my queries and f# code have that consistency.
- sodapopcan 2y agoHa, ok so I gotta give one of these "that's a really strange thing to get hung up on" responses. Erlang and Elixir don't overload the `+` operator. In fact, they don't overload ANY operators. If you can forgive the syntactic choice of the operator itself (which I think it pretty fair considering Erlang predates Postgres by a decade and F# by two decades), this allows them to be dynamic while maintaining a pretty high level of runtime type safety. For example, one of the "subtle bugs" people refer to when criticizing dynamic languages (even strongly typed dynamic languages) is the following would work when both args are given strings or numbers: function add(a, b) { a + b } Erlang/Elixir eliminate this particular subtle bug (and it goes beyond strings and numbers) since: def add(a, b), do: a + b will only work on numbers and raise if given strings.
- mixmastamyk 2y agoIt doesn’t predate sql and certainly not it’s use in mathematics. There are other options for concatenation so this is an unfortunate error. Shouldn’t copy Erlang, otherwise might as well use it.
- trenchgun 2y ago>It doesn’t predate sql and certainly not it’s use in mathematics. What do you mean by "it's use in mathematics"? To my knowledge <> was invented by Algol language creators to use it for inequality. There was no previous use in mathematics. And to my opinion, that was an unfortunate error.
- deleted 2y ago[deleted]
- sodapopcan 2y agoOh ha, duh me, I did not consider it wasn't invented by Postgres.
- mixmastamyk 2y agoInteresting, must have learned it so long ago… Pascal? that I conflated it with math class. Still ~1958 is rather venerable. The plot thickens, apparently ++ is used for erlang. So I still find it a poor choice.
- sodapopcan 2y ago++ is for concatenating lists, it's not the only functional language that uses this. Really though who cares? `=` is already misused in most programming languages.
- mixmastamyk 2y agoWhen looking at new languages, getting the basics right is the first thing I look at. Clumsy string concatenation is a blocker in my business, which is like 75% of the code.
- throwawaymaths 2y agoWell binaries are <<>> so that's consistent at least. And <<>> is quotation marks in several languages, including French.
- mixmastamyk 2y agoGuillemets are not the same and have their own symbols.
- throwawaymaths 2y agoYeah, ok. Go back to 1986 and tell the Erlang team to go use Unicode guillemets
- mixmastamyk 2y agoGleam is from the past few years.
- riffraff 2y ago« and » are also the hyperoperators in perl6/raku https://docs.perl6.org/language/operators#Hyper_operators https://docs.perl6.org/language/operators#Hyper_operators
- cokebot9000 2y agohttps://docs.raku.org/language/operators#Hyper_operators https://docs.raku.org/language/operators#Hyper_operators
- greydius 2y agoOne thing I hate about F# and SQL is that they use <> as a "not equals" operator. In Haskell, <> is the binary operator of any Semigroup instance.
- Jtsummers 2y ago> One thing I dislike with erlang based languages (both gleam and elixir) is that they use “<>” for string concatenation. Erlang doesn't use <> for concatenation so it's odd to name it in this comment, like that language and its developers have anything to do with your complaint. If it upsets you so much, lay it at the feet of the actual groups that chose <> for concatenation instead.
- devmunchies 2y agoI just assumed it was an erlang thing since elixir and gleam both do it. Now it seems even more odd that erlang doesn’t do it but they both chose it.
- trenchgun 2y ago- in Haskell <> is binary operator of a Monoid - in Elixir <> is Binary concatenation operator. Concatenates two binaries. This seems like it might be kind of a joke, actually, purposefully confusing "binary operator" with "an operator that takes two binaries" for humorous effect? - in Gleam <> is string concatenation operator As far as I can see it, they are taking inspiration from Haskell, where <> denotes the monoid binary operation, one concrete example being in the monoid of Lists binary operator being list concatenation, of which String is one example. But really, <> for inequality is also kind of dumb and nonstandard idea (from mathematical notation perspective), originating from Algol. != which C popularized is more clear, and corresponds to the mathematical symbol, of course =/= would be even more close, but that is one more character. ML originally used <> for inequality, following the standard (in CS) of Algol, and it was Haskell which deviated from that tradition. So F# uses still Algol tradition, but Haskell uses /= and C and others use !=, for more mathematical and logical notation.
- gorgoiler 2y agoThen Gleam (and others) use “|>” when piping with “|” would make more sense, except that’s a bit wise OR, not to be confused with “||” which is… string concatenation (in Postgres).
- trenchgun 2y agoF# inherits <> from ML, which inherits it from Algol, which invented it. But that was actually a bad idea, since it deviates from mathematical practice. To follow math, it would be better to use != as in C and those inspired by it, or /= as in Haskell. Or maybe even =/= if you really want to go for the mathy looking notation. Elixir uses <> as an operator for concatenation of binaries, (which does form a monoid of course), not to be confused with how Haskell uses <> as a binary operator of a Monoid, but for sure inspired by it. And Gleam picked it up from them, probably, to use for a special case of a list monoid, String. And Haskell created <> for Monoid, because it would be too confusing to use multiplication sign for the binary operation like mathematicians do. It would not be ok in programming context.
- amelius 2y agoI don't like languages that use > a lot simply because if I accidentally paste a code snippet in my Bash shell it is likely to pipe to some file. Also, <> was != in BASIC, I believe. PS: Don't paste this comment in your shell.
- stonethrowaway 2y ago[flagged]
- macintux 2y agoOr maybe your "no one else is smart/brave enough to say it" wrapper detracted from your message. Additionally, throwing yet more syntax/features at a language to make it pseudo-functional doesn't appeal to everyone. A grab bag of features doesn't an appealing language make (for some).
- stonethrowaway 2y agoI wouldn’t call C# pseudo-functional. The ability to move from one approach to another approach as the problem spaces change is exactly what pragmatism is about. To be flexible and bending and to yield to what the developer needs to do. It is most definitely not for purists if that’s what you’re getting at, but then we are not talking about pragmatism to begin with. Unless we mean to use the word “pragmatic” in the sense of “I like it, therefore it’s pragmatic” in which case we’ve entered circlejerk territory and the article should be flagged as such. But again, let’s be charitable and talk about what really is a pragmatic programming language. As it stands, any competitors of F# are in more serious competition with C#. They just don’t know it. It’s worth discussing if we want to discuss pragmatic languages. People forget their history lessons. This is exactly why and how C++ gained the massive adoption over C that it did. It allowed itself to be used as the Swiss knife of systems programming, and developers did what they wanted/needed to to get the job done. For every C89 (or Heaven forbid pre-standard C) purist, plentiful C++ programmers arose. And C# is entering that territory by stippling things on and incorporating them into its syntax. F# is excellent as a barometer in this regard. Good for testing the waters with a certain crowd and taking what works. I don’t need to claim people aren’t “smart/brave” enough to point this out. That’s not what it’s about at all. It’s more about looking one or two steps ahead rather than looking at the here and now. So, is Gleam pragmatic? Well, is it more pragmatic than C#?
- munchler 2y agoC# is indeed adopting some functional techniques from F#, but C# is still so bogged down with imperative cruft that the resulting combination of styles is a mess.
- munchler 2y agoI converted the example on the Gleam home page [0] to F#: let spawn_task i = async { let n = string i printfn $"Hello from {n}" } // Run loads of threads, no problem seq { 0..200_000 } |> Seq.map spawn_task |> Async.Parallel |> Async.RunSynchronously |> ignore The two are pretty similar, but I would give F# the nod on this one example because it doesn't actually have to create a list of 200,000 elements, doesn't require an explicit "main" function, and requires fewer brackets/parens. [0]: https://gleam.run/ https://gleam.run/
- jorams 2y agoThe creation of a list in the Gleam example is a choice, you could replace 'list' with 'iterator' and it would be lazy.