Re: Pil3 clarification
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Pil3 clarification
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: 2019年5月19日 10:35:42 +0200
Sorry for top-posting, but there is a reason for it.
I was looking in my personal mail Lua-l archive for something and I
stumbled on an old post of mine addressed to Roberto which never got an
answer.
After a brief investigation it appears that I sent that during the
"heat" of a Lua convention when Roberto & C. were abroad and probably
had not the time to even look into it.
Therefore I dare "bump" it, even though it might be obsolete now that
PiL4 is out (which I don't have, whereas I purchased PiL3 at the time).
If the new structure of PiL4 renders this utterly obsolete, please
accept my apology for the noise.
Anyway it boils down to: /is select function still a B-class citizen in
PiL4?/
Thanks
On 03/11/2013 11:32, Lorenzo Donati wrote:
Hi Roberto!
Reading PiL3 I noticed that you don't introduce the `select` function
when you talk about vararg functions.
However you use it in two places, namely p.203 in the snippet:
count = select(2, string.gsub(str, " ", " "))
and at p.205:
nvow = select(2, string.gsub(text, "[AEIOUaeiou]", ""))
Was it an intentional omission? One of those "dark corners of Lua"
mentioned in the preface (p.xvi) which PiL3 skips over?
If this is the case (then I wonder why - I thought it was the natural
way to process varargs) may I suggest to consider adding a line of
explanation before using `select`. IMHO the novice reader could be
really confused since the only `select` that was mentioned before was
Luasocket's select (p.95). It's not at all apparent that `select` is a
Lua base library function, so she could have an hard time guessing
what's happening.
Cheers!
-- Lorenzo