Consider:

(deftype int32 (fixint 32 32 #t)
(defunion (list 'a) Nil (Cons 'a))

In order to create a value of type int32-list

(define ilist (Cons 100))

works fine.

If I write:

(deftype i32list (list int32))

(define ilist Nil)

The type if ilist is not very clear, and I think we must pick the most general (or original) type.

That is,
(define ilist Nil)  ;ilist: (list 'a)
(define jlist (Cons 100)) ; ilist: (list int)
(define klist:i32list Nil) ; ilist: i32list

Since deftype really only creates aliases, how about
(if #t ilist klist) ??

Now consider:
(defstruct (llist 'a) payload:'a link:(ref (llist 'a)))
                                ; llist for linked list
(deftype i32llist (llist int))
(define mlist (i32llist 100 nextnode))

works fine.

But,
(define nlist ((llist int32) 100 nextnode))

CANNOT be allowed. This is because, if in-place specialization is allowed, I should also be able to write:
(define nlist ((llist (fixint 32 32 #t)) 100 nextnode))

and the rule for apply should be changes to
apply : (exprs) | (type types)

This obviously creates an ambiguity in the case of ident for expr vs type. The main problem here is that apply is doing a little too many things.

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

Reply via email to