caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] native code debugging
@ 2001-08-08 18:35 Chris Hecker
  2001-08-09  1:36 ` JayR
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Hecker @ 2001-08-08 18:35 UTC (permalink / raw)
  To: caml-list


Has anyone tried to write an ocaml debugger for native code compiled executables?

Chris

-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] native code debugging
  2001-08-08 18:35 [Caml-list] native code debugging Chris Hecker
@ 2001-08-09  1:36 ` JayR
  2001-08-09  7:08   ` Florian Hars
  2001-08-09  7:10   ` False polymorphic (was: Re: [Caml-list] native code debugging) David Mentre
  0 siblings, 2 replies; 4+ messages in thread
From: JayR @ 2001-08-09  1:36 UTC (permalink / raw)
  To: caml-list


Is the following a side effect of defining these
at the top level?

        Objective Caml version 3.02

# let id x = x;;
val id : 'a -> 'a = <fun>
# let id2 = id id;;
val id2 : '_a -> '_a = <fun>
# id2 7;;
- : int = 7
# id2 "w";;
This expression has type string but is here used with type int


# let id2 = id id;;
val id2 : '_a -> '_a = <fun>
# id2 "w";;
- : string = "w"
# id2 7;;
This expression has type int but is here used with type string
#
-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] native code debugging
  2001-08-09  1:36 ` JayR
@ 2001-08-09  7:08   ` Florian Hars
  2001-08-09  7:10   ` False polymorphic (was: Re: [Caml-list] native code debugging) David Mentre
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Hars @ 2001-08-09  7:08 UTC (permalink / raw)
  To: JayR; +Cc: caml-list

On Wed, Aug 08, 2001 at 07:36:04PM -0600, JayR wrote:
> Is the following a side effect of defining these
> at the top level?

> # let id2 = id id;;
> val id2 : '_a -> '_a = <fun>

No, its a side-effect of side-effects.
It is due to the so-called value restriction, which for some
reason beyond my momentary comprehension is needed to be able to
type programs with side-effects. Section 5.1.1 of the introduction
by Hickey (linked to from the Ocaml homepage under "On-line Tutorials"
explains exactly your problem.

# let id2 x = (id id) x;;
val id2 : 'a -> 'a = <fun>

should work.

Yours, Florian.
-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* False polymorphic (was: Re: [Caml-list] native code debugging)
  2001-08-09  1:36 ` JayR
  2001-08-09  7:08   ` Florian Hars
@ 2001-08-09  7:10   ` David Mentre
  1 sibling, 0 replies; 4+ messages in thread
From: David Mentre @ 2001-08-09  7:10 UTC (permalink / raw)
  To: JayR; +Cc: caml-list

JayR <jcriddle4@home.com> writes:

> # let id x = x;;
> val id : 'a -> 'a = <fun>

This expression is fully polymorphic.

# id 7;;
- : int = 7
# id "w";;
- : string = "w"


> # let id2 = id id;;
> val id2 : '_a -> '_a = <fun>

This one is not (notice the underscore (_) before the type variable
a). It is a monomorphic type that is right know unknown but will be
determined at first instantiation.

> # id2 7;;
> - : int = 7

# id2;;
- : int -> int = <fun>

You see, you now have int instead of '_a.

> # id2 "w";;
> This expression has type string but is here used with type int

So of course the type does not match with a string parameter.

For further information on this subject, have a look at the FAQ:
http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles 

Best regards,
d.
-- 
 David.Mentre@inria.fr
 Opinions expressed here are only mine.
-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-08-09  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-08 18:35 [Caml-list] native code debugging Chris Hecker
2001-08-09  1:36 ` JayR
2001-08-09  7:08   ` Florian Hars
2001-08-09  7:10   ` False polymorphic (was: Re: [Caml-list] native code debugging) David Mentre

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).