guile-devel
[Top][All Lists]
Advanced

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

Re: Fluids vs parameters: which API is better?


From: Ludovic Courtès
Subject: Re: Fluids vs parameters: which API is better?
Date: Mon, 25 Jul 2011 11:24:31 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi BT,

BT Templeton <address@hidden> skribis:

> Andy Wingo <address@hidden> writes:

[...]

>> Here I disagree.  From the perspective of semantics and security, it's
>> important to be able to make assertions as to the type of value returned
>> by a procedure -- that (current-input-port) returns a port.  The same
>> goes for (current-language) and all the other dynamic parameters.
>> Parameters allow us to make guarantees like that.
>
> Why is it uniquely useful to be able to make these guarantees for
> dynamically-bound values? Static/soft typing would be more generally
> useful than parameters.

I agree it’s not specific to dynamically-bound values.

Andy mentioned that exporting, say, the fluid that underlies
‘current-output-port’ would be a problem because you could ‘fluid-set!’
it to anything, which would lead to an obscure wrong-type-arg error
sometime.

OTOH it could be argued that this is no different with mutable global
variables.

> Also, I'd prefer it if parameters used a type predicate or a type
> specifier object instead of a conversion procedure. ISTM that the
> current interface conflates type checking and coercion.

Well, Andy’s proposal is similar to SRFI-39 and I find it convenient
this way.

Thanks,
Ludo’.




reply via email to

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