From: Steve H. <sh...@zi...> - 2002-09-06 18:46:59
|
---- Original Message ----- From: "Mike Orr" <ir...@ms...> > On Fri, Sep 06, 2002 at 12:40:11PM -0400, Steve Howell wrote: > > > So. I don't think there is time to completely flesh-out a more > > > generic implicit type identification system; but perhaps we could > > > add some sort of place holder mechanism for it to be turned off > > > such as #IMPLICIT:OFF > > > > > > > Just a minor quibble here--I don't like the directive in the YAML itself. A > > YAML file can be just data, and the data doesn't have to imply any native > > typing. But some applications require data types. Multiple applications may > > use different data types for the same YAML file. This is true not only when you > > port the same application between multiple languages, but it's also true when > > you use the same data for multiple applications. > > > > Think of a YAML log file. One application may read the log file to compute > > uptime statistics. This application may want to treat dates as dates, memory > > usage as floats, and number of machines down as integers. Another application > > may just want to pretty print the log to a web browser. It wants to treat the > > data as strings. > > > > So there's no use for a directive here in the YAML; you need flexibility in the > > application itself. > > That's what I've been thinking. Whether to use implicit types is not a > function of the document, it's a function of the application. A simple > constructor argument or instance variable in the parser > convertImplicitTypes = False # default True > would do everything I've requested *and* would be unobtrusive to those who > believe in always using YAML's types or want to implement pluggable > types. It would just trigger a huge if-block that bypasses all that. > With a nice little speed improvement too. :) > The reason to implement it now is that *if* anybody has any problems > with our implicit types -- problems we haven't identified yet -- they can > turn it off rather than cursing YAML and vowing never to use it again. > Agreed. > Later, when/if layers are implemented, convertImplicitTypes would mean > "skip layer 2". Although by that point we'd hopefully have separate > entry points for "layer 1 only" and "layers 1 & 2". > Agreed. Thanks for all comments, Mike. Cheers, Steve |