Copilot-Language / copilot

A stream-based runtime-verification framework for generating hard real-time C code.
http://copilot-language.github.io
624 stars 50 forks source link

`copilot-language`: Support modifying values in arrays #36

Open ghost opened 5 years ago

ghost commented 5 years ago

If I have 2 streams carrying doubles, such as:

x :: Stream Double
x = extern "x" Nothing

y :: Stream Double
y = extern "y" Nothing

Is it possible to define, with some function (or maybe an Op2):

xy :: Stream (Array 2 Double)
xy = ??? x y
fdedden commented 5 years ago

Currently there is no way to construct an array from stream carrying scalars. Having a feature like this (and a similar one for structs) would indeed help a lot, and is worth looking into.

ivanperez-keera commented 5 years ago

I wouldn't know how to go about it. I'm thinking about kinds and arities, but I'm not sure we could make it work.

ivanperez-keera commented 1 year ago

Update: Someone is working on a feature atm that would allow us to implement this.

ivanperez-keera commented 1 year ago

Update: @InnovativeInventor has implemented 'set' or 'update' for arrays, which allows us to implement this. We'll be discussing integrating this into Copilot in the upcoming future.

ivanperez-keera commented 8 months ago

Update: similar requests have come up recently related to structs. We are looking into porting the solution that @InnovativeInventor prepared to work for structs and adding both to Copilot. Stay tuned.

ivanperez-keera commented 1 month ago

For awareness, we have an open issue #520 that we intend to merge today on updating fields of structs.

ivanperez-keera commented 1 month ago

Description

Copilot currently supports reading values from streams of arrays, but not changing them.

We'd like to be able to modify an array by adjusting the value at a specific position.

Type

Additional context

None.

Requester

Method to check presence of bug

Not applicable (not a bug).

Expected result

Copilot provides a mechanism to update specific values in arrays in an stream of arrays.

Desired result

Copilot provides a mechanism to update specific values in arrays in an stream of arrays.

Proposed solution

Extend copilot-language to provide operations to modify values of arrays in streams.

Extend copilot-core, copilot-c99 and other libraries accordingly.

Further notes

None.

ivanperez-keera commented 1 month ago

Change Manager: Confirmed that the issue exists.

ivanperez-keera commented 1 month ago

Technical Lead: Confirmed that the issue should be addressed.

ivanperez-keera commented 2 weeks ago

Technical Lead: Issue scheduled for Copilot 4.

Fix assigned to: @ivanperez-keera.