Stream: general

Topic: type aliases and semver stability


Jake Goulding (Jun 23 2019 at 20:24, on Zulip):

Is it semver-OK to replace

pub struct Foo;

with

pub type Foo = RenamedFoo;
pub struct RenamedFoo;
nagisa (Jun 23 2019 at 20:51, on Zulip):

(nuked)

nagisa (Jun 23 2019 at 20:51, on Zulip):

There may be an interac tion with value-namespace

nagisa (Jun 23 2019 at 20:51, on Zulip):

let me do a test

nagisa (Jun 23 2019 at 20:53, on Zulip):

You need something like this as type does not introduce a name into the type-namespace.

Jake Goulding (Jun 23 2019 at 21:31, on Zulip):

@nagisa thank you. How specific is that to my (arbitrary) choice of syntax? e.g. I really have a struct Foo { … }

nagisa (Jun 23 2019 at 21:33, on Zulip):

Unit structs introduce a name into the value-namespace and so does a tuple struct.

nagisa (Jun 23 2019 at 21:34, on Zulip):

If you have a struct-struct, then just type alias is sufficient I think.

nagisa (Jun 23 2019 at 21:35, on Zulip):

it may also be sufficient for tuple structs in case its fields are private.

Last update: Nov 21 2019 at 23:30UTC