4 ms·
> I really regret that there is no good low-level language targeting learners as ubiquitous as Pascal was Some people are betting that Rust will be that langua
by zozbot234 4y ago
> I really regret that there is no good low-level language targeting learners as ubiquitous as Pascal was
Some people are betting that Rust will be that language - and it probably can be a viable first programming language if all you're writing is toy programs with trivial use of dynamic memory, like you probably would when learning Pascal. It certainly has better chances than C++.
- pshirshov 4y agoI can't imagine how Rust may be the perfect low-level language for beginners given its unusual typesystem which comes with significant mental overhead. Really, I have no idea how to explain 7 year old kids how to deal with Rust. It works perfectly with Pascal though.
- zozbot234 4y agoI don't think anyone has seriously tried to teach schoolkids to code in Rust just yet. But the way you'd do it would be to treat it as something close to a pure functional language. .clone() all the things and use Cell<> for the hopefully rare case where you really need shared mutability somewhere. (Even RefCell<> is arguably a step-up in complexity over Cell<>.)
- pshirshov 4y agoEssentially your proposal sounds like you would have to invent some kind of convention-defined language on top of Rust. The beauty of old Pascal was its compact feature set which is really easy to explain.
- mr_00ff00 4y agoI really think rust is great, but after learning what memory management is. Teaching rust first would just be a weird memorization of rules that you might not appreciate.
- zozbot234 4y agoThe borrow checking rules of Rust are anything but "weird". They boil down to not mixing up shared references and exclusive borrows; and, more subtly, preserving the distinction between temporary borrows and complete ownership. (I.e. only the owner can dispose an object; when borrowing, you can only give it back.) That's quite teachable, albeit using these rules in practice is not nearly as easy.
- nequo 4y agoI agree, if C++ can be taught then so can Rust. But pedagogically, it is difficult to motivate why we can’t read a reference and mutate it in the same scope, since Python, JavaScript, Ruby, Lua, Lisp, Java, OCaml, C, etc. all allow it. It is much easier to accept this hurdle after having seen and debugged memory bugs and data races in, e.g., C.
- mr_00ff00 4y agoI’m sure it could be, and maybe I am wrong but I know people say rust has a rough learning curve. I learned C and Typescript before ever touching rust, and I feel like I experienced no rough introduction. Maybe it’s anecdotal, but I always assumed I learned memory and semi-functional programming first, which made rust a breeze.
- cxr 4y ago> Teaching rust first would just be a weird memorization of rules that you might not appreciate. That's pretty much exactly the situation with first-time programmers who are taught Java—none of the background to know why it makes the decisions it does.
- jeroenhd 4y agoI love Rust, but its model and specifics would make it difficult to learn how to write code in other languages. For low-level code, I think Carbon may fill that niche in the future. If it doesn't, C++ may be a good candidate once up-to-date books have been written and compilers actually support the modern spec. Classrooms/guides would need to move away from the still-lingering "C++ is C with classes" approach and use the standard library before that can be a reality, but this book[0] by Bjarne Stroustrup himself demonstrates the future C++ _could_ have if all the modern language features become usable. In business, C++ will still be the domain of ancient clusterfucks compiled by MSVC++ 6 in many areas, similar to how most Java code is still built around Java 8 because that was the most recent stable version for many projects' lifecycle (and Oracle's decision to only ship JRE 8 to consumers doesn't help) and how .NET 4 is still taught in schools because the new and scary dotnet tool doesn't map 1-to-1 with the old way of working. I can't imagine microcontroller toolkits supporting a modern version of _any_ language in the first place. However, if more people would learn modern C++ (or a replacement, like Carbon), I think this class of programming languages can have the same growth and hype Rust has enjoyed for the past years. I'm keeping my eye on Carbon and Zig. Google's influence has managed to push Go to the forefront despite its many quirks, and Zig seems to be focused on doing "C, but right" rather than "C++, but right" which so far is looking pretty promising. It's also fun to see Jakt[1] being developed in real time; I don't think it's a language that will be useful for production software any time soon, but on the other hand it's a language that actually produces binaries reliably (unlike pre-alpha Carbon or pre-release Zig, the latter exposing many problems after switching to a self-hosted compiler). [0]: https://www.stroustrup.com/tour3.html https://www.stroustrup.com/tour3.html [1]: https://github.com/SerenityOS/jakt https://github.com/SerenityOS/jakt
- pshirshov 4y ago> C++ may be a good candidate once up-to-date books have been written and compilers actually support the modern spec I guess the feature set is too... extensive for a beginner.
- kristoff_it 4y ago> Google's influence has managed to push Go to the forefront despite its many quirks Nah, the good things about Go have made it popular. If Google's influence is all it took then Dart would be a much more popular language.
- tptacek 4y agoThere is no reason for programming pedagogy to begin with low-level languages. Python was also designed to be a teaching language, and has been unreasonably effective for that purpose. The majority of all practicing software developers won't need to get closer to the metal than Python does; that wasn't the case in the 1980s and 1990s, when hardware performance was so poor that languages like Python usually weren't viable, but it is now. Rust seems like a distinctively bad teaching language. It's a fine language! But I'd probably teach assembly before I taught Rust --- and both after establishing Python fluency.
- pshirshov 4y ago> Python was also designed to be a teaching language, and has been unreasonably effective for that purpose. From what I've seen, those who learn programming using high-level dynamic languages with managed memory really struggle to understand many basic concepts (e.g. equality/identity, abstract machines, etc, etc) and data structures. > The majority of all practicing software developers won't need to get closer to the metal than Python does Like they'll never need to write a native extension?
- dragonwriter 4y ago> From what I’ve seen, those who learn programming using high-level dynamic languages with managed memory really struggle to understand many basic concepts (e.g. equality/identity, abstract machines, etc, etc) and data structures. That’s not my experience, and I’d be especially surprised if the first of those examples was true of people who learned with Python, since the identity vs. equality distinction is a basic, important, and in most pedagogy very early concept in Python. > Like they’ll never need to write a native extension? Use? Sure. Write? Probably not.
- zozbot234 4y agoIt's not really about starting out close to the metal, it's about mastering a language in a comprehensive way. You can understand the overall semantics of C or PASCAL as a beginning programmer in a way that's just not true of Perl or Python. (It might be true of, say, Scheme, but the clunky paren-based syntax does not make that language intuitive to novice programmers.) Of course C and PASCAL come with the well-known pitfalls associated to memory unsafety, so that's a good reason to pick something like Rust. Rust might be described as complex, but the complexity is built upon a core of language constructs that should be comparatively easy to teach and learn.