[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Say No to global-by-default
- From: Sean Conner <sean@...>
- Date: Wed, 4 Jul 2018 18:24:25 -0400
It was thus said that the Great Gregg Reynolds once stated:
> On Wed, Jul 4, 2018, 4:42 PM Sean Conner <sean@conman.org> wrote:
>
> > It was thus said that the Great Gregg Reynolds once stated:
> > > Ok, but what does that have to do with spelling?
> >
> > I mispelled 'baz' as 'baa'
>
> Haha! But that screws up your example.
Okay, fine:
int foo()
{
int baz;
// lots of code here
return baa;
}
and
function foo()
local baz
-- lots of code here
return baa
end
Better? C will compilain about 'baa' not being defined, while Lua will
silently treat 'baa' as a global value and return nil.
-spc (I still get bit by this in Lua, but luacheck helps here)