Skip to content

@static: fix code samples in html #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions sips/pending/_posts/2016-01-11-static-members.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ These rules exist to enforce the unlikelyhood of an observable difference in sem
The restrictions in this SIP make it hard to observe changes in initialization within the same object.
It is still possible to observe those changes using multiple classes and side effects within initializers:

```scala
{% highlight scala %}
class C {
val x = {println("x"); 1 }
Expand All @@ -176,7 +175,7 @@ object Os extends C {
// x
}
{% endhighlight %}
```


Static fields can be initialized earlier than they used to be initialized while being non-static, but never later.
By requiring `@static` first to be defined first inside the object,
Expand All @@ -189,7 +188,7 @@ Unlike `@tailrec` this annotation does affect the binary API and dropping such a
An alternative to this proposal would be to emit all the fields defined in objects as static.
Unfortunately this gets us under dark waters when we try to figure out in the following example:

```

{% highlight scala %}
class Super {
val c = {println(1); 1}
Expand All @@ -199,7 +198,7 @@ object Object extends Super {
val d = {println(3); 2}
}
{% endhighlight %}
```

Let's consider possible options:

- if the field `c` is emitted as `static` on the bytecode level, it will be initialized before the `c` in superclass is initialized, reordering side-effects in initializers;
Expand Down