Replies: 1 comment 3 replies
-
That's the one you want.
There is a good reason. You showed very clearly that 1. and 3. are not acceptable. There's your reason for using currying. There is precedent for this design in the Scala.js IR, by the way. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I'm working on (my branch) adding position information (
span
) to trees. I've tried three implementations. Which implementation do you think is the best?span
as a field ofTree
liketpe
span
as the second parameter list of constructors. E.g.,Ident(x)(span)
span
to the first parameter list of constructors. E.g.,Ident(x, span)
The first implementation is not good enough because we must call
setSpan
for everyTree
. If we forget it,span
will be the default valueNoSpan
.The second implementation uses currying. But there's not a good reason for using currying.
The last implementation may be the most reasonable, and I'm using it. The problem is it changes the number of parameters. I have to modify every occurance of them. It was a disaster to modify the
ReadTreeSuite
, which had over 1,700 lines of code. I used scalameta to do so but the beautiful formats of cases were lost. I think you won't be happy with that.If you have better ways of implementing the position, please let me know!
Beta Was this translation helpful? Give feedback.
All reactions