qorelanguage / qore

Qore Programming Language
GNU General Public License v2.0
61 stars 10 forks source link

Operators and implicit conversions #489

Open tethal opened 8 years ago

tethal commented 8 years ago

Currently it is possible to apply any operator to almost any expression, but many of them do not make sense:

class C {};
C c();
code x = sub(){};

printf("%N\n", 5 + c);  #5
printf("%N\n", 5 + x);  #5
printf("%N\n", c + x);  #class C: (<NO PRIVATE DATA>) <NO MEMBERS>

I'm not sure what the last one actually does. These cases are not documented, see also #284.

The ultimate goal (in qore-llvm) is to have a well-defined set of overloads for each operator + simple overload resolution rules + implicit coercion rules.

tethal commented 8 years ago

See also #25 and #166