[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 05/24] golang/xenlight: define KeyValueList builtin type




> On Oct 24, 2019, at 8:54 PM, Nick Rosbrook <rosbrookn@xxxxxxxxx> wrote:
> 
>> So we *could* actually just `type KeyValueList struct { }`, and punt on
>> all these initialization questions until such time as it turns out that
>> they're needed.
> 
> If there is no clear need for this type to be implemented in the Go
> package, then I would be in favor of not doing so. IMO, a smaller,
> more focused package is ideal.

Ok, in that case let’s just leave the struct empty.

> 
>> On the other hand, I think we may need to actually think about
>> initializing structures.  You've carefully coded DefBool such that the
>> "zero" value is undefined; but for DevId, for instance, the "initial"
>> value is supposed to be -1; but the way it's coded, an uninitialized Go
>> structure will end up as 0, which may be a valid devid.
>> 
>> [...]
>> 
>> Anyway, perhaps we can think about structure initialization, and
>> implement it after we do the basic structure /  marshalling implementaiton.
> 
> That's probably best. However, at a quick glance it seems like it
> would be pretty straight-forward to generate NewStructType functions
> analogous to libxl_struct_type_init, if that's the desired behavior.

I think we basically have three options:

1. Try to arrange it so that the “zero” values correspond to “default” values 
in libxl; i.e., have DevID 0 -> libxl_devid -1, DevID 1 -> libxl_devid 0, &c

2. Add NewStructType functions

3. Add .Init() methods to structs

#1 I think is probably too risky; so 2 or 3 (or maybe both) will probably be 
needed.  The NewStructType() seems to be more standard.  But I’m open so 
suggestions. :-)

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.