You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4956 Reporter: Bardou Assigned to:@alainfrisch Status: resolved (set by @alainfrisch on 2016-12-07T16:04:48Z) Resolution: suspended Priority: normal Severity: feature Version: 3.11.1 Category: standard library Monitored by: mww mehdi @ygrek@glondu@Chris00@mjambon
Bug description
The idea is to be able to write :
Printf.printf
"Hello %v, %v and %v are OCaml values"
"user name"
1
[ true; false ];
Which would print something like :
Hello "user name", 1 and [ true; false ] are OCaml values
Additional information
This would be very useful especially when debugging.
The toplevel already contains a mechanism to print any type, except functions and abstract values. The same printing conventions could be used. In particular : functions could be printed as , abstract values as .
A mechanism should be added to the typing of formats so that %v (or %V) accepts any value type. Then, code generation could use the type information to produce the correct printer.
This correct printer cannot be produced for polymorphic values, but they could be printed as .
Maybe %V is better than %v, as the convention seems to be that uppercase letter use OCaml conventions.
The text was updated successfully, but these errors were encountered:
This is a major feature wish that requires careful thinking and a lot of work!
Furthermore, we would not have a completely satisfactory solution in the end (due to this catch all case that tend to propagate, as far as you use polymorphic functions). The correct solution to get this feature in its full glory is a major modification of the type system along the lines of G'Caml.
In short, a natural feature wish in a strongly typed polymorphic language; we had it in mind for decades; unfortunately, we are not yet ready to offer it, even in the rather limited extent you proposed.
Original bug ID: 4956
Reporter: Bardou
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2016-12-07T16:04:48Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 3.11.1
Category: standard library
Monitored by: mww mehdi @ygrek @glondu @Chris00 @mjambon
Bug description
The idea is to be able to write :
Printf.printf
"Hello %v, %v and %v are OCaml values"
"user name"
1
[ true; false ];
Which would print something like :
Hello "user name", 1 and [ true; false ] are OCaml values
Additional information
This would be very useful especially when debugging.
The toplevel already contains a mechanism to print any type, except functions and abstract values. The same printing conventions could be used. In particular : functions could be printed as , abstract values as .
A mechanism should be added to the typing of formats so that %v (or %V) accepts any value type. Then, code generation could use the type information to produce the correct printer.
This correct printer cannot be produced for polymorphic values, but they could be printed as .
Maybe %V is better than %v, as the convention seems to be that uppercase letter use OCaml conventions.
The text was updated successfully, but these errors were encountered: