Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: What operator should perl5porters use for safe dereferencing?

by davido (Archbishop)
on May 29, 2012 at 18:17 UTC ( #973083=note: print w/replies, xml ) Need Help??

in reply to What operator should perl5porters use for safe dereferencing?

We have the // and //= operators which work like a 'defined' short circuit, otherwise emulating || and ||=.

On your list of options I don't see ones that kind of stand out as being of similar encoding: //->, and -//>

The concerns are that they start looking like the closing side of a markup tag, and that the version I like the most would become Perl's only four-contiguous-character non-alpha operator (that I can think of).

What I don't like with respect to any of the ~ options is that they feel like they should be doing some form of matching: pattern, smart, or even dereferencing-lookup matching (which is what -> already does as it scans the inheritance tree).


Replies are listed 'Best First'.
Re^2: What operator should perl5porters use for safe dereferencing?
by bobf (Monsignor) on Jun 06, 2012 at 15:37 UTC

    My thoughts, exactly. If such a beast were to arise, I would prefer that it be somewhat consistent (visually) with defined-or (even though we are trying to represent defined-and). I might be persuaded that something based on && would be suitable.

    IMO, many of the poll options resembled bitwise operations, matching, and the ternary operator too strongly.

Re^2: What operator should perl5porters use for safe dereferencing?
by Tux (Abbot) on Jun 07, 2012 at 06:44 UTC

    That was my first hunch too, being a huge fan and user of the defined-or operator, but using that here would have been the opposite of what is required. What is suggested is a defined-and operator, which does not (yet) exist. For me that indeed rules out //-> and -//>. Think about it again when defined-or would be used :)

    Enjoy, Have FUN! H.Merijn

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://973083]
[james28909]: yeah but it would rename those subs xD
[Lady_Aleena]: I'd say, go back to my scratchpad, and really look at what the 3 subs are doing, then play. Meanwhile, I am going afk for about an hour +/- a few minutes.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2017-05-24 05:26 GMT
Find Nodes?
    Voting Booth?