In most of the programming languages to assign special characters as a string, we need to escape them using backslash. It is not an issue at all for most of the times. Even though we are habituated, I like to highlight the difficulties with this escaping from my experience.
There is a chance of making mistake while escaping, may lead to incorrect results. Some times we get compilation problem but some times it escapes the backslash following character incorrectly. For example, if we forgot to escape “c:\backup”, it will treat “\b” as a back space character.
Due to escaping we will loose the readability of the string. More specifically we will face this problem while dealing with regular expressions because they also require escaping. Let us say if we want to use \ as a character in regular expression, we need to escape it as “\\”. While writing this expression in Java code every slash need to be escaped. Then this regular expression becomes “\\\\”. Otherwise both regular expression compiler and Java compiler can not interpret correctly. If we write a big regular expression with special characters it is very hard to interpret the actual expression.
Even though these problems we face rarely, while dealing with them causes a lot of inconvenience. In language it self we may add the capability to escape automatically using some special syntax. It is difficult to change the language syntax so no need to discuss much about the language changes. But it is easy to provide some kind of view transformations from the editors. When we place the cursor near to a string with quotes, an info bubble comes up which shows the string without escaping formalities and allows editing also. Once we click outside it looks like a normal string with escaping. It is just a basic thought for the solution but there may be better ways to address this problem.
Saturday, August 11, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment