Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-30 Thread Nicholas Rosbrook
Hi George, > Just going through in detail, I notice one thing about your > implementation of Defbool: you simply copy over the value of > libxl_defbool.  The header says of libxl_defbool: > >  * Users should treat this struct as opaque and use the following >  * defined macros and accessor

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-30 Thread George Dunlap
On 9/24/19 1:33 AM, Nicholas Rosbrook wrote: > Hi George, > > I made the changes that we discussed WRT C to Go type marshaling. See [1] for > generated code. > > In addition, I took a pass at implementing Go to C type marshaling. The > generated toC functions are also in [1]. > > Finally, I

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-23 Thread Nicholas Rosbrook
Hi George, I made the changes that we discussed WRT C to Go type marshaling. See [1] for generated code. In addition, I took a pass at implementing Go to C type marshaling. The generated toC functions are also in [1]. Finally, I made the necessary changes[2] to the existing xenlight.go so

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-13 Thread Nicholas Rosbrook
> FWIW checked with Ian after I wrote this mail, and he confirmed that > that field (`link` in `libxl_event`) was only meant to be used > internally, and ideally we wouldn't even have that available in the Go > version of the struct (since it's not actually part of the public > interface). > >

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-13 Thread George Dunlap
On 9/12/19 6:35 PM, Nicholas Rosbrook wrote: > I'm not strongly opposed to the struct duplication, but I do prefer the > ability > to perform type assertions as a way to determine which field is "valid." Fair enough. >> So the advantage of this is that you can just call: >> >>     fromC(, ) >>

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-12 Thread Nicholas Rosbrook
> That looks about like we expected -- tolerable and functional, to be > certain, but LotsOfReallyLongTypeNames. Yeah that's definitely a down side... > The only purpose of unions in these structures is to save space (as > opposed to other kinds of unions are specifically designed to allow >

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-12 Thread George Dunlap
On 9/11/19 9:25 PM, Nicholas Rosbrook wrote: > Hi George, > > I made some more progress on gengotypes.py [1]. [snip] > What are your thoughts on these implementations so far? Great! Overall it looks like it's really making progress, which is exciting. > First, I implemented the KeyedUnion

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-11 Thread Nicholas Rosbrook
Hi George, I made some more progress on gengotypes.py [1]. First, I implemented the KeyedUnion translation that we talked about. You can see an example of the generated code in [2]. Second, I took a first pass at the C-to-Go type marshaling. I defined a "marshaler" interface in [3], which

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-04 Thread Nicholas Rosbrook
> Unfortunately this would mean the type assertion would be pretty long as > well: >   hvm := di.TypeUnion.(xenlight.DomainBuildInfoTypeUnionHvm) >   hvm.[element] Made worse by the fact that you really should check the type assertion first: hvm, ok :=

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-04 Thread Nicholas Rosbrook
> Yes, I think that's really the only option.  Poking around, it looks > like a lot of different people have recommended it; and the fact that > it's in use by gRPC means it can't be too terrible a solution. Yeah, having worked with generated gRPC code I don't think it's too bad. > The interface

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-04 Thread George Dunlap
On 9/4/19 5:52 PM, George Dunlap wrote: > On 9/4/19 1:36 AM, Nicholas Rosbrook wrote: >> George, >> >>> Are you up for taking a stab at something like `gengotypes.py`? >> >> I have was able to make a bit of progress on this over the weekend. I've >> started >> `gengotypes.py` in my branch[1]; the

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-04 Thread George Dunlap
On 9/4/19 1:36 AM, Nicholas Rosbrook wrote: > George, > >> Are you up for taking a stab at something like `gengotypes.py`? > > I have was able to make a bit of progress on this over the weekend. I've > started > `gengotypes.py` in my branch[1]; the portion which generates > `xenlight_types.go`

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-09-03 Thread Nicholas Rosbrook
George, > Are you up for taking a stab at something like `gengotypes.py`? I have was able to make a bit of progress on this over the weekend. I've started `gengotypes.py` in my branch[1]; the portion which generates `xenlight_types.go` (the counterpart to _libxl_types.h) is mostly working. The

[Xen-devel] [RFC] Generating Go bindings for libxl

2019-08-02 Thread Nicholas Rosbrook
> IOW, in response to GP, I was going to counter-suggest what you suggest > in this email. :-) > > Are you up for taking a stab at something like `gengotypes.py`? Yes, I think I can handle that. -NR ___ Xen-devel mailing list

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-08-02 Thread George Dunlap
On 7/31/19 10:22 PM, Nicholas Rosbrook wrote: >> I looked at the thing about naked returns, and didn't really understand >> it; but anyway I'm happy to have things modified to be more Go-like.  I >> definitely "speak" Go with a funny accent. > > TL;DR: Naked returns exist; don't use them (with

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-08-02 Thread George Dunlap
On 8/1/19 7:59 PM, Nicholas Rosbrook wrote: >> With that said, what are your expectations for the generated Go code at this >> point? >> Do you think we should try to generate the pieces that call into libxl? Or, >> do you think >> the code generation should be limited to the structs and

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-08-01 Thread Nicholas Rosbrook
> With that said, what are your expectations for the generated Go code at this > point? > Do you think we should try to generate the pieces that call into libxl? Or, > do you think > the code generation should be limited to the structs and boiler-plate C <-> > Go "type > marshaling?" [...] >

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-31 Thread Nicholas Rosbrook
> I return to the question I stated before.  At the moment, your bindings > have the following call chain: > > * DomainInfo(), hand-crafted.  Calls domainInfo(). > * domainInfo(), automaticall generated.  Calls C.libxl_domain_info(). > > The in-tree bindings have the following call chain: > > *

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-31 Thread George Dunlap
On 7/30/19 7:39 PM, Tamas K Lengyel wrote: > On Tue, Jul 30, 2019 at 9:49 AM George Dunlap > wrote: >> >> On 7/30/19 2:48 PM, Tamas K Lengyel wrote: >>> On Tue, Jul 30, 2019 at 7:32 AM Nicholas Rosbrook >>> wrote: Hello, As a follow up to the presentation that Brendan

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-31 Thread George Dunlap
On 7/30/19 10:52 PM, Nicholas Rosbrook wrote: >> All that said, the first question I think is, what the generated code >> needs to look like. Then, if c-for-go can be configured to do that, >> then we can consider it; otherwise, making our own generator from the >> IDL will be the only option. >

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread Nicholas Rosbrook
> All that said, the first question I think is, what the generated code > needs to look like. Then, if c-for-go can be configured to do that, > then we can consider it; otherwise, making our own generator from the > IDL will be the only option. Writing a custom Go code generator means that all C

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread Tamas K Lengyel
On Tue, Jul 30, 2019 at 9:49 AM George Dunlap wrote: > > On 7/30/19 2:48 PM, Tamas K Lengyel wrote: > > On Tue, Jul 30, 2019 at 7:32 AM Nicholas Rosbrook > > wrote: > >> > >> Hello, > >> > >> As a follow up to the presentation that Brendan Kerrigan and I gave at Xen > >> summit earlier this

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread George Dunlap
On 7/30/19 2:11 PM, Nicholas Rosbrook wrote: > Hello, > > As a follow up to the presentation that Brendan Kerrigan and I gave at Xen > summit earlier this month, "Client Virtualization Toolstack in Go", I would > like to open > a discussion around the development of Go bindings for libxl. George

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread George Dunlap
On 7/30/19 2:48 PM, Tamas K Lengyel wrote: > On Tue, Jul 30, 2019 at 7:32 AM Nicholas Rosbrook > wrote: >> >> Hello, >> >> As a follow up to the presentation that Brendan Kerrigan and I gave at Xen >> summit earlier this month, "Client Virtualization Toolstack in Go", I would >> like to open >>

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread George Dunlap
On 7/30/19 2:11 PM, Nicholas Rosbrook wrote: > Hello, > > As a follow up to the presentation that Brendan Kerrigan and I gave at Xen > summit earlier this month, "Client Virtualization Toolstack in Go", I would > like to open > a discussion around the development of Go bindings for libxl. George

Re: [Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread Tamas K Lengyel
On Tue, Jul 30, 2019 at 7:32 AM Nicholas Rosbrook wrote: > > Hello, > > As a follow up to the presentation that Brendan Kerrigan and I gave at Xen > summit earlier this month, "Client Virtualization Toolstack in Go", I would > like to open > a discussion around the development of Go bindings for

[Xen-devel] [RFC] Generating Go bindings for libxl

2019-07-30 Thread Nicholas Rosbrook
Hello, As a follow up to the presentation that Brendan Kerrigan and I gave at Xen summit earlier this month, "Client Virtualization Toolstack in Go", I would like to open a discussion around the development of Go bindings for libxl. George Dunlap, Nicolas Belouin and I have had some discussion