Lab2 and runtime errors

47 views
Skip to first unread message

Alex Evert

unread,
Mar 12, 2014, 6:55:47 AM3/12/14
to proglang-c...@googlegroups.com
Noticed that I could get away with runtime errors as long as no output is produced, would this be considered ok?
The same behavior is present in the mini compiler (with Haskell atleast, suppose not with Java) which happily runs the following code

int x;
x = x+1;
print(1);

Kind regards,
Alex

dhausknecht

unread,
Mar 12, 2014, 7:02:37 AM3/12/14
to proglang-c...@googlegroups.com
The point is that we do NOT have Haskell but a imperative C-like language in which the second line, i.e. the assignment, simply crashes because there is no value for 'x'.
So, short answer is: No!

Alex Evert

unread,
Mar 12, 2014, 7:50:22 AM3/12/14
to proglang-c...@googlegroups.com
Ok, thanks for a definite answer.
Think the problems stems from code akin to

main = do
  a <- test
  print $ (\x y -> y) a 1

test = return $ error "test"  

which lands me in the same problem as in my other thread. 
Will not spam the boards further about this.

Kind regards,
Alex

Alex Evert

unread,
May 28, 2014, 3:59:23 AM5/28/14
to proglang-c...@googlegroups.com
There seems to have been no tests against this, and I don't see how it can easily be avoided with the monadic approach from the book. Can someone give more direct hints now when the course is finished?

Kind regards

Reply all
Reply to author
Forward
0 new messages