You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The assign nested function takes care of assigning values in the form of:
let some.nested.value[2..6][2]["key"]
The reasoning to use transmute here is listed in the code as follows:
/* NOTE
* This function is icky we got to do some trickery here.
* Since it's dangerous and icky it deserves some explanation
* What we do here is we borrow the target we want to set
* as immutable and mem::transmute it to mutable where needed.
*
* We do this since there is no way to tell rust that it's safe
* to borrow immutable out of something that's mutable even if
* we clone data out.
*
* This is safe because:
*
* We only borrow Cow<'event, str> out of the host. So the
* reference points to either the event or script and we
* never mutate strings only ever replace them.
* So even if the map the Cow originally came from we won't
* lose the referenced data. (Famous last words)
*/
Describe the solution you'd like
No sensible re-write comes to mind here, but it's good to have this noted. Perhaps there are approaches we haven't thought of. As with other low-level optimizations, this will be resolved when tremor-script becomes a VM or compiled language.
Describe the problem you are trying to solve
The assign nested function takes care of assigning values in the form of:
The reasoning to use transmute here is listed in the code as follows:
Describe the solution you'd like
No sensible re-write comes to mind here, but it's good to have this noted. Perhaps there are approaches we haven't thought of. As with other low-level optimizations, this will be resolved when tremor-script becomes a VM or compiled language.
Notes
Followup to #1015
The text was updated successfully, but these errors were encountered: