Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EDT:EGL Language Operators and Expressions"
Line 3: | Line 3: | ||
== Operators and expressions (Table 7) == | == Operators and expressions (Table 7) == | ||
− | {| cellspacing="1" cellpadding="1" border="1 | + | {| width="400" cellspacing="1" cellpadding="1" border="1" |
|- | |- | ||
| bgcolor="#999999" align="center" | '''''Operators and expressions<sup>1</sup>''''' | | bgcolor="#999999" align="center" | '''''Operators and expressions<sup>1</sup>''''' | ||
Line 65: | Line 65: | ||
| 1d<br> | | 1d<br> | ||
|- | |- | ||
− | | bgcolor="# | + | | bgcolor="#ffff00" | ''unary (~)<sup>4, 5</sup>'' |
− | | <br>done | + | | bgcolor="#ffff00" | <br>done |
− | | 0.5d<br> | + | | bgcolor="#ffff00" | 0.5d<br> |
− | | 0.5d<br> | + | | bgcolor="#ffff00" | 0.5d<br> |
+ | |- | ||
+ | | bgcolor="#cccccc" | ''unary (+ - !)'' | ||
+ | | done | ||
+ | | done | ||
+ | | done | ||
|- | |- | ||
| bgcolor="#cccccc" | ''math (+ - * / % **)<sup>9</sup>'' | | bgcolor="#cccccc" | ''math (+ - * / % **)<sup>9</sup>'' | ||
Line 100: | Line 105: | ||
| 2d<br> | | 2d<br> | ||
|- | |- | ||
− | | bgcolor="#cccccc" | ''bitwise (& | Xor | + | | bgcolor="#cccccc" | ''bitwise (& | Xor)<sup>5</sup>'' |
− | | | + | | done |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
| 0.5d<br> | | 0.5d<br> | ||
− | | 0. | + | | 0.25d<br> |
|- | |- | ||
− | | bgcolor="#cccccc" | ''assigning bitwise (&= |= Xor | + | | bgcolor="#cccccc" | ''assigning bitwise (&= |= Xor=)<sup>5</sup>'' |
− | | | + | | done |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
| 0.5d<br> | | 0.5d<br> | ||
| 0.5d<br> | | 0.5d<br> | ||
|- | |- | ||
− | | bgcolor="# | + | | bgcolor="#ffff00" | ''bit shifting (<< >> >>> <<= >>= >>>=)<sup>4,5</sup>'' |
− | | | + | | bgcolor="#ffff00" | 2d |
− | | 0.5d | + | [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352742 Validation needs to allow these operators] |
− | | 0.5d | + | |
+ | | bgcolor="#ffff00" | 0.5d | ||
+ | | bgcolor="#ffff00" | 0.5d | ||
|- | |- | ||
− | | bgcolor="# | + | | bgcolor="#ffff00" | ''if-then-else'' (condition ? val1 : val2)''<sup>6</sup>'' |
− | | | + | | bgcolor="#ffff00" | <br>3d |
− | | | + | | bgcolor="#ffff00" | 0.5d<br> |
− | | | + | | bgcolor="#ffff00" | 0.5d<br> |
|- | |- | ||
− | | bgcolor="# | + | | bgcolor="#ffff00" | ''in<sup>7</sup>'' |
− | | <br>1d | + | | bgcolor="#ffff00" | 1d |
− | | N/S | + | | bgcolor="#ffff00" | N/S |
− | | N/S | + | | bgcolor="#ffff00" | N/S |
+ | |- | ||
+ | | bgcolor="#ffff00" | ''like matches<sup>8</sup>'' | ||
+ | | bgcolor="#ffff00" | <br>1d | ||
+ | | bgcolor="#ffff00" | N/S | ||
+ | | bgcolor="#ffff00" | N/S | ||
|} | |} | ||
Revision as of 15:18, 22 July 2011
Please see the parent of this page, EDT:EGL Language.
Operators and expressions (Table 7)
Operators and expressions1 | Core | JavaScript | Java |
. (member access) | done |
done |
done |
= | done |
done |
done |
function invocation | done |
done |
done |
new | done |
done |
done |
{ } (set-values block) | done |
0.5d |
done |
@ | done |
done (no work for generators) |
done (no work for generators) |
[ ] (array access) | done |
done |
done |
[ ] (dynamic access) | done |
1d |
1d |
[ ] (substring)2 | 1d |
done |
done |
isa3 | 1d |
1d |
1d |
as3 | see isa |
done |
1d |
unary (~)4, 5 | done |
0.5d |
0.5d |
unary (+ - !) | done | done | done |
math (+ - * / % **)9 | done |
1d |
done |
assigning math (+= -= *= /= %= **=)9 | done |
0.5d |
done |
:: | done |
0.5d |
0.5d |
?: | done |
0.5d |
0.5d |
logical (And Or && ||) | done |
done |
done |
comparison (< > <= >= == !=) | done |
2d |
2d |
bitwise (& | Xor)5 | done | 0.5d |
0.25d |
assigning bitwise (&= |= Xor=)5 | done | 0.5d |
0.5d |
bit shifting (<< >> >>> <<= >>= >>>=)4,5 | 2d | 0.5d | 0.5d |
if-then-else (condition ? val1 : val2)6 | 3d |
0.5d |
0.5d |
in7 | 1d | N/S | N/S |
like matches8 | 1d |
N/S | N/S |
Notes on Table 7
- We'll document error conditions of operators and expressions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.
- Substrings are immutable, so they can't be the target of an assignment or the argument to an inout parameter.
- The type cannot be a nullable type. Nullability is not part of a type signature.
- There are new bitwise operators in EDT. ~ is a bitwise NOT (also called the compliment), << is a left shift, >> is a right shift where the leftmost bits become zero, >>> is a right shift where the sign is copied into the leftmost bits.
- Bitwise operators are only supported on values of type int.
- The if-then-else operator is borrowed from languages like C and Java. The condition's type must be boolean. The two values must have the same type.
- We'll have functions in the array type to provide similar behavior.
- We'll have functions in the string type to provide similar behavior.
- Date/time math is not supported in EDT. Functions on the date and timestamp types provide similar behavior.