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

RE: sequential evaluation of arguments



    Note:  Although the precise order of evaluation is unspecified, the
    expressions must be evaluated without interleaving.  Interleaving is
    not allowed because Scheme provides no facilities for serializing
    concurrent side effects.

Isn't this a bit strong?  Specifically, saying that exprs MUST BE EVALUATED
WITHOUT INTERLEAVING precludes parallel implementations which do compile-time
side-effect analysis to determine that two expressions' side effects are
non-interferring and thus can safely be run concurrently.  (Note that within
this context, we would consider two calls to CONS to "interfere" in the sense
that they have ALLOCATE effects, the results of which may not be shared, just
as we would consider two calls to I/O routines on the same I/O port to
interfere).

A more forgiving wording might be "expressions must be evaluated without
DETECTABLE interleaving" or "expressions must be evaluated in an order
consistent with some non-interleaved evaluation.  Detectable interleaving is
not allowed because Scheme provides no facilities for serializing concurrent
interferring side-effects." I emphasize interferrence since that is the real
concern: one shouldn't care about serializing non-interferring side-effects.

To point, it would be nice to allow common sub-expression ellimination of
pure expressions, such as:

 (let* ((x (f (moby-expensive-number-crunch 3.1415)))
	(y (g (moby-expensive-number-crunch 3.1415))))
   (h x	y))

  ==

 (let* (($$ (moby-expensive-number-crunch 3.1415))
        (x  (f $$))
        (y  (g $$)))
   (h x y))

My understanding of the Note at the top is that this would be forbidden.
It would be a shame to banish "sufficiently clever" compilers for parallel
machines to the realm of non-Scheme.

Am I just being an alarmist?				~Ziggy