Skip to content

Consider removing while from the language #5440

Closed
@propensive

Description

@propensive

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions