lua-users home
lua-l archive

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


On Aug 1, 2014, at 1:38 PM, William Ahern <william@25thandClement.com> wrote:

> 
> Just my opinion, but I feel like string coercions are just too convenient.
> Most dynamic languages support them, IME, perhaps excepting Python.
> JavaScript has rather unintuitive behavior, but that's because it overloads
> the + operator with concatenation.

I think this depends on the audience. As volunteer work, I’ve taught scripting (Javascript and Lua) to many non-programmers over the years. Its not hard to explain strings, numbers, even integers. The biggest hurdle comes when they need to get the difference between “12” and 12 in source code. Once they get that, they are starting to understand the basics of types and the importance of syntax.

And then, you have to say: but sometimes “12” can be used like 12 … and I groan inside as I see their eyes glaze over again.

So:
— I don’t think coercion is useful for programmers; we don’t need it.
— I don’t think coercion is useful for non-programmers; they don’t understand it (or misunderstand it).

—Tim