TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

Better array support #223

Closed jakhog closed 6 years ago

jakhog commented 6 years ago

For arrays to be more useful, I would like to have:

  1. For-each loops (like we have discussed in #160). I feel like I have made the mistake of forgetting to increment the index in while loops enough times now. Since we also know the cardinality of the arrays at compile-time, this should be an easy thing to do.

  2. Array initializers, e.g. var array : Integer[3] = { 1, 3, 5, }. Yes, it is mostly sugar and just to reduce copy-pasting of set statements. But it also helps to make sure you actually set all the values (and not to many) of the array.

  3. Array slicing. So you don't have to manually copy values if you want to pass part of an array to e.g. a function. E.g. var a : Int[100], then you could do, var b : Int[10] = a[0:10].

jakhog commented 6 years ago

No slicing? 😢

brice-morin commented 6 years ago

Seems we already are too fancy....

On Thu, 5 Jul 2018, 11:29 Jakob Høgenes, notifications@github.com wrote:

No slicing? 😢

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/TelluIoT/ThingML/issues/223#issuecomment-402663032, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjKqRfyqPbtureFpMscV7x1QhMSS3Fqks5uDdxsgaJpZM4Uj9rm .