Live data from Hacker News

I always forget the argument order of the `ln -s` command

reddit.com

71–80 of 127 posts

Re: I always forget the argument order of the `ln -s` command

#71
post #36

Earlier quoted context omitted.

This is a crime against usability IMO. Another comment mentioned that tar takes arguments as "target source" rather than "source target". Ever notice that for everything in the world that screws, like valves or screws or bottle caps, counter-clockwise loosens and clockwise tightens? How is it we got the whole world to agree on that convention, but software is 50/50 on how we order the source and destination?

Except volume dials.

I conclude from this, by process of logical inference, that "louder" must be a type of "tighter".

"Forward" is also "tighter", apparently.

Re: I always forget the argument order of the `ln -s` command

#72
post #66
post #14

Earlier quoted context omitted.

Probably in order to be consistent with assignment.

I think it's more to do with the requirement that mandatory arguments have to go before optional ones (it wouldn't work the other way round).

In strcpy, memcpy and partners, both arguments are (rather obviously) mandatory...

Re: I always forget the argument order of the `ln -s` command

#74
post #14

Earlier quoted context omitted.

Probably in order to be consistent with assignment.

Which is really the odd ball. In a left-to-right language, it's sort of bizarre that we don't write `4 = x' since the rvalue tends to be the more complicated part of the expression. The curious bit is, AT&T assembly syntax does follow this convention so you'll see something like `mov $5, ax'.

Indeed. Assignment should really look like something like this this:

  expression -> variable;

Re: I always forget the argument order of the `ln -s` command

#75
post #10

Does anyone know why C calls like 'strcpy' and 'strcat' are the opposite of this? strcat(target, source) strcpy(target, source) But, in SH... cp source target I feel like these things were developed around the same time, by the same community. I've always wondered if there was a reason for the different perspective.

The reason strcat, strcpy have the destination first is because of the need to support a variable number of arguments. By definition, if the number of arguments is variable, they must be at the end. So if you think of sprintf for instance, the destination has to be first. Now, to be consistent, strcat has to behave the same and have the destination first as well, although it doesn't have a variable number of argument…

I'm pretty sure strcpy et al pre-date the introduction of varargs. Besides, there's no reason the format string couldn't be the last argument of printf, except the specific technical detail that C requires at least one mandatory argument in any variadic function (the variable's address is used to locate the optional arguments in the stack.)

Re: I always forget the argument order of the `ln -s` command

#76
post #10

Does anyone know why C calls like 'strcpy' and 'strcat' are the opposite of this? strcat(target, source) strcpy(target, source) But, in SH... cp source target I feel like these things were developed around the same time, by the same community. I've always wondered if there was a reason for the different perspective.

This is a crime against usability IMO. Another comment mentioned that tar takes arguments as "target source" rather than "source target". Ever notice that for everything in the world that screws, like valves or screws or bottle caps, counter-clockwise loosens and clockwise tightens? How is it we got the whole world to agree on that convention, but software is 50/50 on how we order the source and destination?

My first car (a 1967 Dodge Monaco) had 'backwards' lug nuts on the left hand side of the car...

http://en.wikipedia.org/wiki/Lug_nut#History

Propane tanks also used to have backwards screwing connections. I believe this was a safety 'feature' given the mainstream use of small propane tanks. Having them tighten counter-clockwise prevents similar looking but wrong hoses from being attached to the tank. It also tricked people who didn't understand propane tanks form being able to remove a connection (since they would usually just tighten it further).

Re: I always forget the argument order of the `ln -s` command

#79
post #76

Earlier quoted context omitted.

This is a crime against usability IMO. Another comment mentioned that tar takes arguments as "target source" rather than "source target". Ever notice that for everything in the world that screws, like valves or screws or bottle caps, counter-clockwise loosens and clockwise tightens? How is it we got the whole world to agree on that convention, but software is 50/50 on how we order the source and destination?

My first car (a 1967 Dodge Monaco) had 'backwards' lug nuts on the left hand side of the car... http://en.wikipedia.org/wiki/Lug_nut#History Propane tanks also used to have backwards screwing connections. I believe this was a safety 'feature' given the mainstream use of small propane tanks. Having them tighten counter-clockwise prevents similar looking but wrong hoses from being attached to the tank. It also tricked…

Cars generally still do have backwards nuts on the LHS. Something about vibration and direction of turn. Some of the other bolts on the LHS can be that way too.

Same with some of the LP gas cylinders I have encountered here in Aus.

Re: I always forget the argument order of the `ln -s` command

#80
post #10

Does anyone know why C calls like 'strcpy' and 'strcat' are the opposite of this? strcat(target, source) strcpy(target, source) But, in SH... cp source target I feel like these things were developed around the same time, by the same community. I've always wondered if there was a reason for the different perspective.

Similar confusion arises from the AT&T and Intel syntaxes for x86 assembly which differ in the order of operands:

Intel:

mov bx, 100

AT&T:

mov $100, %bx

http://en.wikipedia.org/wiki/X86_assembly_language#Syntax

Post reply on HN