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

Goodbye Hash rockets... #769

Merged
merged 2 commits into from Nov 20, 2023
Merged

Goodbye Hash rockets... #769

merged 2 commits into from Nov 20, 2023

Conversation

ixti
Copy link
Member

@ixti ixti commented Oct 18, 2023

I love Hash rockets. And think that it helps distinguish Hashes from keyword arguments, but:

  1. we should avoid using options Hashes in arguments
  2. lately I find it harder to deal with conditional logic of how Ruby differentiates keyword args from Hashes - so IMO it's better to move towards style that will imply we're using keyword arguments

Enforce ruby19 Hash syntax for Hashes with Symbol keys only, and enforce
hash-rockets in case of mixed usage:

    { a: 1, b: 2 }        # good
    { a: 1, "b" => 2 }    # bad
    { :a => 1, "b" => 2 } # good (no mixed syntax)

In future we will swap all options hashes with keyword args.
@ixti ixti requested review from tarcieri and sferik October 18, 2023 15:00
@tarcieri tarcieri changed the title Goodby Hash rockets... Goodbye Hash rockets... Oct 18, 2023
@ixti ixti marked this pull request as ready for review October 18, 2023 19:26
Copy link
Contributor

@paul paul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@ixti ixti merged commit f207bb5 into main Nov 20, 2023
6 checks passed
@ixti ixti deleted the ixti/ruby19-hash-syntax branch November 20, 2023 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants