News for hackers. Stuff that matters.
Re:/ vs. \ confuses me a lot, how do you remember them? by 9wzYQbTYsAIc on Sunday October 09, 2022 @01:35AM (#33138517)
Read the manual, memorize, and make use of muscle memory.
Re:/ vs. \ confuses me a lot, how do you remember them? by stop50 on Sunday October 09, 2022 @01:43AM (#33138544)
On unix: no problem backslashes are only used as escapes windows: as escapes no problem, for paths, take the next best class for pathbuilding and use it and double the backslashes at every position it is given to external output(printf, ...)(and double it at every time the output is going through another parsing.
Re:/ vs. \ confuses me a lot, how do you remember them? by themodelplumber on Sunday October 09, 2022 @01:49AM (#33138557)
I remember making so many mistakes with those. Still do sometimes.

But at first I know I had to remember them like this: "Top is left side, or top is right side?" like where is the literal top of the shape at. Then I made a little memory aid out of that.

Comparing the usage in OSes: You can imagine the backslash as the front of the W in Windows, and the forward slash as the front of an italic L for Linux, for example. Or any of a million other ways to think about it, probably.

My sympathies though, it's not fun or cool and while the post title may not describe my feeling at the moment, it's fun to see someone else working through it like this, because we all have little battles to fight along the journey.

Re:/ vs. \ confuses me a lot, how do you remember them? by schoen on Sunday October 09, 2022 @01:54AM (#33138573)
Maybe you could think of the forward slash as making progress on a graph. Things are growing over time, so (at least culturally in a business and economic context) they're getting better, so we're "moving forward".
Re:/ vs. \ confuses me a lot, how do you remember them? by 9wzYQbTYsAIc on Sunday October 09, 2022 @01:53AM (#33138567)
backslash can also the left side of the person and the forward slash the right side of the person in the classic hands up in the air emoji: \o/
Re:/ vs. \ confuses me a lot, how do you remember them? by schoen on Sunday October 09, 2022 @02:00AM (#33138596)
After reading the replies, I'm confused about whether you're having more trouble with the names "back" and "forward" or more trouble remembering the meanings assigned to them in programming languages. Some people seemed to take your question one way and some people seemed to take it the other way.

In the Windows command line, \ is the path separator and / is for options.

That diverges from the Unix command line, where / is the path separator and \ is for escaping special characters ("use the literal meaning of this character, rather than the special meaning"). The Unix command line uses hyphen (-) for options.

Most programming languages use \ for escaping special characters, so \" would often be a literal quotation mark and \\ would often be a literal backslash. For example, in many languages writing

  "\""
will give a one-byte-long string containing a quotation mark character. Here the backslash escapes the second quotation mark, cancelling out its meaning of ending the string.

https://en.wikipedia.org/wiki/Use%E2%80%93mention_distinctio...

https://en.wikipedia.org/wiki/Escape_character

The second article mentions a further subtlety, which is that escaping a character that doesn't have a special meaning sometimes adds a special meaning. For example, "\t" is used in many programming languages to write the tab character (ASCII 9), while "\n" is used to write the newline character (ASCII 10).

Re:/ vs. \ confuses me a lot, how do you remember them? by 9wzYQbTYsAIc on Sunday October 09, 2022 @02:13AM (#33138655)
Also, path separation in URIs uses / as a path separator but // to identify the authority

https://www.rfc-editor.org/rfc/rfc3986#section-3

Re:/ vs. \ confuses me a lot, how do you remember them? by schoen on Monday October 10, 2022 @12:52AM (#33147896)
I think Windows also does that with file sharing where it uses remote references like "\\host\path".
Re:/ vs. \ confuses me a lot, how do you remember them? by 9wzYQbTYsAIc on Monday October 10, 2022 @02:07AM (#33148299)
And is it a \ or / between domain and username in Windows?

Trial and error, every time on that one.

Re:/ vs. \ confuses me a lot, how do you remember them? by beardyw on Sunday October 09, 2022 @02:50AM (#33138767)
As characters Forward Slash leans to the Right and is often the cause of division. Back Slash leans to the Left and has been involved in helping difficult characters escape. Both are employed as path separators.
Re:/ vs. \ confuses me a lot, how do you remember them? by demetrius on Sunday October 09, 2022 @04:29AM (#33139110)
If you think about cursive writing (or an italic font, based on the cursive writing), the names are pretty straightforward.

All letters in cursive and italic are slanted to the right. Iceland becomes Iceland, with top part of each letter going right and bottom part going left.

So, if you just wanted to write a slash in cursive, you'd end up with /. That's just a normal slash, a result of writing a line according to the general direction of the writing.

And the slash that defies the general direction of the writing is 'backslash'. For this, you have to move your hand back from your normal writing position.

Re:/ vs. \ confuses me a lot, how do you remember them? by ifqwz on Sunday October 09, 2022 @04:43AM (#33139166)
This reminds me of people who even in adulthood confuse "left" and "right" - I have always wondered how that happens.
Re:/ vs. \ confuses me a lot, how do you remember them? by alrlroipsp on Sunday October 09, 2022 @05:51AM (#33139485)
It happens because not everyone is wired the same as you are. You probably already noticed this in other fields of life.
Re:/ vs. \ confuses me a lot, how do you remember them? by colechristensen on Sunday October 09, 2022 @06:53AM (#33139832)
The piece of the brain that handles that works better for some people than others. Whether it’s genetic or developmental, it’s just a thing which happens to some people.
Re:/ vs. \ confuses me a lot, how do you remember them? by 9wzYQbTYsAIc on Monday October 10, 2022 @02:12AM (#33148327)
https://pubmed.ncbi.nlm.nih.gov/2319959/

“It follows that the participants were not in a state of complete ignorance. Rather, they relied upon extraneous knowledge of either a general or a specific nature (bias and schema hypotheses, respectively), whose importation into this domain was in fact invalid. The resulting belief that coin portraits face left was not right.”

Re:/ vs. \ confuses me a lot, how do you remember them? by stjohnswarts on Sunday October 09, 2022 @06:11AM (#33139586)
I remember that / is the right way to do it as done on my favorite OS (Linux) left is the incorrect way pursued by a lesser operating system (windows) but it still works there despite being the obviously wrong way to do it, but windows has to do things bassackwards. Also a lot of times "/" works on both, depending on API/file operations. On linux \ is mostly used to escape things in quotes and regex's.
Re:/ vs. \ confuses me a lot, how do you remember them? by jaitaiwan on Sunday October 09, 2022 @07:22AM (#33139989)
Forward slash unless windows is pretty much how I remember it. Character escapes are universally backslash.

If you're asking me how to remember the difference between them, I just imagine I'm the line, then the question is: does it look like I'm falling forward or backward.

Re:/ vs. \ confuses me a lot, how do you remember them? by dusted on Sunday October 09, 2022 @07:41AM (#33140107)
/ is what seperates paths and ends your tags. \ is what escapes your special characters.

But back in the olden days, I thought \ is what windows uses in paths, / is what URLs use.

Re:/ vs. \ confuses me a lot, how do you remember them? by kevin_b_er on Sunday October 09, 2022 @09:51AM (#33140992)
For the usage? I guess it is natural now, like left and right.

For the names? The little stick figure is leaning forward or backward in reading order.

Re:/ vs. \ confuses me a lot, how do you remember them? by solardev on Sunday October 09, 2022 @01:06PM (#33143042)
Thanks for the stick figure tip! That's so helpful.
Re:/ vs. \ confuses me a lot, how do you remember them? by mikewarot on Monday October 10, 2022 @05:13AM (#33149358)
Slash - Normal fractions, division, and conversational use all use / as in 1/2 x/y he/she etc. I describe it over the phone as the one under the question mark.

Backslash - Not used much except in Linux, C, etc. As others have said, path separations, quoting characters, etc. \n is a linefeed in most quoted strings. I describe this as the slash not under the question mark

Now, paths on Unix use / because \ is already in use... so you end up with /home/mike

Lastly, DOS, and thus Windows, had to use \ because they needed to be as different as possible from Unix (to avoid lawsuits)... and thus you end up with C:\DOS