<charlottia>
<jfng[m]1> "found one way to do it: Value...." <- `a.as_value().reset` too. `a.reset` where `a` is a `View` is equal to `a["reset"]`, which for underlying `ArrayLayout`s, does a `word_select` (i.e. tries to slice the underlying signal, which would be desirable if you said `a[2]` or something). It tries to value-cast the string `"reset"` to use as an offset, which is the error you see there.
<jfng[m]1>
i see, that aligns with what the stacktrace reported
<jfng[m]1>
i'm just a bit surprised to step on a `TypeError` just by referencing an attribute of an object
<charlottia>
I think it can be a little confusing, because Signal(shape, ...) where shape is a ShapeCastable subclass instance wraps the newly created Signal in that class, so while it looks like you just made a Signal which is now in a, you actually made a Signal and a View, and the View's in a and the Signal's its target/as_value().
<charlottia>
> <@jfng:matrix.org> i see, that aligns with what the stacktrace reported
<charlottia>
> i'm just a bit surprised to step on a `TypeError` just by referencing an attribute of an object
<charlottia>
Yes; it's an "interesting" effect of the `getattr`->`getitem` forwarding `View` does, I guess?
<jfng[m]1>
charlottia: yeah, and it won't be a `Signal` until you `Value.cast()` it
<charlottia>
Yes, or as_value().
<charlottia>
Maybe it'd be better if ArrayLayout-backed Views didn't do the getattr forwarding, to avoid this.
<charlottia>
(right now View is generic enough to work for struct/union/array/flexible layout happy paths without any modification, but it complicates the non-happy paths like these.)
<jfng[m]1>
agreed, gettattr forwarding is useful when your field have names (i.e. strings); since array fields use indices, you couldn't access them like that anyway