Hello,
I was defining a (generic & higher-order) list-of-terms parsing func. It uses
funcs which each parse a term of a given type from a token stream and advance a
ref index. As you may note below, I initially forgot to 'ref' the index in the
type of the parse func passed as param, in the generic func signature.
The compiler accepted and the program segfault-ed (for getting a value instead
of a reference, probably). Certainly ref qualifiers should be checked,
shouldn't they? The situation indeed is somewhat special here.
Foo getFoo(Token[] tokens, ref uint index)
{...}
Term[] getTerms (Term) (Term function (Token[], uint) parseFunc, Token[] tokens)
{...}
void main()
{
Foo[] foos = getTerms!(Foo)(&getFoo, s); # ==> segfault
}
Denis
--
_________________
vita es estrany
spir.wikidot.com