From 3464dabeb96a16d8d748387528f7c9d664df582a Mon Sep 17 00:00:00 2001 From: pca006132 Date: Tue, 8 Jun 2021 12:03:49 +0800 Subject: [PATCH] Kernel objects specification as per discussion in #8 --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ee9a147..8f3c69f 100644 --- a/README.md +++ b/README.md @@ -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?)