Re: (code, sample output and keyboard/device input <code>, <samp>, <kybd>) part of my review of 3.12 Phrase elements

Robert Burns wrote:
> On Jul 20, 2007, at 8:06 AM, Lachlan Hunt wrote:
>> Semantics comes from the agreement between the creator and consumer of 
>> the content, not from someones personal interpretation of the class 
>> names in the source code.  The microformats community provides such 
>> agreements for a variety of class names.
> 
> Semantics comes from much more than simply agreements between 
> communities. For example you wrote me an email message. I am replying. 
> The words and phrases we piece together are unique to the particular 
> situation. No standards body has approved the precise way I'm using 
> these words.

The agreement doesn't have to be explicit.  In the case of natural 
languages, which have developed over thousands of years, there are 
implied agreements about the meanings of words, which have been 
documented in dictionaries.

But there is a huge difference between the interpretation of natural 
languages and computer languages.  While a human may be able to derive 
the meaning of a sentence, sometimes even if it contains some unfamiliar 
words, a computer cannot derive the meaning of computer code without a 
prior agreement of its meaning.

For example, given this LOLCODE example:

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
 UPZ VAR!!1
 VISIBLE VAR
 IZ VAR BIGR THAN 10? GTFO. KTHX
KTHX
KTHXBYE

http://lolcode.com/examples/count-1

You wouldn't expect a computer to do anything useful with that, without 
a compiler that understands the language.  There needs to be prior 
agreement between programmer (creator) and compiler (consumer) that, for 
example, "IM IN YR LOOP" starts a loop, KTHX marks the end of the loop 
block and GTFO terminates the execution of it.  Without that agreement, 
the code is meaningless for the consumer.

> And yet I believe they contain semantics. My hope (even 
> without an a priori agreement) is that you will heuristically glean 
> semantics from my prose that stands in some relation to the semantics I 
> hoped to convey.
> 
> Are you also seriously telling me that if I write:
> 
> <pre class='c;plusplus> i= 10; <//pre>
> 
> You cannot think of any meaning I might be trying to convey

As a human, sure, I can read that source code and interpret your 
intended meaning.  But the source code is not going to be read by most 
people viewing your page.  It's read by the browser, which then conveys 
the semantics it understood to the user through its presentation and 
behaviour.

If I assume the syntax errors weren't present (I don't understand why 
you included those errors), and that were written as this instead:

<pre class="cplusplus"> i = 10; </pre>

Then " i = 10; " would typically be rendered visually as a block of 
preformatted text in a monospace font.  The class name by itself conveys 
no additional meaning.  To the browser, it's just an opaque string with 
no more meaning than class="foo".

>> The spec defines the meaning of both <pre> and <code>.  The first 
>> example is defined to mean a block of computer code, the second is 
>> just a generic block of preformatted text.  However, whether or not 
>> that distinction is actually useful, is certainly questionable.
> 
> However, the second block of preformatted text had a class='cpluplus'. 
> To claim that no meaning can be read from that is a little like closing 
> your eyes, plugging your ears and shouting: "I don't understand what 
> you're saying"!

A typical user *would not* see the class name.  You're relying on the 
user reading the source code to interpret the meaning, which just 
doesn't happen in reality.  The browser that cannot interpret the 
meaning of the class name, and thus cannot convey any semantics to the 
user by itself, without assistance from the author.

> What if that fragment appeared in the following document:
> 
> <style type='text'css'>
>     pre.cpluplus {
>         color: purple;
> }
> </style>
> <p>... purple will indicate it is C++...</p> 
> <pre class='c;plusplus> i= 10; <//pre>

Ignoring the syntax errors and assuming the code was rendered in purple, 
sure, you can give the browser guidance in how to convey the semantics 
of your class name to the user using stylesheets.  But that doesn't mean 
the browser has understood the meaning of the class name itself, or that 
the class name carries any particular meaning.

> Even then are you still telling me this conveys no meaning.

Meaning is conveyed to a user through presentation and behaviour, and so 
a human who sees the purple code would be able to understand that it was 
sample C++ code.  The meaning is not conveyed by the class name, even 
though you have used it to apply the presentation.

> Would you prohibit authors from writing a document like this? Unless I get prior 
> approval from some microformat politburo, I'm prohibited from writing a 
> document like this? Would I be purged for this markup? :-)

What?  No!  I do not understand your point.  All I'm saying is that 
class names by themselves don't convey any particular semantics without 
an agreement of their meaning (either explicit or implied), and that 
nothing useful can be done with them by default, beyond the presentation 
and behaviour specified by the author.

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Saturday, 21 July 2007 00:55:32 UTC