syntax idea: simplifed ifs

dennis luehring dl.soluz at gmx.net
Wed Apr 19 03:21:06 PDT 2006


Fredrik Olsson schrieb:
>> how would you write these example in your in syntax?
>>
> Not that easy as sets is mostly not a simple solution for complex 
> conditions, but a simple solution to complex set problems.
> 
>> if( x == [ a && !b || c ] ) --> if( x == a && x == !b || x == c )
>>
>> if( x == [ a && (!b || c)] ) --> if( x == a && ( x == !b || x == c ) )

> These are not good examples of where sets strength lies, this is a 
> better example:

set strength lies in "or" operations

> if (x == [a || b || c]) --> if (x == a || x == b || x == c)
> would be
> if (x in <a, b, c>)

thats clear - but you can't write my above examples simpler with your "in"

> But the true power lies in what can be done with sets, unions, 
> intersections, etc.

examples - "in" isn't enough (its just the "or" part of my idea)



More information about the Digitalmars-d mailing list