[Prev][Next][Index][Thread]

Dynamic typing confuses me!



Hello, I'm coming from a traditional strongly-typed background (C++ & Ada95)
and I'm trying to get a grasp on modern functional objects.
Why does this code give a run-time error?

define method fact (x) => ()
if (x = 1)
  1;
else
  fact(x - 1) * x;
end;
end method fact;

define method main () => ()
fact (5);
end method main;

begin
  main();
end;


...if I give it all the typing info, it works but it seems to me it can
infer it in theory.
Am I completly misunderstanding?

BTW I'm using functional developer...







Follow-Ups: