Lyricdev
GitHub

LYR-MIG0205

an opaque type became a struct

hint · spec 14-cli

A note of lyric fix --from-4: an opaque type H = T; of Lyric 4 is written as struct H :: [Equatable] { v: T }, x as H as H { v = x } and h as T as h.v.

Explanation

Lyric 5 has no opaque alias. A struct with one field keeps what the alias was for: a value of its own identity that converts to nothing implicitly, compared with == within its type. The two as crossings are written as the construction and the field access.

What changes: a native signature of Lyric 4 took the underlying value, and the struct crosses into C as a struct. Where the value goes to C or to the host, pass its v.

Example

proposal[LYR-MIG0205] main.lyr:3:1: 'UserId' was an opaque type over 'int'; it is a struct with one field 'v', its 'as' crossings field accesses and constructions — where the value crosses into C or the host, pass its 'v'