ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:110523] [Ruby master Misc#19087] String#to_c supports "_"
@ 2022-10-27 16:44 andrykonchin (Andrew Konchin)
  2022-10-28 10:35 ` [ruby-core:110532] [Ruby master Bug#19087] String#to_c supports multiple "_" nobu (Nobuyoshi Nakada)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: andrykonchin (Andrew Konchin) @ 2022-10-27 16:44 UTC (permalink / raw)
  To: ruby-core

Issue #19087 has been reported by andrykonchin (Andrew Konchin).

----------------------------------------
Misc #19087: String#to_c supports "_"
https://bugs.ruby-lang.org/issues/19087

* Author: andrykonchin (Andrew Konchin)
* Status: Open
* Priority: Normal
----------------------------------------
I've noticed a minor inconsistent behaviour of `String#to_c` method. It does not treat a sequence of `_` character as an end of meaningful characters:

```ruby
"123".to_c # => (123+0i)
"12_3".to_c # => (123+0i)
"12__3".to_c # => (123+0i)
"12___3".to_c # => (123+0i)
```

Similar methods `#to_i` and `#to_r` treat multiple `_` in a different way - they just ignore characters after it:

```ruby
"12__3".to_i # => 12
"12__3".to_r # => (12/1)
```

I would expect `#to_c` to behave similarly.


---

```
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:110532] [Ruby master Bug#19087] String#to_c supports multiple "_"
  2022-10-27 16:44 [ruby-core:110523] [Ruby master Misc#19087] String#to_c supports "_" andrykonchin (Andrew Konchin)
@ 2022-10-28 10:35 ` nobu (Nobuyoshi Nakada)
  2022-11-15 15:34 ` [ruby-core:110768] " andrykonchin (Andrew Konchin)
  2022-12-09 12:18 ` [ruby-core:111246] " nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2022-10-28 10:35 UTC (permalink / raw)
  To: ruby-core

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


https://github.com/ruby/ruby/pull/6645

----------------------------------------
Bug #19087: String#to_c supports multiple "_"
https://bugs.ruby-lang.org/issues/19087#change-99858

* Author: andrykonchin (Andrew Konchin)
* Status: Open
* Priority: Normal
* Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------
I've noticed a minor inconsistent behaviour of `String#to_c` method. It does not treat a sequence of `_` character as an end of meaningful characters:

```ruby
"123".to_c # => (123+0i)
"12_3".to_c # => (123+0i)
"12__3".to_c # => (123+0i)
"12___3".to_c # => (123+0i)
```

Similar methods `#to_i` and `#to_r` treat multiple `_` in a different way - they just ignore characters after it:

```ruby
"12__3".to_i # => 12
"12__3".to_r # => (12/1)
```

I would expect `#to_c` to behave similarly.


---

```
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:110768] [Ruby master Bug#19087] String#to_c supports multiple "_"
  2022-10-27 16:44 [ruby-core:110523] [Ruby master Misc#19087] String#to_c supports "_" andrykonchin (Andrew Konchin)
  2022-10-28 10:35 ` [ruby-core:110532] [Ruby master Bug#19087] String#to_c supports multiple "_" nobu (Nobuyoshi Nakada)
@ 2022-11-15 15:34 ` andrykonchin (Andrew Konchin)
  2022-12-09 12:18 ` [ruby-core:111246] " nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: andrykonchin (Andrew Konchin) @ 2022-11-15 15:34 UTC (permalink / raw)
  To: ruby-core

Issue #19087 has been updated by andrykonchin (Andrew Konchin).


Thank you!

----------------------------------------
Bug #19087: String#to_c supports multiple "_"
https://bugs.ruby-lang.org/issues/19087#change-100111

* Author: andrykonchin (Andrew Konchin)
* Status: Open
* Priority: Normal
* Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED
----------------------------------------
I've noticed a minor inconsistent behaviour of `String#to_c` method. It does not treat a sequence of `_` character as an end of meaningful characters:

```ruby
"123".to_c # => (123+0i)
"12_3".to_c # => (123+0i)
"12__3".to_c # => (123+0i)
"12___3".to_c # => (123+0i)
```

Similar methods `#to_i` and `#to_r` treat multiple `_` in a different way - they just ignore characters after it:

```ruby
"12__3".to_i # => 12
"12__3".to_r # => (12/1)
```

I would expect `#to_c` to behave similarly.


---

```
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
```




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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:111246] [Ruby master Bug#19087] String#to_c supports multiple "_"
  2022-10-27 16:44 [ruby-core:110523] [Ruby master Misc#19087] String#to_c supports "_" andrykonchin (Andrew Konchin)
  2022-10-28 10:35 ` [ruby-core:110532] [Ruby master Bug#19087] String#to_c supports multiple "_" nobu (Nobuyoshi Nakada)
  2022-11-15 15:34 ` [ruby-core:110768] " andrykonchin (Andrew Konchin)
@ 2022-12-09 12:18 ` nagachika (Tomoyuki Chikanaga)
  2 siblings, 0 replies; 4+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2022-12-09 12:18 UTC (permalink / raw)
  To: ruby-core

Issue #19087 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONTNEED

I agree that the new behavior is consistent and preferable, but I don't think it should be fixed on the stable branches.
If there are any troubles on the real world applications with this issue, please let me know.

----------------------------------------
Bug #19087: String#to_c supports multiple "_"
https://bugs.ruby-lang.org/issues/19087#change-100537

* Author: andrykonchin (Andrew Konchin)
* Status: Closed
* Priority: Normal
* Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONTNEED
----------------------------------------
I've noticed a minor inconsistent behaviour of `String#to_c` method. It does not treat a sequence of `_` character as an end of meaningful characters:

```ruby
"123".to_c # => (123+0i)
"12_3".to_c # => (123+0i)
"12__3".to_c # => (123+0i)
"12___3".to_c # => (123+0i)
```

Similar methods `#to_i` and `#to_r` treat multiple `_` in a different way - they just ignore characters after it:

```ruby
"12__3".to_i # => 12
"12__3".to_r # => (12/1)
```

I would expect `#to_c` to behave similarly.


---

```
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
```




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-09 12:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 16:44 [ruby-core:110523] [Ruby master Misc#19087] String#to_c supports "_" andrykonchin (Andrew Konchin)
2022-10-28 10:35 ` [ruby-core:110532] [Ruby master Bug#19087] String#to_c supports multiple "_" nobu (Nobuyoshi Nakada)
2022-11-15 15:34 ` [ruby-core:110768] " andrykonchin (Andrew Konchin)
2022-12-09 12:18 ` [ruby-core:111246] " nagachika (Tomoyuki Chikanaga)

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).