Update page 'Future AerScript Versions'
@@ -18,6 +18,28 @@ Variables that are declared at method/closure scope could have an implicit type
|
||||
string $var = 'text' // Explicitly typed string
|
||||
auto $var = 'text'; // Implicitly typed string
|
||||
|
||||
### IS keyword
|
||||
The is operator could be used to check if the run-time type of an object is compatible with the given type or not. It should return true if the given object is of the same type otherwise, return false.
|
||||
|
||||
class A {
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
class C {
|
||||
}
|
||||
|
||||
class Prorgam {
|
||||
void main() {
|
||||
object $obj = new B();
|
||||
var_dump($obj is B); // true
|
||||
var_dump($obj is A); // true
|
||||
var_dump($obj is C); // false
|
||||
var_dump($obj is object); // true
|
||||
}
|
||||
}
|
||||
|
||||
### Operator overloading
|
||||
It should be possible to redeclare or overload most of the built-in operators available in AerScript. Thus a programmer could use operators with user-defined object types as well. Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. similar to any other function, an overloaded operator has a return type and a parameter list.
|
||||
|
||||
|
Reference in New Issue
Block a user