Re: Implicit Typing
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <1178216389.19567.58.camel@nero> |
On Wed, 2007-05-02 at 01:09 -0700, Ingy dot Net wrote: > > The boolean case raises a second issue however. There is a conflict > > between "correctly" guessing the types of data with utter lack of schema > > information, and "correctly" interpreting the value of data when the > > schema is known. In the boolean case, this means that when reading a > > random-off-the-street file without any knowledge what it means, > > interpreting Y as a string seems to be the right thing to do. At the > > same time, when a server application is reading reading a boolean field > > in its own dedicated configuration file, interpreting the same Y > > character as the boolean value true also seems as the right thing to do. > > > > This leaves us in something of a bind. The immediate solution that comes > > to mind is: > > Why does this leave us in a bind? > > I would say that your server application would be aware that its > configuration file had implicit booleans, and would then set the appropriate > option in the YAML Loader module/object/whatever to DTRT. So far, so good. The problem is that, say, a YAML-pretty printer would feel justified in stripping away quotes around a "Y", not knowing that the server application will then start treating it as a boolean (assume a polymorphic field for a second). The challenge is to define rules that allow the specific application to do what it wants to without a fuss, while keeping the generic programs safe. The spec addresses this for the most part; the missing piece is defining the "basic set of types". How do you feel about defining such a basic set and requiring an explicit tag if venturing outside it? > One more thing... could you stop referring to the "Parser" when talking bout > typing. IMO, no typing activity happens at the parser level. Use the term > Composer or at least Loader. My bad, you are absolutely correct. The name of the relevant processing phase is "compose" so I suppose I should have said "composer" :-) Have fun, Oren Ben-Kiki ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/