From: why t. l. s. <yam...@wh...> - 2002-09-07 17:58:15
|
Tom Sawyer (tra...@tr...) wrote: > at this core level (pure yaml without types) types can be reasonably > delt with in implementation. a program will use the data, typecasting it > as is suitable to its needs. this is important, because DIFFERENT > LANGUAGES DO NOT SHARE THE SAME TYPES. My problem with this argument is that if we really believe it, then YAML crumbles. See, the Integer and the String and the Float generally typecast well between languages. It's the sequence and mapping that give us more trouble! For example, PHP doesn't have a seperate Array and Hash. It's all the associative array. So round-tripping an array properly would involve scanning all the keys of the array for 0-(n-1) keys. And then there is the possibility of just one of those keys missing. At that point is it still a sequence? Perhaps it is a sequence with a Nil entry. Perhaps it's a mapping at that point. We can't very well have the emitter making up new entries to compensate. Brian has said it before: We're trying to make YAML a config file syntax, a serialization format, an intermediary format for everything and anything. But what is it really? If we have typing, then it sure starts to sound a lot more like a serialization language. It certainly doesn't sound like a config file! I have some objections to the config file view of YAML, which appears to want to present YAML as Not-YAML. As a no-nonsense, stripped bare (no headers, no typing) syntax leading a hidden life somewhere else as a full-fledged graph. I mean what's the big deal with configuration files? How hard is it to write a config file parser and how many people are going to look at YAML and say, "Screw this! I can write five regexps to do my config file!" I can see YAML's case for config (I'm thinking of Neil's recent spam project) but somebody needs to stand up for YAML's individuality. If somebody is going to use YAML for config, then their users will likely have to know some YAML. I wouldn't seek to disguise it. I'd rather hear this: "Wow, YAML is cool because you have a language-neutral technique for storing and loading data. It's like config files on crack!" Than this: "Oh, YAML's this config file format that's TRYING to be a data serialization format, too." I guess I don't see the big deal about implicit types because I see YAML as data serialization. And when it comes to a discussion about surrounding data with '(' ')' so that you don't have to surround your strings with '"' '"' then it seems to me that YAML is a config file at heart. > taking this further, when i dump a Ruby object to yaml, the type comes > out something like: !ruby/classname. that's a problem for > interoperability. it should just be !classname. it should not matter > that it came from Ruby. and by my approach as given above, it would not > matter. it's just a name, for any other implementation to interprept as > suites it. I think we'll make this transistion once we see how the implementations work together and once we have implicit typing down. Certainly I'd like to see classes transfer smoothly between languages. For now, we use the language identifier as a sandbox for proofs of concept. _why |