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: 6610 Reporter: herbelin Status: closed (set by @damiendoligez on 2016-04-12T13:09:34Z) Resolution: not a bug Priority: normal Severity: minor Version: 4.01.0 Target version: 4.03.0+dev / +beta1 Category: tools (ocaml{lex,yacc,dep,debug,...}) Related to:#5975 Monitored by:@gasche
Bug description
Hi,
I'm not sure this is a bug or an intended feature. In the trace mechanism, optional arguments with a default value are printed using their internal representation in the option type rather than using their usage type, as in:
let f ?(a=true) x = if a then x else x;;
#trace f;;
f 1;;
(*
f <-- ?a:None
f -->
f* <--
f* -->
*)
Steps to reproduce
let f ?(a=true) x = if a then x else x;;
#trace f;;
f 1;;
The text was updated successfully, but these errors were encountered:
I built my understanding of optional arguments empirically by reading code using optional arguments, without explicitly thinking at their internal representation. This was cases with a default value for which the abstraction w.r.t. the internal representation as an option type apparently worked well.
I now acknowledge that the current mechanism of optional arguments cannot be explained without referring to its implementation as syntactic sugar on top of the option type, renouncing to propose a true abstraction,
Original bug ID: 6610
Reporter: herbelin
Status: closed (set by @damiendoligez on 2016-04-12T13:09:34Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 4.01.0
Target version: 4.03.0+dev / +beta1
Category: tools (ocaml{lex,yacc,dep,debug,...})
Related to: #5975
Monitored by: @gasche
Bug description
Hi,
I'm not sure this is a bug or an intended feature. In the trace mechanism, optional arguments with a default value are printed using their internal representation in the option type rather than using their usage type, as in:
let f ?(a=true) x = if a then x else x;;
#trace f;;
f 1;;
(*
f <-- ?a:None
f -->
f* <--
f* -->
*)
Steps to reproduce
let f ?(a=true) x = if a then x else x;;
#trace f;;
f 1;;
The text was updated successfully, but these errors were encountered: