Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-10 Thread Victor Toso
Hi, On Fri, Nov 10, 2023 at 01:58:20AM -0800, Andrea Bolognani wrote: > On Thu, Nov 09, 2023 at 08:01:48PM +0100, Victor Toso wrote: > > On Thu, Nov 09, 2023 at 09:34:56AM -0800, Andrea Bolognani wrote: > > > We should call this Null instead of IsNull, and also make it a > > > pointer similarly to

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-10 Thread Andrea Bolognani
On Thu, Nov 09, 2023 at 08:01:48PM +0100, Victor Toso wrote: > On Thu, Nov 09, 2023 at 09:34:56AM -0800, Andrea Bolognani wrote: > > We should call this Null instead of IsNull, and also make it a > > pointer similarly to what I just suggested for union branches > > that don't have additional data a

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-09 Thread Victor Toso
Hi, On Thu, Nov 09, 2023 at 09:34:56AM -0800, Andrea Bolognani wrote: > On Mon, Oct 16, 2023 at 05:26:57PM +0200, Victor Toso wrote: > > [*] The exception for optional fields as default is to Types that can > > accept JSON Null as a value. For this case, we translate NULL to a > > member type call

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-09 Thread Andrea Bolognani
On Mon, Oct 16, 2023 at 05:26:57PM +0200, Victor Toso wrote: > [*] The exception for optional fields as default is to Types that can > accept JSON Null as a value. For this case, we translate NULL to a > member type called IsNull, which is boolean in Go. This will be > explained better in the docu

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-06 Thread Andrea Bolognani
On Mon, Nov 06, 2023 at 04:52:12PM +0100, Victor Toso wrote: > On Mon, Nov 06, 2023 at 07:28:04AM -0800, Andrea Bolognani wrote: > > On a partially related note: while I haven't yet looked closely at > > how much effort you've dedicated to producing pretty output, from a > > quick look at generate_

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-06 Thread Victor Toso
Hi, On Mon, Nov 06, 2023 at 07:28:04AM -0800, Andrea Bolognani wrote: > On Mon, Oct 16, 2023 at 05:26:57PM +0200, Victor Toso wrote: > > This patch handles QAPI alternate types and generates data structures > > in Go that handles it. > > > > Alternate types are similar to Union but without a discr

Re: [PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-11-06 Thread Andrea Bolognani
On Mon, Oct 16, 2023 at 05:26:57PM +0200, Victor Toso wrote: > This patch handles QAPI alternate types and generates data structures > in Go that handles it. > > Alternate types are similar to Union but without a discriminator that > can be used to identify the underlying value on the wire. It is n

[PATCH v2 04/11] qapi: golang: Generate qapi's alternate types in Go

2023-10-16 Thread Victor Toso
This patch handles QAPI alternate types and generates data structures in Go that handles it. Alternate types are similar to Union but without a discriminator that can be used to identify the underlying value on the wire. It is needed to infer it. In Go, most of the types [*] are mapped as optional