Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: what would you like to see in perl5.12?

by blazar (Canon)
on Aug 20, 2007 at 19:57 UTC ( [id://633926]=note: print w/replies, xml ) Need Help??


in reply to what would you like to see in perl5.12?

Nested statement modifiers (e.g. EXPR1 if EXPR2 for LIST instead of EXPR2 and EXPR1 for LIST)

That is not going to happen: the idea was firmly rejected by $Larry when it was suggested for Perl 6. Although occasionally I've cherished the idea, it's "kinda too much" for me too.

Method names given as expressions ($foo->do{ EXPR }(LIST) instead of my $tmp=EXPR; $foo->$tmp(LIST) or $foo->${\(EXPR)}(LIST))

While I desired that too, but I can't think of a syntax that would be unambiguous:

  • $foo->do{ EXPR }(LIST) could be a regular method call. And do is already a (overloaded) keyword. What if one has a do() method?
  • $foo->{ EXPR }(LIST) could be a hash dereference;
  • $foo->( EXPR )(LIST) could be a sub dereference. And that ")(" is, well, ugly.
Attributes on packages (allowing e.g. package Foo:extends("Bar"))

Well, this would be cool. Wait! I still have to learn how to use attributes on subs... Oh well!!

Replies are listed 'Best First'.
Re^2: what would you like to see in perl5.12?
by ysth (Canon) on Aug 20, 2007 at 20:52 UTC
    Method names given as expressions ($foo->do{ EXPR }(LIST) instead of my $tmp=EXPR; $foo->$tmp(LIST) or $foo->${\(EXPR)}(LIST))
    While I desired that too, but I can't think of a syntax that would be unambiguous:
    I couldn't come up with any case where ->do{ was ambiguous. It's currently a syntax error.
      I couldn't come up with any case where ->do{ was ambiguous. It's currently a syntax error.

      I hadn't considered the curlies: I had seen them but kinda not really noticed them. (It's been a terribly hard day.) If I take the curlies into account I get a very "unorthogonal" deviation from all the rest of Perl syntax I can think of. A bareword, with curlies next to it. And should whitespace be allowed between them? Or is do{ to be thought of as a single glyph? Anyway you think of it, it's very ugly.

        No, not a single glyph. Just a straightforward use of do BLOCK where it's not currently allowed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://633926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-03-28 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found