Stream: t-compiler/wg-rls-2.0

Topic: Naming question


matklad (Nov 16 2019 at 10:40, on Zulip):

We have a Source<T> type which is basically a pair of T and HirFileId, where T is somthing relative to file.

What's the best name for the field which holds T? Currently it's called ast, but that doesn't always makes sense:

Daniel Mcnab (Nov 16 2019 at 10:41, on Zulip):

Maybe of?

matklad (Nov 16 2019 at 10:43, on Zulip):

Hm,

fn foo(node: Source<SyntaxNode>) {
    let parent = node.of.parent();
}
Daniel Mcnab (Nov 16 2019 at 10:45, on Zulip):

I was just thinking that this is the Source of T makes some sense. You're right - as a field to access, it's not very clear.

matklad (Nov 16 2019 at 10:51, on Zulip):

Otoh,

fn foo(node: Source<SyntaxNode>) {
    let parent = node.it.parent();
}

might actually not look that bad...

Laurențiu Nicola (Nov 16 2019 at 11:05, on Zulip):

Ahem, is value too traditional?

matklad (Nov 16 2019 at 11:07, on Zulip):

I like value!

Last update: Dec 12 2019 at 00:45UTC