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) == | ||
− | {| | + | {| style="width: 496px; height: 1035px" border="1" cellspacing="1" cellpadding="1" |
|- | |- | ||
| bgcolor="#999999" align="center" | '''''Operators and expressions<sup>1</sup>''''' | | bgcolor="#999999" align="center" | '''''Operators and expressions<sup>1</sup>''''' | ||
Line 11: | Line 11: | ||
|- | |- | ||
| bgcolor="#cccccc" | ''. (member access)'' | | bgcolor="#cccccc" | ''. (member access)'' | ||
− | | done<br> | + | | done<br> |
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''='' | | bgcolor="#cccccc" | ''='' | ||
− | | done<br> | + | | done<br> |
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''function invocation'' | | bgcolor="#cccccc" | ''function invocation'' | ||
| <br>done | | <br>done | ||
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''new'' | | bgcolor="#cccccc" | ''new'' | ||
− | | done<br> | + | | done<br> |
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''{ } (set-values block)'' | | bgcolor="#cccccc" | ''{ } (set-values block)'' | ||
| <br>done | | <br>done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''@'' | | bgcolor="#cccccc" | ''@'' | ||
| <br>done | | <br>done | ||
− | | done (no work for generators)<br> | + | | done (no work for generators)<br> |
| done (no work for generators)<br> | | done (no work for generators)<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''[ ] (array access)'' | | bgcolor="#cccccc" | ''[ ] (array access)'' | ||
| <br>done | | <br>done | ||
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''[ ] (dynamic access)'' | | bgcolor="#cccccc" | ''[ ] (dynamic access)'' | ||
− | | done<br> | + | | done<br> |
− | | 1d<br> | + | | 1d<br> |
| done {{bug|353653}}<br> | | done {{bug|353653}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''[ ] (substring)<sup>2</sup>'' | | bgcolor="#cccccc" | ''[ ] (substring)<sup>2</sup>'' | ||
− | | done {{bug|354165}}<br> | + | | done {{bug|354165}}<br> |
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''isa<sup>3</sup>'' | | bgcolor="#cccccc" | ''isa<sup>3</sup>'' | ||
| <br>done {{bug|354167}} | | <br>done {{bug|354167}} | ||
− | | 1d<br> | + | | 1d<br> |
| done {{bug|353654}}<br> | | done {{bug|353654}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''as<sup>3</sup>'' | | bgcolor="#cccccc" | ''as<sup>3</sup>'' | ||
| <br>done | | <br>done | ||
− | | done<br> | + | | done<br> |
| done {{bug|353655}}<br> | | done {{bug|353655}}<br> | ||
|- | |- | ||
| bgcolor="#ffff00" | ''unary (~)<sup>4, 5</sup>'' | | bgcolor="#ffff00" | ''unary (~)<sup>4, 5</sup>'' | ||
| bgcolor="#ffff00" | <br>done | | bgcolor="#ffff00" | <br>done | ||
− | | bgcolor="#ffff00" | 0.5d {{bug|366875}}<br> | + | | bgcolor="#ffff00" | 0.5d {{bug|366875}}<br> |
| bgcolor="#ffff00" | 0.5d {{bug|366876}}<br> | | bgcolor="#ffff00" | 0.5d {{bug|366876}}<br> | ||
|- | |- | ||
Line 77: | Line 77: | ||
| bgcolor="#cccccc" | ''math (+ - * / % **)<sup>9</sup>'' | | bgcolor="#cccccc" | ''math (+ - * / % **)<sup>9</sup>'' | ||
| <br>done | | <br>done | ||
− | | 1d<br> | + | | 1d<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''assigning math (+= -= *= /= %= **=)<sup>9</sup>'' | | bgcolor="#cccccc" | ''assigning math (+= -= *= /= %= **=)<sup>9</sup>'' | ||
| <br>done | | <br>done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''::'' | | bgcolor="#cccccc" | ''::'' | ||
| <br>done | | <br>done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| done {{bug|353656}}<br> | | done {{bug|353656}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''?:'' | | bgcolor="#cccccc" | ''?:'' | ||
| <br>done | | <br>done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| done {{bug|353656}}<br> | | done {{bug|353656}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''logical (And Or && ||)'' | | bgcolor="#cccccc" | ''logical (And Or && ||)'' | ||
| <br>done | | <br>done | ||
− | | done<br> | + | | done<br> |
| done<br> | | done<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''comparison (< > <= >= == !=)'' | | bgcolor="#cccccc" | ''comparison (< > <= >= == !=)'' | ||
| <br>done | | <br>done | ||
− | | 2d<br> | + | | 2d<br> |
| 2d {{bug|353657}}<br> | | 2d {{bug|353657}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''bitwise (& | Xor)<sup>5</sup>'' | | bgcolor="#cccccc" | ''bitwise (& | Xor)<sup>5</sup>'' | ||
| done | | done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| 0.25d {{bug|353658}}<br> | | 0.25d {{bug|353658}}<br> | ||
|- | |- | ||
| bgcolor="#cccccc" | ''assigning bitwise (&= |= Xor=)<sup>5</sup>'' | | bgcolor="#cccccc" | ''assigning bitwise (&= |= Xor=)<sup>5</sup>'' | ||
| done | | done | ||
− | | 0.5d<br> | + | | 0.5d<br> |
| 0.5d {{bug|353658}}<br> | | 0.5d {{bug|353658}}<br> | ||
|- | |- | ||
| bgcolor="#ffff00" | ''bit shifting (<< >> >>> <<= >>= >>>=)<sup>4,5</sup>'' | | bgcolor="#ffff00" | ''bit shifting (<< >> >>> <<= >>= >>>=)<sup>4,5</sup>'' | ||
| bgcolor="#ffff00" | 2d | | bgcolor="#ffff00" | 2d | ||
− | [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352742 Validation needs to allow these operators] | + | [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352742 Validation needs to allow these operators] |
| bgcolor="#ffff00" | 0.5d | | bgcolor="#ffff00" | 0.5d | ||
Line 138: | Line 138: | ||
|- | |- | ||
| bgcolor="#ffff00" | ''Object Expression'' | | bgcolor="#ffff00" | ''Object Expression'' | ||
− | | bgcolor="#ffff00" | done {{bug|366742}}<br> | + | | bgcolor="#ffff00" | done {{bug|366742}}<br> |
− | | bgcolor="#ffff00" | {{bug|366860}}<br> | + | | bgcolor="#ffff00" | {{bug|366860}}<br> |
| bgcolor="#ffff00" | {{bug|366861}}<br> | | bgcolor="#ffff00" | {{bug|366861}}<br> | ||
|- | |- | ||
− | | bgcolor="#ffff00" | ''Ternary Operator <br>(condition ? val1 : val2)<sup>6</sup><br>'' | + | | bgcolor="#ffff00" | ''Ternary Operator <br>(condition ? val1 : val2)<sup>6</sup><br>'' |
− | | bgcolor="#ffff00" | 3d {{bug|366872}}<br> | + | | bgcolor="#ffff00" | 3d {{bug|366872}}<br> |
− | | bgcolor="#ffff00" | .5d {{bug|366873}}<br> | + | | bgcolor="#ffff00" | .5d {{bug|366873}}<br> |
| bgcolor="#ffff00" | .5d {{bug|366874}}<br> | | bgcolor="#ffff00" | .5d {{bug|366874}}<br> | ||
+ | |- | ||
+ | | bgcolor="#ffff00" | | ||
+ | ''Object Expression <br>{key : value, ''<br>''"key" : value}<sup>10</sup>'' | ||
+ | |||
+ | | bgcolor="#ffff00" | done{{bug|366742}}<br> | ||
+ | | bgcolor="#ffff00" | .? | ||
+ | | bgcolor="#ffff00" | ? | ||
|} | |} | ||
− | '''Notes on Table 7'''<br> | + | '''Notes on Table 7'''<br> |
#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. | #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. | ||
− | #<span style="background: | + | #<span style="background: rgb(255,165,0)">Substrings are immutable, so they can't be the target of an assignment or the argument to an inout parameter.</span> |
− | #<span style="background: | + | #<span style="background: rgb(255,165,0)">The type cannot be a nullable type. Nullability is not part of a type signature.</span> |
#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. | #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. | #Bitwise operators are only supported on values of type int. | ||
Line 158: | Line 165: | ||
#We'll have functions in the array type to provide similar behavior. | #We'll have functions in the array type to provide similar behavior. | ||
#We'll have functions in the string 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. | + | #Date/time math is not supported in EDT. Functions on the date and timestamp types provide similar behavior. |
+ | #Object expression is borrowed from java script, which allows an object to be created "on the fly". The key can either be an ID or a string and the value can be any expression that is valid on the right hand side of an assignment. |
Revision as of 09:28, 4 January 2012
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 |
done bug 353653 |
[ ] (substring)2 | done bug 354165 |
done |
done |
isa3 | done bug 354167 |
1d |
done bug 353654 |
as3 | done |
done |
done bug 353655 |
unary (~)4, 5 | done |
0.5d bug 366875 |
0.5d bug 366876 |
unary (+ - !) | done | done | done |
math (+ - * / % **)9 | done |
1d |
done |
assigning math (+= -= *= /= %= **=)9 | done |
0.5d |
done |
:: | done |
0.5d |
done bug 353656 |
?: | done |
0.5d |
done bug 353656 |
logical (And Or && ||) | done |
done |
done |
comparison (< > <= >= == !=) | done |
2d |
2d bug 353657 |
bitwise (& | Xor)5 | done | 0.5d |
0.25d bug 353658 |
assigning bitwise (&= |= Xor=)5 | done | 0.5d |
0.5d bug 353658 |
bit shifting (<< >> >>> <<= >>= >>>=)4,5 | 2d | 0.5d | 0.5d |
in7 | 1d | N/S | N/S |
like matches8 | 1d |
done (see IR bug) |
N/S |
is/not | done | N/S | N/S |
Object Expression | done bug 366742 |
bug 366860 |
bug 366861 |
Ternary Operator (condition ? val1 : val2)6 |
3d bug 366872 |
.5d bug 366873 |
.5d bug 366874 |
Object Expression |
donebug 366742 |
.? | ? |
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.
- Object expression is borrowed from java script, which allows an object to be created "on the fly". The key can either be an ID or a string and the value can be any expression that is valid on the right hand side of an assignment.