ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:104611] [Ruby master Bug#17719] Irregular evaluation order in hash literals
Date: Thu, 15 Jul 2021 06:22:42 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-92898.20210715062241.4@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17719.20210312130546.4@ruby-lang.org

Issue #17719 has been updated by nobu (Nobuyoshi Nakada).


I think it can be fixed by removing the optimization in the parser and leaving it to the compiler.

----------------------------------------
Bug #17719: Irregular evaluation order in hash literals
https://bugs.ruby-lang.org/issues/17719#change-92898

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
@mame pointed out an irregular evaluation order example.

```sh
$ ruby -e '{foo:p(1), bar:p(2), foo:p(3)}'
-e:1: warning: key :foo is duplicated and overwritten on line 1
1
3
2
```

It feels like a bug.
https://github.com/nobu/ruby/tree/duplicated-keys-order

Or, probably it would be better to turn into an error?



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2021-07-15  6:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 13:05 [ruby-core:102831] [Ruby master Bug#17719] Irregular evaluation order in hash literals nobu
2021-03-12 20:40 ` [ruby-core:102836] " xtkoba+ruby
2021-07-15  6:22 ` nobu [this message]
2021-10-14 22:55 ` [ruby-core:105636] " jeremyevans0 (Jeremy Evans)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-92898.20210715062241.4@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).