Access to the defaults arguments of methods and ParamTermClause #14078
Unanswered
rssh
asked this question in
Metaprogramming
Replies: 2 comments 3 replies
-
Besides forward- and backward-compatible, perhaps there is also hackward-compatible. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Wow, in dottty. $lessinit$greater$default also works: https://github.com/lampepfl/dotty-macro-examples/blob/master/defaultParamsInference/src/macro.scala. (was in search) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, It's no way to find default arguments of function from macro.
Logically, DefDef have TermParamClause wich provide List(Valdef) and default arguments can be there.
But currently, all rhs are empty. I.e. next code:
Always return an empty list for all defdefs.
From one side, this can be a bug, from other --- semantics of default-values is other, maybe better way is to provide some other API for this, so this should be a feature request?
Note, that in Scala2, some code generation libraries use default values of a primary constructor (in a quite hacky way, for example
Beta Was this translation helpful? Give feedback.
All reactions