This is the mail archive of the guile@cygnus.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]

switch statement (Re: records)


On Sun, Jul 25, 1999 at 11:02:33AM +1000, Chris Bitmead wrote:
> 
> Jost Boekemeier wrote:
> 
> > If display, + and others were not user visible we would not 
> > have any problem whith them.  But they are visible to the user 
> > and you can't create a polymorphic system on top of an generic 
> > interface.
> 
> There's no such thing as "can't"...
> 
> (define (display a) (let ((old-disp display)) 
>       (if (foobartype? a) (display-foobar a) (old-disp a))))

So then you have several other types that you want to add to
the display function and so you can keep doing the same thing.
The end result is a linked list of (if ...) statements with some
(lambda () ...) overheads between them and hey, looks like we
have just re-invented the switch statement in a less efficient form.

Then again, it is probably fair to argue that the whole thing
is just an implementation issue and the outside effect is exactly
the same -- in which case one might argue that all languages are
the same and the difference is an implementation issue (presuming
Turing completeness).

	- Tel

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