Qualified identifiers opinion
Christian Maeder
Christian.Maeder at dfki.de
Mon Aug 20 07:21:22 EDT 2007
Simon Marlow wrote:
> I believe the solution we adopted for GHC 6.8.1 (and I proposed for
> Haskell') strikes the right balance.
>
> M.where is lexed as an identifier. This doesn't require adding any
> exceptions or corner cases to either the implementation or the
> specification of the grammar. It is much easier to implement than the
> existing Haskell 98 rule (I deleted 30 lines of code from GHC's lexer to
> implement it). It's easy to understand. It removes an opportunity for
> obfuscation. It must be the right thing!
Yes, and fortunately (for all tools that output names unqualified, like
ghci's browse) an identifier like "M.where" is unusable, because ghc
fails with:
Qualified name in function definition
Otherwise (or nevertheless) I would invest an extra code line in the
lexer to rule out such identifiers.
C.
More information about the Glasgow-haskell-users
mailing list