[foreign-jextract] RFR: Represent typedef with Declaration.Variable instead of Declaration.Scoped
Henry Jen
henryjen at openjdk.java.net
Thu Apr 30 16:09:02 UTC 2020
On Thu, 30 Apr 2020 12:37:33 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> I disagree (pretty strongly) with the direction proposed in this patch. Making a `typedef` a variable is a workaround.
> Under no circumstances you can get a value out of a typedef - a typedef does not model a variable, and trying to bend
> the API to do so is, IMHO, wrong.
While I agree with your statement, the Declaration.Variable API doesn't present a value(), only Constant has a value().
In a sense, type() is the value of a Type declaration.
> To me the big issue is that a typedef declaration, as it stands, is only good to wrap a declaration. But the solution I
> think, would be to have a more explicit `TypeDef` declaration tree, which has a name and a type (where the type can be
> a `Declared`, if need be).
As current Declaration.Variable stands, it's perfect, with name(), type() and kind(). We can either create a different
interface, or rename to something else if that helps.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/137
More information about the panama-dev
mailing list