From: Shivkumar Chandrasekaran <shiv@ece.ucsb.edu>
To: caml-list@inria.fr
Subject: Re: [Caml-list] functors with style?
Date: Mon, 19 Nov 2001 14:10:25 -0800 [thread overview]
Message-ID: <3B7E6820-DD3A-11D5-9119-003065BDAA76@ece.ucsb.edu> (raw)
In-Reply-To: <B1E4D3274D57D411BE8400D0B783FF32A8D5EA@exchange1.cswv.com>
On Monday, November 19, 2001, at 10:32 AM, Krishnaswami, Neel wrote:
>
> A functor is compiled to what is essentially a function that
> takes a record as an argument (the module it receives as an
> argument), and returns a record of functions and values. So
> code generation happens only once for each functor, and each
> functor application takes a very small amount of memory at
> link time.
>
Which of course is a problem at the "small-scale". For example I would
like to develop a functor that is generic over the representation of
reals (float32_elt, float64_elt, fixed_point, etc.). But now if I
instantiate it for float64_elt and do arithmetic over float64_elt even
simple operations will be looked-up at run-time leading to a terrible
performance loss.
Ideally I would prefer it if the compiler allowed the programmer to
decide which functor applications lead to compile-time code generation
and which are through dictionary-passing.
For example, in Clean (which has type classes not functors of course),
instants of basic types be prevented from using dictionary passing. Not
sure what happens in haskell though...
--shiv--
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-11-20 8:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-19 18:32 Krishnaswami, Neel
2001-11-19 22:10 ` Shivkumar Chandrasekaran [this message]
2001-11-20 16:48 ` Brian Rogoff
[not found] <9td4tb$csv$1@qrnik.zagroda>
2001-11-20 12:26 ` Marcin 'Qrczak' Kowalczyk
-- strict thread matches above, loose matches on Subject: below --
2001-11-19 16:32 William Harold Newman
2001-11-19 19:31 ` Francisco Valverde Albacete
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3B7E6820-DD3A-11D5-9119-003065BDAA76@ece.ucsb.edu \
--to=shiv@ece.ucsb.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox