lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Apr 26, 2017, at 12:21 PM, Coda Highland <chighland@gmail.com> wrote:
> 
> "Good idiomatic modern C++" != "good didactic C++". The stuff you're
> talking about is a complete non-issue for a beginning programmer.
> 
> Templates: You don't need to know how to WRITE templates in order to
> USE them. Beginners should be getting vector<> instead of arrays.

Beginners should be getting tables instead of arrays.

> Iterators: Beginners will be using integer-indexed loops. Iterators
> can be introduced later when non-random-access containers show up.

There's a good chapter on iteration in PiL. Note that cons-less iteration via next is covered...

> Smart pointers: Smart pointers are beautiful things, but
> beginner-level C++ won't be doing the kinds of memory management that
> needs it. This is going to come AFTER iterators, probably.

Smart pointers? What are pointers?

> Exception safety: Beginner C++ programmers are going to want to let
> exceptions crash the program. Writing exception-safe code can be
> introduced when it becomes necessary, which isn't going to happen
> until you get to file I/O.

Luckily for you, Lua has no story on how to handle prompt resource deallocation on non-local control flow, so I can't make the joke.

> Lambda expressions: Beginners will learn them idiomatically in the
> context of sorting a container. They won't get complicated until they
> start closing over references.

...but I can make it here!

> You're right that learning C++ to a level that you can write
> enterprise-grade software is a long and arduous education, but that
> doesn't mean that you have to jump in with both feet.

I guess I don't see the point of teaching C++ except as an elective. If you're a CS/EE major, you need to deal with the metal eventually[1], so you might as well go Python/Lua/Scheme then C then assembly. If you're not a CS/EE major, study Python/numpy and Excel, and run circles around the EEs.

Jay

[1]: OK, towards the end, SICP goes pretty far in making its runtime just as annoying as real metal.