* Darin McBride <dmcbride@cpan.org> [2012-07-08 16:15]: > On Sunday July 8 2012 8:02:21 AM Aristotle Pagaltzis wrote: > > * Darin McBride <dmcbride@cpan.org> [2012-07-08 06:50]: > > > On Sunday July 8 2012 6:42:58 AM Aristotle Pagaltzis wrote: > > > > Why would the last example here be the odd one out? What makes > > > > an empty list so abhorrent in the vicinity of `my` that unlike > > > > anywhere else in Perl, there it has to be forbidden? > > > > > > Personal opinion, but "my ()" makes no semantic sense even if it > > > makes syntactical sense. > > > > What about its semantics is nonsensical? It seems perfectly > > well-defined to me, the concept of “zero” is not exactly novel. > > Well-defined != sensical. > > Basically, you're saying that its syntax makes sense (well-defined), > and using that to question my claim that it makes no semantic sense > when I already conceded that it may make syntactical sense. I am not questioning. I just asked to make sure I didn’t miss a subtler argument, instead of a simple unobjectionable one in which the specific technical meanings of “semantic” and “syntactic” were confused. (“Semantic” does not mean “makes sense”.) (Fine, multiplying by 1 makes sense in Perl. How far does that go? Does $x * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 make sense too?) > foo() for (); > > This statement doesn't make much sense. However, it's simply the same as: > > foo() for (@list) > > where @list is empty. No it isn’t, and allowing the latter does not necessitate allowing the former. In fact, other than on the RHS of an assignment when clearing a list, there is practically nowhere that writing `()` is ever sensible in Perl (discounting the use of parens to call a sub when not passing arguments; and in fact they are only required for method calls). Yet you can sprinkle it just about everywhere. Shouldn’t ($foo, (), $bar, (), $baz) = 1..3; be an error? > And, Eric, not that I have much say in the matter, but I'd find > a simple comment "# no arguments" or even an empty prototype, to be > a clearer way to document a lack of arguments ;-) I agree that seems a way to confound (novices especially) more than to enlighten. Also please do not use prototypes for that. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>Thread Previous | Thread Next