Mailing List Archive


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

Re: [tlug] STM, the Silver Bullet, and the Foot



On 2008-11-26 01:18 +0900 (Wed), Stephen J. Turnbull wrote:

> Curt Sampson writes:
> 
>  > This differs significantly from modern LISP-like languages where when
>  > you say '(foo (a) (b))', and 'foo' happens to be 'and', it's specified
>  > that '(a)' must be evaluated before '(b)', and '(b)' must not evaluated
>  > if '(a)' evaluates to false. (Is 'foo' a macro with special evaluation
>  > order, as above?
> 
> 'foo' is whatever it is.  'and's behavior means that it is a "special
> form", neither a macro nor a function (it can be implemented as a
> macro, since macros evaluate none of their arguments so that its
> expansion can do so where necessary).

Right. I'd not realized that 'special forms' were as special as they
are, but my complaint remains, unless I'm misunderstanding things here:
you need knowledge of the entire environment (closure) within which
you're operating to know if arguments will be evaluated or not. Am I
incorrect that in this example (no doubt with syntatical errors, but I
think you'll get the gist of it)

    (let ((old-and and)) 
      (let ((and (lambda (x y) (old-and x y))))
	(and #f launch-missiles)))

that the missiles will be launched, whereas in most contexts,
"(and #f launch-missiles)" will not launch them?

This is where Haskell shines; to a much greater degree than other
languages, things like IO and STM use are propagated both down (when
something in the environment above you has redefined things) and up
(when you are doing something buried deep in a library) to a much
greater degree than other languages.

>  > The advantage lies in Haskell, not in STM.
> 
> I'll buy that.  Caveat "or any pure functional language", of course.
> Haskell just happens to be the (deservedly) popular one at the moment.

I'm not sure it actually applies to all functional languages labeled
as "pure," actually; whether these things would work the same way in
Clean, I'm not sure. But in the general case, yes, this is an advantage
of purity.

cjs
-- 
Curt Sampson       <cjs@example.com>        +81 90 7737 2974   
Mobile sites and software consulting: http://www.starling-software.com


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links