opendylan
opendylan copied to clipboard
Need compiler warning for limited vector access
I would expect a compile-time warning for this:
let v = make(limited(<vector>, of: <integer>), size: 1);
v[0] := #t;
(There is a run-time error, as expected.)
I meant to use the following code, where I explicitly declared the type of v:
define constant <int-vector> = limited(<vector>, of: <integer>);
let v :: <int-vector> = make(<int-vector>, size: 1);
v[0] := #t;
This also doesn't get a compile-time warning.
(It would be wonderful if the type of v were inferred to be <int-vector> without being explicitly declared to be that type, but that's a different issue. I can't find where in the DRM this is defined, but it's kind of implied in the let doc.)