Recursive Declarations (for functions).
Leandro Lucarella
llucax at gmail.com
Fri Aug 24 09:36:17 PDT 2007
Hi. I was designing a FSM and I wanted to use a simple scheme where a
state is represented with a function which returns a pointer to the next
state (function) when I realized there is no support in the language to
declare a function that returns a function with the same signature as
itself.
Here is an explanation of the problem and suggested solutions for C++:
http://www.gotw.ca/gotw/057.htm
AFAIK you can implement something similar in D, but D doesn't have a
"native" solution either.
What I want to know is if it's even posible to have a nice syntax to
support this, something like:
fp function() fp;
Is the type system capable of handling this?
--
LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
------------------------------------------------------------------------
E-Mail / JID: luca at lugmen.org.ar
GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2
GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
------------------------------------------------------------------------
CONDUCTOR BORRACHO CASI PROVOCA UNA TRAGEDIA: BATMAN UNICO TESTIGO
-- Crónica TV
More information about the Digitalmars-d
mailing list