19123, "ben-albrecht", "Output entire function signature when printing first class functions", "2022-01-26T16:02:18Z"
This is a follow-up issue to #13210
As of #13232, users can get the name of an fcf by casting it to a string:
proc fun(arg: int): int {
return arg*2;
}
var fcf = fun;
// Name accessible through casting and/or printing:
const fcfName = fcf:string; // "fun()"
writeln(fcf); // fun()
It would be helpful to be able to print additional information about the function, for example:
- argument names and argument types
- return type
- whether or not the function throws
- where clauses
Basically, we'd want this to print the full signature of the function.
It may be valuable to introduce a field, fcf.name
, similar to fcf.retType
and fcf.argTypes
, so that users can still access the name alone without doing some string parsing. This is requested and discussed in #13285