News for hackers. Stuff that matters.
Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by brandonbloom on Friday May 15, 2015 @11:45AM (#9551336)
You've misunderstood his point with that example. He knows it's ambiguous, but he's telling you that it's an undesirable distinction to make.
Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @11:51AM (#9551384)
OK, but then he's wrong about that. <input type=button/> does not mean the same thing as <input><type>button</type></input>.

No matter how you slice it, Erik is wrong here. His translation is lossy, and a lossy translation is bad because it can't be applied bidirectionally.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by brandonbloom on Friday May 15, 2015 @12:01PM (#9551453)
Again, you're missing the point. He's saying that those two things shouldn't be different. He's clearly well aware that they are different.

His very first sentence is:

    As long as we think aloud in alternative syntaxes, I actually prefer to
    break the _incredibly_ stupid syntactic-only separation of elements and
    attribute values.
His entire post is a hypothetical in which you 1) need a structured markup language and 2) are willing to break compatibility with XML.
Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @12:52PM (#9551868)
No, I understand what he is saying. My claim is that he is wrong. They should be different. There's a significant and useful difference between data and metadata, and hence there's a significant and useful difference between tags and attributes, and if you throw out that distinction you lose useful functionality, and specifically you lose the ability to distinguish between, e.g.:

<input type=button/>

and

<input><type>button</type></input>

Tags compose in different ways than attributes, that difference reflects a real aspect of the structure of the problem, and hence it's useful.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by brandonbloom on Friday May 15, 2015 @09:25PM (#9554634)
But it's not a difference between metadata and data. It's a difference between structural representations. Either or both representations can be used to encode data or metadata, but that separation comes from the interpretation of the markup.
Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @11:48PM (#9554985)
Yes. But the two structures at issue are:

((foo baz bar) bing)

and

(foo (baz bar) bing)

The only difference is in the location of a single paren. But latter representation (Erik's) loses information whereas the former does not. All else being equal, and absent a compelling argument why the lost information has no value, it is better not to lose information.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by brandonbloom on Saturday May 16, 2015 @01:00AM (#9555104)
1) There's no information to be lost. He's not talking about encoding XML, he's talking about general design criteria for a cleanroom markup language design. I don't understand why this point is hard to get.

2) The idea that it's "better not to lose information" is totally nonsensical because the value of information is contextual. For example, the ascii encoding of this message useful omits the subtleties of my awful handwriting, although you're right: it would be better to preserve the information present in the deep pencil strokes, indicating my frustrating with this thread.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Saturday May 16, 2015 @01:51AM (#9555188)
> He's not talking about encoding XML

Yes he is:

"I have come to _loathe_ the half-assed hybrid that some XML-in-Lisp tools use and produce"

> The idea that it's "better not to lose information" is totally nonsensical

You are knocking down a straw man. I didn't say that is it better not to lose information, full stop. I said "All else being equal, and absent a compelling argument why the lost information has no value" it is better not to lose information. In the case of your handwriting, all else is not equal.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by ICWiener on Friday May 15, 2015 @12:27PM (#9551662)
Erik Naggum even answererd the question about ambiguity himself in the same thread:

https://groups.google.com/d/msg/comp.lang.lisp/8eUxiibm_zA/i...

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @12:57PM (#9551905)
The essence of his response:

"Whether bar is an attribute or a sub-element of foo is irrelevant to processing them."

I disagree. Elements and attributes compose in different ways, and I think this distinction is useful and hence relevant. I think it is self-evident that:

<input type=button/>

and

<input><type>button</type></input>

mean different things, and that it is legitimate to try to express either of these things, and so distinguishing between these two different things is useful.

In particular, the latter representation implies that:

<input>foo</input> <type>bar</type>

might mean something. The former representation makes it explicit that the type attribute is intended to be inextricably bound to the input tag. I think that's useful information.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by ICWiener on Friday May 15, 2015 @01:45PM (#9552272)
Did you just summarize thousands of sentences in a single one?

Neither <input type=button/> nor <input><type>button</type></input> does mean anything without a spec of your language, and trying to infer that <input>foo</input> or <type>bar</type> is valid is only due to some pre-conception about the underlying semantics you gave to your data (you chose familiar tag names, after all).

If I gave you a sample XML file from work, you'd have a very hard time knowing whether one attribute/element is or isn't optional (or bound) to an element. You'd need a schema/meta-model or even an informal spec.

With attributes/elements, you have two ways of defining data where only one is necessary: (input (type button)). The closet example I can think of is for example, if you had a lisp that is not homoiconic but had two different syntaxes for lists at its core: [] and (), without a simple way to abstract over them. Then your data format would be cumbersome to use with no added benefit: whether or not a []-list means something different than a ()-list depends on the specification of your data.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @02:25PM (#9552621)
> Did you just summarize thousands of sentences in a single one?

Could be. The comment format demands a certain succinctness.

> Neither <input type=button/> nor <input><type>button</type></input> does mean anything without a spec of your language, and trying to infer that <input>foo</input> or <type>bar</type> is valid is only due to some pre-conception about the underlying semantics you gave to your data (you chose familiar tag names, after all).

Yes, that's true. Semantics is ultimately a very deep rabbit hole. My main claim is that it's useful to have an unambiguous syntactic distinction between data and metadata so that you can tell that the BAZ in <FOO BAZ=BAR>BING</FOO> is INTENDED to be a MODIFIER for FOO and NOT part of the CONTENT that FOO is marking up.

Actually, let me try to be excruciatingly precise: my claim is that it is not self-evident that a syntactic distinction between data and metadata is useless. Hence a rendering of XML into sexprs that preserves this distinction is defensible, and dismissing it in the pejorative terms that Erik uses is not justified.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by ICWiener on Friday May 15, 2015 @03:36PM (#9553106)
Just as code is data and data is code, meta-data is another form of data. Erik' quotes are all taken from https://groups.google.com/d/msg/comp.lang.lisp/8eUxiibm_zA/C...:

> [...] is INTENDED to be a MODIFIER for FOO and NOT part of the CONTENT that FOO is marking up

"The intended use has less to do with it than the notion that you can define what is meta-information and what is information at the time you want to decide whether something goes in an attribute or a sub-element. My argument is that this is impossible. Whether it is meta-information or information is a reflection of the actual use, not the intended use.

However, given that the mechanism was created, and I will argue that it was not so much created as it was never thought possible to be any other way, it was used to define several language properties. "Now that we have this, would it not also be nice to have that." This means that several of the attribute types grew very far apart from the contents of sub-elements and you sort of "had" to use them as attributes, but only sort of, because the application can and does define the semantics of everything, and if you want ID and IDREF, you can make the same choice as you would in Common Lisp to use symbols or a hash tables of strings."

> Actually, let me try to be excruciatingly precise: my claim is that it is not self-evident that a syntactic distinction between data and metadata is useless. Hence a rendering of XML into sexprs that preserves this distinction is defensible, and dismissing it in the pejorative terms that Erik uses is not justified.

"No, there is nothing that requires there to be element attributes as a distinct concept from element contents. There are, however, a number of practical things that follow from making that arbitrar distinction which can look like rationales, but if you ask yourself "why can it not be a subelement", there are no real answers, only appeals to the idea that there somehow __have to be a distinction. It took me years to figure out that the whole attribute idea is completely vacuous, and I worked with the creator of SGML himself for several years on several SGML-related standards and projects. I started writing "A conceptual introduction to SGML" back in 1994, but as I had pained my way through five chapters, I had to realize that it was all wrong. There was a basic design mistake in the whole language framework. That mistake is that simply put: "what is good enough for the users of the language is not good enough for its creators". Each and every level of "containership" in SGML has its own syntax, optimized for the task. Each and every level has a different syntax for "the writing on the box" as opposed to "the contents of the box". This follows from a very simple, yet amazingly elusive principle in its design: Meta-data is conceptually incompatible with data. This is in fact wrong. Meta-data is only data viewed from a different angle, and vice versa. SGML forces you to remain loyal to your chosen angle of view."

So, the opinion seems to be that the arbitrary structure you put between meta-data and data at the moment you create data is not necessarly well-suited for people using your data: then, despite being useful, the syntactic distinction becomes an annoyance.

By the way, Erik's dissmissal is (1) the result of years of experience working on SGML, and (2) not pejorative, but argumented. He is the one arguing against the "self-evidence" of attributes.

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @11:53PM (#9555003)
> Erik's dissmissal is ... not pejorative

Sorry, the phrase "incredibly stupid" is pejorative.

And I don't really care if his position is the result of years of experience. It's wrong nonetheless. There are certainly stupid things in SGML, but the attribute/element distinction is not one of them. (Or at least, it's not a no-brainer that this is one of the stupid things in SGML, so if you're going to claim that the attribute/element distinction is stupid you need to provide a cogent argument to support your position and not just proclaim it as self-evidently true.)

Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by evacchi on Friday May 15, 2015 @11:59AM (#9551439)
I believe his point was that what you are losing there does not really carry any extra information
Re:Erik Naggum on Attributes in SGML, XML, Lisp (2001) by lisper on Friday May 15, 2015 @12:59PM (#9551917)
Yes, I know that was his point. My claim is that he was wrong. The distinction does carry extra information. See my other comments in this thread for specific examples.