Short list with things to finish for D2

Walter Bright newshound1 at digitalmars.com
Thu Nov 19 13:26:41 PST 2009


aarti_pl wrote:
> I know that quite a few people here doesn't like to allow users to 
> define their own operators, because it might obfuscate code. But it 
> doesn't have to be like this. Someone here already mentioned here that 
> it is not real problem for programs in C++. Good libraries don't abuse 
> this functionality.

The problem with user defined operators is:

  1. User defined tokens - mixes up lexing with semantic analysis

  2. User defined syntax - mixes up parsing with semantic analysis

and then we're in C++ land :-(

Unless such have a unique grammar that can be lexed and parsed:

     a :string: b

where string is the user defined name, so you can do things like:

     a :^^: b

and define your own pow operator. The problem with this approach is the 
sheer ugliness of it.



More information about the Digitalmars-d mailing list