Elm syntax in elixir

Try to check Clojure … :wink: (your brain will start getting hot)

1 Like

All I was commenting on was that you were assessing the OCaml syntax from a perspective of familiarity with Ruby and unfamiliarity with OCaml - a position from which it is impossible to determine whether the syntax is in fact “simple”. All you (or anybody in a similar position) can tell is that it would “not be easy” for you to comprehend it without further study.

One of the points of Rich Hickey’s talk is that “simplicity” is often a misunderstood concept and that following the “easy” (familiar) path will often lead to incidental/accidental and harmful complexity, while the path to “simplicity” often isn’t “easy”.

I have to admit that for the longest time I would have recommended a statically typed language for a “first language” because I believed that it was essential to have static type checking as a safety net. More recently I have come around to the position that “wrangling a type system” is actually a separate, more advanced skill set. I suspect that is why the HtDP languages are dynamically typed.

Don’t get me wrong “thinking in types” is still an important and essential skill but working in a statically typed language with an inferior type system can actually handicap you by overzealously blocking approaches that work in a dynamic (or properly typed) language. The flip side is that dynamic languages never force you to “think about types” (in a rigorous, systematic manner) - so you are actually never forced to learn how to “wrangle a type system”.

Well, being “famous” never stopped anyone from being narrow minded (seems to encourage it in some people) - ignore 'em.

1 Like

I wasn’t trying to determine whether it was simple or not though, just whether I liked the syntax or not :101:

Sounds like an interesting talk - I might have to watch/read it one day :slight_smile:

I can totally see how some people might think some languages might be better for beginners to start of with. However not everyone is the same and I think for some people, perhaps those like me who just can’t get into something if some thing or another just isn’t quite right for them (a bit OCD-ish perhaps) then it might be better find what’s most suitable for them. That’s all I was trying to tell that guy.

Luckily he wasn’t one of the people that I (nor many others) respected in the community, he is known for his rude and arrogant behaviour - it did bother me a little bit because I was very new to both programming and Ruby, but when Ryan Bates came to my rescue I was totally fine.

If anything, him telling me not to blog just made me want to do it more :icon_redface:

Oooh it’s awesome that I still recognize these, having built a trivial game using assembly and a LED display for a class project a few years ago :slight_smile:

Quite a reasonable way to look at this, IMO. Everyone has different aesthetic taste, and I find the ML type languages are syntactically brilliant and (most of the time) concise. I like beautiful syntax, but its not really a showstopper; my main concern would be language features (that’s why I kinda dislike writing Go, no map/filter/reduce support and you’re stuck with only for loops :cry:).

1 Like

11 posts were split to a new topic: Off-topic posts from Elm Syntax thread

Assembly language, BASIC, C/C++, Python, Ruby, Java, LISP, Haskell, OCaml, Erlang, Elixir… They are all possible to use for building complex systems. The difference is mainly in where you’ll get to spend your effort.

When all else is said and done though, I’d like to think that the most important thing about any language / framework / software ecosystem / community is what it inspires you to build.

1 Like

Curiosity got the best of me and I did some quick searching. The elm-community/elm-compiler-docs project looks like a promising way to get familiar with the Elm’s compiler stages, leading up to JS code generation. If you take advantage of the work the Elm compiler does for you, like name canonicalization and optimization, you’ll have a lot less to worry about making an Erlang/Elixir code generator.

1 Like

You think being clear and succinct is a bad thing? I hope not :101:

Elixir: Clear, mostly. Succinct, rarely. ^.^
Remember, it does have a Ruby heritage. :wink:

You said:

that is the definition of being succinct :confused:

Personally I think the balance is right - not too bare like Python or the ML code I posted earlier, and not too convoluted like say C, or PHP.

I think ‘so many words’ is the opposite of brief :101: And to be Succinct you have to Brief. I checked dictionary :stuck_out_tongue:

I thought he was referring to lots of simple words, like def and end - hence him saying “makes me feel kind of childish”.

It’s all a moot point anyway, different strokes for different folks - if people love languages that I feel would drive me up the wall, good for them :lol:

As @jwarlander said… [quote=“jwarlander, post:28, topic:3358”]
…the most important thing about any language / framework / software ecosystem / community is what it inspires you to build.
[/quote]

Uh, ‘so many’ means ‘way too many’, not 'succinct. :wink:

Because it reminds me of my exposure to BASIC and such as a child. ^.^

But still, as for succinct see:
Elixir:

def someFunction(anArg, anotherArg) do
  anArg + anotherArg
end

Compare to OCaml/SML/ML with the same names:

let someFunction anArg anotherArg =
  anArg + anotherArg

And no, it is not whitespace sensitive, just everything is an expression, absolutely everything, so it knows the end because the expression ends. :slight_smile:

Well then what you would call succinct, I would call sparse :wink:

Ruby and Elixir has the right balance of succinctness IMO.

Python, OCaml, Elm etc is too sparse for my taste (in your example above, I MUCH prefer the Elixir version)
C, PHP, JS etc with all their endless brackets and semi colons are too convoluted for me.

But that’s just my personal preference and that’s not to say I won’t use other languages. I’m still going to check out Bucklescript at some point, though, I do wish the syntax was more like Ruby and Elixir :lol:

*runs

1 Like

Look at ReasonML then, it compiles with Bucklescript. ^.^

It all comes to personal preference in the end. I prefere whitespace to do…end or brackets, since you indent code for readability anyway. I don’t remember how many times I forgot that stupid do in either ruby or elixir and got enigmatic errors about totally different lines :smiley:

1 Like

To be honest, I do prefer either the elixir form or the eta reduced form someFunction = (+).

Is something similar possible in OCaml as well?

Ps: I’m not a point free evangelist but for such short examples I prefer point free over point full. But I recognize when point free gets point less :grin:

Yes, it is. OCaml has the same elegance of expression as the other languages in the ML family. Technically it works mostly the same as Haskell, for example. The difference in how it’s written mostly seems to lie in that they’re not as perversely happy to create new operators, etc.

Yeah… That there is an operator for nearly every other binary function annoys me as hell… I can’t remember most of them and use their names counterparts. Most of the time it’s a huge gain in readability compared to the code of a co student who worships point free and operators…

Jose said something about it in a interview before. Basically to achieve this it requires some fundamental changes on Erlang. I think from the perspective of writing productivity, Elixir is great already. If you want the “safe” thing for writing software on server side, I think OCaml should do(through Bucklescript it does the front end as well). It’s been battle proven like Erlang and very fast(think about C++). I was a big Elm fan and I wanted to have the experience of Elm everywhere as well. And I came across @OvermindDL1 's thread about Bucklescript and start porting my Elm code on his project https://github.com/OvermindDL1 . Basically it’s an Elm Architecture on OCaml and I found it so fascinating that OCaml is totally capable of expressing what Elm could express in a similar manner and almost identical structure. So my plan is to replace Elm with Bucklescript and master OCaml on the way. Well anyway highly recommend OCaml/Bucklescript for you!

1 Like