From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: n8gray@gmail.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Representation of objects
Date: Wed, 17 Aug 2005 07:40:34 +0900 (JST) [thread overview]
Message-ID: <20050817.074034.03110706.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <aee06c9e050816150491c35f9@mail.gmail.com>
From: Nathaniel Gray <n8gray@gmail.com>
> I've been poking around a bit into the representation of objects in
> OCaml and I'm a bit confused. Based on caml_get_public_method in
> asmrun/obj.c and various bits of stdlib/camlinternalOO.ml I see that
> the method table is an "array" where the even entries are closures and
> the odd entries "tags" -- hashed method names. (The first two entries
> are special.) The table is stored sorted in order of increasing tag
> value. Please correct me if I've misunderstood something here.
Correct.
> I've got two questions:
>
> 1. Does this mean that essentially all method invocations need to
> search the method table? The method table of a superclass is no
> longer a prefix of that of a subclass. There's a GETMETHOD(i,obj)
> bytecode, but I'm struggling to figure out when you could use it.
>From other posts, it seems that you have found caml_get_public_method.
> 2. What about hash collisions? There's no collision resolution code
> in the method lookup functions.
The type system prevents them. That is, if there is a potential
collision between tag names, it will be detected at compile time.
Jacques Garrigue
next prev parent reply other threads:[~2005-08-16 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-16 22:04 Nathaniel Gray
2005-08-16 22:40 ` Jacques Garrigue [this message]
2005-08-16 23:01 ` [Caml-list] " Nathaniel Gray
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=20050817.074034.03110706.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@yquem.inria.fr \
--cc=n8gray@gmail.com \
/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