Added #9
This commit is contained in:
parent
1e80d8d285
commit
b79c1725b3
18
README.md
18
README.md
@ -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]`.
|
||||||
|
Loading…
Reference in New Issue
Block a user