4 ms·
> I personally find Haskell's syntax a bad example in language syntax. It's super powerful, but with too many inconsistencies, idiosyncrasies and noise. Intere
by tome 13y ago
> I personally find Haskell's syntax a bad example in language syntax. It's super powerful, but with too many inconsistencies, idiosyncrasies and noise.
Interesting. Could you give an example? I find Haskell to have pretty much the most consistent, non-idiosyncratic and clean syntax of any language I know.
- bjourne 13y agoThe order of operations is incredibly haphazard. Here is GP:s example again decorated with in which order the expression is evaluated: {6}({9}putStrLn . {8}show . {7}sum) {5}[{2}read x | x <- ({1}splitOn "+" "3++4"), {4}not ({3} x)] Here is the same code expressed in Factor: "3++4++9" "+" split harvest [ string>number ] map sum present print Annotated with evaluation order: "3++4++9"{1} "+"{2} split{3} harvest{4} [ string>number{5} ]{6} map{7} sum{8} present{9} print{10}
- hcarvalhoalves 13y agoGlad I'm not the only one bothered by that.
- tome 13y agoAnd here's the GP's other example: (putStrLn{9} . show{8} . sum{7} . map{5} read{6} . filter{4} (not{3} . null{2}) . split '+'{1}) "28+32+++32++39" and here's ak217's Python version: expr{1} = '28+32+++32++39' print{8} sum{7}(int(i){6} for i in expr.split('+'){2} if{5} i is not ''{4}) Actually, I prefer your Factor example even more than the Haskell (even though I've never heard of the language) because the order of operations is more natural to me, but really I don't think the proposition "Haskell's syntax [is] a bad example in language syntax" has been demonstrated. Comprehensions in Python and in Haskell are an impediment to composability as I mentioned in another post on this story.
- justinpombrio 13y agoIndeed, concatenative languages are written in a very natural way. I wonder if they wouldn't make good teaching languages: you have to learn about a stack, but the evaluation order is trivial (do the first thing, then the second, ...), and there are no variables to contend with. Haskell programs, on the other hand, are clearly written backwards :-)