Re: YAML's No in Perl
by audreyt (Hermit) on Mar 13, 2006 at 19:12 UTC
|
use YAML::Syck;
$YAML::Syck::ImplicitTyping = 1;
Load("No"); # undef
I had ImplicitTyping on, but Ingy told me it should be off by default to save time and reduce confusion and improve compatibility. So... Blame him. :-) | [reply] [d/l] |
|
|
Hi audrey.
Save time? Execution time? Please explain... I think YAML::Syck is fast enough for all of my needs.
Improve compatibility with what, older Perl modules (all of which are 'alpha' or 'beta' and should not guarantee API/backwards compatibility anyway)? I would vote for better interoperability with the other YAML-using languages, as it is one of YAML's biggest strength.
Reduce confusion? Hm, that's not what I experienced. Implicit typing is also one of YAML's basic features.
So, turn it and keep it on please :)
| [reply] |
|
|
Okay, I did add a prominient notice to YAML::Syck 0.38 and credited you for it in the ChangeLog. Thanks!
| [reply] |
|
|
|
|
| [reply] |
Re: YAML's No in Perl
by adrianh (Chancellor) on Mar 13, 2006 at 12:06 UTC
|
Strangely, all of them but Perl have had no problem with No being false, but interestingly in Perl we are confused every now and then and load No as the string 'No'. What's going on here? :-)
Bugs from the sound of it. I'm sure the developers would love a nicely wrapped up test case and an RT bug report :-)
| [reply] |
Re: YAML's No in Perl
by wazoox (Prior) on Mar 13, 2006 at 12:11 UTC
|
Perl evaluates 0, undef and '' (empty string) as false in scalar context. It evaluates () (empty list) as false in list context. Any other string evaluates as true. I don't see what's wrong with that; if "No" evaluates false, what about "NO", "no", "N" ? What about "Non", "Niet", "Nein" and "La'" ? | [reply] [d/l] |
|
|
| [reply] |
|
|
I see. It could be then a nice feature to add to the YAML module. After all, it's only an alpha release : latest is 0.58.
| [reply] |
|
|