version: multiple conditions

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 17 09:22:26 PDT 2015


On 06/17/2015 02:28 PM, Jonathan M Davis wrote:
> On Wednesday, 17 June 2015 at 06:23:15 UTC, Jacob Carlborg wrote:
>> On 2015-06-16 22:36, Jonathan M Davis wrote:
>>
>>> Sounds like it's preventing an abuse of operator overloading to me... :)
>>
>> Sounds like it's preventing a perfectly good use case. Or do you
>> prefer AST macros instead :)
>
> I prefer that operators actually do what they're supposed to do per how
> they work with the built-in types and that they not be redefined to do
> something else. An operator which is overloaded specifically do
> something other than what occurs with the built-in types is just begging
> for problems. Sure, we can't prevent all operator overloading abuses,
> and they can be misimplemented just like any other function, but the
> whole point of having operator overloading is to make it so that
> user-defined types can look and operate like built-in types, not to
> invent new syntax, and I think that inventing new syntax via operator
> overloading is a _very_ clear abuse of it. And I really don't think that
> folks should be trying to add syntax to the language for DSLs or
> anything of the sort, and I'm very glad that D prevents that in many
> cases while still allowing us to have useful features such as operator
> overloading.
>
> - Jonathan M Davis

FWIW, the use case presented was roughly to make the database look and 
operate like built-in arrays.


More information about the Digitalmars-d mailing list