[GHC] #8113: Cannot override ghci builtin commands with :def[!]
GHC
ghc-devs at haskell.org
Thu Aug 29 02:44:56 UTC 2013
#8113: Cannot override ghci builtin commands with :def[!]
-------------------------------------+-------------------------------------
Reporter: duncan | Owner:
Type: bug | Status: closed
Priority: normal | Milestone: 7.8.1
Component: GHCi | Version: 7.6.3
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: Other | Difficulty: Easy (less than 1
Test Case: | hour)
ghci/scripts/T8113 | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+-------------------------------------
Comment (by rwbarton):
I suppose what I specifically want to happen when I enter a `:command` is
an algorithm like this.
If the name I entered is an exact match for a macro or built-in, use that
name.
Otherwise, try to complete the name to the name of a ''built-in'' in the
traditional way. If this succeeds, use the resulting name.
Otherwise, try to complete the name to the name of a macro, and use the
resulting name if that succeeds, otherwise give up.
In all cases where we got a name, use the ''macro'' of that name if there
is one, and otherwise use the built-in. (Obviously, for `::command`,
ignore macros entirely.)
In other words, built-ins should take precedence over macros for the
purpose of name ''completion'', but macros should take precedence over
built-ins for the purpose of name ''lookup''. This is backwards-
compatible from the perspective of the user who is not aware of the
change—`:t` will always mean `:type`, as long as the user has no macro
named `:t`, just like in previous versions of ghci—while still allowing
the aware user to redefine exactly what `:type` means. And it's flexible
enough in that if the user really wants `:t` to complete to some other
macro `:test` that they've written, they can always define another macro
`:t` to expand to `:test`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8113#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list