rems-project / sail

Sail architecture definition language
Other
563 stars 92 forks source link

"Accessing and updating vectors" using `with` should be expanded #604

Open ThinkOpenly opened 4 days ago

ThinkOpenly commented 4 days ago

The section "Accessing and updating vectors" includes:

A vector v can have an index index using [v with index = expression]. Similarly, a sub-range of v can be updated using [v with n .. m = expression] [...]

Note "index index". I presume that inadvertent.

Also, this could benefit some further explanation and examples.

Does the expression [x with 1 = 2] create a new array with the same size and type as x, but with the value at index 1 set to 2?

It's not clear what these expressions using with do, or how to best use them.

Alasdair commented 4 days ago

Does the expression [x with 1 = 2] create a new array with the same size and type as x, but with the value at index 1 set to 2?

Yes, exactly this