|Anonymous | Login | Signup for a new account||2016-02-06 01:25 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004956||OCaml||OCaml general||public||2010-01-07 11:41||2011-12-09 11:08|
|Target Version||Fixed in Version|
|Summary||0004956: Printf format: %v or %V to print any value|
|Description||The idea is to be able to write :|
"Hello %v, %v and %v are OCaml values"
[ 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 <fun>, abstract values as <abstr>.
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 <poly>.
Maybe %V is better than %v, as the convention seems to be that uppercase letter use OCaml conventions.
|Tags||No tags attached.|
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 <poly> 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.
|2010-01-07 11:41||Bardou||New Issue|
|2010-01-07 15:22||doligez||Status||new => acknowledged|
|2010-01-12 10:01||weis||Note Added: 0005227|
|Copyright © 2000 - 2011 MantisBT Group|