Another switch suggestion.

Stewart Gordon smjg_1998 at yahoo.com
Sun Sep 3 05:13:21 PDT 2006


Fredrik Olsson wrote:
<snip>
> Yes, this is yet again a proposal to add sets and ranges from pascal to 
> D. It should not just work for cases. A language construct that only 
> works in one construct is pretty useless. A great language have many 
> small constructs solving specific problems, that can be combined to 
> infinity to solve any problem. Naturally sets, if included, should be 
> usable in any context.
> 
> So <1, 42> was only my small example of how a set literal could be 
> constructed. But if we are top use Chris Miller's suggestions for array 
> and struct literals, then the set literal would probably be int<>!<1, 
> 42> instead ( using {} for struct content, [] for arrays, and <> for 
> sets, seems plausible too me).

I'm still not sure if I like this notation.  Maybe that would be 
parseable, under the provision that the by the time it spots a '<' 
immediately following '!' it would know that it isn't parsing a 
RelExpression containing a negation.  And making use of the same 
undocumented disambiguation rule that distinguishes a pointer 
declaration from a MulExpression.

Would it be possible to do intervals of non-builtin types?  Open or 
semi-open intervals of floating points?  Regions of the complex plane? 
Generally, infinite sets that aren't just intervals or unions thereof?

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list