Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



#scala
whenever you encounter an expression of type Nothing: because Nothing is uninhabited (there are no values of that type) you know that the expression has no normal form; when evaluated it must (one of):
  • loop forever
  • exit the VM
  • abruptly pass control elsewhere (use return or throw exception?)
If you want to change selection, open document below and click on "Move attachment"

tpolecat
What's going on? Whatever the type of return 2 is, it comforms with both Int and String. And since both of those classes are final and Int is an AnyVal you know where this is headed. def x: Int = { val a: Nothing = return 2; 1 } Right. So, <span>whenever you encounter an expression of type Nothing you would do well to turn smartly and head the other direction. Because Nothing is uninhabited (there are no values of that type) you know that the expression has no normal form; when evaluated it must loop forever, exit the VM, or (behind door #3) abruptly pass control elsewhere, which is what's happening here. If your reaction is "well logically you're just invoking the continuation, which we totally do all the time in Scheme so I don't see the problem" then fine. Cookie for you.


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.