Recursive data-types

ponce via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 27 04:26:31 PDT 2014


I'm dabbling with Scheme interpreter and ultimately I would need 
to declare the following types.

--------------

struct Function
{
     Environment env;
     Atom params;
     Atom body_;
}

// An atom is either a string, a double, a symbol, a function or 
a list of atoms
alias Atom = Algebraic!(string, double, Symbol, Function, This[]);

--------------

These definitions can't work since Function and Atom need each 
other in this recursive definition.

How to get out of this trap?
Do I have to drop Algebraic and go back to manual tagged unions?


More information about the Digitalmars-d-learn mailing list