Operator overloading

dennis luehring dl.soluz at gmx.net
Tue Dec 23 13:31:34 PST 2008


aarti_pl schrieb:
> Ary Borenszweig pisze:
>> dennis luehring escribió:
>>>> ...
>>>> This translation is quite awful and unreadable. It would be so much 
>>>> better to get:
>>>>
>>>> Query query = Select(a).Where(id == 5);
>>>
>>> what speaks against an sql parsing mixin?
>>>
>>> would be more expressive, compiletime based and typesafe
>>> and even far more be able than what you can do with operator overloading
>> 
>> Autocompletion and syntax coloring.

> Yes. And additionally:
> * you can not build safely your queries on runtime

that even not possible with operators - or?

> * when moving Query around in program you will not be able to make it 
> typesafe, because it is just string

not if you parse the string at compiletime an use the
type information from outer scope for validation

> * in my db access system it won't be possible to automatically create 
> database, typesafely get results from resulting table and few other nice 
> features...

just a quick look into blades (library with vector math language 
extensions - based on compiletime strings)

http://www.dsource.org/projects/mathextra/browser/trunk/blade/BladeDemo.d

don referes to outer vars in his "strings" and you can typecheck them



More information about the Digitalmars-d mailing list