[Nickle] Better struct subtype syntax

Keith Packard keithp at keithp.com
Sat Jan 5 23:01:10 PST 2008

Bart and I chatted on the phone this evening about struct subtyping and
decided that all syntaxes involving the 'extend' keyword were too
confusing, and that what we really wanted to talk about was joining two
struct types together to create a composite type. Well, we use the '+'
keyword for lots of other joining operations, so why not for types?

        typedef struct {
                int	i;
        } super_t;
        typedef super_t + struct {
                real f;
        } sub_t;

This extends to joining more than two types together quite naturally,
with familiar behavior.

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/nickle/attachments/20080105/1196f979/attachment.pgp 

More information about the Nickle mailing list