Saturday, 28 July 2007

Silly language design decisions.

Didn't know that before:

Perl's zipping operator

Every self-respecting dynamic language has a zipping function (or method). Python has its built-in zip(), haskell as well. Ruby gets it implemented as one of Array methods. I just didn't know (untill 3 days ago), that it's particularly useful for perl programers. Unfortunately, its name is THREE CHARACTERS LONG! O_o, that is waaay too many. That's why Larry Wall introduced zipping operator. You wonder what is it? Isn't that obvois? It's Yen symbol! Come on, it looks like a zipper anyway!


Except for the fact, that there are _two_ Yen signs in unicode (¥ and ¥). And only one is recognised by the parser. Lame. Fortunately, Larry changes it to 'Z' in perl 6

Take a look on Jonathan's blog entry

And some quotes:

The zipper/yen operator has been renamed to Z. This is good for me, as I’ve never been very good at memorizing Vim’s digraphs.
Maybe we should avoid other symbols like this for sigils
BTW, the exact same thing happens with the Won sign ₩ on Korean Windows
systems; it is also mapped to 0x5c in the default codepage, and paths
are displayed with the Won sign instead of the backslash as separators.
Just something to keep in mind in case you are tempted to use the Won
sign as a sigil or operator in the future.


Visual Basic AndAlso short circuit operators

Well, story is simple. When Visual Basic was designed, either no one knew about short circuit operators, or they didn't recognise their virtues. And years after, they couldn't stick it in because of backwards complatibility. But they found a solution eventually: AndAlso and OrElse operators. Simple, isn't it? AndAlso it doesn't break the compatibility. I only wonder why OrElse is OrElse and not... let's say OrPossibly or OrMaybe or OrHowAbout.

No comments: