caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Print values like the toplevel's printer
@ 2004-11-05 22:12 Clément Capel
  0 siblings, 0 replies; 8+ messages in thread
From: Clément Capel @ 2004-11-05 22:12 UTC (permalink / raw)
  To: Wolfgang Müller

Hello,

you should take a look at the function "execute_phrase" 
(toplevel/toploop.ml)
which evaluate and print a term.
Two interesting functions are called:
- outval_of_value
- Printtyp.tree_of_type_scheme
and
!print_out_phrase

I think the parameter "v" is the value...


Clément Capel


Le 5 nov. 04, à 13:23, Wolfgang Müller a écrit :

> Hi,
>
> I would like to print values to a file in a human-readable manner 
> without
> having to compose the output writers of print_int and friends. In 
> short, I
> would like to use the toplevel's function for screen output of 
> structured
> values.
>
> Is there a simple way, a FM or a mailing list you can point me to?
>
> I googled quite a bit, but apparently not with the right terms.
>
> Cheers,
> Wolfgang
> -- 
> Dr. Wolfgang Müller
> LS AI 1
> Universität Bayreuth
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-08 23:44   ` brogoff
@ 2004-11-09  8:48     ` Daniel Bünzli
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Bünzli @ 2004-11-09  8:48 UTC (permalink / raw)
  To: caml-list

Le 9 nov. 04, à 00:44, brogoff a écrit :

> I wonder if there is an alternative
> approach being considered to provide some of the desired features, like
> safe value IO, dynamic typing, and overloading?

Although research oriented you may want to have a look at acute, an 
extension of an ocaml core to support, among other things, type safe 
value IO :

<http://www.cl.cam.ac.uk/users/pes20/acute/>

Daniel


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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-06 11:15 ` Jim
@ 2004-11-08 23:44   ` brogoff
  2004-11-09  8:48     ` Daniel Bünzli
  0 siblings, 1 reply; 8+ messages in thread
From: brogoff @ 2004-11-08 23:44 UTC (permalink / raw)
  To: caml-list

On Sat, 6 Nov 2004, Jim wrote:
> What we really need is generics.  I thought there was a post in the
> mailing list some time ago saying that generics was going to be
> appear in O'Caml at some point, but I haven't seen anything for a long
> time.  Does anyone know if it is still planned?
>
> Regards,
> Jim

I thought that development was to continue in the OCaml branch after 3.08.
Looking at the CVS, whre nothing has been updated for over seven months, it
appears abandoned. If that's the case, I wonder if there is an alternative
approach being considered to provide some of the desired features, like
safe value IO, dynamic typing, and overloading? I was previously under the
impression that safe value IO was a very desired feature, and that once the
machinery for that was aded that the rest of GCaml would be folded in quickly.

It isn't clear to me how the GCaml extensions would work with all of the
other extensions in OCaml (objects and variants and...) and it is already a
kind of complicated language. It would be a lot easier if the generics were just
being added to Caml Special Light.

-- Brian


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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-05 12:23 Wolfgang Müller
  2004-11-05 13:31 ` [Caml-list] " padiolea
@ 2004-11-06 11:15 ` Jim
  2004-11-08 23:44   ` brogoff
  1 sibling, 1 reply; 8+ messages in thread
From: Jim @ 2004-11-06 11:15 UTC (permalink / raw)
  To: caml-list

On Fri, Nov 05, 2004 at 01:23:13PM +0100, Wolfgang Müller wrote:

> I would like to print values to a file in a human-readable manner without 
> having to compose the output writers of print_int and friends. In short, I 
> would like to use the toplevel's function for screen output of structured 
> values.
> 
> Is there a simple way, a FM or a mailing list you can point me to?
> 
> I googled quite a bit, but apparently not with the right terms.

Aside from clever uses of various bits of the top level, you can also
use camlp4 to automatically generate print functions for types.  I think
there is an example in the camlp4 manual.

What we really need is generics.  I thought there was a post in the
mailing list some time ago saying that generics was going to be
appear in O'Caml at some point, but I haven't seen anything for a long
time.  Does anyone know if it is still planned?

Regards,
Jim


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

* Re: [Caml-list] Print values like the toplevel's printer
@ 2004-11-05 23:15 Clément Capel
  0 siblings, 0 replies; 8+ messages in thread
From: Clément Capel @ 2004-11-05 23:15 UTC (permalink / raw)
  To: caml-list

Hello,

you should take a look at the function "execute_phrase" 
(toplevel/toploop.ml)
which evaluate and print a term.
Two interesting functions are called:
- outval_of_value
- Printtyp.tree_of_type_scheme
and
!print_out_phrase

I think the parameter "v" is the value...


Clément Capel


Le 5 nov. 04, à 13:23, Wolfgang Müller a écrit :

> Hi,
>
> I would like to print values to a file in a human-readable manner 
> without
> having to compose the output writers of print_int and friends. In 
> short, I
> would like to use the toplevel's function for screen output of 
> structured
> values.
>
> Is there a simple way, a FM or a mailing list you can point me to?
>
> I googled quite a bit, but apparently not with the right terms.
>
> Cheers,
> Wolfgang
> -- 
> Dr. Wolfgang Müller
> LS AI 1
> Universität Bayreuth
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-05 13:54   ` Wolfgang Müller
@ 2004-11-05 15:51     ` pad
  0 siblings, 0 replies; 8+ messages in thread
From: pad @ 2004-11-05 15:51 UTC (permalink / raw)
  To: Wolfgang Müller; +Cc: caml-list

Wolfgang Müller <Wolfgang.Mueller2@uni-bayreuth.de> writes:

> > I recently post a message to allow this (with generic print in the subject
> > of the message).
> 
> Thanks a lot, but isn't there something more simple without forking processes?

well it is quite simple to fork a process :) and it is maximum reuse :)

why don't you like this solution ? is it because it is slow ? ugly ?
there is some way to improve easily my solution by not forking each time for each
call to generic_print  by using a pipe with the toplevel
(I plan to do a tracer for ocaml better than the #trace using this technique)


> 
> Is there no way to reuse the code that is already in the toplevel?
> 
> Cheers,
> Wolfgang


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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-05 13:31 ` [Caml-list] " padiolea
@ 2004-11-05 13:54   ` Wolfgang Müller
  2004-11-05 15:51     ` pad
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Müller @ 2004-11-05 13:54 UTC (permalink / raw)
  To: caml-list

> I recently post a message to allow this (with generic print in the subject
> of the message).

Thanks a lot, but isn't there something more simple without forking processes?

Is there no way to reuse the code that is already in the toplevel?

Cheers,
Wolfgang

-- 
Dr. Wolfgang Müller
LS AI 1
Universität Bayreuth


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

* Re: [Caml-list] Print values like the toplevel's printer
  2004-11-05 12:23 Wolfgang Müller
@ 2004-11-05 13:31 ` padiolea
  2004-11-05 13:54   ` Wolfgang Müller
  2004-11-06 11:15 ` Jim
  1 sibling, 1 reply; 8+ messages in thread
From: padiolea @ 2004-11-05 13:31 UTC (permalink / raw)
  To: Wolfgang Müller; +Cc: caml-list

> Hi,
>
> I would like to print values to a file in a human-readable manner without
> having to compose the output writers of print_int and friends. In short, I
> would like to use the toplevel's function for screen output of structured
> values.

I recently post a message to allow this (with generic print in the subject
of the message).

the code is available at:
 http://www.irisa.fr/prive/padiolea/hacks/generic_print.ml

example:
  let _ = print_string (generic_print [[1;3];[2;9;8];[3;4]] "int list
list" in
  let _ = print_string (generic_print [1;3;2;9;8;3;4] "int list") in
   ...

 test:
  ./test_generic
  ==>
   [[1; 3]; [2; 9; 8]; [3; 4]]
   [1; 3; 2; 9; 8; 3; 4]




>
> Is there a simple way, a FM or a mailing list you can point me to?



>
> I googled quite a bit, but apparently not with the right terms.
>
> Cheers,
> Wolfgang
> --
> Dr. Wolfgang Müller
> LS AI 1
> Universität Bayreuth
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



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

end of thread, other threads:[~2004-11-09  8:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-05 22:12 [Caml-list] Print values like the toplevel's printer Clément Capel
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05 23:15 Clément Capel
2004-11-05 12:23 Wolfgang Müller
2004-11-05 13:31 ` [Caml-list] " padiolea
2004-11-05 13:54   ` Wolfgang Müller
2004-11-05 15:51     ` pad
2004-11-06 11:15 ` Jim
2004-11-08 23:44   ` brogoff
2004-11-09  8:48     ` Daniel Bünzli

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