Created
August 24, 2012 14:58
-
-
Save sirrobert/3451664 to your computer and use it in GitHub Desktop.
Interesting 'eval' inconsistency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
a => {a => 1} | |
b => {b => 2}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
say { | |
a => {a => 1} | |
b => {b => 2}, | |
}; | |
say eval slurp 'demo.data'; | |
## | |
# output: | |
# | |
# Block.new() | |
# "b" => {"b" => 2} | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's worth noting that when the hashes are well-formed (in both cases) the output is right.
As interesting (maybe?) is that in the eval version, the resulting value is ONLY the second hash. The first one is discarded.