-
Notifications
You must be signed in to change notification settings - Fork 54
Created puzzler: What's in a box. #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@tbvh: Hi Tim Thanks for this! I get the following when running this in the REPL:
I'm guessing that's what your expecting. My main question is: what do you regard as the main element of the puzzler? To me, the most potentially confusing line is I'm asking because, if we think it's likely that the reader will either think that @nermin: Your thoughts..? |
Thanks for your reply. I encountered this puzzle IRL, when I was looking at HList. I didn't really know about right binding methods at that time. As I was experimenting with them, I implemented them using On the other hand, I do understand your point, perhaps equallity is too obvious. I was looking for an operation on Tuple, that I could implement on Box, so that I could call the (apparent) Box method on my Tuple object and raise the confusion. But I didn't find an appropriate method, other that equals. I have two suggestions
For 1, equality would still fail, but we are accessing a member Let me know what you think. |
@tbvh: Thank you for the update. Been a busy week here, but I hope to be able to get round to responding in the next couple of days. Thanks for your patience! ;-) |
Thanks for the suggestions, @tbvh! As you also pointed out, the
with candidate answers such as "does not compile", "prints true", "prints false", "throws an exception" or so. The reason I'm still in two minds about this is because it fundamentally relies on the fact that the reader simply doesn't know the The fact that this actually compiles (because a tuple happens to have a value |
Not very puzzling. The day one of fast track to Scala has maps But a puzzler on the DSL, Candidate implicits undergo overload resolution. Is there a way to make it prefer the Predef arrow conversion? One can construct puzzlers like crosswords, but it's more fun to stumble across them |
@tbvh Any thoughts on A.P. Marki's comments? I'm inclined to agree that we need to find a reason for the puzzler that is not just that users don't know about @som-snytt: Thoughts on the following?
I guess the associativity of the arrows shouldn't really be a surprise - the odd thing perhaps is this even compiles, i.e. that @nermin: Your thoughts on this one..? |
@demobox That's pretty good. They've done work to stanch the members leaking in from implicits. This is from Tuple2Zipped.Ops, and it's not even Although it's kind of a bug, it's such a common occurrence that it's more of a syndrome. So that's a useful lesson. I wonder if IntelliJ tells you what introduced the member. Actually, it's in the scaladoc: I just fixed a bug with that -- oh yeah, it failed if the implicit took a by-name arg. OK, why not, https://issues.scala-lang.org/browse/SI-9382 |
Thank you for this discussion. I hope to be able to return one day with a valid puzzler. (For puzzlers sake of course, not to pick on Scala.) |
Next puzzlers presentation should have an animation depicting a dart board with a photo of Martin. When the audience is stumped, a dart lands dead center, bull's-eye. As more people answer correctly or groan at how stupid the puzzler is, the dart flies wider of the mark. |
Tricks you on a method '->', by application of the ArrowAssoc implicit conversion.
Probably works with 2.9.0 (and older), but tested on 2.11.4.