www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - expression overloading

reply Bob <bob.efrei laposte.net> writes:
Would it be possible/usefull/fast to implement expression overloading 
instead of operator overloading?

What I call "expression overloading" is like:

float add_mul_func(float a, float b, float c)
written 'a * b + c' or 'c + a * b'
{
version d
     {
     return a * b + c;
     }
version x86
     {
     asm
         {
         FMULADD c,a,b
         ...
         }
     }
}
Jun 14 2004
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Bob" <bob.efrei laposte.net> wrote in message
news:cajoi9$4pb$1 digitaldaemon.com...
 Would it be possible/usefull/fast to implement expression overloading
 instead of operator overloading?
Not at the moment. Yes. Yes. But whether it's desirable depends on the effects it would have on the language. I suspect they would be quite significant, so don't expect to see it in 1.0. But having an interest in such things - see my article Fast String Concatenation in June's C/C++ Journal - I would be interested in seeing this issue explored at a later time. -- Matthew Wilson Author: "Imperfect C++", Addison-Wesley, 2004 (http://www.imperfectcplusplus.com) Contributing editor, C/C++ Users Journal (http://www.synesis.com.au/articles.html#columns) STLSoft moderator (http://www.stlsoft.org) "If I'm curt with you it's because time is a factor. I think fast, I talk fast, and I need you guys to act fast" -- Mr Wolf -------------------------------------------------------------------------------
Jun 14 2004