Java2D III

Frank Benoit keinfarbton at nospam.xyz
Thu Jul 20 15:23:25 PDT 2006


What does this table mean?

tokenNames[POST_INC]="++";
tokenNames[Java symbol] = "D translation"
??

The main problem is, that the operator cannot be mapped 1o1.
The plus in Java can concatenate two strings, in D the '~' is used.
Same for += and ~=.
So if the parser do not know the types of the + operands, a solution can
be to make every + operation to a D function call.

java:
a += b;
c = a + b;
D:
AddAssign( a, b );
c = Add( a, b );

And AddAssign, Add are overloaded with various types:
Add( char[], ... )
Add( int, int )
Add( long, long )
...

Java:
a instanceof ClassA
D:
((cast(ClassA)a) !is null )








More information about the Digitalmars-d-announce mailing list