Added recent discussions #16
Loading…
Reference in New Issue
No description provided.
Delete Branch "pca"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #9, #12, #15.
I'm not sure if it would be a good idea to keep them on the same line. I think some people would want a length limit on their code (e.g. 80 chars), and if the name/type name is long, the pseudocomment might have to be placed on the next line which is weird. I think it would be better to place it on top, but I'm open to changing this if you like.
OK we can drop this for now and clarify it later.
e872af6b7d
to3f55dea87b
Yes, that would work similarly to Rust attributes (e.g.
#[cfg(feature = "target_kasli_soc")]
)ok, I am fine with that style of pseudocomments, it would need to be clearly defined in the manual.
So is there any changes required for this PR?
@ -50,0 +52,4 @@
```python
class Foo:
# nac3:no_warn_unused
a: int
We can probably also support:
The rule would be that the comment applies to the next line if the comment is the first thing on the line, and it applies to the current line if there is something before it.
3f55dea87b
tod85db80385
@ -50,0 +58,4 @@
def __init__(self):
pass
```
* Instance variables that are not defined in the constructor but used elsewhere
What if they are created on the host?
One way would be to check if the value is used, and if the constructor defines it. If not, see whether the result of executing
build
would assign to it.Another direction would be to make
build
a static method with signature() -> Self
, and pass the parameters to the constructor. IMO this is a more principled approach. Example:No, again I would not put ARTIQ-specific features into the core of the compiler.
And build() in ARTIQ is called by the constructor anyway. https://github.com/m-labs/artiq/blob/master/artiq/language/environment.py#L244
The problem is that we cannot really analyze host code statically, we can only run it. What about the second option?
I'm mainly thinking about static analyze without actually executing the constructor. We can also let the host execute the constructor and then check for field definition when we create the kernel object (and in fact we must do so if the kernel is host only). Should I document this?
Yes, that sounds like the only viable option in my opinion.
I think so. And also explain the situation with objects that are created in kernels (with
@kernel
or@portable
on__init__
).@ -144,0 +159,4 @@
mode checking (recursively check all elements, which would be slower for
large lists) or performance mode which only check the first element of each
list. (#15)
* Code region protected by a type check, such as `if is_type(x, int):`, would
Mention that
is_type
is the only way to do type checks, i.e.isinstance(...)
andtype(...) == ...
do not compile.d85db80385
toc5769686f2
c5769686f2
to13591c5999
@ -50,0 +59,4 @@
pass
```
* Use-before-define:
* Host-only constructor/contains `build` method: Warn if a certain field `f` is
The
build()
method is ARTIQ-specific and just something that is called by theEnvExperiment
constructor, which may or may not be used to build compilable objects. When it is, we are simply in the "object fields were defined by host" case.Special handling of the
build()
method has no place in the compiler.@ -50,0 +62,4 @@
* Host-only constructor/contains `build` method: Warn if a certain field `f` is
used in other kernel methods but missing from the object constructed in
the host.
* `@portable`/`@kernel` constructor with no `build` method: Warn if a certain
Shouldn't it error out and not just warn? Calling any method on uninitialized memory sounds like certain trouble.
13591c5999
tob79c1725b3