Closed ionathanch closed 3 years ago
@ionathanch I can change the parts I've written about functions
I was thinking the same thing, since they're both Contracted
, but yeah it seemed like it would make the code more complex to deduplicate things
I was thinking we'd define a sealed trait where we only declare the things we care about, then have Function
and Method
implement it and override those values specifically. They'd then have a .toFunction
or .toMethod
thing we'd call at the end after we do the rewrite but I'm just yak shaving here
Please don't implement this lol update comment
Because the body of Function
is an Option[Exp]
, while the body of Method
is an Option[Seqn]
(statements)
Just realized I haven't written any test examples, gonna do some (or one, at least) and merge after that
🅱️regor spinning in his grave rn
Might as well, right? Gotta change the writeup to include this though, but functions are similar enough to methods that it can probably just be mentioned in passing. The only difference is that the body of a function is an expression, not a statement.