Short list with things to finish for D2
retard
re at tard.com.invalid
Thu Nov 19 13:44:14 PST 2009
Thu, 19 Nov 2009 13:26:41 -0800, Walter Bright wrote:
> 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
>
Some languages have syntactic rule extensions which allows defining
symbols constructed either from characters [a-zA-Z][a-zA-Z0-9]* (like C)
or from special characters like <>:;,.-/\ etc.
Another feature is that in those languages operators are just normal
functions with extra syntax (fixity, associativity, etc.)
This way even "built-in" operations on ints etc. can be defined in the
library.
> 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.
Haskell uses a `myFun` b.
More information about the Digitalmars-d
mailing list