Re: chained compares was a real PITA
Pichai Asokan <[email protected]> Fri, 9 Apr 2004 11:30:12 -0700 (PDT)
| Newsgroups | gmane.comp.lang.prothon.devel |
|---|---|
| Message-ID | <[email protected]> |
Maybe you shd consider posting that code as a protypical case in point :-) Asokan Pichai --- Mark Hahn <[email protected]> wrote: > It took me 2 and a half days to get chained compares > (a < b < c) in and > working. I ended up doing it three different ways > before I got it right. > It now evaluates with the implied ANDs, evaluates > each term only once, and > short-circuits properly. > > I ended up utilizing prototypes to their best > advantage. I made an object, > representing a compare result, that delegated > everything, data and methods, > to the real compare result, to fool everything into > thinking it was that > object, but made one change to it so that it behaved > differently when used > in the next compare in the chain. For the first > time the prototype-based > stuff was a real advantage. > > > _______________________________________________ > Prothon-dev mailing list > [email protected] > http://lists.prothon.org/mailman/listinfo/prothon-dev ===== C was designed by Dennis Ritchie under the assumption that all programmers are like Dennis Ritchie. Java looks as if it has been designed under the assumptions that all programmers are like Dennis the menace. __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/