[Top][All Lists]

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

Fluids vs parameters: which API is better?

From: Mark H Weaver
Subject: Fluids vs parameters: which API is better?
Date: Mon, 18 Jul 2011 17:57:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi Andy,

Andy Wingo <address@hidden> writes:
> So I am optimistic regarding our ability to gradually change over to
> parameters, if you are in agreement that parameters are the interface
> that we should export.

I'm sorry to throw a monkey wrench into this nice plan, but I would like
to briefly argue that fluids are the far superior interface.

>From an efficiency perspective, it is much more straightforward and
reliable for a compiler to understand what operation is done by
(fluid-ref x) than (x).  Granted, this requires an assumption that
`fluid-ref' has not been set to something else, but we're already making
similar assumptions for many other common operations, and there are
various ways we can manage these assumptions more cleanly in the future.

More generally, from a perspective of semantics and security, it is
preferable for a program to apply a known operation (e.g. `fluid-ref')
to some data, than to call the `data' as a procedure and ask it to do
something.  Yes, there are cases when the flexibility of message passing
is worthwhile, but there are significant disadvantages.  Once you do
this, you can no longer analyze the behavior of a procedure without
knowing a lot about the data itself.

In this particular case I think it would be a shame to enshrine the
disadvantages of message passing into our API, on such a fundamentally
important set of primitives.

What do you think?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]