"bearophile" <[email protected]> wrote in message news:[email protected]... > Predicates are quite common. In D I presume the standard way to write them > is with a name like "isFoo". In other languages they are written in other > ways: > > > if (foo.isEven) {} > if (foo.isEven()) {} > filter!isEven(data) > > if (foo.evenQ) {} > if (foo.evenQ()) {} > filter!evenQ(data) > > if (foo.even?) {} > if (foo.even?()) {} > filter!even?(data) > > Other usages: > > contains? > areInside ==> inside? > >
It's nice, and it's one of the things in Ruby that I like, but I'd be surprised if it didn't cause parsing (or even lexing) ambiguities with ?:. If that could be reasonably solved, I'd be in favor of it, but I'm not sure it can.
