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

Re: [Xen-devel] [PATCH v2-resend 07/30] libxl: ocaml: avoid reserved words in type and field names.



> Rob Hoes writes ("[Xen-devel] [PATCH v2-resend 07/30] libxl: ocaml: avoid
> reserved words in type and field names."):
> > Current just s/type/ty/ and there are no such fields (yet) so no
> > change to generated code.
> 
> I think this should be done in a systematic way, and one which is an
> injection[1].  What if someone later introduces a field called "ty" in the
> same struct as one called "type" ?
> 
> I don't know what a good convention would be in ocaml, but for example
> you could prefix everything with "idl_" (including names starting "idl_").
> 
> [1] http://en.wikipedia.org/wiki/Injection_%28mathematics%29

Yes, I see what you mean. I don't really like to prefix everything, but that is 
mostly for aesthetic reasons. Although even an injective transformation such as 
prefixing isn't always safe: what if we prefix "type" to become "xl_type", and 
someone adds a keyword "xl_type" to OCaml?

I am not sure what the best solution would be in OCaml, but I'll ask around a 
bit.

Cheers,
Rob

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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