Skip to content

Commit e61fbd4

Browse files
committed
fix.
1 parent 8e5400f commit e61fbd4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proposals/024-any-dyn-types.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Currently, Slang allows interface types to be used directly to declare a variabl
2020

2121
### Language Version
2222

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.
2424

2525
### Dynamic interface types
2626

@@ -41,6 +41,7 @@ By default, a `dyn` interface is subject to the following restrictions, unless l
4141
1. It must not define any generic methods.
4242
1. It must not define any mutating methods.
4343
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]`.
4445

4546
Any type that conforms to one or more `dyn` interface is subject to these restrictions:
4647

@@ -49,6 +50,7 @@ Any type that conforms to one or more `dyn` interface is subject to these restri
4950
In addition, such types are subject to these restrictions unless language version is 2025 or `-enable-experimental-dynamic-dispatch` flag is present:
5051

5152
1. The type itself cannot be generic.
53+
1. Extensions that make types conform to `dyn` interfaces are not allowed.
5254

5355
### Use of interface types
5456

@@ -69,6 +71,7 @@ The following rules apply to `some` and `dyn` qualifiers on var decls:
6971
1. A value of `dyn` interface type cannot be assigned to a location of `some` interface type, but the opposite direction is OK.
7072
1. Attempting to use a `dyn` or `some` typed value before initialization is an error.
7173

74+
7275
Here is an example demonstrating the rules:
7376

7477
```

0 commit comments

Comments
 (0)