[foreign-jextract] RFR: Represent typedef with Declaration.Variable instead of Declaration.Scoped
Henry Jen
henry.jen at oracle.com
Thu Apr 30 18:14:19 UTC 2020
On Apr 30, 2020, at 9:53 AM, Maurizio Cimadamore <mcimadamore at openjdk.java.net> wrote:
>
> On Thu, 30 Apr 2020 15:00:24 GMT, Henry Jen <henryjen at openjdk.org> wrote:
>
>> 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.
>
> Variable is perfect in the sense that it has the right structure.
Yes.
> But it's not at all what a typdef is! Imagine I write
> a visitor for the declaration API: if I see vistVariable and I'd expect to see a global, or a struct field, I would now
> have to defend _against_ typedefs?
>
Regarding the defense, isn’t that the case already when we suppose to check kind() to do proper action?
However, I understand that by “Variable”, we maybe thinking a classification that you will need to generate a getter/setter for its value, which won’t be the case for typedefs, but it is somewhat a stretch for PARAMETER as well.
> From a logical point of view a typedef has nothing to do with a variable declaration, so a new `Declaration.Typedef`
> interface would be preferrable
>
Sure. We should add a new Visitor method as well?
Cheers,
Henry
More information about the panama-dev
mailing list