Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006769OCamlstandard librarypublic2015-02-03 21:112018-06-06 10:58
Assigned Toweis 
PlatformOSOS Version
Product Version4.02.1 
Target VersionFixed in Version 
Summary0006769: Formatting tags are lost on a flush
DescriptionI'm not sure whether it is a bug or feature, but if you flush formatter, it will "forget" all its tags.

Steps To Reproduce# set_tags true;;
- : unit = ()
# printf "@{<html>@{<body>hello@}@}";;
<html><body>hello</body></html>- : unit = ()
# printf "@{<html>@{<body>hello@.@}@}";;
- : unit = ()
Additional Informationis also reproducible on 4.01
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
doligez (administrator)
2017-03-15 15:13

The question is whether `flush` should close the currently open tags as well as the boxes.
ivg (reporter)
2017-03-15 15:47

Tags represent semantics (i.e., what is data about), where boxes represent the syntax (i.e., how it is printed; how it looks like).

Intuitively, the flush operation should be transparent with respect to the syntax and semantics of data. So the same program with and without interleaved flushes should have the same final output. This is the first invariant.

Another intuitive property is that flush should dump all available data. This is the second invariant.

It is not trivial to preserve both these properties with respect to boxes since we can't layout a stream that has non-closed boxes.

A possible solution is to provide two `flush` functions - `hard_flush` and `flush`. The `hard_flush` may break the first invariant (syntax and semantics), but will never violate the second one. It should be used at the end of the program, or other already exceptional/abnormal conditions. The normal `flush` function, will always preserve the first invariant, although the second one will be relaxed. Basically, a `flush ppf` is a recommendation to flush data as soon as possible.
weis (developer)
2018-06-06 10:22

This has been solved on 2016/05/24.
weis (developer)
2018-06-06 10:53

When flushing, the pretty-printer engine now automatically closes all open semantic tags. This is consistent to the treatment of pretty-printing boxes that are all closed before rendering available material. Note that closing a semantic tag may output arbitrary text (close tag printing and marking). Hence, the rendering engine now automaticall adds new material to the output. One can argue that automatically closing semantic tags and adding material to the output may surprise the user and hurt the program normal behavior; however, not closing a semantic tag is most likely a bug and the new behavior will reveal the problem and help to fix it.
weis (developer)
2018-06-06 10:58

Resolved for two years and no complaint reported => close it!

- Issue History
Date Modified Username Field Change
2015-02-03 21:11 ivg New Issue
2015-02-19 00:10 doligez Status new => acknowledged
2015-02-19 00:10 doligez Target Version => 4.03.0+dev / +beta1
2016-04-18 14:13 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2017-02-16 14:01 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:43 doligez Category OCaml standard library => standard library
2017-03-15 15:13 doligez Note Added: 0017674
2017-03-15 15:14 doligez Assigned To => weis
2017-03-15 15:14 doligez Status acknowledged => assigned
2017-03-15 15:14 doligez Target Version undecided =>
2017-03-15 15:47 ivg Note Added: 0017677
2018-06-06 10:22 weis Note Added: 0019159
2018-06-06 10:53 weis Note Added: 0019160
2018-06-06 10:53 weis Status assigned => resolved
2018-06-06 10:53 weis Resolution open => fixed
2018-06-06 10:58 weis Note Added: 0019161
2018-06-06 10:58 weis Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker