You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Semi-related to #519 by the goal of improving Scala.js debugging experience.
scala-java-time makes liberal use of non-local returns, e.g.:
for (trans <- transArray) {
info = findOffsetInfo(dt, trans)
if (info.isLeft || (info ==Right(trans.getOffsetBefore)))
return info
}
On the JS platform, Scala.js tries to compile non-local returns to native return and break, but this is not always possible, so they are sometimes compiled to use the NonLocalReturnControl exception.
This presents a problem for debugging Scala.js code in the browser, because you often want to use the Break on caught exceptions debugger option (e.g. to catch the origin of the exception in effect systems / observable graphs), but scala-java-time's NonLocalReturnControl exceptions trigger the debugger just as well in that case, and when working with date-heavy code, skipping through all those exceptions becomes unfeasible. I hoped that having fixed sourcemaps, I would be able to use the browser's "don't break here" option, but it does not seem to work, not sure why.
Also, nonlocal returns as a language feature are already throwing compiler deprecation warnings in Scala 3, so we do need a long term solution for that anyway.
With all that in mind, would you entertain a PR replacing nonlocal returns with equivalent constructs, e.g. while loops, else branches, etc.? There's a lot of such returns, I don't know if I can replace all of them, but I could at least get started on that.
The text was updated successfully, but these errors were encountered:
Semi-related to #519 by the goal of improving Scala.js debugging experience.
scala-java-time makes liberal use of non-local returns, e.g.:
On the JS platform, Scala.js tries to compile non-local returns to native
return
andbreak
, but this is not always possible, so they are sometimes compiled to use theNonLocalReturnControl
exception.This presents a problem for debugging Scala.js code in the browser, because you often want to use the
Break on caught exceptions
debugger option (e.g. to catch the origin of the exception in effect systems / observable graphs), but scala-java-time'sNonLocalReturnControl
exceptions trigger the debugger just as well in that case, and when working with date-heavy code, skipping through all those exceptions becomes unfeasible. I hoped that having fixed sourcemaps, I would be able to use the browser's "don't break here" option, but it does not seem to work, not sure why.Also, nonlocal returns as a language feature are already throwing compiler deprecation warnings in Scala 3, so we do need a long term solution for that anyway.
With all that in mind, would you entertain a PR replacing nonlocal returns with equivalent constructs, e.g.
while
loops,else
branches, etc.? There's a lot of such returns, I don't know if I can replace all of them, but I could at least get started on that.The text was updated successfully, but these errors were encountered: