May be you are right.
I cannot see the difference between
// Virtualized built-ins
def __ifThenElse[T](cond: => Boolean, thenp: => T, elsep: => T): T
And:
def foreach[U](f: Elem => U): Unit
So I just do not understand why such optimization(foreach
) does not work by default.
Currently I can see, that
@tailrec
def gcd(a: Int, b: Int): Int = …
works fine.
And I can see that for
does not work fine in some case.
So I prefer to have anotation which always works fine, than a declaration that works fine in most cases.
I just do not want to make something like
for if
If the compiler guarantees it I will completely agree with you.