You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
switch constant attr to explicit + make IList an attribute (#308)
this PR changes `IList` to an attribute allowing it to be a compile-time
value. It also extends the runtime of `IList` so that one can keep track
of the element type information at runtime. This solves the problem of
capturing global values like below
```python
alist = [1, 2, 3] # could be hard to know element type when list is long
alist = IList([1, 2, 3], elem=types.Int) # allow user explicitly type the global value
@basic
def main()
return alist
```
This PR is breaking becausae now accessing the `value` field of
`Constant` will give either `PyAttr` or some other attribute type (e.g
`IList`) instead of original `T` and store as `PyAttr`. This also
partially fix#270 . A new attribute base class `Data` and method
`unwrap` are provided for convenience to covnert between attribute and
runtime Python value.
so this is gonna be a tricky breaking change for downstream because it
is hard to detect this behaviour change due to the fact that interpreter
won't check its value type. But this will allow us using other
attributes as a constant value as part of the python dialect.
0 commit comments