September 30, 2003
J Anderson wrote:
> lio@mondobizzarro.com wrote:
> ...
> I like this idea, and that syntax.
> 
> Humm, but if that syntax isn't liked (because of the reserved inheritance rules Mike mentions) how about this.
> 
> enum PROPTYPE { Int, Float };
> enum PROPTYPE2 { append PROPTYPE, String };
> ...
> -Anderson
> 

what about:
enum PROPTYPE2 = PROPTYPE.append({String, Double});

Assignment isn't quite the right concept, ::= is closer (if you BNF). But it is a close concept, and it isn't ambiguous.  The idea here is we are saying that PROPTYPE2 is constructed  by appending more values to PROPTYPE.  But there doesn't seem to be a language construct meaning "is constructed by".

Given D, my preferred form:
enum PROPTYPE2 ::= PROPTYPE + {String};
looks out of place.  Actually, closer to D would be:
enum PROPTYPE2 ::= PROPTYPE ~ {"String"};
but it's the "is constructed by" verb that looks out of place.

1 2
Next ›   Last »