Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
What is a standard definition (or a CS theory based formal definition) for Escaping?
I personally would define "escaping" in software development in general and coding in particular as follows:
Making an exception to match data which otherwise would not be allowed to be matched:
If a program is generally not allowed to match some character/s, such as single and/or double quotes than we make an exception by "escaping" such character/s to be matched (as well as data they wrap, if there is any).
My problem is that I am not sure if this definition is broad enough to cover all possible "escaping" scenarios.
What is a standard definition (or a CS theory based formal definition) for escaping (if there is one and it's not mere abstraction)?
1 answer
The term escape sequence apparently dates back to the telegraph and pre-computer technology, according to wikipedia: https://en.wikipedia.org/wiki/Escape_sequence.
So I doubt there's an universally relevant definition of the term. I would guess that the term, in the scope of computer science, originates from C, UNIX and AT&T. The C language (5.2.1) makes this formal definition of an escape sequence:
In a character constant or string literal, members of the execution character set shall be represented by corresponding members of the source character set or by escape sequences consisting of the backslash
\
followed by one or more characters.
This definition covers the use of escape sequences in C and various languages inherited from C, but not necessarily all uses of escape sequences in all languages.
0 comment threads