Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Clever vs. Readable

by JavaFan (Canon)
on Aug 10, 2008 at 09:51 UTC ( [id://703388]=note: print w/replies, xml ) Need Help??


in reply to Re: Clever vs. Readable
in thread Clever vs. Readable

Some reasons why it's wrong in my opinion:
  1. I've no idea what vertical bar with a small hook to the bottom right means. It's certainly not a common math symbol. (At least, not on its own. It's a "left floor" symbol, usually used together with a "right floor" symbol, indicating the expression in between is rounded down to the nearest integer).
  2. It's a symbol that doesn't display well in my urxvt. And even if it did, it will be awkward to enter in my editor.
  3. It doesn't work in perl5.10 or earlier.

Replies are listed 'Best First'.
Re^3: Clever vs. Readable
by John M. Dlugosz (Monsignor) on Aug 11, 2008 at 03:50 UTC
    I was aluding to this tongue-in-cheek article I had just posted. I think it's a more common symbol than, say, @list».*foo, which is actual Perl 6. At least it has precedent, rather than being something totally new.

    What is a "urxvt"?

    After posting, I noticed that it did not show well in the font my browser chose for it. The hook is too small and it is easily confused with a solid vertical bar.

    So assuming font issues were taken care, what do you think of seeing ⌈$x⌉ to mean round up to an integer using ceiling semantics? Even the well-known trunc is not known at a glance to have floor or toward-zero semantics while the synonym ⌊⌋ would be obvious.

    Even more so in domain-specific notation: why invent a legal identifier name when a symbol or notation is already in use with the intended meaning?

    —John

      urxvt is a Unicode capable rxvt (the fact it didn't display well was due to the symbol missing in the fonts that are used); rxvt is a lightweight virtual terminal; an xterm with a lot less memory.

      As for ⌈$x⌉, I would understand what it means. I wouldn't use it, typing ceil I can do blind, while I would have to look up the codepoints for and , and even then it will take more than 4 keystrokes. As for ⌊⌋, it wouldn't be equivalent to trunc. tt>⌊⌋ rounds towards negative infinity (well, at least it does so in math - it may round towards 0 in Perl6), so it would be equivalent to floor.

      As for "inventing" legal identifier names, a couple of points:

      1. There's no point in "inventing" names. Symbols typically have names, and all Unicode symbols have names. So if you use the name of the symbol as the identifier name, you're not inventing it. You just use the name instead of the symbol.
      2. ASCII will be working correctly on a lot more platforms than Unicode for a long time to go.
      3. Keyboard sizes are limited. Most Unicode symbols are not present on a keyboard and need special handling to input them. Letters are present and inputted much more easily.
      4. Only a handful symbols are well-known; and most of them are present on the keyboard and are already used by Perl.
      5. Most people will be able to find floor efficiently in an index, as people know f follows e and comes before g. But where does go? It's ok if you have a handful of symbols, but not if you have hundreds.
      Syntactic sugar is nice, but too much sugar spoils a dish.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found