[Newbies] Re: [] whileTrue: [] implementation

David Mitchell david.mitchell at gmail.com
Wed Oct 5 21:29:56 UTC 2011


Great explanation here:
http://gbracha.blogspot.com/2009/12/chased-by-ones-own-tail.html

Read the comments as well.


On Wed, Oct 5, 2011 at 12:56 PM, Erlis Vidal <erlis at erlisvidal.com> wrote:
> is there any reason why smalltalk doesn't implement tail recursion
> optimization? Is by "language design"? It tries to avoid any issue?
>
> Thanks
> Erlis
>
> On Wed, Oct 5, 2011 at 1:50 PM, nicolas cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
>>
>> Bert Freudenberg <bert <at> freudenbergs.de> writes:
>>
>> >
>> > On 05.10.2011, at 00:24, nicolas cellier wrote:
>> >
>> snip... gmane is a tyrant
>> >
>> > Yes, but log(n) is still not good enough for loops that run forever.
>> > Like the
>> Morphic main loop. Or the idle process.
>> >
>> > I don't think it's possible to emulate whileTrue without reaching for
>> > the meta
>> hammer. Interesting
>> > discussion though. Maybe a bit over the head of the average newbie ;)
>> >
>> > - Bert -
>> >
>>
>> Ah yes of course, this is the essential case... And we cannot even know if
>> the
>> loop is going to halt.
>> For the two specific cases you submitted, we could cheat by using another
>> VM
>> magic and let the UI and idle process regenerate by forking themselves and
>> completely ignore any synchronisation requirement.
>> Or emulate tail call elimination by playing with thisContext>>sender:
>> But the sport is becoming a bit crooked. And we're getting far from
>> initial
>> question.
>> It's already something to know that a jump bytecode solves these problems
>> efficiently.
>>
>> Nicolas
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>


More information about the Beginners mailing list