Add note about Scala 3 compiler flags#179
Conversation
|
I wish Take this for example: val v = Var(0)
div(
text <-- v,
onClick.mapTo(v.now() + 1) --> { if (v.now() < 5) v.writer }
)With |
I'm sorry, I didn't get it. Second, the problem in your example is indeed that we discard the writer - so it's not subscribed to clicks. The branch itself is executed - see scastie example. |
My understanding is that this warning is considered a "bug" in Scala, the one I linked. Personally, I don't think it should be considered a bug, but as today, it is. I've just added a comment to that issue with my counter-argument to the proposed change, but until and unless they change their mind, this warning is sadly slated to go away in a future release of Scala 3.
Well, yes. If the user tries to return the writer conditionally, it's because they expect to trigger it conditionally. If the writer is ignored without a warning instead, that's a problem. BTW I looked into the history a bit, and it turns out that the wvalue-discard compiler flag was only implemented in Scala 3.3.0 – I probably wrote those docs before I switched to that version. |
The import-guarded feature is safe when proper compiler flags are there