Posts Tagged ‘backslash’

A Backslash is not a Slash

June 26, 2011

I must be playing the crotchety old man today. Maybe it has something to do with not feeling all that well. I’ll get over that, but I might not get over these young’uns who, when I tell ’em to use a slash, ask which one. There is only one. It is used for division. It is used in paths for Internet protocols like HTTP and FTP. It is used as the directory separator on UNIX and UNIX-like systems, which is how it came to be used in Internet protocols. That slash. You know the one.

These young’uns seem to get the slash confused with the backslash. I’m not quite sure why. Try putting in your source code somewhere “a = b \ 2” and I can guarantee that it won’t divide by two unless you have made a conscious effort to do something about that backslash. Try putting backslashes in place of the slashes in the URL bar of your web browser. There is a good chance that the web browser won’t know what you want it to do, and if you get past that, the web server will likely give you a 404.

My best guess is that these young’uns have gotten confused by some Microsoft software allowing both the slash and backslash to be used as directory separators. There was a time when their web browser allowed this and caused some people just learning how to make web sites to make links that were incompatible with anything other than Microsoft software. It seems we have gotten past that bit of confusion from the late 1990’s, yet some software developers get confused when I tell them to use a slash, even though they ought to know them apart to make their division and escape sequences work.

I suppose I might be partly to blame. I regularly use slashes in paths on code that runs on Windows systems because I know that the Windows libraries, like Win32, will interpret the slash as a directory separator. It was a fine decision on Microsoft’s part to assist in porting UNIX software to Windows, and I do use some software at work that started on UNIX and was later ported to Windows. The whole development team does, even if they don’t realize it. So, I use slashes in the paths because they work, and I don’t have to type two characters; using the backslash would start an escape sequence and require another backslash to be interpreted as a single backslash in a string literal.

Still, that doesn’t seem very confusing to me. Software developers need to get this sort of thing straight, so I’m still not clear as to why software developers don’t know what I mean when I say slash. I can understand if they ask about it in the context of a path since not all software on Windows will go both ways, but I get asked outside that context, too. I think when I’m asked which slash to use in the future, I may start answering with use the character for division, or use the character for an escape sequence. If a software developer still doesn’t know what I mean, then they shouldn’t be employed as a software developer. Fortunately, I think it’ll be a while before I find myself working with such an ignorant developer.

Advertisements

False Steps

The Space Race as it might have been

keithlugcom.wordpress.com/

You Control The Action!

High Frontier

the space colony simulation game

Simple Climate

Straightforwardly explaining climate change, so you can read, react and then get on with your life.