Re: [q-lang-users] H/M-based typing for Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-11-30 21:29:37
|
Andrew Berg wrote: > That being said, I am in favor of a faster native code compiler. Are there optimizations that become possible with stronger type system that are impossible without one? Unboxing. E.g., if the type checker can infer that a certain parameter in a recursive function is always an integer then that parameter can be unboxed before invoking the function and can be passed around as just a plain integer. That saves you the runtime checks for the type and extracting the integer's value from an expression cell. > It seems to me that if all of the equations for a program are known at compile time (and as Q is defined now, I think that is the case) then it should be reasonable to infer a lot of the type information at compile time. No? Yes. In fact standard H/M allows you to infer *all* types in a program, automatically, *without* any explicit typing information (except in some rare corner cases). Of course this becomes more difficult if you want to support ad-hoc polymorphism (like a function or constructor which takes either an integer or a list as an argument, which isn't possible with standard H/M, but is a no-brainer in Q). Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |