Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: Half-serious quest for prefix anonymous refs taking

by starbolin (Hermit)
on May 31, 2008 at 16:53 UTC ( [id://689445]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Half-serious quest for prefix anonymous refs taking
in thread Half-serious quest for prefix anonymous refs taking

The word prefix is still throwing me. I think a better term would be predicate. Again, the notation you propose would be ambiguous. In your example: my $href = \% <== foo => 1, bar => 2; That could either mean a hash whose first key is a hashref 'foo' or a reference to a hash with one key 'foo' followed by the comma operator and a two element list ( bar, '2' ). Although in the case provided it may be clear what you intended, the ambiguity increases if one were to attempt to nest operators:

my $ref = \%< ship => Serenity, crew => \@< Mal, Wash, Jane, Zoe, pas +sengers => \@< Simon, Book
Perl has no way of knowing you want 'passengers' to be in the same hash as 'ship' but instead you would end up with crew =>[Mal, Wash, Jane, Zoe, passengers, [Simon, Book]]Certainly not what was intended.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^6: Half-serious quest for prefix anonymous refs taking
by blazar (Canon) on May 31, 2008 at 19:15 UTC
    The word prefix is still throwing me. I think a better term would be predicate.

    I personally believe that it won't and I can't understand why it's throwing you, given that it's the correct technical term. In Perl 6 you can actually declare prefix, postfix, circumfix, etc. operators, which are basically regular functions.

    Again, the notation you propose would be ambiguous.

    It was just a very wild shot at it, to explain the kind of beast I "want," not a possible description of the beast. Actually I pointed out it couldn't be, for a well defined reason. That's why I'm asking here.

    In your example: my $href = \% <== foo => 1, bar => 2; That could either mean a hash whose first key is a hashref 'foo' or a reference to a hash with one key 'foo' followed by the comma operator and a two element list ( bar, '2' ). Although in the case provided it may be clear what you intended, the ambiguity increases if one were to attempt to nest operators:

    I call that an ordinary precedence issue, (except that I didn't specify the precedence of the operator nor do I have any precise idea about it) to be resolved with the use of parens when not doing the right thing without them.

    --
    If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-18 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found