lua-users home
lua-l archive

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


On Tue, Jan 31, 2012 at 17:35, curt <curt@northarc.com> wrote:
> On 1/31/2012 3:36 PM, Marc Balmer wrote:
>>
>>
>>
>>
>> Am 31.01.2012 um 21:23 schrieb Francesco Abbate<francesco.bbt@gmail.com>:
>>
>>>> It depends. There is a cost (syntax and run-time) to exception
>>>> handling in Lua.  We know that goto is low-level, but it is not
>>>> inherently evil in the hands of someone who knows that it's the most
>>>> optimal solution.  And as for 'bad code', the best solution is
>>>> education, not limiting the language so that it can be 'safe'
>>>> according to the current definition of 'safe'.
>>>>
>>>> Gotos are also useful for code generation, particularly if one has
>>>> some kind of #line pragma as well.
>>>
>>> I'm sorry but I don't agree on this point. Adding a bad feature like
>>> goto to facilitate automatic code generation, this is a bad argument.
>>>
>>> I will be afraid to see in future Lua libraries and application using
>>> gotos :-/
>>>
>>> Francesco
>>
>> gotos are a good concept.
>>
>
> They come up. I find the need of a goto about... once a year. Usually to
> error out of a long init-chain that just looks too hideous without it.
>
> Last time was to leave a Python macro pair that created a scope.
>
> Unless, of course, you count break, continue and switch/case in which case I
> use goto continuously :)
>
> -Curt
>
>

I thought Lua just added goto because people wanted continue, named
break, etc and they felt goto would satisfy those all at once?

It might be useful for code generation, but without #line you can't do
any serious generation of Lua code anyway...

-- 
Sent from my toaster.