Closed
Description
It seems that while
does not need to be a part of the core language. A simple definition such as,
@tailrec
def while(pred: => Boolean)(fn: => Unit): Unit = if(pred) { fn; while(pred)(fn) }
in Predef
would suffice to provide the same functionality, and would enable a slight reduction in the size of the core language. I don't know what difference (if any) it would make to performance characteristics. There would be a potential disadvantage that it would become possible to shadow the while
method, but not by existing code, of course.
Something similar would probably be possible with do
/while
syntax.
Metadata
Metadata
Assignees
Labels
No labels