Merge pull request 'Kernel objects specification as per discussion in #8' (#14) from kernel-object into master
Reviewed-on: #14
This commit is contained in:
commit
ae12c946c5
|
@ -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?)
|
||||
|
|
Loading…
Reference in New Issue