[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua style guide ?
- From: Peter Aronoff <telemachus@...>
- Date: Wed, 7 Jun 2017 08:41:27 -0400
Russell Haley <email@example.com> wrote:
> I found your code in Moses very readable and well structured but
> I noticed you use '_' for some 'root' level variables (for lack of
> a better term). My understanding (I think I read it somewhere) was '_'
> was supposed to be used in cases where you weren't going to use the value
> like in:
Re "I think I read it somewhere". The use of _ for unused/throwaway
variables is definitely a convention in Lua. Maybe you read this in
Roberto's Programming in Lua? "Usually, I reserved the identifier _ (a
single underscore) for dummy variables" (page 5 in the 3rd edition). But
you may have read it in the wiki's style guide or a bunch of other places.
If I had to guess, the original tendency may have started with PiL, but
maybe people who have been in the community longer would know better.
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System