Skip to content

Instantly share code, notes, and snippets.

@sirrobert
Created August 24, 2012 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirrobert/3451664 to your computer and use it in GitHub Desktop.
Save sirrobert/3451664 to your computer and use it in GitHub Desktop.
Interesting 'eval' inconsistency
{
a => {a => 1}
b => {b => 2},
}
use v6;
say {
a => {a => 1}
b => {b => 2},
};
say eval slurp 'demo.data';
##
# output:
#
# Block.new()
# "b" => {"b" => 2}
#
@sirrobert
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment