[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require() parse error in 5.3.4/5.4.0-work2?
- From: Kenneth Lorber <keni@...>
- Date: Wed, 27 Jun 2018 07:15:25 -0400
> On 26 Jun 2018, at 13:13, Kenneth Lorber <firstname.lastname@example.org<mailto:email@example.com>> wrote:
> On Jun 23, 2018, at 8:57 AM, Andrew Gierth <firstname.lastname@example.org<mailto:email@example.com>> wrote:
> To me it is about flexibility, multiple return values, and the ability to only take what is needed. Eg:
> Without a bunch of locals. Why would you even want to limit that and make it an error? It takes flexibility away.
> For example: take OpenResty, it uses a lot of those extra checks and it's a pita. See this code for example:
> The last argument “socket options” must be a table, not even `nil` is accepted. Hence in the calling code it requires an if-then construct.
> So be careful what you wish for with those checks.
I was going to just let this go, but the replies are getting so far afield I just can't. I'm not asking about the language feature in general, or about function prototypes, or user written code or any of the other things people have brought up.
I'm talking about the basic, lua-distribution-supplied functions such as require. So let me rephrase my original questions and we'll just stick to require only:
Is there some reason accepting require("file", "ignored argument") is a language feature? Some use-case I don't see? (If so, why is there the occasional check for extra arguments?)
Is it documented somewhere I missed that lua functions supplied by the distribution accept and ignore extra arguments?
Is there any reason not to add checks for extra arguments to the functions supplied by the lua distribution? If it's performance, it could be available as a compile time option.
I hope this gets the discussion back on track, whether anyone agrees with me or not.