Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: cheesy hack...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 2821 of 2841
Post > Topic >>

Re: cheesy hack to get first class polymorphism?

by Jon Harrop <jon@[EMAIL PROTECTED] > Apr 28, 2008 at 02:43 PM

Torben Ęgidius Mogensen wrote:
> Most functional language compilers don't do this kind of multiple
> instantiation but instead exploit that polymorphic functions don't
> need to access the polymorphic data so, as long as the size of the
> polymorphic data is the same, the same code can work on any type.
> Hence, the compilers ensure that all data has the same size (typically
> one machine word), storing larger data in the heap and just keep a
> pointer to it in a register or stack slot.  Hence, you need only one
> copy of each polymorphic function and you can compile this in advance
> without knowing which future instances it will be applied to.  The
> disadvantage is that you need to store more things in the heap.

Certainly in the 1990s compilers like OCaml did that but modern FPL
compilers often target CLRs like .NET and inherit this functionality from
them.

-- 
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u




 5 Posts in Topic:
cheesy hack to get first class polymorphism?
raould <raould@[EMAIL   2008-04-24 16:24:01 
Re: cheesy hack to get first class polymorphism?
Paul Rubin <http://phr  2008-04-24 19:06:13 
Re: cheesy hack to get first class polymorphism?
torbenm@[EMAIL PROTECTED]  2008-04-25 09:27:37 
Re: cheesy hack to get first class polymorphism?
Jon Harrop <jon@[EMAIL  2008-04-28 14:43:27 
Re: cheesy hack to get first class polymorphism?
Jon Harrop <jon@[EMAIL  2008-04-28 14:43:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 0:14:29 CDT 2008.