This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CTAX revisited


Ian Bicking <ianb@colorstudy.com> writes:

> On Mon, Jul 24, 2000 at 06:19:34PM +0200, Marius Vollmer wrote:
> > > I was trying to forget goto :)
> > 
> > Ahh, no need for that.  I don't think it's more complicated to
> > implement than continue/break.  In fact, I find that goto occasionally
> > allows for code that is more structured than having to forego goto.
> > Of course, it's also right to discourage its wanton use, but for me
> > that is no reason to exclude it from the language. When you have a GC,
> > jumping around wildly is not so much a problem as it is for C++, for
> > example.
> 
> Is it so easy?  I was looking at your code for tagbody, and I don't 
> think it will work for goto.  It only allows jumping about at one level,
> you can't jump into or out of a control structure or a let.

Ahh, yes, scratch the bit about jumping around wildly.  I was being
over-enthusiastic, I'm afraid.  I would now say that jumping into
binding constructs is not sensible, but jumping out of them could be
provided.

I just noticed that the following has the problem of not being
tail-recursive.  Is there a fix without using catch/throw?

    (define (jump-around)
      (tagbody
       one
        (display 1)
        (two)
        (display 3)
       two
        (display 2)
        (one)))

(Incidentally, almost no code generated by the tagbody macro is
tail-recursive because the macro unconditionally appends a call to a
tag function to every body.  Damn.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]