uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
61 stars 16 forks source link

Add support for lazy parameters evaluation #374

Open javierfernandes opened 8 years ago

javierfernandes commented 8 years ago

To correctly implement the && method being shortcircuit in the wollok.lang.Boolean class we need some sort of built-in mechanism in the language itself for modelling lazily evaluated parameters.

method and(lazy other) { .... }

and then when used

true.and(calculateSomething())

the "other" value will be calculated by interpreting "calculateSomething())" only upon the first usage in the method body

Still we need to implement the "and" operation as a native method in this case, since it is a really low level operation, but currently the interpreter is sending an xtend closure to the method as parameter which is basically like a "future".

npasserini commented 8 years ago

:+1: