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

Missing Printf.ikbprintf #7110

Closed
vicuna opened this issue Dec 28, 2015 · 5 comments · Fixed by #9364
Closed

Missing Printf.ikbprintf #7110

vicuna opened this issue Dec 28, 2015 · 5 comments · Fixed by #9364

Comments

@vicuna
Copy link

vicuna commented Dec 28, 2015

Original bug ID: 7110
Reporter: berke.durak
Status: acknowledged (set by @damiendoligez on 2017-04-13T11:19:14Z)
Resolution: open
Priority: low
Severity: feature
Platform: Unix
OS: Linux
OS Version: 3.17
Version: 4.01.0
Category: standard library

Bug description

The Printf module provides an ikfprintf function that takes a continuation and ignores the format:

val ikfprintf :
  (out_channel -> 'a) ->
  out_channel -> ('b, out_channel, unit, 'a) format4 -> 'b

The same should be provided for buffers.

val ikbprintf :
  (Buffer.t -> 'a) ->
  Buffer.t -> ('b, Buffer.t, unit, 'a) format4 -> 'b

Steps to reproduce

N/A

Additional information

I noticed the ikbprintf function was missing while updating a simple logging function to provide a "log, then raise Failure exception" functionality.

The logging function was initially written with channels, but was later updated to use Buffer formatters to support logging to multiple channels.

@muskangarg21
Copy link
Contributor

@Octachron there seems to be a ikbprintf function in printf.mli printf.ml format.mli format.ml.
could you please explain what more need to be done.
Thanks

@Octachron
Copy link
Member

There is no Printf.ikbprintf? Currently, we have a group of three functions

Print on a buffer Print on a output channel
Really print kbprintf kfprintf
Pretend to print ikfprintf

And we are missing a ikbprintf, which would pretend to print on a buffer without doing anything.

@muskangarg21
Copy link
Contributor

There is no Printf.ikbprintf? Currently, we have a group of three functions
Print on a buffer Print on a output channel
Really print kbprintf kfprintf
Pretend to print x ikfprintf

And we are missing a ikbprintf, which would pretend to print on a buffer without doing anything.

Oh I misread it, Thanks for the visualisation, I ll add it in a few hours.

@muskangarg21
Copy link
Contributor

@Octachron
On making changes in stdlib/printf.ml and printf.mli, then running make I am encountering an error:

Error: Files utils/build_path_prefix_map.cmo and utils/config.cmo   
    make inconsistent assumptions over interface Stdlib__printf

@Octachron
Copy link
Member

You can normally get rid of those error with make clean

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

Successfully merging a pull request may close this issue.

4 participants