Are you for or against writing "otherwise" as a keyword?
otherwise
is frequently used and therefore should have been written as a keyword.\\
otherwise
was coded in prelude like this otherwise = True
\\
So what is the reason that otherwise
was not coded as a keyword?\\
\\
To understand you have to go back. It seems that this has been done to minimize the number of keywords.\\
Today it seems surprising. And I wonder why we wrote the conditional expression with if``then``else
?
That's three additional keywords.\\
\\
It would have been better to write the conditional expression as in Sasl condition -> exp1 ; exp22
(By adapting the operators of course.)\\
Let's go back to otherwise
. And take a look at this code.\\
otherwise :: Bool
otherwise = Prelude.otherwise
sig :: Integer -> Integer
sig n | a = -1
| b = 0
| Main.otherwise = 1
where { a = n < 0;
b = n == 0 }
z :: Bool
z = if Main.otherwise == Prelude.otherwise then True else False
main :: IO ()
main = do {
print (sig 0);
print (z) }
This code works but the compiler result is different by adding or removing the first two lines of code.\\
For me it is urgent that otherwise
become a keyword as in Miranda.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |