16 Jul 19:46
Is "typecase self of" a syntax error?
From: Sorin Miklós Zsejki <zsejki@...>
Subject: Is "typecase self of" a syntax error?
Newsgroups: gmane.comp.lang.fortress.general
Date: 2008-07-16 17:50:14 GMT
Subject: Is "typecase self of" a syntax error?
Newsgroups: gmane.comp.lang.fortress.general
Date: 2008-07-16 17:50:14 GMT
If I have:
component Main
export Executable
trait T
m() = typecase self of
T => "T"
else => "else"
end
end
run(args) = ()
end
I get "/path.../Main.fss:5:24: Syntax Error". Is it an error? If I
have "typecase s = self of" instead, I don't get the error message.
Unrelated to this, I've seen I pass "-Dfortress.static.analysis=1"
when I call fortress. Probably this was documented sometime somewhere.
Does this still have an effect? If so, does it have the same effect as
running typecheck before?
The only reason I can
think that you might want to do this to if the typecase is a (small)
part of a larger body, and doesn't correspond to another method
(especially if the subtraits may be defined in different
components). Something like:
trait T
m() = do
(* lots of stuff here *)
typecase self of
U => u()
V => v()
else => () (* do nothing *)
end
(* more stuff *)
end
trait U extends T
u() = ...
end
trait V extends T
v() = ...
end
RSS Feed