Tuesday, September 26, 2017
Wednesday, September 13, 2017
Friday, September 8, 2017
Wednesday, March 29, 2017
Saturday, March 11, 2017
In this tutorial I will show how multi-methods are implemented in ELENA
To take part in parameter dispatching classes should be declared with dispatchable attribute.
To dispatch the parameter we have to send cast message to it:
This approach works quite good for a single parameter. For several parameters this approach works not so good. It is possible to resolve them using several nested closures. Currently general solution is not possible. But basic data types support limited two parameter dispatching:
The result will be:
Friday, March 10, 2017
In this short article I will show how to implement event handler using a new attribute : event
To declare a new event handler we should declare the field with event attribute:
The first parameter indicates the action type (func1 is an action with a single generic parameter), the second one - the property name to be used for attaching the handler.
To attach the handler we have to call the property with our action:
The simple example code is below: