Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: What operator should perl5porters use for safe dereferencing?

by pvaldes (Chaplain)
on Jun 13, 2012 at 11:09 UTC ( #975955=note: print w/replies, xml ) Need Help??

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

mmmh, I think that I had an interesting idea...

This is a safety kit:

Is iconic, simple and universally understood

So what if instead something like ~> we consider something like [+]>?

We could to teach emacs or vim to print this 3 chars in red so is more readable that other options and thus you can't mistake for a part of a sum, is a red cross in a box, everybody can catch this idea in seconds

If you want SAFE dereference simply add a safety kit "[+]" to your code:

I don't know if this could horribly crash with another internal or external perl structures (don't think that the combo [+]> should be frequently seen in a regex anyways) but looks a simple, elegant, easy to remember and strong concept to me, and not to much ugly to read, specially if we use an editor that can print this 3 characters in red if found before a ">".

 [+]>     $rock->()->the->kasbah();     $rock[+]>  ()[+]>  the[+]>   kasbah();

What dou you think about it?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2019-10-18 09:15 GMT
Find Nodes?
    Voting Booth?