User loginNavigation |
Language design: Escaping escapesMost languages use special characters or special sequence of characters to denote the use of special directives. For instance, in C format strings: "\n" denotes new line, and if you wanted to have backquote n, you'd have to write "\\n". In VB, since " is used to delimit strings, you'd use "" to mean double quotes. eg. "He said ""Boo""!" In each case, if you wanted to show source code in the same language, it gets very painful, since you'd have to escape escapes. For instance to show the example of <img> tag in HTML, I'd have to do this: <img src="example" > In C you'd do this: printf("For example: printf(\"Hello World\\n\"); prints \Hello World\"\n");
Are there any languages or patterns which handle this kind of situation more elegantly? Examples of patterns:
By Chui Tey at 2004-10-10 00:46 | LtU Forum | previous forum topic | next forum topic | other blogs | 10122 reads
|
Browse archivesActive forum topics |
Recent comments
7 hours 50 min ago
3 days 16 hours ago
3 days 16 hours ago
4 days 21 hours ago
5 days 1 hour ago
5 days 2 hours ago
5 days 2 hours ago
4 weeks 5 days ago
5 weeks 1 day ago
10 weeks 3 days ago