[Nickle]crashing nickle in <100 bytes

Keith Packard nickle@nickle.org
Tue, 23 Jul 2002 14:07:36 -0700


Around 18 o'clock on Jul 23, Carl Worth wrote:

	typedef list;
	typedef struct {
	    list next;
	} list;
	list burn = {next = 0};
	crash = burn;

For the programmers convenience, nickle automatically creates structures 
and unions when they aren't initialized explicitly.  This automatic 
initialization wasn't checking for recursive structures.

> PS. Would it make sense to have a literal other than 0 to represent a
> null pointer? I've got a code segment hear that I think would be
> useful with a function accepting a poly that could legitimately be an
> integer, (such as 0), or a null pointer

Should you be using a union instead of 'poly' in this case?  Unions give 
you explicit tags and some reasonable typechecking for this kind of case.  
Their syntax is a bit awkward in places; feel free to suggest improvements.

I can still imagine cases where a separate explicit nil would be useful 
though.

Keith Packard        XFree86 Core Team        HP Cambridge Research Lab