caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Naylor <bwv211mail@yahoo.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] double-functors for types and values
Date: Thu, 13 Jun 2002 08:36:20 -0700 (PDT)	[thread overview]
Message-ID: <20020613153620.78279.qmail@web13406.mail.yahoo.com> (raw)
In-Reply-To: <20020613123311H.garrigue@kurims.kyoto-u.ac.jp>

--- Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> wrote:
> There 's something fishy in struct type btype = B.btype end:
> if you're still inside B, you cannot refer to yourself as B.

Whoops, sorry.  You're right - the actual code uses more nested modules or type
renaming, which I left out of the sample code.

> Functors should incur three costs:
> * type abstraction cost: if you depend on abstract types, some data
>   structure accesses cannot be optimized.

I would like to see an example of an unoptimizable case

> * function abstraction cost: all imported functions and (some?)
>   exported functions cannot be called directly. Expensive.

So in the following code:

module MakeA (A : sig type x end) = struct
  let foo = ...
  module MakeB (B : sig val quux : ... end) = struct
    let bar = ...
  end
end

Both [foo] and [bar] will not cost anything to evoke, but [quux] will cost an
extra indirection since it was imported in the functor parameter?

> * structure access cost: you have to dereference to get to your
>   closures. I believe it's cheap compared to the function abstraction
>   cost. Xavier Leroy had recently some figures showing that a method
>   call (double indirection) was not that much more expensive than an
>   abstract function call.

Is this referring to closures over over local modules (using [let module])
only, or does it have an impact on top-level modules as well?

Can someone come up with a link to the figures mentioned above?

Thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
-------------------
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


      reply	other threads:[~2002-06-13 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12 21:31 Brian Naylor
2002-06-13  3:33 ` Jacques Garrigue
2002-06-13 15:36   ` Brian Naylor [this message]

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=20020613153620.78279.qmail@web13406.mail.yahoo.com \
    --to=bwv211mail@yahoo.com \
    --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;
as well as URLs for NNTP newsgroup(s).