From a034251c23e47ac7c948389bf9c228da6c380d06 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 12 Apr 2021 19:58:45 +0800 Subject: [PATCH] improved explanation for kernel only classes --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1570f31..c9ac79d 100644 --- a/README.md +++ b/README.md @@ -110,12 +110,13 @@ def fail_write() -> None: * Only `uint32`, `int32` (and range of them) can be used as index. ### Kernel Only class -* Annotate the class with `@kernel`. -* Functions are all kernel only, including constructor. - -Questions: -* Should we also do `@portable`? -* Support inheritance and polymorphism? +* Annotate the class with `@kernel`/`@portable`. +* The instance can be created from within kernel functions, or the host if it is + portable. It can be passed into kernels. +* All methods, including the constructor, are treated as kernel/portable + functions that would be compiled by the compiler, no RPC function is allowed. +* If the instance is passed into the kernel, the host is not allowed to access + the instance data. Access would raise exception. ## Generics We use [type variable](https://docs.python.org/3/library/typing.html#typing.TypeVar) for denoting generics.