[REBOL] Re: forall error
From: g:santilli:tiscalinet:it at: 23-May-2001 14:50
Joel Neely wrote:
> > ** Internal Error: Stack overflow
> > ** Near: not tail? get word
> >
> > get: func [myVar] [
> > forall myDB [
> > rec: first myDB
> > if rec/fType = myVar [
> > remove myDB
> > ]
> > ]
> > ]
> >
>
> If you have a minute, would you try this alternative?
>
> get: func [myVar /local walkDB] [
> walkDB: myDB
> while [not tail? walkDB] [
> rec: first walkDB
> either rec/fType = myVar [
> remove walkDB
> ][
> walkDB: next walkDB
> ]
> ]
> ]
If you look at the error above, you'll discover immediately what
the problem is. :-)
(For Charles: you called your function GET. The word 'GET in REBOL
is usually associated to the GET native function; FORALL wants to
call that function, and uses the 'GET word to do so. But since you
just told REBOL that the word 'GET is associated with your
function, FORALL will call YOUR function instead of the native
GET. Your function, in turn, will call FORALL that will call your
function again and so on until you get a stack overflow.)
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/