[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Spaces before brackets - acceptable?
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 7 Jul 2009 10:22:30 +0200
2009/7/7 Nick Gammon <nick@gammon.com.au>:
> I have been using Lua for a few years now, and feel comfortable with it. It
> is incorporated into one of my programs which gets thousands of downloads.
> However I was recently thrown by a complaint from a user that my examples on
> my web site are "wrong" because I gave examples like:
>
> print ("Hello World")
>
> instead of:
>
> print("Hello World"")
>
>
> Now we all know that both forms work (with or without the space before the
> bracket).
>
> So, I reached for my copy of Programming in Lua, to set him on his way,
> explaining that if he only RTFM he would see, that on page XXX it says that
> white space is not significant. This is where I hit a problem. I seem to
> recall reading it somewhere, but can't find the page. Searching the online
> manual on the website for "space" only returns references to things like
> "stack space".
>
> The page about "Some Lexical Conventions" for example, does not mention
> spaces at all.
>
> I note that many of the examples in Programming in Lua actually omit the
> space when explaining function calls.
>
> Even "The Complete Syntax Of Lua" doesn't seem to mention whitespace.
> Obviously it is needed to separate words like "local" and "function" but
> that seems to be implied.
>
> So please don't laugh, but can someone point me to where it says, on the
> official documentation, that a space is OK between a function name and the
> bracket which starts the arguments? Thank you.
The closest I found is:
"As an exception to the free-format syntax of Lua, you cannot put
a line break before the '(' in a function call."
Why do you need to prove it to that user ? Can't you just point him on
this mailing list so that he discredits himself on his own ?