Sat, 20 May 2000 20:45:47 +1000, Fergus Henderson <[EMAIL PROTECTED]> pisze:

> For the next version of Haskell, I propose changing the wording to
> 
>       The integer literal i is equivalent to fromInteger i.  Normally
>       fromInteger is a method in the standard Prelude class Num (see Section
>       6.4.1), but it is also possible for modules to use `import qualified
>       Prelude' and then define their own fromInteger function or method,
>       or import fromInteger from another module.

Such breakage of lexical scoping is generally dangerous and bad
language design (like using C preprocessor); not because it is a
change, but in itself.

I would be disappointed if code like:
    bad x = -x
        where
        negate = ...
did not use standard meaning of unary negation.

> This is somewhat ambiguous; if it is really intended that unary -
> always refer to the negate function define in the Prelude, it really
> ought to be written as
> 
>       The special form -e denotes prefix negation, the only prefix operator in 
>Haskell , and is
>       syntax for Prelude.negate (e).
>                  ^^^^^^^^

IMHO it is better to state that all such names mentioned in the report
refer to Prelude versions, than to clutter the report with explicit
Prelude qualification everywhere.

It's simply more readable. And definition of a function normally
does not require qualification of names it uses, because Haskell is
lexically scoped. Specification of syntactic sugar in terms of the
core language is not a blind textual substitution.

[...]

> So again, for the next version of Haskell I propose the wording be
> changed to make it clear that the `>>' and `>>=' in the translation
> for `do' expressions need not refer to the methods defined in the
> standard Prelude.

And if someone does not use >> and >>= at all, only "do" notation,
and defines >> as right bit shift, "do" stops working?!

Haskell is lexically scoped!

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to