4 ms·
This post is missing my favorite one! fn evil_lincoln() { let _evil = println!("lincoln"); } What's weird about this? To understand what evil_lincoln is
by steveklabnik 1y ago
This post is missing my favorite one!
fn evil_lincoln() { let _evil = println!("lincoln"); }
What's weird about this?
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.
- ibotty 1y agoWhat's the joke exactly? English is not my native language.
- jerf 1y agohttps://www.basicfun.com/lincoln-logs/ https://www.basicfun.com/lincoln-logs/ This would be something the Boomer generation grew up with, and I think maybe the previous generation too. They're still around but they've certainly faded; they used to be Lego-level popular kids toys back then. They are named after President Lincoln, but only as a marketing tactic to use some of his reputation, there's no real connection. I would imagine even some native English speakers are learning something with this post. I haven't seen them in a while.
- ranguna 1y agoYes, but why is it evil?
- drfuchs 1y agoThere’s a strong connection between President Lincoln and log cabins. He grew up in a series of log cabins, and this fact was widely known during his campaign.
- bennettnate5 1y ago> They were named after President Lincoln, but only as a marketing tactic > there's no real connection Funny--I always thought it was meant to be a pun on linkin', as in you're linkin' the logs together because they have those slots that fit precisely together on the ends.
- saghm 1y agoI think it's both that and the popular tale of Lincoln having been born in a log cabin (which for some reason I thought I had heard wasn't actually true, but from looking into it now, it seems like a lot of sources say it is, so maybe I heard wrong?)
- saghm 1y agoI'm a late millennial, and I'd sometimes see them as a kid too. I'm not sure about more recent generations, but I think that they might have stuck around longer than you might think.
- iforgotpassword 1y agoI saw some kids in a park a few years ago in Beijing playing with those. First time I saw them. Didn't know the name until now though. :)
- Timwi 1y ago> This would be something the Boomer generation grew up with ... in your country I assume. I've never heard of these, but from the looks of it, they look like an American version of Playmobil or Fisher Price.
- dolmen 1y agoWe have a brand in France that is a bit older (1911) that also still makes wood toys. https://www.jeujura.fr/ https://www.jeujura.fr/
- kelnos 1y agoThey were still pretty common when I was a kid in the early '80s. genX'ers and older millennials born in the US are likely to know about them, or perhaps even have had a set of them (I did).
- rendaw 1y agoWhat's the joke exactly? English is my native language.
- steveklabnik 1y agolog "lincoln" is a reference to the toy "lincoln logs"
- mbStavola 1y agoA dog entered a tavern and said: "I cannot see anything, I'll open this one!"
- hansjorg 1y agoTough crowd.
- san1927 1y agolove this one thats a really underrrated fact