Add function support to nameof keyword
Fixes #673.
Proof-of-concept, feedback is welcome!
Currently blocked by #770
From a review
the
v0shouldn't be hardcoded, as there may be undefined number of variations of the same function. not sure how you should select a variation in this situation, though
... I guess we forbid nameof on overloads. nameof implies breaking out of the Amber type system so there's no way to clearly select a variant anyway.
The alternative is compiling variants in a "turntable" function which would be returned by nameof, and handle type-checking the number and type of arguments at runtime. The turntable would only be compiled for functions nameof was called on.
Or a special syntax to denote the expected argument set, like nameof my_fun(Text, [Number]) in these situations.
I've also taken the liberty of changing the merge base from main to staging. I don't think this will cause any problems.
Ah found an issue: this nameof doesn't mark the function as used, so if it's the only instance the function just doesn't get compiled.
I'm still not entirely happy with the hard-coded "v0" in your code change. However, I suggest that we defer further review on this PR until @Ph0enixKM's PR is merged, because AIUI it touches Bash variable name generation, and will consequently have an impact on this PR.
@Thesola10 can you update with the feedback and the latest changes?
@Ph0enixKM to you think that this PR can be updated and moved on?
This PR is blocked by #770