between and among: worth Phobosization?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 17 10:15:29 PST 2013


On 12/17/13 8:43 AM, Byron wrote:
> I don't know why we can do this instead:
>
> if(foo in ["alpha", "beta", "delta"] ) {
>
> }

It's a good idea.

> basically have an opIn operator  x in y -> y.opIn(x)
> U* opIn(T, U)(T key)
> can define in runtime for arrays, and allow custom ones to be defines

No, that should only work for literal arrays.

> and
>
> if(1 < x <= 10) {
>
> }
>
> I remember this being shot down before...

"Don't change semantics of C code".

> Both of these are easier to read, and are more natural.  They also cover
> more cases.

No - "among" could take a custom predicate.


Andrei



More information about the Digitalmars-d mailing list