3 ms·
The reason I can think of are: - it'd be annoying to have to write `println!("{}", &s);`, - this is not an inconsistency one thinks about in practice: ownersh
by dbaupp 10y ago
The reason I can think of are:
- it'd be annoying to have to write `println!("{}", &s);`,
- this is not an inconsistency one thinks about in practice: ownership is important in Rust, but the compiler does all the annoying checking, so IME one can just let it fade into the background and not think about it until the compiler tells you there's a problem,
- it's an "permissive" inconsistency: writing a & will still compile and give the same output,
- it's a syntax-level inconsistency created by the println! macro packaging up the normal syntax, not some special rules for special functions: there's still a literal & borrow in there (see the macro expansion),
- historical reasons, and no-one was annoyed enough (or even noticed it enough) to change it.
- Too 10y agoHmm. If people would think it was annoying to println!("{}", &s) they wouldnt use rust in the first place because you have to do that everywhere else for plain functions. Beeing permissive makes it even worse as there are now 2 inconsistent ways to do the same thing. Maybe I need to understand rust macros better. I guess this all boils down to: macros are a very bad idea, as in other programming languages.