Closed porky11 closed 8 years ago
On Wed, Sep 07, 2016 at 11:45:50AM -0700, Fabio Krapohl wrote:
If you define function-like objects, they normally would call the same functions, just with different values of the struct's members. So it would make more sence if all instances of a struct call the same function by default. Simple solution: If the first argument is a value (the only objects that cannot be used as functions by default) it will be expanded to a normal function call Example:
(def x (v (x …) ;will be expanded to (call x …)
Benefits of
call
(or whatever the macro's name will be): can be overloaded for different types can also be a macro can have the current behaviour as default macroexpansion will also work on types defined by core or other libs not intended as function structs
Thanks, this is a good idea. It has now been implemented, save that the form name is 'invoke', rather than 'call', and the function struct support has been removed.
If you define function-like objects, they normally would call the same functions, just with different values of the struct's members. So it would make more sence if all instances of a struct call the same function by default. Simple solution: If the first argument is a value (the only objects that cannot be used as functions by default) it will be expanded to a normal function call Example:
Benefits of
call
(or whatever the macro's name will be): can be overloaded for different types can also be a macro can have the current behaviour as default macroexpansion will also work on types defined by core or other libs not intended as function structs