Closed andrewchambers closed 4 years ago
Originally, I wanted to discourage making everything callable and only functions/cfunctions to be callable, simply because one cannot resume a fiber over C stack frames. When it became clear that I was being a bit paranoid and it was useful to make many things callable for indexing, methods, etc. I changed my mind. I just haven't yet added callable abstracts.
For various reasons, I don't think it's as big of an issue now. I can add such functionality.
Thank you for explaining
This is now solved by https://github.com/janet-lang/janet/commit/b8d530da36d01cfd8e5b05879bfb5a51d8a1ce05 ?
yes
Currently it is not possible to call an abstract type as a function, indeed calling an abstract type and getting from one are the same operation.
This became apparent to me when making the https://github.com/andrewchambers/janet-jcjit library:
I was curious if this is a specific design decision? I suppose you could say the current design assumes abstract types are more like data structures than anything else.
If it's something worth adding, I'd be willing to do the patch.
Of course, its easy to work around in the current form using a trampoline function.