Open SebastienGllmt opened 6 years ago
It's definitely supposed to be possible to do:
call %ptr()
I don't have time to investigate this immediately, but I will look into it sometime in the next couple days. In the meantime, if you want to help, can you tell me what went wrong when you tried to do a local call on a function pointer?
I just tried it out and you are right. I must have made a typo or something.
I guess the only consideration now is do we want to make calladdress
apply to @iele.address()
by default.
Probably the simplest solution is to make %foo = calladdress @bar
assemble into
%this = call @iele.address()
%foo = calladdress @bar at %this
This would not require a change to the VM and is consistent with the other types of syntactic sugar the assembler offers.
The following is the smallest example of a lambda I could come up with (calling
foo()
and callingbaz()
will have the same result)Unfortunately this is not very pretty because
1)
Calladdress
requires an "at" instead of implicitly using@iele.address()
1) You cannot usecall
on a register. You must usecall at
I don't know why these restrictions exist.
Anyways this is a cool feature and it's much prettier than what you have to do in Solidity which involves mangling byte arrays 👍