[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Gregory Morrisett <jgm@C...> |
| Subject: | RE: [Caml-list] Type safe affectation ? |
>The problem is that holes at the type level are a difficult feature to >offer: they require linear types in the compiler. As an >optimization, it is a rather high-level one, and maybe not so >easy to know when it will apply. Perhaps, but it's easy for a compiler to offer support for "tail-allocation" (i.e., a tail-call except for a constructor application) which is what you need for a tail-recursive append or map. Perry Cheng implemented it in the TIL compiler in about a week if memory serves and it was a tremendous improvement in performance without any magic. Yasuhiko Minamide wrote a paper on how to model this well (I think it appeared in ICFP). The approach used in our Typed Assembly Language paper is yet another approach based on a simple subtyping trick with initialization flags. It didn't require linear types at all and instead of implicit subtyping, you could accomplish the same thing with an explicit (type-safe) up-cast. So, all in all, it's quite possible to have the compiler implement this optimization for the common case of tail-allocation, and if you think it's more generally applicable, then you could move to something like TAL's initialization flags (though I would prefer the former option.) -Greg ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners