From: Steve H. <sh...@zi...> - 2002-09-09 00:42:21
|
----- Original Message ----- From: "Clark C. Evans" <cc...@cl...> > A model is an abstraction which is defined clearly enough so that > we can make statements about it and use it to compare to things > which claim to fit the model. A good model abstracts those things > which are important for the cause, and is slient on tangential issues. > > The "generic" model for YAML is an abstraction of a device which > can store information; namely information having a fairly simple > random-access graph structure. Things which implement the device > may be able to store more information than what the model states; > but to be safe, applications which would like to work with all > YAML implementations should only expect to store stuff which is > described by the model; as anything else may not work somewhere else. > > Unlike many open source projects, YAML is one with many implementations. > As such, it is a grave disservice to the YAML community when one > implementation supports things which the others don't without quite > a firm warning to the user. > > ... > > There are two complementary ways to view YAML. One is as a syntax > with lines, encodings, carriage returns, etc. And the other is as > an internal representation of data; a typed graph of maps/list/scalars. > YAML is a ballence between the two. Sometimes you want to work > at the "syntax" level; this is why we have the syntax model. Other > times you want to work at the "serial" level, where the graph is > flattened by giving it a total ordering, and other times you > want to work at the "generic" level where the full graph properties > are visible. Thus you have a spectrum: > > SYNTAX VIEW SERIAL VIEW GRAPH VIEW > > The usefulness of the graph/generic view is that it is the > smallest possible model which gives the greatest varieties. > > Why is this important? > > Well, if you viewed the syntax as king, you end up having > to be concerned with how it is written all of the time. Really > this isn't all that helpful. How it is written, i.e., which > integer format to use (decimal, decimal w/ leading 0, hex, etc) > which key ordering to use, which scalar style to use, are best > kept and managed in the Syntax Layer. Otherwise they just > get-in-the-way when you are doing graph manipulations, adding > numbers, etc. > > If you look at the serial view as king, then you always have > to be concerned which node comes before the other. In RAM > this isn't a constraint so it shouldn't be in the graph view. > > But why not just use the syntax without a graph model? > > If you did this, then what must be kept in memory to "preserve" > the information gets complicated and ugly. Also, taking this > one step further, the syntax model seems to allow all kinds of > things (duplicate keys for instance). However, this is > problematic since not all programming languages support multi-maps > natively... nor should they. Yes, it seems to be a powerful > data structure, but it is more complicated than map/list. > Clark, you appear not to trust your users to make wise decisions about how they use YAML. Python programmers have common sense. Cheers, Steve |