Call Special Functions for Operators Like Python

Registered by Eike

Call special functions to process operators. Use the same function names and semantics like in Python.

Blueprint information

Status:
Complete
Approver:
Eike
Priority:
Essential
Drafter:
Eike
Direction:
Approved
Assignee:
Eike
Definition:
Approved
Series goal:
Accepted for trunk
Implementation:
Informational Informational
Milestone target:
None
Started by
Eike
Completed by
Eike

Related branches

Sprints

Whiteboard

Operators are implemented with specially named methods like in Python. For details see:
http://docs.python.org/reference/datamodel.html#emulating-numeric-types

SIML uses special methods and data attributes that do not exist in Python. Names for these special attributes begin with the string '__siml_'. With this convention there are no accidental clashes with special attributes from Python, and it can also be easily guessed that theses methods (__siml_foo__) are special methods for the Siml language.

- Assignment:
    __siml_assign__(this, other): performs assignments. Special considerations for fundamental types: Unknown second argument 'other' must be possible.

- Boolean operators:
There are special functions for the boolean operators. The 'and' and 'or' operators are not short-circuit operators like in Python, but both arguments are always evaluated.
    __siml_and2__(this, other): 'and' operator
    __siml_or2__(this, other): 'or' operator
    __siml_not__(this): 'not' operator
In the future the complete algorithm detailed in PEP 335 will be implemented, to get short-circuit behavior.
   http://www.python.org/dev/peps/pep-0335/

- String conversion:
    __siml_str__ behaves like __str__, but returns a Siml string instance.

Proposed method:
- Graph creation:
    __siml_graph__ called by the built in graph function, calls built in graph function on Float attributes.
- Differentiation:
    __siml_diff__(this, distribution_domain): return a derivative of the object. There is a global distribution-domain 'time_domain' that denotes time derivatives. This function is a convenience to retrieve the associated differential, and to declare it if it does not already exist. There should be functionality to explicitly associate an existing variable to an other variable as a derivative of it (associate_derivative(variable, derivative, domain)).

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.