Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document %a = %a, %b and %a ,= %b (and link ,= to that section for convenience) #1855

Closed
AlexDaniel opened this issue Mar 20, 2018 · 1 comment
Labels
docs Documentation issue (primary issue type)

Comments

@AlexDaniel
Copy link
Member

AlexDaniel commented Mar 20, 2018

I grepped the docs and couldn't fine any place where we show something like this:

my %a = :11a, :22b;
%a = %a, :33x;
say %a # OUTPUT: «{a => 11, b => 22, x => 33}␤»

Also, this can be written using ,=:

my %a = :11a, :22b;
%a ,= :33x;
say %a # OUTPUT: «{a => 11, b => 22, x => 33}␤»

,= is of course not specific to hashes and behaves like any other op combined with =. However, it seems like ,= is particularly useful for hashes, and people who stumble upon it in code should be able to find this section quickly.

@AlexDaniel AlexDaniel added the docs Documentation issue (primary issue type) label Mar 20, 2018
@cfa
Copy link
Contributor

cfa commented Mar 20, 2018

It might be worth adding examples using the hash contextualiser too,

say %(%a, :33x);  # OUTPUT: «{a => 11, b => 22, x => 33}␤»
say  (%a, :33x);  # OUTPUT: «({a => 11, b => 22} x => 33)␤»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type)
Projects
None yet
Development

No branches or pull requests

2 participants