Open mterber opened 4 years ago
I think this request would confuse more than it helps. I like the simple semantics currently in place. Creating instantaneous helper functions as you did with memcpy
seem to me to be the better approach.
Maybe a compromise could be to support variable array lengths. This way, I could at least reuse the same (generic) memcpy() function for different activities that deal with arrays of different size. Otherwise you end up with an impressive line-up of helper functions that, in principle, do exactly the same thing.
Maybe some limited generic support like below would help here some day:
function memcpy<L, T>(from: [L]T)(to: [L]T)
var i: nat32
while i < L repeat
to[i] = from[i]
end
end
That sounds good from a user's point of view. :+1:
Is your feature request related to a problem? Please describe. Sometimes it is required to process arrays in the context of a running activity, e.g. for a copy operation like in the following example:
Here, dataTx shall be copied to _txbytes. This requires to loop over the array bytes within a single reaction. However, this is not allowed in activities, only in functions. So whenever I have to loop over arrays in an activity I have to create special function for that purpose.
Describe the solution you'd like I would like to be able to execute instantaneous loops within activities directly.