You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use jl.Class'es instead of ClassTag's in structural calls.
This simplifies the life of everyone: the expansion of structural
calls, the implementation of `scala.reflect.Selectable`, and the
reverse engineering performed by the Scala.js back-end.
As a side benefit, the new transformation supports bottom types in
the arguments. It was previously limited because we do not allow
the generation of `ClassTag`s for `Null` and `Nothing`: they are
unsound in arrays, which is what `ClassTag`s are designed for, but
on their own they have perfectly valid `Class`'es.
Copy file name to clipboardExpand all lines: docs/docs/reference/changed-features/structural-types-spec.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,13 +35,17 @@ def selectDynamic(name: String): T
35
35
```
36
36
Often, the return type `T` is `Any`.
37
37
38
-
The `applyDynamic` method is used for selections that are applied to arguments. It takes a method name and possibly `ClassTag`s representing its parameters types as well as the arguments to pass to the function.
38
+
Unlike `scala.Dynamic`, there is no special meaning for an `updateDynamic` method.
39
+
However, we reserve the right to give it meaning in the future.
40
+
Consequently, it is recommended not to define any member called `updateDynamic` in `Selectable`s.
41
+
42
+
The `applyDynamic` method is used for selections that are applied to arguments. It takes a method name and possibly `Class`es representing its parameters types as well as the arguments to pass to the function.
39
43
Its signature should be of one of the two following forms:
Both versions are passed the actual arguments in the `args` parameter. The second version takes in addition a vararg argument of class tags that identify the method's parameter classes. Such an argument is needed
48
+
Both versions are passed the actual arguments in the `args` parameter. The second version takes in addition a vararg argument of `java.lang.Class`es that identify the method's parameter classes. Such an argument is needed
45
49
if `applyDynamic` is implemented using Java reflection, but it could be
46
50
useful in other cases as well. `selectDynamic` and `applyDynamic` can also take additional context parameters in using clauses. These are resolved in the normal way at the callsite.
47
51
@@ -58,13 +62,13 @@ and `Rs` are structural refinement declarations, and given `v.a` of type `U`, we
0 commit comments