6 ms·
I feel like the article does not address the stated question. arg(ument) c(ount) and arg(ument) v(ector) is what I was taught. edit: After a re-read, the arti
by vidanay 6y ago
I feel like the article does not address the stated question.
arg(ument) c(ount) and arg(ument) v(ector) is what I was taught.
edit: After a re-read, the article is about where the actual values come from and not the historical semantic meaning of the variable names.
- sillysaurusx 6y agoI was just as interested in the etymology.
- globuous 6y agoMe too, I once knew it but looked it up again earlier today out of curiosity. I was actually quite surprised to see this thread popup on HN a few hours later!
- zabzonk 6y agoAlso, in C (and C++) the names of the parameters are not significant - you could call them x and y and the compiler would be happy.
- vidanay 6y agoIn what language is the name of a method parameter ever significant?
- foota 6y agoAny with named args?
- monocasa 6y agoSmalltalk and ObjC for a couple examples. I wouldn't be surprised to find out Swift was too, but I'm not 100% on that.
- plorkyeran 6y agoThe name of method parameters in obj-c is not significant. The argument label and argument name are different things. In `- (void)frobulateThing:(id)firstThing andAlso:(id)secondThing;`, `firstThing` and `secondThing` are the argument names and can be changed with no impact on the callers, while `frobulateThing:andAlso:` is the part relevant to callers. In Swift the argument labels are the same as the argument names by default, but you can also supply different values for them.
- loopz 6y agoI kinda like the idea of it, or at least have the option to do that. You can name args in python function calls.
- senkora 6y agoPython. Since any argument can be called as a keyword arg, the names of arguments are a part of the API, and renaming them can break user code. I have written bugs because of this.
- loopz 6y agoFor compiled languages, it's neat to get compiler error instead of a nasty bug.
- Karliss 6y agoNo compiler in Python. In combination with features like varargs, kwargs, unpacking dictionary into args, argument forwarding Python allows you to turn this into bugs.
- senkora 6y agoWell, Python does get compiled to bytecode before it is run. And the compiler does tell you about some errors, like inconsistent indentation, even if that code is never executed.
- kortilla 6y agoIn python without explicit analysis using something like pylint you won’t find out until function call time.
- deleted 6y ago[deleted]
- quietbritishjim 6y agoA bug is a problem that affects your users. If you're a library author then your users are developers of applications (and higher-level libraries), so an unintentional breaking change to your API is definitely a bug.
- dotancohen 6y ago
- SilasX 6y agoRuby on Rails. Ugh. (Though yes, that’s a framework rather than a language.)
- deleted 6y ago[deleted]
- inopinatus 6y agoNamed arguments in much of the Rails API are received by the method via a single hash parameter, not as individual lexically bound variables. In most cases, Ruby handles this capture via a double-splat operator in the parameter list. However, Ruby itself does have both positional and named method parameters. The former contribute to arity and may be overridden and renamed in subclasses, and this remains true for Rails methods accepting positional arguments. It is also the case that a hash is implicitly congruent to named arguments, although this is controversial and may change in future. I’m sorry to report that no-one has ever described this as “arg hash” or “argh” for short.
- ufo 6y agoAnother example is Angular.js It used Javascript's toString() method to get the names of the arguments and then did dependency injection magic based on it. Does anyone know if that is still the case for recent versions of Angular?
- bmm6o 6y agoAnd because js is frequently minified, there is a way to specify the names as string literals to keep the injection working.
- staycoolboy 6y agoThat's an easy one: Python. The function declaration can force significant naming, but only for the caller.
- dcminter 6y agoJava (sometimes) where reflection allows you to inspect the parameter names, and you can optionally retain the names in the compiled bytecode. E.g. these days the Spring framework defaults to using the parameter name as the qualifying name to discriminate between otherwise identical types during autowiring.
- DSMan195276 6y agoSince it hasn't been mentioned yet, C#/.NET also has this dumb feature - the name of the parameter is compiled into the dll, and can be used for 'named arguments', where the caller can write `a: 20` in the argument list to assign the parameter called `a` to 20. If the library developer renames the parameter to something other than `a`, than that old code won't compile anymore (Though AFAIK the old compiled code is still ABI compatible with the new version, since the method arguments are resolved at compile time).
- int_19h 6y agoPretty much any language that allows named parameters at call site.
- enriquto 6y agoI prefer to use c and v, to be more explicit.
- srathi 6y agoI thought the same. Now I think it is simply argument-count and argument-values. Not sure if that is correct!