Added recent discussions #16

Merged
sb10q merged 1 commits from pca into master 2024-08-17 17:37:23 +08:00
1 changed files with 18 additions and 0 deletions
Showing only changes of commit b79c1725b3 - Show all commits

View File

@ -47,6 +47,24 @@ def fail_write() -> None:
self.a = a self.a = a
self.b = b self.b = b
``` ```
* Instance variables not used would be warned by the compiler, except for those
preceded by the pseudocomment `# nac3:no_warn_unused`. (#9) The comment can
either be placed on top of the variable or next to the variable. Example:
```python
class Foo:
# nac3:no_warn_unused
a: int
b: int # nac3:no_warn_unused
def __init__(self):
pass
```
* Use-before-define:
* Host-only constructor: Error if a certain field `f` is
used in other kernel methods but missing from the object constructed in the
host.
* `@portable`/`@kernel` constructor: Error if a certain
field `f` is used in other kernel methods but not defined in the
constructor, or used in the constructor before definition.
* Three types of instance variables: (Issue #5) * Three types of instance variables: (Issue #5)
* Host only variables: Do not add type annotation for it in the class. * Host only variables: Do not add type annotation for it in the class.
* Kernel only variables: Denoted with type `Kernel[T]`. * Kernel only variables: Denoted with type `Kernel[T]`.