You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The style guide suggests using {} for empty hashes and %() for non-empty hashes. This is inconsistent.
Suggestions
Since {} is considered confusing (although technically it's supposed to be straight forward) with blocks, and empty %() is considered a trap (see rakudo/rakudo#1946), why not just use hash instead? According to jnthn in rakudo/rakudo#1946 (comment) these are a "sure bet".
Suggested: avoid both %() (empty construct is a trap) and {} (possible confusion with blocks) for constructing hashes, and always use hash instead:
my $foo = hash; # empty hash
my $bar = hash a => 'b', c => 'd'; # non-empty hash
Note: these can be used with or without parentheses. Since that goes for most expressions, that could probably use its own recommendation in the style guide.
rafaelschipiura, raiph and zoffixznetraiph and AlexDaniel