What do you think about link cast operator to a "toX" function? [message #1782935] |
Mon, 05 March 2018 12:52 |
|
Dear all.
In Xbase DSL, we have the cast operator, e.g. .
In Java, we have functions for converting an object to another type, e.g. .
Now, I think about a mechanism that may automatically link the cast operator within a DSL to any "toX" function.
Let the DSL code
The DSL compiler should try:
- If the type of the value is a primitive type, use the standard cast operator;
- If a single function "def toXYZ : Type" is defined within the type of value, call it;
- If a single function "def toXYZ : T" where "T is a super type of Type" is defined, call it;O
- Otherwise, use the standard cast operator.
Do you think this feature is practibable?
All the best.
Stéphane.
[Updated on: Mon, 05 March 2018 14:54] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01785 seconds