Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rafael (2125)

Friday January 13, 2006
01:09 PM

Today's disgusted moment

[ #28342 ]
Sometimes, language programming constructs are just objectively ugly. (Or do I do too much C programming ? No. I don't want to believe that.)
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Ternary operators are inherently ugly, the only thing a language designer can do is choose amongst the flavours of ugliness.

    Having to create a syntax that lets three units (condition, true selection, false selection) be associated easily by a reader requires at least 2 operators and is an order of magnitude more awkward than binary operators. While C and Perl5 go for huffman encoding with ? : (which Perl6 is changing to ?? :: IIRC), there is history for using a more verbose mechanism, requiring more verbo

    • While C and Perl5 go for huffman encoding with ? : (which Perl6 is changing to ?? :: IIRC), there is history for using a more verbose mechanism,

      The oldest is the quatenary operator or ternary if in Fortran -

      if (expr) line_lt, line_eq, line_gt

      which predates if..then by several years; but neary as old is the ternary operator if in Lisp

      (if pred-expr, true-val, false-val)

      which with is pretty well Huffman encoded.

      The beautiful thing of Perl is TIMTOWTDI ... if you won't want ternary operators, don't

      --
      Bill
      # I had a sig when sigs were cool
      use Sig;
  • We will adjust the syntax of what goes inside an 'if' to disallow lambda; currently

    if lambda: x:

    is accepted but quite useless (it's always true) so this will be disallowed.

    I guess backward compatibility is an issue when working with Python. That's something rather important advocacy note to remember.