Re:Best aspects of C
by steveklabnik on Tuesday November 17, 2020 @05:03PM
(#25130550)
Just a few small comments. Maybe understanding some rationale will help.
> #[] - why the [] if # already makes that line different from the usual code? seems superfluous
# does not "make that line different from the usual code." The whole #[] construct is it, it has nothing to do with lines. You could put "#[foo] #[bar]" on one line if you wanted, you could write "#[foo] fn lol()" if you wanted...
> foo! - yelling out function calls. "print!" "exit!" "macro!". Angry Codes!
This helps both humans and computers parse; macro invocations don't have to follow regular Rust syntax, and the ! helps indicate that that's true.
> Default for Borrowed -
This is not language syntax, this is the name of two types. You can name your types however you'd like.
> #[] - why the [] if # already makes that line different from the usual code? seems superfluous
# does not "make that line different from the usual code." The whole #[] construct is it, it has nothing to do with lines. You could put "#[foo] #[bar]" on one line if you wanted, you could write "#[foo] fn lol()" if you wanted...
> foo! - yelling out function calls. "print!" "exit!" "macro!". Angry Codes!
This helps both humans and computers parse; macro invocations don't have to follow regular Rust syntax, and the ! helps indicate that that's true.
> Default for Borrowed -
This is not language syntax, this is the name of two types. You can name your types however you'd like.