Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: What operator should perl5porters use for safe dereferencing?

by pvaldes (Chaplain)
on Jun 13, 2012 at 11:09 UTC ( [id://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:

http://www.shoestringmag.com/files/images/main/DIY_Emergency_Kit.jpg

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found