[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc2) now available
- From: James Graves <james.c.graves.jr@...>
- Date: Wed, 22 Jun 2011 09:50:53 -0500
David Kastrup <firstname.lastname@example.org> wrote:
> Alexandre Rion <email@example.com> writes:
>> I also think that labels should be per block.
> Local variables are per block. This makes it possible to have
> self-contained syntactical entities with minimal outside interaction.
> function-local labels break this concept, and it is not clear to me how
> this would affect label/goto outside of functions.
I think the one-label-per-function restriction is fine.
If your function is soooo big that you're losing track of what labels
you've been using, then you've got other problems. Having unique
labels in each function makes it easier for me to read and understand
I would like to encourage all developers to:
A) Use 'goto' sparingly, of course. Error handling and a 'continue'
replacement are acceptable to me. However, if a little
re-organization would allow you to use some other control structure,
that is preferred.
B) Put as much thought into naming labels as you would naming local
variables. Please use descriptive names, such as ::retry_read::
instead of just ::retry:: and ::skip_blank_line:: instead of
::continue::, to draw from some recent examples.