utop icon indicating copy to clipboard operation
utop copied to clipboard

_ prefixed identifies not shown in signatures

Open Drup opened this issue 11 years ago • 6 comments

In utop:

# module Foo = struct   let x = 1  let _y = 2 end ;;
module Foo : sig val x : int end 

in ocaml:

 # module Foo = struct   let x = 1  let _y = 2 end ;;
module Foo : sig val x : int val _y : int end

This is just wrong. T_T

Drup avatar Aug 06 '14 19:08 Drup

It's a feature ;) You can disable it with:

  • UTop.set_hide_reserved false;;
  • the -show-reserved command line flag

ghost avatar Aug 11 '14 12:08 ghost

For the record it was requested for syntax extensions that generate _ prefixed values.

ghost avatar Aug 11 '14 12:08 ghost

I'm not very fond of inconsistency with regular ocaml by default, it's confusing for most people, and informed users can change the default if they want to.

Drup avatar Aug 11 '14 14:08 Drup

utop doesn't try to mimic exactly the behavior of the default toplevel. It tries to focus on the user experience so I don't think it is a problem if it makes different choices. If the consensus was that show-reserved is a better default then it could certainly be changed but there have been more requests for making hide-reserved the default.

ghost avatar Aug 11 '14 14:08 ghost

Hum, ok, fair enough. Would it be possible to enable only in presence of camlp4 ?

Drup avatar Aug 11 '14 16:08 Drup

Even without camlp4 it is common practice to have _ prefixed identifiers for private stuff that shouldn't be exposed to the user. And automatically setting this when loading camlp4 or ppx would not play nice with command line flags or the user calling [UTop.set_hide_reserved] explicitly.

ghost avatar Aug 12 '14 08:08 ghost