Re: What operator should perl5porters use for safe dereferencing?by pvaldes (Chaplain)
|on Jun 13, 2012 at 11:09 UTC||Need Help??|
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?