lua-users home
lua-l archive

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


Yeah, that's why I mentioned Go. you can do

foo := 25
foo := "I'm a foo!"
foo = 25 // ERROR! foo is type string!

On Wed, Jun 17, 2015 at 6:48 PM, Tim Hill <drtimhill@gmail.com> wrote:

On Jun 17, 2015, at 4:07 PM, Brigham Toskin <brighamtoskin@gmail.com> wrote:

Would you expect an error? Perhaps you don't actually know C, if you're steeped in awesome things like Lua and Erlang, but this totally valid C. In fact, it outputs what you would expect, if you were familiar with Lua local scoping with blocks:

    foo == 100
    foo == 25

You can't redefine a var in the same scope like you can with Lua or say Go's := operator, but you can definitely redefine variables within a scope in lots of languages.


But I think that’s not the point. In C what you CANNOT do is:

int foo = 25;
int foo = 25;

.. but you CAN do something similar to this in Lua.

—Tim





--
Brigham Toskin