improved explanation for kernel only classes
This commit is contained in:
parent
284ab3324c
commit
a034251c23
13
README.md
13
README.md
|
@ -110,12 +110,13 @@ def fail_write() -> None:
|
||||||
* Only `uint32`, `int32` (and range of them) can be used as index.
|
* Only `uint32`, `int32` (and range of them) can be used as index.
|
||||||
|
|
||||||
### Kernel Only class
|
### Kernel Only class
|
||||||
* Annotate the class with `@kernel`.
|
* Annotate the class with `@kernel`/`@portable`.
|
||||||
* Functions are all kernel only, including constructor.
|
* The instance can be created from within kernel functions, or the host if it is
|
||||||
|
portable. It can be passed into kernels.
|
||||||
Questions:
|
* All methods, including the constructor, are treated as kernel/portable
|
||||||
* Should we also do `@portable`?
|
functions that would be compiled by the compiler, no RPC function is allowed.
|
||||||
* Support inheritance and polymorphism?
|
* If the instance is passed into the kernel, the host is not allowed to access
|
||||||
|
the instance data. Access would raise exception.
|
||||||
|
|
||||||
## Generics
|
## Generics
|
||||||
We use [type variable](https://docs.python.org/3/library/typing.html#typing.TypeVar) for denoting generics.
|
We use [type variable](https://docs.python.org/3/library/typing.html#typing.TypeVar) for denoting generics.
|
||||||
|
|
Loading…
Reference in New Issue