caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Does this function exist?
@ 2002-09-18 23:01 Gurr, David (MED, self)
  0 siblings, 0 replies; 15+ messages in thread
From: Gurr, David (MED, self) @ 2002-09-18 23:01 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: caml-list, Gurr David (MED Self) (E-mail)



> -----Original Message-----
> From: Kontra, Gergely [mailto:kgergely@mlabdial.hit.bme.hu]
> Sent: Tuesday, September 17, 2002 9:21 AM
> To: John Prevost
> Cc: Lukasz Lew; caml-list@inria.fr
> Subject: Re: [Caml-list] Does this function exist?
> 
> 
> >Doesn't matter--you still need type information.
> 
> BTW allowing polymorphism doesn't solve the problem? Ocaml is strictly
> typed, so one can figure out it's parameter in compile-type, right?
> Or wrong?

Most ML languages do type erasure rather than 
dictionary passing.  Yeah, the compiler knows the type,
but you want the runtime to know the type.  But the 
runtime doesn't know much more than int,float,closure,
pointer to something with a constructor tag.  Java's
reflection and C++ RTTI come at a price that is 
considered wrong by designers who pick type erasure.
I am a fan of reflection but I agree with Ocaml's
choices.  What you seem to want is IMHO something
that is right for debuggers and interactive toploops
but not other code, thus they not the other code should
pay the price.  Read up on implementation of ML on
JVM or MSCLR for an alternative to the Ocaml choices.
-D
PS if you are really into this, you could implement
RTTI with preprocessing via camlp4 (?or MetaOcaml?).

> Gergo
> 
> +-[Kontra, Gergely @ Budapest University of Technology and 
> Economics]-+
> |         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu  
>         |
> |  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 
> 9656     |
> +-------"Olyan langesz vagyok, hogy poroltoval kellene 
> jarnom!"-------+
> .
> Magyar php mirror es magyar php dokumentacio: http://hu.php.net
> 
> -------------------
> 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
> 
-------------------
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


^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: [Caml-list] Does this function exist?
@ 2002-09-18 23:01 Gurr, David (MED, self)
  0 siblings, 0 replies; 15+ messages in thread
From: Gurr, David (MED, self) @ 2002-09-18 23:01 UTC (permalink / raw)
  To: Florian Hars; +Cc: caml-list, Gurr David (MED Self) (E-mail)



> -----Original Message-----
> From: Florian Hars [mailto:florian@hars.de]
> Sent: Tuesday, September 17, 2002 10:18 AM
> To: Kontra, Gergely
> Cc: caml-list@inria.fr
> Subject: Re: [Caml-list] Does this function exist?
> 
> 
> Kontra, Gergely wrote:
> > BTW allowing polimorphism doesn't solve the problem? 
> 
> No
> 
>  > Ocaml is strictly
> > typed, so one can figure out it's parameter in compile-type, right?
> 
> Yes. This is why such a beast as requested at the start of 
> this thread can't be
> implemented as a function, but only with some serious 
> compiler magic (that 
> breaks separate compilation) like the toplevel does.

How does the toploop break separate compilation?  The toploop
is not magic and any user program that needs the same 
functionality (like a debugger) could do the same.

> 
> How would you compile a module like:
> 
> type verbose_list 'a = Nil | Cons of 'a * 'a verbose_list
> let cons elt l =
> 	print_string "Consing element ";
> 	print elt;
> 	print_string " to list ";
> 	print l;
> 	print_newline ();
> 	Cons (elt, l)
> 
> when all you know about elt at compile time is that it is 
> completly polymorphic?

The same way that F# knows it.  F# has separate compilation.
Or Java, or C#, or Smalltalk, or Perl.  Not that that I 
believe that that is a "good thing".

-D

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


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [Caml-list] Does this function exist?
@ 2002-09-09 17:56 Lukasz Lew
  2002-09-09 19:34 ` John Prevost
  0 siblings, 1 reply; 15+ messages in thread
From: Lukasz Lew @ 2002-09-09 17:56 UTC (permalink / raw)
  To: caml-list

Hello 
Is there in OCaml a function ['a -> ()] which would print striong 
representation of first arument on stdout, just like OcamlTop does?

print [3; 3];;

should print:
"- : int list = [3; 3]"

It would be very usefull for debugging.
Lukasz Lew

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

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


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

end of thread, other threads:[~2002-09-18 23:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-18 23:01 [Caml-list] Does this function exist? Gurr, David (MED, self)
  -- strict thread matches above, loose matches on Subject: below --
2002-09-18 23:01 Gurr, David (MED, self)
2002-09-09 17:56 Lukasz Lew
2002-09-09 19:34 ` John Prevost
2002-09-09 20:18   ` Lukasz Lew
2002-09-09 20:55     ` John Prevost
2002-09-09 20:59       ` Lukasz Lew
2002-09-17 16:21       ` Kontra, Gergely
2002-09-17 17:17         ` Florian Hars
2002-09-09 21:40     ` Yutaka OIWA
2002-09-09 23:10     ` Nicolas Cannasse
     [not found]   ` <Pine.LNX.4.44.0209092212360.21417-100000@zodiac.mimuw.edu. pl>
2002-09-09 22:05     ` Chris Hecker
2002-09-09 22:48       ` Remi VANICAT
2002-09-10  1:10         ` Daniel de Rauglaudre
2002-09-16 16:56   ` Kontra, Gergely

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