Here are some examples.
RbYAML.load("!!null")
RbYAML.load("!!str")
RbYAML.load("!!map")
RbYAML.load("!!seq")
In my opinion, it should return an empty instance of the certain type.
For the above examples, the results should be as follows.
nil
String.new
Hash.new
Array.new
In Syck, all statements will throw syntax error exceptions.
In jvyamlb,
load("!!null") and load("!!str") will return null.
load("!!map") and load("!!seq") will throw exceptions.
--
Kind Regards
spritesun
I think if YAML1.1 specification does not say anything, it could make sense to follow whatever Syck does. After all, this is what most people use for ruby yaml parsing, and compatibility is a nice thing to have.
-yong
Btw, I would assume that the example doesn't use !!null or !!str for
syck, since that doesn't work (it's not 1.0 compatible syntax)
Cheers
> On 5/25/08, *mushishi* <spri...@gmail.com
> <mailto:spri...@gmail.com>> wrote:
>
>
> Hi guys,
> Is there anyone could give me some suggestion about empty value
> parsing?I can't find solution in YAML1.1 specification.
>
> Here are some examples.
> RbYAML.load("!!null")
> RbYAML.load("!!str")
> RbYAML.load("!!map")
> RbYAML.load("!!seq")
>
> In my opinion, it should return an empty instance of the certain type.
> For the above examples, the results should be as follows.
> nil
> String.new
> Hash.new
> Array.new
>
> In Syck, all statements will throw syntax error exceptions.
> In jvyamlb,
> load("!!null") and load("!!str") will return null.
> load("!!map") and load("!!seq") will throw exceptions.
>
--
Ola Bini (http://ola-bini.blogspot.com)
JRuby Core Developer
Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
Practical JRuby on Rails (http://apress.com/book/view/9781590598818)
"Yields falsehood when quined" yields falsehood when quined.
So I think the behavior should act as,
load("!!null") => nil
load("!!str") => "" # same as String.new
load("!!map") => throw exception
load("!!seq") => throw exception
Btw, what about load("")?
In syck, it return false,
In jvyamlb, it return null.
I prefer jvyamlb behavior here. It's really weird if return false.
--
Kind Regards
spritesun