[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: <boolean> (was Re: object-class)



> Date: Sun, 22 Nov 92 00:33:13 -0500
> From: Bob Kerns <rwk@crl.dec.com>
> 
>     Date: Sat, 21 Nov 92 15:35:16 PST
>     From: dyer@eagle.sharebase.com (Scot Dyer)
>     
>     This can't be properly translated to Dylan (I don't think) since Dylan has no
>     proper way of specifying lazy evaluation of arguments to functions.
>     
> Please forgive any syntactic errors, since I'm at home
> without my Dylan manual, and Scheme is not my native
> language, but:
> 
> (if cond true false) =>
> 
> (define-method my-if ((singleton #t) then else)
>   (then))
> (define-method my-if ((singleton #f) then else)
>  (else))
> 
> (my-if cond (lambda () then) (lambda () else))

This is exactly the same way that Smalltalk does it, although Mr. Dyer might
not have noticed that because Smalltalk obscures the creation of closures as
the arguments to if by using syntax (square brackets).

And you all thought I had long ago stopped reading this very digressive
discussion, with its programming examples in Common Lisp, Scheme, and
Smalltalk (but not Dylan).