Skip to content

Commit 28b5b6e

Browse files
committed
Change compatibility notice to mention possible semantics change
1 parent c46da16 commit 28b5b6e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

content/better-fors.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,15 @@ List(1, 2, 3)
358358

359359
### Compatibility
360360

361-
This change is binary and TASTY compatible since for-comprehensions are desugared in the Typer. Thus, both class and TASTY files only ever use the desugared versions of programs.
361+
This change may change the semantics of some programs. It may remove some `map` calls in the desugared code, which may change the program semantics (if the `map` implementation was side-effecting).
362362

363-
While this change is forward source compatible, it is not backward compatible, as it accepts more syntax.
363+
For example the following code will now have only one `map` call, instead of two:
364+
```scala
365+
for
366+
a <- doSth(arg)
367+
b = a
368+
yield a + b
369+
```
364370

365371
### Other concerns
366372

0 commit comments

Comments
 (0)