Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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:

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?


Comment on Re: What operator should perl5porters use for safe dereferencing?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-10-22 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (118 votes), past polls