parent
4e3522c400
commit
74dadbcaa2
@ -12,7 +12,7 @@ A right associative \** operator can be added to support exponentiation, along w
|
||||
printf("2 ** 3 = %d\n", 2 ** 3); // 8
|
||||
printf("2 ** 3 ** 2 = %d\n", 2 ** 3 ** 2); // 512
|
||||
|
||||
### Operator overloading
|
||||
### 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.
|
||||
|
||||
class Box {
|
||||
@ -27,4 +27,10 @@ It should be possible to redeclare or overload most of the built-in operators av
|
||||
$box->length = $box1->length + $box2->length;
|
||||
return $box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### Methods Annotation
|
||||
Implement Java-like annotations as a form of syntactic metadata that can be added to source code. They should be limited to methods. Some proposed annotations:
|
||||
* @Deprecated - Marks the method as obsolete. Causes a warning if the method is being called
|
||||
* @Unimplemented - Marks the method as not implemented. Causes a warning if the method is being called
|
||||
* @Executable - Mars the method as program entry point. Forces VM to launch this method instead of Program::main(). If such annotation is not specified, VM should fallback to Program::main() and throw error if none found
|
Loading…
Reference in New Issue
Block a user