Editing 234: Escape Artist

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:
 
{{w|Harry Houdini}} (born Erik Weisz/Ehrich Weiss) was a famous escape artist, whose more famous routines included escaping straitjackets and switching places with an assistant while locked inside a box.
 
{{w|Harry Houdini}} (born Erik Weisz/Ehrich Weiss) was a famous escape artist, whose more famous routines included escaping straitjackets and switching places with an assistant while locked inside a box.
  
The word "escape" also has a meaning {{w|Escape character|in computer science}}. To "escape" something in programming means to replace a character or character sequence that would usually have a special meaning with another character sequence that doesn't have this special meaning. One common way of escaping is to have a special escape character that removes the special meaning from whatever character follows it. For instance, many programming languages enclose text strings in quotation marks (e.g. <code>"this is a string"</code>). If you tried to directly put a quotation mark inside the string, the compiler would interpret it as the end of the string. To avoid this, the quotation mark is ''escaped'' with a backslash: <code>"He said, \"Goodbye!\", and went away."</code>
+
The word "escape" also has a meaning {{w|Escape character|in computer science}}. To "escape" something in programming means to replace a character or character sequence which would usually have a special meaning with another character sequence that doesn't have this special meaning. One common way of escaping is to have a special escape character which removes the special meaning from whatever character follows it. For instance, many programming languages enclose text strings in quotation marks (e.g. <code>"this is a string"</code>). If you tried to directly put a quotation mark inside the string, the compiler would interpret it as the end of the string. To avoid this, the quotation mark is ''escaped'' with a backslash: <code>"He said, \"Goodbye!\", and went away."</code>
  
 
The problem [[Cueball]] is having is related to the fact that {{w|Bash (Unix shell)|the Bash shell}} interprets spaces as a special syntactic marker, when he actually just wants the spaces to be literal space characters. In this case, escaping the spaces with \ would force Bash to interpret his script in this way.
 
The problem [[Cueball]] is having is related to the fact that {{w|Bash (Unix shell)|the Bash shell}} interprets spaces as a special syntactic marker, when he actually just wants the spaces to be literal space characters. In this case, escaping the spaces with \ would force Bash to interpret his script in this way.
Line 18: Line 18:
 
The person talking to Cueball is having a separate conversation about Houdini as Cueball thinks aloud about his script issue, which results in diverging conversations. This eventually leads Cueball to suggest that Houdini might have "escaped" (freed himself from) handcuffs by "escaping" (removing the special meaning from) them with backslashes.
 
The person talking to Cueball is having a separate conversation about Houdini as Cueball thinks aloud about his script issue, which results in diverging conversations. This eventually leads Cueball to suggest that Houdini might have "escaped" (freed himself from) handcuffs by "escaping" (removing the special meaning from) them with backslashes.
  
Sometimes, escape characters need to be "nested" - the backslash character itself can be escaped as \\ to produce a literal backslash, so if, for example, one needs to produce a literal quotation mark to output to a script file, and that script file ''also'' needs to have the quotation mark escaped, one would need to type it out as \\\", which would be output as \". If I needed to actually output that \\\", one would need to type it as \\\\\\\". The number of backslashes needed grows, and can be very hard to keep track of (see [[1638: Backslashes]]). This behavior is a type of n-level nested quotation mentioned in the title text. This could, in practice, be very easy with syntax highlighting showing where the parser sees the string as ending, making it trivial to escape out the characters that should be escaped, e.g.:
+
Sometimes, escape characters need to be "nested" - the backslash character itself can be escaped as \\ to produce a literal backslash, so if, for example, one needs to produce a literal quotation mark to output to a script file, and that script file ''also'' needs to have the quotation mark escaped, one would need to type it out as \\\", which would be output as \". If I needed to actually output that \\\", one would need to type it as \\\\\\\". The number of backslashes needed grows, and can be very hard to keep track of (see [[1638: Backslashes]]). This behavior is a type of n-level nested quotation mentioned in the title text.
<code>"And then he said \"Hi\"."</code>
 
In this example, the nested quotes could be escaped until the editor shows the uniform color of strings.  
 
  
 
An {{w|iron maiden (torture device)|iron maiden}} is supposedly a medieval torture device, currently believed to have been invented for tourism purposes much later than the time period when it was said to have been used.
 
An {{w|iron maiden (torture device)|iron maiden}} is supposedly a medieval torture device, currently believed to have been invented for tourism purposes much later than the time period when it was said to have been used.

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)