Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000352OCamlOCaml generalpublic2001-05-04 11:422013-07-29 07:16
Reporteradministrator 
Assigned Todoligez 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.13.0+dev 
Summary0000352: have ocaml support the '-' option (for standard input)
DescriptionFull_Name: Sven Luther
Version: 3.01
OS: debian GNU/linux
Submission from: lambda.u-strasbg.fr (130.79.90.63)


Note : this is a feature wish, i didn't find the 'priority' entry in the bug
fill form, so ...

Hello, ...

I wanted to run the labgltk examples from the lablgtk debian package, they are
on a read only directory, and some of them are compressed.

it is easy to run the uncompressed ones (lablgtk -labels file.ml), but not so
easy to run the compressed ones.

I thought it would be nice to be able to do as follows :

gunzip -c file.ml.gz | lablgtk -labels -

but ocaml clearly don't support this syntax yet.

I know about at least 2 workaround :

1) under bash you cna do :

(gunzip -c testgtk.ml.gz; echo ";;") | lablgtk -labels

but this will scroll up the display, and is not so nice.

2) you can also do :

gunzip -c testgtk.ml.gz | lablgtk -labels /dev/fd/0

but i don't think this is the nicest of solutions

3) it could be possible also to patch toplevel/toploop.ml,changing :

< let filename = find_in_path !Config.load_path name in
< let ic = open_in_bin filename in

to :

> let (filename, ic) =
> if name = "-" then
> (name, stdin)
> else
> let filename = find_in_path !Config.load_path name in
> (filename, open_in_bin_filename) in

or something such more appropriate.

Thanks to Nicolas GEORGE <nicolas.george@ens.fr>, for hinting me to those and
provide the (untested) patch.

What do you think of it ? Is this something that would be a nice addition to
ocaml, or is it not worth it, to difficult to do ?

Also you could link ocaml with zlib, so as to be able to read compressed files
directly, but i don't know if it is worth it.

Friendly,

Sven Luther
(Thanks to



TagsNo tags attached.
Attached Files

- Relationships
related to 0005232confirmed wish: -str option for ocaml 

-  Notes
(0000108)
administrator (administrator)
2002-11-13 15:39

Looks good. To be implemented.
(0006568)
doligez (administrator)
2011-12-30 17:29

[speaking for the OCaml toplevel rather than labltk]
The "-" syntax is already used by this option:

  - <file> Treat <file> as a file name (even if it starts with `-')

So I have implemented it as a "-stdin" option.

Implemented in trunk (3.13).

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2011-12-30 17:12 doligez Assigned To => doligez
2011-12-30 17:12 doligez Status acknowledged => assigned
2011-12-30 17:29 doligez Note Added: 0006568
2011-12-30 17:29 doligez Status assigned => closed
2011-12-30 17:29 doligez Resolution open => fixed
2011-12-30 17:29 doligez Fixed in Version => 3.13.0+dev
2011-12-30 17:29 doligez Description Updated View Revisions
2013-07-29 07:16 gasche Relationship added related to 0005232


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker