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

ocaml-dns- quick ocaml question



i have two types, rr_type and q_type. rr_type is a subset of q_type, extended 
it by about 5 elements. both are currently implemented in Dns.Packet as cenums 
which are translated to variant types.

i've just realised that (of course?) this means that the last definition 
(rr_type) overrides the first (q_type) as they have overlapping elements.

is there a nice/idiomatic way around this without either going to polymorphic 
variant types (that's what the `T types are called, right?) or just defining 
the cenum q_type with rr_type aliased to it (for slightly better readability), 
and using that everywhere?

eg., should i do something like create submodules Qtype and RRtype of Packet, 
and define cenum t in each?

-- 
Cheers,

R.




This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


 


Rackspace

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