lua-users home
lua-l archive

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

On 26 April 2017 at 21:44, Andrew Starks <> wrote:
> On Wed, Apr 26, 2017 at 7:07 PM, Sean Conner <> wrote:
>> It was thus said that the Great Coda Highland once stated:
>>> 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)
> I think I'm weird or something or I'm not seeing your particular
> forest for the trees that I've stared at. I think I'd pox both of your
> houses.
> Static types: When learning how to program, I don't know that static
> typing is a net positive. To me, it tends to push problems elsewhere
> and cause a whole lot of code to be generated, just to get around the
> strong typing. When you're first starting out, is it necessary to
> teach this or is it a concept that can be added later?
> Early on, I want to learn about the basic structures of programming
> and how they're composed. I want to learn about:

They are composed according to the one thing you left out of your
list: types. :)

Even in Lua, a beginner needs to learn that a table is not a number
and that you can do different things to each. That's types. Maybe you
meant to cover this under "values", but if we make the notion of types
clear, you don't need the darned "references" in that list so early.
While we look at Lua variables through the glasses of our experience,
we tend to think as some arguments being call-by-value and some
call-by-reference because of copying and pointers in the
implementation, but really if you abstract this away, it is no
different when you pass a number or a table as an argument.

As for types being static or dynamic, there will be disagreeing
opinions here. But if advocates of functional programming say that
starting with functional programming is better because values of
variables don't change so things are less confusing, then I could make
a similar argument that starting with static typing is better because
types of variables don't change so things are less confusing. If
sometimes _we_ lose track of what's inside our Lua tables, imagine

Most often when I see people complaining about static types, often
mentioning their verbosity, I think that the problem is that people
are not thinking of particularly good languages (similarly to the "OOP
is bad because Java is verbose" thing — in fact, Java is a common
strawman to bash static typing as well).

-- Hisham