* Obj module
@ 1999-01-19 13:09 Hendrik Tews
1999-01-19 23:17 ` doligez
1999-01-20 2:29 ` Jacques GARRIGUE
0 siblings, 2 replies; 4+ messages in thread
From: Hendrik Tews @ 1999-01-19 13:09 UTC (permalink / raw)
To: caml-list
Hi,
where can I find documentation on the Obj module in the standard
library?
Can somebody explain the meaning of those C primitives starting
with a percent sign, eg "%identity"?
Thanks,
Hendrik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Obj module
1999-01-19 13:09 Obj module Hendrik Tews
@ 1999-01-19 23:17 ` doligez
1999-01-20 2:29 ` Jacques GARRIGUE
1 sibling, 0 replies; 4+ messages in thread
From: doligez @ 1999-01-19 23:17 UTC (permalink / raw)
To: Hendrik Tews; +Cc: caml-list
>From: Hendrik Tews <tews@irritatie.cs.kun.nl>
>where can I find documentation on the Obj module in the standard
>library?
This module is deliberately undocumented because it breaks the type
system. If you use it, your program can crash or behave in erratic
ways. We don't document the module because we don't want spurious bug
reports from users who use it without knowing what they're doing.
More seriously, there is no way to document this module in an
implementation-independent way, and its behaviour is likely to change
with every release of O'Caml. Basically, the documentation is the
whole source code for the O'Caml compiler, runtime and libraries. If
you don't understand it, don't use Obj.
>Can somebody explain the meaning of those C primitives starting
>with a percent sign, eg "%identity"?
They are not really C primitives, but pseudo-primitives that are
recognised and implemented by the code generator itself, so the linker
will never see them. In the byte-code system, each of these is
expanded to one byte-code, in the native-code compiler, they are
replaced by a short sequence of instructions.
-- Damien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Obj module
1999-01-19 13:09 Obj module Hendrik Tews
1999-01-19 23:17 ` doligez
@ 1999-01-20 2:29 ` Jacques GARRIGUE
1999-01-20 12:03 ` Hendrik Tews
1 sibling, 1 reply; 4+ messages in thread
From: Jacques GARRIGUE @ 1999-01-20 2:29 UTC (permalink / raw)
To: tews; +Cc: caml-list
From: Hendrik Tews <tews@irritatie.cs.kun.nl>
> where can I find documentation on the Obj module in the standard
> library?
There is (intentionally) no documentation to this module.
But it shall be rather easy to understand once you read the chapter on
interfacing with C in the reference manual, which gives lots of
information about how values are represented physically.
> Can somebody explain the meaning of those C primitives starting
> with a percent sign, eg "%identity"?
These primitives are handled in a special way by the compiler.
For "%identity", it is simply discarded, as you might expect.
Some others are converted to instructions of the abstract machine.
And finally some may really call C primitives.
The only way to really know what happens is to read the compiler's
sources.
Jacques
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Obj module
1999-01-20 2:29 ` Jacques GARRIGUE
@ 1999-01-20 12:03 ` Hendrik Tews
0 siblings, 0 replies; 4+ messages in thread
From: Hendrik Tews @ 1999-01-20 12:03 UTC (permalink / raw)
To: caml-list
Hi,
Jacques GARRIGUE writes:
Date: Wed, 20 Jan 1999 11:29:04 +0900
Subject: Re: Obj module
From: Hendrik Tews <tews@irritatie.cs.kun.nl>
> where can I find documentation on the Obj module in the standard
> library?
There is (intentionally) no documentation to this module.
Ok, I would not expect a complete documentation of this module.
But I thought it would be possible to make statements like
If in a program
let super_inst : super_class = (sub_inst : sub_class :> super_class)
is accepted by the compiler, then it is save to do
let re_sub = (Obj.magic(super_inst) : sub_class)
Does this hold in general, or only in the current implementation,
or not even there?
But it shall be rather easy to understand once you read the chapter on
interfacing with C in the reference manual, which gives lots of
information about how values are represented physically.
This is true. But I wanted to use it together with object types.
And I was not able to find something about the layout of the
method suites and how method dispatch is implemented.
Bye,
Hendrik
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-01-20 13:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-19 13:09 Obj module Hendrik Tews
1999-01-19 23:17 ` doligez
1999-01-20 2:29 ` Jacques GARRIGUE
1999-01-20 12:03 ` Hendrik Tews
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox