[Grace-core] fixing REPL's
Kim Bruce
kim at cs.pomona.edu
Thu May 2 13:30:13 PDT 2013
Andrew,
Sounds good to me, but I thought you were the one concerned about interpreting REPLs. If it is all just sitting in a general (completed) object, then it shouldn't be a problem. Of course we do need a way of stepping through an execution, but that's a bit off to the side.
Kim
On May 2, 2013, at 10:34 AM, Andrew P Black <andrew.p.black at gmail.com> wrote:
> I'm not impressed by the "nested scopes" idea for a dynamic language like Grace. And we don't have teletypes any more, so we should be re-thinking "REPL", which implies that we do. I like to think of a "play space" in which the student can edit and execute code.
>
> It seems much more reasonable to me to treat the contents of the "play" window as a grace program, make it editable and executable, and make the semantics identical to what would be in a file.
>
> In particular, the Grace equivalent of
>
> Prelude> let sqr x = x * x
> Prelude> let sqq x = (sqr x) + 1
> Prelude> sqq 5
> 26
>
> would be
>
> method sqr(x) { x * x }
> method sqq(x) = { sqr(x) + 1 }
>
> and that sqr(x) on the second line means self.sqr(x) — it's supposed to be dynamically bound. So if the student re-defined sqr(x), she will expect the behaviour of sqq to change.
>
> This can be made clear to the student by letting them EDIT the code in the "play" window, i.e., change the definition of method sqr rather than typing another one.
>
> Andrew
>
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
More information about the Grace-core
mailing list