[m-rev.] for review: add `any_is_bound' pragma

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jul 17 23:39:49 AEST 2003


On 17-Jul-2003, David Overton <dmo at cs.mu.OZ.AU> wrote:
> 
> This change adds a new pragma `any_is_bound(t/n)' which tells the compiler
> that for type t/n the inst `any' should be considered to be equivalent to a
> bound inst i where i contains all the functors of the type t and each argument
> has inst `any'.  This is required to allow us to represent HAL's `old' inst
> using `any'.

Why not write out the `bound(...)' insts explicitly?

> In HAL, `old' is like `any' if the type is an instance of a
> particular type class (`solver/1').  However, for types that are not instances
> of `solver/1', `old' needs to be treated as though it is `bound'.

Does this mean that the mode system in HAL behaves differently depending on
which type class instance declarations are in scope?

> This change also provides a new Boolean option `--default-any-is-bound' which,
> when set, assumes that `any' is always equivalent to `bound', except for types
> t/n for which a `:- pragma any_is_not_bound(t/n)' declaration exists.  We plan
> to use this option when compiling HAL code because it allows us to use existing
> non-solver types (e.g. types defined in the Mercury standard library) without
> having to explicitly add a `:- pragma any_is_bound' declaration for each type.

Compiler options that affect the language semantics should be avoided
where possible.  I would rather make --default-any-is-bound be the
default, and then there's no need for the compiler option or the
`any_is_bound' pragma.

As for the `any_is_not_bound' pragma, well, I don't really like the name.
Also, I'd rather explicit syntax as part of the type declaration,
rather than a separate pragma.  For example, perhaps something along
the lines of `:- solver type ...' instead of `:- type ...'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list