Lyricdev
GitHub

LYR-MIG0311

a library function used as a value

hint · spec 14-cli

A note of lyric fix --from-4: a function of Lyric 4's library that is a method in Lyric 5, sum or over, is used as a value, and no function stands for it.

Explanation

Where a free function of Lyric 4 became a method in Lyric 5 — sum(it) is it.sum(), over(xs) is xs.iter() — the migration rewrites each call. Used as a value, the function has no call to rewrite, and no function of that name is left.

Pass a lambda that calls the method: (it) => it.sum(). The import of the old name goes either way.

A function that only changed its name becomes such a lambda by itself: let f = absInt; is let f = (value: int) => abs(value);, because abs is generic in Lyric 5 and no value.

Example

by hand[LYR-MIG0311] main.lyr:4:13: 'sum' is written as a method in Lyric 5, and no function stands for it — pass a lambda that calls it: (it) => it.sum()