[e-lang] Why aren't guards allowed on forward declarations?

David Hopwood david.hopwood at industrial-designers.co.uk
Wed Sep 26 19:38:28 EDT 2007


Kevin Reid wrote:
> On Sep 26, 2007, at 16:57, David Hopwood wrote:
>> Kevin Reid wrote:
>>> On Sep 26, 2007, at 16:20, David Hopwood wrote:
>>>>    def succeeded :boolean
>>> (Syntactic note: Forward declarations may not have guards.)
>> Any good reason for this? It seems as though the semantics would be  
>> clear.
> 
> I was thinking about that myself. For the forward-declaration usage,  
> it doesn't seem a problem.
[...]
> The one maybe-problem with this mechanism is that it doesn't compose  
> with other promises in the way resolvers are usually expected to.  
> That is, given this resolver, resolving it to a promise is not  
> transparent (and fails instead).

... even though the final resolution of that promise may have been
accepted by the guard.

If promises/resolvers in general have guards, then we might expect it
to be valid to resolve a promise with guard S to a promise with guard T,
if-and-only-if T is a subtype of S.

(Am I assuming idempotent guards here? Let's just consider idempotent
guards for simplicity, to start with.)

In a statically typed language with F-bounded polymorphism
(subtype constraints on type parameters, like in Java 1.5 or Eiffel),
this would "just work". Can we also make it work in E? The problem
seems to be to make sure that the subtype check is consistent with the
'accepts' check.

-- 
David Hopwood <david.hopwood at industrial-designers.co.uk>



More information about the e-lang mailing list