* [ruby-core:66039] [ruby-trunk - Bug #10463] [Open] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
@ 2014-11-01 2:13 ` sawadatsuyoshi
2014-11-01 2:22 ` [ruby-core:66040] [ruby-trunk - Bug #10463] " sawadatsuyoshi
` (11 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: sawadatsuyoshi @ 2014-11-01 2:13 UTC (permalink / raw
To: ruby-core
Issue #10463 has been reported by Tsuyoshi Sawada.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:66040] [ruby-trunk - Bug #10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
2014-11-01 2:13 ` [ruby-core:66039] [ruby-trunk - Bug #10463] [Open] :~@ and :!@ are not parsed correctly sawadatsuyoshi
@ 2014-11-01 2:22 ` sawadatsuyoshi
2014-11-01 2:37 ` [ruby-core:66041] " silverhammermba+ruby
` (10 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: sawadatsuyoshi @ 2014-11-01 2:22 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by Tsuyoshi Sawada.
The report above is the result for irb. With `ruby -e` on the terminal, they return different results.
~~~
$ ruby -e "p :~@"
:~
$ ruby -e "p :!@"
bash: !@: event not found
~~~
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-49759
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:66041] [ruby-trunk - Bug #10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
2014-11-01 2:13 ` [ruby-core:66039] [ruby-trunk - Bug #10463] [Open] :~@ and :!@ are not parsed correctly sawadatsuyoshi
2014-11-01 2:22 ` [ruby-core:66040] [ruby-trunk - Bug #10463] " sawadatsuyoshi
@ 2014-11-01 2:37 ` silverhammermba+ruby
2019-07-09 3:58 ` [ruby-core:93625] [Ruby master Bug#10463] " merch-redmine
` (9 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: silverhammermba+ruby @ 2014-11-01 2:37 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by Max Anselm.
That's because bash is trying to interpolate the string.
$ ruby -e 'p :!@'
:!
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-49760
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93625] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (2 preceding siblings ...)
2014-11-01 2:37 ` [ruby-core:66041] " silverhammermba+ruby
@ 2019-07-09 3:58 ` merch-redmine
2019-07-09 15:30 ` [ruby-core:93640] " nobu
` (8 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: merch-redmine @ 2019-07-09 3:58 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by jeremyevans0 (Jeremy Evans).
I did some research, and this is related to the fact that Ruby allows `!@` and `~@` as method names (back to the initial SVN revision for `~@`), silently dropping the `@` from the method name:
```ruby
class A
def !@; :!@ end
def ~@; :~@ end
end
!A.new
# :!
~A.new
# :~
A.instance_methods(false)
# => [:!, :~]
```
This diff would remove this behavior:
```diff
diff --git a/parse.y b/parse.y
index 33f1ef072e..ed7dae8955 100644
--- a/parse.y
+++ b/parse.y
@@ -8772,6 +8772,7 @@ parser_yylex(struct parser_params *p)
if (IS_AFTER_OPERATOR()) {
SET_LEX_STATE(EXPR_ARG);
if (c == '@') {
+ pushback(p, c);
return '!';
}
}
@@ -9184,9 +9185,6 @@ parser_yylex(struct parser_params *p)
case '~':
if (IS_AFTER_OPERATOR()) {
- if ((c = nextc(p)) != '@') {
- pushback(p, c);
- }
SET_LEX_STATE(EXPR_ARG);
}
else {
```
However, it breaks using `~@` and `!@` as method names, which is breaks one test in bootstraptest. This is because both the symbol and the method name use `fname` in the parser. There is probably a way to remove support for using these in symbols but keeping the support in method names that I am not currently aware of. However, I'm sure if we want to keep supporting `~@` and `!@` in method names.
FWIW, JRuby handles `:~@` and `:!@` the same way as CRuby.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79229
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [ruby-core:93640] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (3 preceding siblings ...)
2019-07-09 3:58 ` [ruby-core:93625] [Ruby master Bug#10463] " merch-redmine
@ 2019-07-09 15:30 ` nobu
2019-07-09 15:56 ` [ruby-core:93642] " merch-redmine
` (7 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: nobu @ 2019-07-09 15:30 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by nobu (Nobuyoshi Nakada).
If `:!@` and `:!` are different things, also `!foo` and `foo.!` are different things.
This means a backward incompatibility.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79248
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93642] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (4 preceding siblings ...)
2019-07-09 15:30 ` [ruby-core:93640] " nobu
@ 2019-07-09 15:56 ` merch-redmine
2019-07-09 16:40 ` [ruby-core:93643] " nobu
` (6 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: merch-redmine @ 2019-07-09 15:56 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by jeremyevans0 (Jeremy Evans).
nobu (Nobuyoshi Nakada) wrote:
> If `:!@` and `:!` are different things, also `!foo` and `foo.!` are different things.
I don't believe that is true. With the above patch:
```ruby
class A
def !; :! end
def ~; :~ end
end
!A.new
# :!
A.new.!
# :!
~A.new
# :~
A.new.~
# :~
```
The `@` in `:!@` and `def !@; end` was ignored during lexing before, it doesn't affect the semantics. This is different than `+@` and `+`:
```ruby
class A
def +; :+ end
def +@; :+@ end
end
+A.new
# :+@
A.new.+
# :+
```
> This means a backward incompatibility.
The backward incompatibility should be limited to making the following invalid syntax:
```ruby
def !@; end
def ~@; end
alias foo !@
alias bar ~@
:!@
:~@
```
Currently, `:!@` is different than `:"!@"`, which very much appears to be a bug. With the above patch `:!@` is a syntax error (`:"!@"` is still valid).
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79250
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93643] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (5 preceding siblings ...)
2019-07-09 15:56 ` [ruby-core:93642] " merch-redmine
@ 2019-07-09 16:40 ` nobu
2019-07-09 16:53 ` [ruby-core:93644] " merch-redmine
` (5 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: nobu @ 2019-07-09 16:40 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by nobu (Nobuyoshi Nakada).
jeremyevans0 (Jeremy Evans) wrote:
> nobu (Nobuyoshi Nakada) wrote:
> > If `:!@` and `:!` are different things, also `!foo` and `foo.!` are different things.
>
> I don't believe that is true. With the above patch:
Sorry, forgot `@`, I wanted to mean `!foo` and `foo.!@`.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79251
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93644] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (6 preceding siblings ...)
2019-07-09 16:40 ` [ruby-core:93643] " nobu
@ 2019-07-09 16:53 ` merch-redmine
2019-07-10 9:27 ` [ruby-core:93653] " shevegen
` (4 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: merch-redmine @ 2019-07-09 16:53 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by jeremyevans0 (Jeremy Evans).
nobu (Nobuyoshi Nakada) wrote:
> jeremyevans0 (Jeremy Evans) wrote:
> > nobu (Nobuyoshi Nakada) wrote:
> > > If `:!@` and `:!` are different things, also `!foo` and `foo.!` are different things.
> >
> > I don't believe that is true. With the above patch:
>
> Sorry, forgot `@`, I wanted to mean `!foo` and `foo.!@`.
Well, `foo.!@` would be a syntax error with the patch. Is there a reason other than backwards compatibility to keep this automatic aliasing of `!@` to `!` and `~@` to `~`? If not, maybe we could deprecate this in 2.7 and remove it in Ruby 3 (if matz approves).
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79252
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93653] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (7 preceding siblings ...)
2019-07-09 16:53 ` [ruby-core:93644] " merch-redmine
@ 2019-07-10 9:27 ` shevegen
2019-07-18 19:22 ` [ruby-core:93834] " merch-redmine
` (3 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: shevegen @ 2019-07-10 9:27 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by shevegen (Robert A. Heiler).
Interesting - I did not know this. sawa finds stuff. :)
Personally I would be in favour of changing the behaviour as Jeremy described (I also think this
may be a bug or perhaps an oddity), but I guess it depends on a) whether matz wants to change it
in the first place and b) then when to change it, if a) evaluates to a change.
A secondary consideration may be to query how many ruby users depend on this backwards behaviour.
I have no statistical dataset to make a statement either way, but from intuition, I would venture
that this change would not affect a lot of ruby code out there; I could be wrong though.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79264
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:93834] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (8 preceding siblings ...)
2019-07-10 9:27 ` [ruby-core:93653] " shevegen
@ 2019-07-18 19:22 ` merch-redmine
2019-07-30 7:40 ` [ruby-core:94031] " ko1
` (2 subsequent siblings)
12 siblings, 0 replies; 13+ messages in thread
From: merch-redmine @ 2019-07-18 19:22 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by jeremyevans0 (Jeremy Evans).
File tilde-bang-at-symbols.patch added
matz confirmed in the last developer meeting that he wants `def !@; end` to continue to work. However, I still think we should fix it so that `:!@` and `:~@` are not treated as `:!` and `:~`. This is a bit tricky to do as the parser currently uses the same lex state for both cases (`EXPR_FNAME`).
The simplest way I can think to fix this is in the attached patch. It changes the `:!` and `:~` cases to use lex state `EXPR_FNAME|EXPR_FITEM`, and changes the code to check on whether `EXPR_FITEM` is one of the lex states. If `EXPR_FITEM` is one of the lex states, then it doesn't ignore the `@`.
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-79706
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
---Files--------------------------------
tilde-bang-at-symbols.patch (2.22 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:94031] [Ruby master Bug#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (9 preceding siblings ...)
2019-07-18 19:22 ` [ruby-core:93834] " merch-redmine
@ 2019-07-30 7:40 ` ko1
2019-09-02 6:30 ` [ruby-core:94731] [Ruby master Feature#10463] " ko1
2019-12-20 8:12 ` [ruby-core:96372] " matz
12 siblings, 0 replies; 13+ messages in thread
From: ko1 @ 2019-07-30 7:40 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by ko1 (Koichi Sasada).
Assignee set to nobu (Nobuyoshi Nakada)
----------------------------------------
Bug #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-80256
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version:
* ruby -v: 2.1.4
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
---Files--------------------------------
tilde-bang-at-symbols.patch (2.22 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:94731] [Ruby master Feature#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (10 preceding siblings ...)
2019-07-30 7:40 ` [ruby-core:94031] " ko1
@ 2019-09-02 6:30 ` ko1
2019-12-20 8:12 ` [ruby-core:96372] " matz
12 siblings, 0 replies; 13+ messages in thread
From: ko1 @ 2019-09-02 6:30 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by ko1 (Koichi Sasada).
Backport deleted (2.0.0: UNKNOWN, 2.1: UNKNOWN)
ruby -v deleted (2.1.4)
Assignee changed from nobu (Nobuyoshi Nakada) to matz (Yukihiro Matsumoto)
Tracker changed from Bug to Feature
----------------------------------------
Feature #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-81347
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
---Files--------------------------------
tilde-bang-at-symbols.patch (2.22 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [ruby-core:96372] [Ruby master Feature#10463] :~@ and :!@ are not parsed correctly
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
` (11 preceding siblings ...)
2019-09-02 6:30 ` [ruby-core:94731] [Ruby master Feature#10463] " ko1
@ 2019-12-20 8:12 ` matz
12 siblings, 0 replies; 13+ messages in thread
From: matz @ 2019-12-20 8:12 UTC (permalink / raw
To: ruby-core
Issue #10463 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Rejected
I don't see the practical benefit of this proposal. Besides that incompatibility is a clear drawback.
Matz.
----------------------------------------
Feature #10463: :~@ and :!@ are not parsed correctly
https://bugs.ruby-lang.org/issues/10463#change-83287
* Author: sawa (Tsuyoshi Sawada)
* Status: Rejected
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
The at mark in literal symbols `:~@` and `:!@` are ignored.
~~~ruby
:~@ # => :~
:!@ # => :!
~~~
---Files--------------------------------
tilde-bang-at-symbols.patch (2.22 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-12-20 8:12 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-10463.20141101021311@ruby-lang.org>
2014-11-01 2:13 ` [ruby-core:66039] [ruby-trunk - Bug #10463] [Open] :~@ and :!@ are not parsed correctly sawadatsuyoshi
2014-11-01 2:22 ` [ruby-core:66040] [ruby-trunk - Bug #10463] " sawadatsuyoshi
2014-11-01 2:37 ` [ruby-core:66041] " silverhammermba+ruby
2019-07-09 3:58 ` [ruby-core:93625] [Ruby master Bug#10463] " merch-redmine
2019-07-09 15:30 ` [ruby-core:93640] " nobu
2019-07-09 15:56 ` [ruby-core:93642] " merch-redmine
2019-07-09 16:40 ` [ruby-core:93643] " nobu
2019-07-09 16:53 ` [ruby-core:93644] " merch-redmine
2019-07-10 9:27 ` [ruby-core:93653] " shevegen
2019-07-18 19:22 ` [ruby-core:93834] " merch-redmine
2019-07-30 7:40 ` [ruby-core:94031] " ko1
2019-09-02 6:30 ` [ruby-core:94731] [Ruby master Feature#10463] " ko1
2019-12-20 8:12 ` [ruby-core:96372] " matz
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).