Open dotta opened 12 years ago
Martin doesn't need this for the Coursera class, so moved it to next Milestone (we will need to hack the REPL support in the compiler to get the right behavior)
I don't think this is a bug. The type of an assignment is Unit
, so there is no value to display. Otherwise, we could display ()
I see your point, but I think it's a matter of perception. I like the worksheet because it shows me the program's flow, and seeing updates to a var
is what I'd expect. (but it may be me having a wrong expectation of course)
The type of var a = 2
is Unit as well, but we display that. I would also expect to see re-assignment of a var displayed, but I'm not sure what I would expect if it were re-assigned multiple times in a loop.
Not exactly. var a = 2
is a definition, not an expression. It does not have a type (for instance, you can't assign a definition to a local variable, or pass it as argument, etc so in fact it does not have a value).
We display initial values of definitions, but not for reassignments. I don't feel that strongly about this one, but it would be an irregularity (what other expressions of type Unit
should we special case?).