3 ms·
The problem with incremental improvements is you have to keep backwards compatibility. This is a big issue when it comes to keywords. For instance this is valid
by sitharus 9y ago
The problem with incremental improvements is you have to keep backwards compatibility. This is a big issue when it comes to keywords. For instance this is valid C#:
using async = Task<string>;
class BadIdea {
public async async async(async async) { }
}
- steveklabnik 9y agoRust has a fun similar one. I'm assuming for the same reason as C#: contextual keywords. union union<'union> { union: &'union union<'union>, } https://github.com/rust-lang/rust/blob/59675d29eb47eb743026dcc0737884f548f2197a/src/test/run-pass/weird-exprs.rs#L110-L112 https://github.com/rust-lang/rust/blob/59675d29eb47eb743026d...
- AndyKelley 9y agoplease, I have to know, what is evil_lincoln testing?
- steveklabnik 9y agoThis is why I love this file. To understand what evil_lincoln is doing, you have to understand very old Rust. Here's the commit that introduced it: https://github.com/rust-lang/rust/commit/664b0ad3fcead4fe4d22c05065a82a338770c429 https://github.com/rust-lang/rust/commit/664b0ad3fcead4fe4d2... fn evil_lincoln() { let evil <- log "lincoln"; } log was a keyword to print stuff to the screen. Hence the joke, https://en.wikipedia.org/wiki/Lincoln_Logs https://en.wikipedia.org/wiki/Lincoln_Logs Now that log is the println! macro, the joke is lost. It doesn't say explicitly why this is "weird", but given some other comments in the file, // FIXME: Doesn't compile //let _x = log true == (ret 0); I am assuming that using the return value of log was buggy, and so this tested that you could save it in a variable. I don't remember the exact semantics of log, but if it's like println!, it returns (), which is useless, so binding it to a variable is something you'd never write in real code, so it's "weird" in that sense.
- vram22 9y agoHere is a similar one in Python (in the sense of using the same word or identifier multiple times): x = [[1,2], [3,4], [5,6]] [x for x in x for x in x] For more details see: https://jugad2.blogspot.in/2014/03/flatten-list-of-lists-with-list.html https://jugad2.blogspot.in/2014/03/flatten-list-of-lists-wit...