develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113554] my() with empty list causes weird error

Thread Previous | Thread Next
Aristotle Pagaltzis
July 7, 2012 23:02
Re: [perl #113554] my() with empty list causes weird error
Message ID:
* Darin McBride <> [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.

(Do you mean it makes no intentional sense? I would agree with that. But
there are many other things you can do in a programming language that
are pointless: multiplying by 1, concatenating with the empty string,
a statement consisting solely of an expression with no side effects,
etc. That doesn’t mean it’s a good idea to disallow them.)

Aristotle Pagaltzis // <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About