Then any object which implements the puts and newline methods can be passed to the myfunc method.
I have a tentative implementation for Spin2 checked in to github now, but it's probably buggy. We could also change the way it works a bit, if there are shortcomings we find now.
Ah man that is fantastic That worked straight away...That's a nice simple syntax and I think it really fills a good space between function pointers and object pointers.
Thanks a million!
Comments
The idea of interfaces is kind of like structs but for functions (only). So for example you could have something like:
Then any object which implements the
puts
andnewline
methods can be passed to themyfunc
method.I have a tentative implementation for Spin2 checked in to github now, but it's probably buggy. We could also change the way it works a bit, if there are shortcomings we find now.
Ah man that is fantastic
That worked straight away...That's a nice simple syntax and I think it really fills a good space between function pointers and object pointers.
Thanks a million!