in reply to numbers with chainable comparisons
I'd rather struggle with clunkier syntax than deal with subtle bugs introduced by an almost-but-not-quite perfect overloading attempt. Ideally, the language we'ld write it would *have* the syntax we wanted in the first place. I'd rather work with the language we know than spent time rewriting it and learning the abstractions, and the limitations of the abstractions in theory, and the bugs in the abstractions in practice. Enough of that ad hoc development work, and you've got your own entirely new language which no one understands, and which doesn't actually work.
So, while interesting, if I want to write the mathematical expression "x <y <=z" in perl, I'd probably just use the alternative math syntax, "x is bounded by the interval (x,z]", and write:
$x->is_bounded_by("(",$y,$z,"]" );
or more likely just the simple and obvious:
$x < $y and $y <= $z
which does force you to repeat part of the expression, but has the advantage that a grade school kid knows what the code does.
Just my $0.02
--
Ytrew
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: numbers with chainable comparisons
by Irrelevant (Sexton) on Jan 19, 2006 at 09:44 UTC | |
Re^2: numbers with chainable comparisons
by Courage (Parson) on Jan 19, 2006 at 18:19 UTC | |
by Anonymous Monk on Jan 19, 2006 at 22:12 UTC |