lua-users home
lua-l archive

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


It was thus said that the Great Coda Highland once stated:
> 
> Beginner C++ should be passing things by value
> or by reference instead of by pointer as much as possible, and
> idiomatic C++ reflects this. (There's a reason that move semantics
> were such a big deal in the discussions leading up to C++11; that's
> what allows pass-by-value to operate efficiently.)

  Perhaps it's because of my extensive background in Assembly and C, but
what exactly *is* the difference between a pointer and a reference, other
than hiding the pointer behind some syntactic surgar?

> >> 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.
> 
> As mentioned upthread, there's no point in teaching C when you could
> be teaching C++. C++ can do literally everything C can, and it can do
> it with syntax that's much friendlier and much less error-prone. 

  Even coroutines?  Such as https://github.com/spc476/C-Coroutines

(okay, granted, it's implemented in assembly, but it works quite well for C;
I wouldn't even know how to begin to adapt that for C++)

> Even
> the argument about being better in restricted environments is proven
> to not hold water, because Arduino's primary language is C++. (That's
> not to say that the C++ STL is suitable for restricted environments.
> That's a separate argument.) In fact, learning C before learning C++
> I've found tends to HURT your ability to write good C++ until you've
> unlearned some habits.

  And C++ hurts your ability to reason about non-object oriented code I've
found.  Yes, C++ is technically a multi-paradigm programming language where
you don't *have* to use classes, but come on ... it's OOP (I am not a fan of
OOP, just so you know where my biases lie).

> High level language -> C -> assembly is really a pretty bad path
> nowadays. The demand for assembly skill is ridiculously small. I'm a
> CS major myself, and I've only ever written assembly for the fun of it
> on retro systems (and an attempt to write a C++ compiler, which got
> aborted due to the instructor vanishing). 

  What did the instructor vanishing have to do with not finishing a C++
compiler?  Unless it was a (rather ridiculously large) class project.

> I've never had demand to
> write so much as a single line of assembly code in a professional
> context. If you're going to teach assembler in school, you should be
> teaching it on a toy model as a didactic tool for understanding the
> low-level functioning of the CPU instead of teaching it as an actual
> programming language.

  That, I agree with.  There are much better CPUs to learn assembly on than
the x86 beast we're stuck with today.  I'm fond of the Motorola CPUs myself
(6809 for 8-bit, 68000 series for 32-bit).

> Meanwhile, modern C++ is a sufficiently high-level language that if
> you come at it with an open mind (instead of with prejudices derived
> from the disaster that was pre-C++11 in a world that had to support
> Visual Studio 6 long past its obsolescence) you'll find a much more
> modern and comfortable experience than you might have expected.

  I still find it more verbose than Ada ever was, even today.  

  Then again, I'm old school when it comes to this stuff anyway.

> Lua is a good lightweight general-purpose language, don't get me
> wrong, and there's probably nothing wrong with exposing fledgling
> programmers to it. But in terms of actually building engineering
> skill, I think starting off with a statically-typed object-oriented
> language is a better choice.

  Remove "object oriented" and I would probably agree.  

  -spc (At the very least, come up with some better examples of OOP than
	animals, vehicles or shapes)