|
|
|
|
|
by kenko
4105 days ago
|
|
How did you arrive at any of those conclusions? That doesn't strike me as a very straightforward interpretation of the offhand reference to the syntax's being natural, made without any further comment. Nor do I see why "def" being a macro makes the syntax "natural in its representation" (or even what you mean by that). Just as a test: if that is what he meant by the syntax's being natural, he should be willing to claim that the syntax of Scheme is at least as natural. |
|
While Elixir may appear similar to Ruby syntactically, because of it's `do, end` blocks, that similarity is actually somewhat superficial. In reality, a Rubyist will only feel slightly more comfortable with Elixir's syntax than someone coming from another imperative language, for a couple reasons. One, Elixir's usage of do/end is far more regular than in Ruby, where `do/end` have a very specific meaning, and two, the differences from Ruby syntax (defmodule, defstruct, fn -> end, |>, calling anonymous functions) are actually greater than the similarities. But I think both the Rubyist and the (Javascript, C, Go, Python) programmer will find Elixir's syntax more natural than they would find the syntax of many other functional languages.
Of course, at the end of the day, our intuitions and feelings about syntax are quite subjective, and syntax is a very tricky thing because of this.
I can't say for sure what the author meant by natural syntax of course, but this would be my guess, based on how I've seen the term used in other descriptions of the language.
I'm curious what language background you come from, and whether there are particular things about elixir's syntax you found unnatural, difficult or uncomfortable?