Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format.set_margin - setting to maximum value #8454

Closed
vicuna opened this issue Jan 23, 2004 · 1 comment
Closed

Format.set_margin - setting to maximum value #8454

vicuna opened this issue Jan 23, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 23, 2004

Original bug ID: 2052
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hi... I am using the Format module to pretty-print a term. I want to
have the option to print it as a single long line in certain
circumstances, although usually the term will be printed with nice
breaks, to fit within a given margin.

The obvious way to do this is to set the margin to "infinity" - a very
large value.

However, the only way to do this is to say

Format.set_margin 999999999

where it's critical that I get exactly the right number here: if it's
too high, the documentation informs me that "nothing happens". The
literal is therefore not just ugly, but also dangerous.

I would rather say either

Format.set_margin max_int

or

Format.set_margin Format.pp_infinity

This is therefore a request for either (a) Format.set_margin to treat
values >999999999 as if they were requests for 999999999, rather than
ignoring; or (b) to export pp_infinity from Format.

Thanks..

--KW 8-)

Keith Wansbrough kw217@cl.cam.ac.uk
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.

@vicuna
Copy link
Author

vicuna commented Jul 2, 2004

Comment author: administrator

see #8455
assigned to PW

Fixed by defining a function set_margin_to_max : unit -> unit that sets the
margin to the maximum that the formatter can afford.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant