Skip to content

Commit 0e6e16f

Browse files
committed
Incorporate feedback by @janekdb and @dwijnand
Thank you.
1 parent 5462e27 commit 0e6e16f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sips/pending/_posts/2016-01-11-static-members.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Static methods and fields for JavaScript classes are one of the very few things
2525

2626
## Overview ##
2727

28-
In order for method or field to be considered static it needs to be defined in an `object` and annotated `@static`.
28+
In order for a method or field to be considered static it needs to be defined in an `object` and annotated `@static`.
2929
There is no special syntax proposed to access these members, they are accessed as if they were a member of defining objects with all appropriate access requirements for accessing them.
3030

3131
For example:
@@ -44,7 +44,7 @@ println(Foo.bar(12))
4444
{% endhighlight %}
4545
```
4646

47-
Intuively, the presence of the `@static` annotation ensures that a field/method is declared as a static member of the companion class.
47+
Intuitively, the presence of the `@static` annotation ensures that a field/method is declared as a static member of the companion class.
4848
For the JVM, the above would therefore look to other Java code as if it had been declared with the following Java code:
4949

5050
```java
@@ -87,7 +87,7 @@ Foo.x = 5; // in ES6, there is no declarative syntax for static fields yet
8787
{% endhighlight %}
8888
```
8989

90-
## Comparisson with mirror classes ##
90+
## Comparison with mirror classes ##
9191

9292
Scalac currently generates static forwarders for fields and methods in top-level objects:
9393

@@ -108,7 +108,7 @@ If not annotated, it will be created in the companion module with a static forwa
108108

109109
## Restrictions ##
110110

111-
The following rules ensure that method can be correctly compiled into static member on both JVM and JavaScript:
111+
The following rules ensure that methods can be correctly compiled into static members on both JVM and JavaScript:
112112

113113
1. Only objects can have members annotated with `@static`
114114

@@ -130,14 +130,14 @@ If implemented in the dotty code base, the following modifications would be need
130130
- extend `LambdaLift` to trigger an error if a method annotated with `@static` method cannot be lifted to the top level scope;
131131
- extend `GenBCode` to emit static fields and methods in companion classes and forwarders to them in companion modules.
132132

133-
## Overriding&Hiding ##
133+
## Overriding & Hiding ##
134134
Java allows classes to define static methods with the same name and signature as a static method of a superclass. In order to define the semantics of such cases, the Java Specification introduces the notion of [hiding](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.8.2).
135135

136136
This is required because in Java calling a `static` method on a class instance is supported.
137137
This proposal does not need to introduce this notion as we do not support such calls.
138138

139139
## Comparison with [@lrytz's proposal](https://gist.github.com/lrytz/80f3141de8240f9629da) ##
140-
Lucas Rytz has proposed a similar SIP, but his SIP requires changes to the typer to ensure that `@static` fields do not capture `this`, as in his proposal `@static` fields are defined in the class, rather than its companion object.
140+
Lukas Rytz has proposed a similar SIP, but his SIP requires changes to the typer to ensure that `@static` fields do not capture `this`, as in his proposal `@static` fields are defined in the class, rather than its companion object.
141141
It also does not address the question of `@static` members in inner objects and inheritance/hiding of those methods in subclasses.
142142

143143
## Open questions ##

0 commit comments

Comments
 (0)