r/elm • u/Voxelman • Jul 11 '21
Elm should be the first programming language taught at universities and colleges.
9
u/Kurren123 Jul 11 '21
We learnt Haskell as our first language in uni
2
u/Voxelman Jul 11 '21
Do you think that it was good to learn a strongly typed functional programming language first?
8
u/Kurren123 Jul 11 '21
I think the benefit of learning it first is that you don’t need to unlearn a bunch of OOP which can get in the way
1
5
u/salinasjournal Jul 11 '21
I wish I had learned a functional language first because the different way of thinking necessary to code in this way is useful for other languages. I can see an argument that it is harder to get functional code to work, which may be frustrating for a beginner, but when you do get it to run it is more likely to run without bugs. The discipline of using immutable variables certainly helped me improve my code in other languages by using constants more often.
3
7
u/tripack45 Jul 14 '21
Elm as in its current state contains various semantics inconsistencies that makes it not suitable as an exemplary language.
The compiler also makes certain arbitrary restrictions (e.g. at most 3 elements for a tuple, and the removal of support for custom operators) based essentially personal preferences, setting a bad example for students.
The lack of language specification also makes program semantics whatever the compiler do, which is bad because 1) lecture content could be invalidated at any time by a change in compiler behavior 2) no authoritative source for what the language should behave.
2
u/Voxelman Jul 14 '21
Best answer until now. In that case I agree that Elm might not be the best choice. Thanks
10
Jul 11 '21
Elm is great for what is great for: browser apps. It is not a general purpose language.
PureScript would already be a better fit in that regards.
I don't know if I'd start m off with a typed language. Maybe a lisp with SICP would be my choice. Then a strongly typed language as second.
1
u/Voxelman Jul 11 '21
Maybe you can switch to Haskell after the basic concept is solidified. Or you can even directly start with Haskell, at least at Universities.
I just think Java(Script), C/C++ or Python are not the best choice to begin with.
1
Jul 12 '21
I agree that the last languages you mention are terrible beginner languages (C being the least bad). That’s the crux for me. As with others here, I think an ideal sequence would start with Scheme. For MLs, I think SML is probably the best teaching language.
2
u/Voxelman Jul 12 '21
I think it depends on the age of the students/children. For university students, Elm is perhaps too much of a toy language.
1
Jul 11 '21
I just think Java(Script), C/C++ or Python are not the best choice to begin with.
Totally agree. Maybe Python. But otherwise I think we have better to offer for leaning the baiscs.
2
u/deanporterteamusa Jul 12 '21
Came here to say this (more or less). Scheme + SICP.
I am really glad I went through SICP before writing Haskell, Idris, Erlang, Elixir, etc. I don’t know if I would’ve appreciated those languages and/or the functional paradigm if it weren’t for SICP or scheme. I still write scheme these days (write as in write with pencil and paper when I’m working out some recursive function).
0
u/Voxelman Jul 11 '21
Purescript is in my opinion a horrible choice. In that case I would prefer Haskell.
But you don't need a general purpose language to learn programming. Elm would be perfectly fine to learn programming concepts.
2
Jul 11 '21
So we disagree.
To why not Haskell: to many functions in prelude are not total.
-2
u/Voxelman Jul 11 '21
Well, if I Google for videos about "elm tutorial" I have about 162000 hits, if I do the same for Purescript I just get 7440. Even if I search for "elm language tutorial I have 33600 hits.
Purescript doesn't seem to be very popular and you won't find much learning material.
A reason might be that Elm has batteries included and is much easier to use, but I'm not sure.
2
3
u/britishmutt Jul 11 '21
McMaster University uses Elm to teach kids to program: http://outreach.mcmaster.ca/. Start em' young!
2
u/Voxelman Jul 11 '21
I think, porting "the nature of code" to Elm would be a good learning material.
1
u/britishmutt Jul 12 '21
I haven’t read that, but in general it would be good to see more books that use Elm rather than ones that are about Elm.
2
u/deanporterteamusa Jul 12 '21
So… playing devil’s advocate here: could it be that your excitement about Elm is (in part) due to having programmed in a different language before Elm?
Elm solves a particular set of problems, but like other languages it’s no panacea.
After writing C and C++ (novice to intermediate) and then writing a lot of Rust I thought (hoped, really) I’d have no reason to to write C or C++. However, for me, this was just some ignorance on my part. I didn’t have enough real world experience to know about or benefit from the tradeoffs each language (including it’s ecosystem, paradigm, etc.) represents.
I get your enthusiasm though! I feel similarly about Scheme (or Lisp, Racket, etc).
Hmmm, what would be cool is a language trade off course where different systems are written in different languages/paradigms and are compared/contrasted in a way that demonstrates limitations/capabilities.
2
u/jimmux Jul 12 '21
I feel the same. These days I have no wish to write in C, but I'm glad it was one of the first languages I was taught because it's closer to metal and you have to respect what the machine will do with your code. When I had a choice of languages for uni projects I would usually use C because it made me understand the algorithms being taught better.
At the same time, I wish I was also taught something like Elm so I could see how nice things can be in a purpose built language. The mathematical concepts around pure functional languages are pretty fascinating too.
We did have a course that covered different paradigms, but it wasn't enough to just have a single lesson in an ML language where the benefits weren't obvious, then move right on to a concatenative, language, then something else.
1
u/Voxelman Jul 12 '21
I didn't say learn only FP, I say learn FP first. You should also learn assembler and OOP.
Many schools that only minor in computer science only teach OOP.
1
Jul 11 '21
I don't think pure functional languages are good introductions to programming. They are too far removed from actual computers. You might as well teach lambda calculus in CS101.
2
u/Voxelman Jul 11 '21
Seriously? Modern computers have 4, 8 or even 16 cores/threads. Imperative languages are known for data race problems. One reason for the increasing popularity of functional programming are multi-core CPUs.
Languages like Rust are a good example. Rust uses functional features to eliminate data race issues.
So the opposite is the case. Functional programming works much better on actual computers.
3
Jul 11 '21
Rust has functional elements, but it is not functional. You are very much encouraged to mutate and iterate rather than shadow and recurse. Actually, Rust would be a much better language to learn than haskell or Elm. Especially with how it's tooling is so easy to use. Cough, cough, Elm lsp that uses folder called
elm-stufffor its cache and absolutely refuses to run with no comprehensible errors if you happen to call your project folder for learning elmelm-stuff.1
u/Voxelman Jul 11 '21
I know that Rust is multi paradigm. But it uses lot ideas from FP. Even the borrow checker has it roots in FP if you think about it carefully.
Someone on YouTube commented recently about Rust: "The Scala and Haskell folks I showed it to immediately get it. Java and C# devs aren't as used to..."
2
u/salinasjournal Jul 11 '21
I don't think that is necessarily a bad thing. We don't teach hex, then assembler, then C/C++, then Java. The ability to get things done (and done right) is more valuable to me than speed or similarity to computer architecture.
2
u/Auslegung Jul 11 '21
Absolutely agreed. I've mentored several people over the past 3 years who are getting into software careers and I always recommend they learn Elm, for the very reasons you've listed (and defended) throughout this post.
13
u/mrunkreativ98 Jul 11 '21
Ok. Why?