Hacker News new | ask | show | jobs
by zozbot234 1278 days ago
Is syntax really that big of an obstacle to learning a first programming language? The semantics of a C-like language like Nim could hardly be more different to Python's, they're pretty much at opposite ends in the stack.
4 comments

It can be. I would've loved to pick up Rust, the patterns for code structuring etc. that are evolving from it seem interesting to me. But getting the syntax right is just fairly difficult compared to other languages and at some point you just lose your patience. At the same time there's not enough learning material that works for me to dive into the deeper contexts to make it "click" for me.

Contrasting that to my experience with nim, I could get going almost immediately and thus didn't get held up much with the basics, which gave me more time to dive into more interesting concepts that it provides, like templates, compile-time-evaluation (new for me as a pythonista back then), macros etc.. I still got stuck here and there, mind you, but that was for more complex question than "How do I get a config from place X without the compiler yelling at me", and the discord was very helpful for that.

Nim feels much more like python than c to me, and the minimal number of non-alphanumeric characters in source is a big part of that.
> Is syntax really that big of an obstacle to learning a first programming language?

Of course. Compare, at the extremes, languages like APL or Brainfuck to something like Python or Scratch. Syntax is a huge factor in people wanting to learn to code or not.

Those languages have actually very different semantics too. I would say lisp is a better example of the importance of syntax.

People obsess (wrongly) about superficial details in my opinion.

I know of an example first hand where syntax only mattered: OCaml vs ReasonML. ReasonML is merely a syntactic change from OCaml as it's simply OCaml underneath, but people, especially coming from web languages like Javascript, liked ReasonML more than OCaml and were more willing to use it.

Another example, Gleam (an Erlang BEAM based language like Elixir) [0]:

> Shot in the wind, but is there a plan for different syntax? For those who've become comfortable in different fp camps, I can't really see myself picking up curly brackets and C-style code again. I really like the idea(s) of this project, but it's the thought of staring at that kind of code that's just a bit too much. I'd rather do something like [Nim,Scala,Clojure,F#]->JS if I needed to have that.

> > Unlikely I'm afraid. We used to have an ML style syntax but once we switched to a more mainstream syntax we had a big surge in popularity and interest.

> > I am very fond of the ML syntax, but I think it is the semantics and type system that really matter, so I am very happy to sacrifice syntax in order to make Gleam more widely accessible.

[0] https://news.ycombinator.com/item?id=27063049

Syntax is pretty much the entire reason that people stay away from languages like Erlang and Lisp
Or you know, types. Or too much expressivity.