Skip to content

Goodbye Hash rockets...#769

Merged
ixti merged 2 commits intomainfrom
ixti/ruby19-hash-syntax
Nov 20, 2023
Merged

Goodbye Hash rockets...#769
ixti merged 2 commits intomainfrom
ixti/ruby19-hash-syntax

Conversation

@ixti
Copy link
Copy Markdown
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

ixti added 2 commits October 18, 2023 16:33
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 sferik and tarcieri 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
Copy Markdown
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
@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.

3 participants