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.fprintf does not support string substitution #5803

Closed
vicuna opened this issue Oct 28, 2012 · 2 comments
Closed

Format.fprintf does not support string substitution #5803

vicuna opened this issue Oct 28, 2012 · 2 comments
Milestone

Comments

@vicuna
Copy link

vicuna commented Oct 28, 2012

Original bug ID: 5803
Reporter: @bobzhang
Status: closed (set by @xavierleroy on 2015-12-11T18:20:57Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: standard library
Monitored by: @hcarty

Bug description

let print_money currency_fmt sum =
Printf.printf "ammount due: %(%i%)" currency_fmt sum;;
let print_dollar sum = print_money "$ %i" sum ;;

print_dollar 32;;

let print_money currency_fmt sum =
Format.fprintf Format.std_formatter "ammount due: %(%i%)" currency_fmt sum;;
let print_dollar sum = print_money "$ %i" sum ;;
print_dollar 32;

the two print_dollars behave differently..

@vicuna
Copy link
Author

vicuna commented Jan 3, 2013

Comment author: @damiendoligez

The second version prints "ammount due: ", then returns a wrong value (probably a closure) under the [unit] type. This is a bug in Format.

@vicuna
Copy link
Author

vicuna commented Jul 11, 2013

Comment author: @damiendoligez

This appears to be fixed in 4.01.0+dev.

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added the stdlib label Mar 14, 2019
@vicuna vicuna added this to the 4.01.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant