On Tue, 2008-09-30 at 15:39 -0700, Pal-Kristian Engstad wrote:
> Swaroop Sridhar wrote:
> > It is definitely possible to support this syntax using different
> > syntactic constructs for example:  aloc[3] for array subscript and
> > vec{3} for vector subscript.
> >   
> The latter is very akin to OCaml's approach...

No, it isn't. The problem is that if we see

  (generic-nth array-or-vector n): T

then we know that array-or-vector is either (vector T) or (array T ?i).
The problem is that we do not know what "i" is, and the array length is
part of its type.

In order to handle this as a type class, we need to do instantiation
over literals so that we will be able to define

(forall ((ndx:word))
   (define array-nth (ar:(array 'a ndx) n)  <primitive-impl>))

At that point, yes, we could form a type class. This, by the way, is why
neither of the current primitives is named "nth" -- we do plan to do
instantiation over literals shortly.

The problem at present is that we haven't enough information to do the
inference correctly when nth is generic.


shap


_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to