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
Copy file name to clipboardExpand all lines: proposals/024-any-dyn-types.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Currently, Slang allows interface types to be used directly to declare a variabl
20
20
21
21
### Language Version
22
22
23
-
We introduce Slang language version 2026, which can be enabled with compiler flag -lang 2026. By default, the compiler assumes language version 2025. Many breaking changes in this proposal is behind language version 2026.
23
+
The new syntax and type checking rules are introduced to Slang language version 2026, which can be enabled with compiler flag -lang 2026. By default, the compiler assumes language version 2025 so existing code will continue to compile.
24
24
25
25
### Dynamic interface types
26
26
@@ -41,6 +41,7 @@ By default, a `dyn` interface is subject to the following restrictions, unless l
41
41
1. It must not define any generic methods.
42
42
1. It must not define any mutating methods.
43
43
1. It cannot contain any methods that has a `some IFoo` return type, or has any `some IFoo` parameters.
44
+
1. A `dyn` interface cannot inherit from `IDifferentiable`, and cannot contain any function requirements that are marked as `[Differentiable]`.
44
45
45
46
Any type that conforms to one or more `dyn` interface is subject to these restrictions:
46
47
@@ -49,6 +50,7 @@ Any type that conforms to one or more `dyn` interface is subject to these restri
49
50
In addition, such types are subject to these restrictions unless language version is 2025 or `-enable-experimental-dynamic-dispatch` flag is present:
50
51
51
52
1. The type itself cannot be generic.
53
+
1. Extensions that make types conform to `dyn` interfaces are not allowed.
52
54
53
55
### Use of interface types
54
56
@@ -69,6 +71,7 @@ The following rules apply to `some` and `dyn` qualifiers on var decls:
69
71
1. A value of `dyn` interface type cannot be assigned to a location of `some` interface type, but the opposite direction is OK.
70
72
1. Attempting to use a `dyn` or `some` typed value before initialization is an error.
0 commit comments