Kernel objects specification as per discussion in #8 #14

Merged
pca006132 merged 1 commits from kernel-object into master 2021-06-08 17:11:59 +08:00
1 changed files with 6 additions and 3 deletions
Showing only changes of commit 3464dabeb9 - Show all commits

View File

@ -49,10 +49,10 @@ def fail_write() -> None:
```
* Three types of instance variables: (Issue #5)
* Host only variables: Do not add type annotation for it in the class.
* Kernel only variables: Denoted with type `Kernel[T]`.
* Kernel Invariants: Immutable in the kernel and in the host while the kernel
is executing. Type: `KernelInvariant[T]`. The types must be immutable.
(use tuple instead of list in the host, but the type annotation should still
be list?)
is executing. Type: `KernelImmutable[T]`. The types must be immutable.
In particular, the attribute cannot be modified during RPC calls.
* Normal Variables: The host can only assign to them in the `__init__`
function. Not accessible afterwards.
* Functions require full type signature, including type annotation to every
@ -62,6 +62,9 @@ def fail_write() -> None:
return a + b
```
* RPCs: optional parameter type signature, require return type signature.
* Classes with constructor annotated with `kernel/portable` can be constructed
within kernel functions. RPC calls for those objects would pass the whole
object back to the host.
* Function default parameters must be immutable.
* Function pointers are supported, and lambda expression is not supported
currently. (maybe support lambda after implementing type inference?)