Next: , Previous: Keyword and default arguments, Up: Extensions to C


2.1.2.4 Recursive types and functions

L handle recursive types and functions very well. In functional programming languages, recursive type definition is often “work-arounded” by using a “rec” keyword.

In L, the rule is that “every code simultaneously entered is treated as a whole”.

For instance, if you feed L with:

     type Toto = struct { Tata; } *;
     type Tata = struct { Toto; } *;

L would correctly interpret this. UNIMPLEMENTED: not yet. Only

     type Int_List ; struct { Int head; Int_List tail; }*

recursive definition works for now.

But if you feed L with:

     type Toto = struct { Tata; } *;

and (after) with:

     type Tata = struct { Toto; } *;

You would get an error after the first sentence, because the definitions you supply is incomplete.

See Chunk for more informations.