These are chat archives for rust-lang/rust

29th
Dec 2018
David O'Connor
@David-OConnor
Dec 29 2018 02:07
@omni-viral - thanks - that worked
Matthew de Detrich
@mdedetrich
Dec 29 2018 07:05
How does one escape keywords for fieldnames, i.e. I want to do the followng
IfElse {
        if: Box<SpannedExpr < Id > >,
        then: Box<SpannedExpr < Id > >,
        else: Box<SpannedExpr < Id > >,
    }
Nopey Nope
@Nopey
Dec 29 2018 07:05
r#if?
lemme check
Yeah, r#if will work
Matthew de Detrich
@mdedetrich
Dec 29 2018 07:14
Yup thanks
Michal 'vorner' Vaner
@vorner
Dec 29 2018 07:36
r#if is considered ugly and only the last resort (eg. if calling through FFI to something that is keyword in rust but not in C, for example). The other option is to be creative in the names, like if_ or if_stmt.
Matthew de Detrich
@mdedetrich
Dec 29 2018 22:30
Why is it considered ugly?I mean I am making a lexer and those are what the fields literally mean
Ichoran
@Ichoran
Dec 29 2018 23:48
I think it's considered ugly because it is ugly? Instead of graceful lines and smooth contours, you have this big hash smack in the middle of your word, an unwelcome and then unavoidable visual distraction. (However, if it makes the most sense, well....)