Hacker News new | ask | show | jobs
by ryanthedev 2238 days ago
I stopped at his argument about getting a string with the contents of RED.

That's why you have a variable. Which is a specific named property of an object.

var lastName ="RED"

Umm. It's his last name?

1 comments

and then you have a function like: `def printGreeting(lastName, firstName)`

and you call it like `printGreeting(firstName, lastName)`

and whoops, the compiler won't tell you you did something wrong. Maybe your editor will, if it shows handy little param name stuff next to the args in your call, but a github PR won't.

So someone ordering the arguments in a method in a non-intuitive way makes your variable name much less useful once you have to pass it around.

Sure, this is a trivial example ("why did you order the params in such a dumb order!?!?") but that's what is meant by variables not knowing much about what they are. It's a String. That doesn't tell us much, and doesn't tell the compiler or interpreter much about which functions expect it in what places.