还有什么比较惯用的方法,IsExpired,Expired或NotExpired

问题描述 投票:4回答:2

什么是惯用语言?


// Present tense
type MyStruct struct {
    IsExpired bool
}

// Perfect tense  (? i don't know my tenses)
type MyStruct struct {
    Expired bool
}

// Present tense but flipped
type MyStruct struct {
    NotExpired bool
}

我真的在为go的命名约定苦苦挣扎。我发现很难推理出正确的命名方式。我的直觉说Expired,但我认为其他人会说IsExpired

go variables naming
2个回答
1
投票

0
投票

-2
投票
© www.soinside.com 2019 - 2024. All rights reserved.