Welcome to the Wikipedia Computing Reference Desk Archives
|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.
|
I once saw a version of HTML that relied on whitespace instead of closing tags to end scope, sort of similar to CoffeeScript. Does anyone know the name of this variant of HTML? A Quest For Knowledge (talk) 21:39, 17 May 2015 (UTC)[reply]
- Some HTML tags don't need to be closed, like the br tag used between lines 1 and 2, without the closing tag, and between 2 and 3, with the closing tag:
1
2
3
- StuRat (talk) 21:48, 17 May 2015 (UTC)[reply]
- What I am saying is that in most languages, white space is not significant in how code is written. However, there are some languages where white space matters. For example, in JavaScript, white space doesn't matter. You could code this:
if (true) {
doSomething();
} else {
doSomethingElse();
}
- ...which is semantically identical to this...
if (true) {
doSomething();
} else {
doSomethingElse();
}
- ...which is semantically identical to this...
if (true) {
doSomething();
} else {
doSomethingElse();
}
- But the equivalent CoffeeScript has no scope terminators such as closing brackets. Instead, it relies on indentation to determine scope. So, this is how you would write the identical code in CoffeeScript:
if true
doSomething()
else
doSomethingElse()
- ...whereas this would mean something completely different (I'm not sure that this code would even transcompile) ...
if true
doSomething()
else
doSomethingElse()
- I once saw a version of HTML that worked the same way. Instead of closing tags, it relied on white space to determine scope. So, instead of this...
<html>
<head>
<title>This is a title</title>
</head>
<body>
Hello world!
</body>
</html>
- ...it looked something like this...
<html>
<head>
<title>This is a title
<body>
Hello world!
- A Quest For Knowledge (talk) 22:06, 17 May 2015 (UTC)[reply]
- Have you any more context? For instance, Hamlet templates[1] can look like this. They aren't really a 'version' of HTML, but nor - I think - was whatever you remember. 82.13.241.56 (talk) 23:16, 17 May 2015 (UTC)[reply]
- I once used a language for a CNC punch machine that didn't allow empty spaces at the ends of lines. It would give me very strange errors when it happened and it took me at least an hour to find the problem the first time it happened since a space isn't visible. I eventually found it by mistake when I happened to put the cursor at the end of the line and noticed the space. You can bet your life that I never forgot about that error! But this was not HTML. Dismas|(talk) 23:44, 17 May 2015 (UTC)[reply]
- Also see: Whitespace (programming language)... --Guy Macon (talk)
- It could have been Hamlet, or something similar to it. A Quest For Knowledge (talk) 20:14, 18 May 2015 (UTC)[reply]