From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> Date: Wed, 16 Apr 2008 09:39:52 -0400
. . . Yes, they use multiple-typed values such that (3 < 5) returns (5 but True), which used in a numeric context is a 5 that can be chained with further infix:{'<'}s but in a boolean context is True. Pardon a lurker, but I'm not sure I understand the point of this. In: if $x < $y < $z { ... } I would expect a sensible compiler short-circuit the "$x < $y" part, and indeed the "Chained comparisons" section of S03 (version 135) says A chain of comparisons short-circuits if the first comparison fails . . . But the definition of chaining associativity under "Operator precedence" says this is equivalent to: if ($x < $y) and ($y < $z) { ... } (modulo multiple evaluation), but IIUC "and" is not short-circuiting. Which is intended? I am hoping the "Operator precedence" definition should be "andthen"; I would find non-short-circuiting behavior rather surprising. Assuming that the intent is for short-circuiting, the compiler *can't* in general produce code that invokes subsequent chained ops, as that would require evaluating subsequent arguments. So when would these "Num but True" values ever be needed? And wouldn't it also be helpful to implement chaining in such a way that a specialized chained op implementation couldn't mess it up by returning plain True? My apologies if this is spelled out somewhere; I couldn't find anything about this application of multiple-typing in S03. -- Bob Rogers http://rgrjr.dyndns.org/