[Nickle]Tonight's topics

Keith Packard nickle@nickle.org
Wed, 24 Jul 2002 12:38:38 -0700


Around 0 o'clock on Jul 24, Bart Massey wrote:

> 3) There should be no way to create a type with no obviously
>    well-defined values.  In the absence of partial <undef>
>    this means that
>      typedef x;
>      typedef struct {
>         x y;
>      } x;
>    has to go, and also its singly and mutually recursive
>    cousins.  I sincerely doubt anyone will miss them.

Ok, so the question is how to specify this limitation.  The limitation 
devolves down to restrictions on the use of forward-declared types (the 
bare 'typedef x').  Here's what I think the restrictions should be:

1) You can create a reference type to a forward declared type:

	typedef x;
	typedef *x y;

  That's because '0' is always a legal pointer value which can terminate any
  possible value recursion.

2) You can create a union containing a forward declared type, but the
   union must contain one non forward-declared type:


	typedef list;

	typedef union {
		void	end;
		list	next;
	} listref;

  This restriction ensures that there is always a non-recursive value 
  possible.

I think that these two restrictions ensure that all types have finite 
value representations.

-keith