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. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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?spanas a field ofTreeliketpespanas the second parameter list of constructors. E.g.,Ident(x)(span)spanto the first parameter list of constructors. E.g.,Ident(x, span)The first implementation is not good enough because we must call
setSpanfor everyTree. If we forget it,spanwill 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!
All reactions