Thanks Jens,

It's great to hear interest in this. I was hoping that there might be some
existing patterns to follow in terms of extending the grammar that would
fall somewhere between "do it yourself" and "add full support upstream" but
this may have been overly wishful thinking.

We are currently using custom generators driven by the alecthomas go parser
[1], so we unfortunately do not have much to share in terms of Apache
specifics. We have prototyped this by forking the parser and then using the
additions to the AST in our Go generator (using generics from 1.18).

I will sync up with my team internally and get back to you on the dev
mailing list.

Thanks!

[1]: https://github.com/alecthomas/go-thrift

On Sat, Mar 19, 2022 at 5:28 PM Jens Geyer <jensge...@hotmail.com> wrote:

> Hi,
>
> first I would like to move this topic to the dev list, it seems more
> appropriate.
>
> Extending the grammar and also the relevant data structures is certainly
> doable, I have little doubt about this point.
>
> However, experience shows that extending a grammar is usually only the
> first and usually also among the easier step of the process of extending
> a DSL-based code generation tool like Thrift. The more complicated
> (and/or time-consuming) pieces of the puzzle come after that. We need to
> enrich all code generators to properly support the new grammar features.
> This part may also involve writing additional code to modify the parsed
> syntax-tree before its handed over to the generators.
>
> At least to me personally the proposal sounds interesting. Since it
> seems you already invested some thoughts & time at this, as a first step
> it would be great to learn more about the general concept you have in
> mind. Also, sharing some details could help, like what you achieved
> already, what still needs to be done, etc.
>
> Have fun,
>
> JensG
>
> PS: The technical details how contribution works is explained here:
> http://thrift.apache.org/docs/HowToContribute
>
>
> Am 18.03.2022 um 20:39 schrieb Andrew Matheny:
> > Hello Thrift users,
> >
> > My company is heavily invested in Thrift and would like to extend the
> > language to allow for more standardization across all of our APIs.  We
> are
> > particularly interested in adding support for generic structs.  For
> example:
> >
> > template ListResourcesResponse<Resource> {
> >    1: optional base.ResponseStatus status;
> >    2: optional i32 skip;
> >    3: optional i32 limit;
> >    4: optional i32 total;
> >    5: optional list<Resource> results;
> > }
> >
> > We have prototyped this by extending the parser we're using but we'd like
> > to explore what options are available via the community before
> > committing to a non-standard thrift dialect. My questions to this group
> > would be:
> > * Does anyone have any experience with something like this? Either in
> > generics specifically or in extending the standard grammar.
> > * What would be the process for updating the Apache maintained grammar to
> > include an additional feature like this?
> >
>


-- 
* Andrew Matheny*
Senior Software Engineer

m: 681.285.8088

Reply via email to