Lyricdev
GitHub

LYR-MIG0321

a written parameter

hint · spec 14-cli

A note of lyric fix --from-4: a function writes a struct it took as a parameter. It was a copy in Lyric 4; in Lyric 5 a parameter is a let.

Explanation

A struct parameter of Lyric 4 was a copy the function could change, and its caller saw nothing of it. A parameter of Lyric 5 is a let (LYR-SEM0019), and the same block cannot bind its name anew (LYR-SEM0176).

Copy it into a var of another name and write that: var copy = v;. The behaviour stays what it was, the caller's value untouched. The note stands at the first write of each parameter; the uses after it are for the same change.

Example

by hand[LYR-MIG0321] main.lyr:10:5: the parameter 'v' is written; it was a copy in Lyric 4, and in Lyric 5 a parameter is a 'let' — copy it into a 'var' of another name, 'var copy = v;', and write that