opEquals/opCmp returning other types

Jacob Carlborg doob at me.com
Wed Mar 21 13:53:43 PDT 2012


On 2012-03-21 17:44, H. S. Teoh wrote:

> The "D way" is to use strings for DSELs which get evaluated at
> compile-time, or a custom set of methods that you can build expressions
> out of. Operator overloading really should be limited to arithmetic
> types (for numerical classes) and built-in operations like array lookups
> and stuff.
>
> Trying to shoehorn language-level operators to do something they weren't
> intended to do only leads to problems. (C++'s overloading of<<  and>>
> for I/O is a very bad design decision IMO.)

"find", "map" and similar functions can be used on arrays. What's wrong 
in being able to use the same syntax for accessing a database. I think 
the following would be a great syntax:

Person.where(x => x.name == "John");

Where "Person" is a class connected to a database table.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list