[#84867] [Ruby trunk Bug#14357] thread_safe tests suite segfaults — v.ondruch@...
Issue #14357 has been reported by vo.x (Vit Ondruch).
11 messages
2018/01/15
[#85364] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
v.ondruch@tiscali.cz wrote:
[#85368] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/03
Eric Wong wrote:
[#85442] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Eric Wong <normalperson@...>
2018/02/06
Eric Wong <normalperson@yhbt.net> wrote:
[#85451] Re: [Ruby trunk Bug#14357] thread_safe tests suite segfaults
— Vladimir Makarov <vmakarov@...>
2018/02/06
On 02/06/2018 05:00 AM, Eric Wong wrote:
[#84874] [Ruby trunk Bug#14360] Regression CSV#open method for writing from Ruby 2.4.3 to 2.5.0 — shevegen@...
Issue #14360 has been updated by shevegen (Robert A. Heiler).
3 messages
2018/01/15
[#84980] [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — hsbt@...
Issue #13618 has been updated by hsbt (Hiroshi SHIBATA).
10 messages
2018/01/23
[#85012] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/23
hsbt@ruby-lang.org wrote:
[#85081] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
Eric Wong <normalperson@yhbt.net> wrote:
[#85082] Re: [Ruby trunk Feature#13618][Assigned] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/01/24
> Thinking about this even more; I don't think it's possible to
[#85088] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — danieldasilvaferreira@...
Issue #13618 has been updated by dsferreira (Daniel Ferreira).
3 messages
2018/01/25
[#85107] [Ruby trunk Misc#14222] Mutex.lock is not safe inside signal handler: what is? — eregontp@...
Issue #14222 has been updated by Eregon (Benoit Daloze).
3 messages
2018/01/25
[#85136] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — Eric Wong <normalperson@...>
samuel@oriontransfer.org wrote:
3 messages
2018/01/26
[ruby-core:84727] [Ruby trunk Feature#14277] Improve strings vs symbols ambiguity
From:
mame@...
Date:
2018-01-08 17:25:04 UTC
List:
ruby-core #84727
Issue #14277 has been updated by mame (Yusuke Endoh).
I show one example that the difference between Symbols and Strings is actually useful for me: [a trie](https://en.wikipedia.org/wiki/Trie).
```ruby
class Trie
def initialize
@root = {}
end
def insert(key, val)
n = @root
key.each_char do |ch|
n = (n[ch] ||= {})
end
n[:leaf] = val
end
def lookup(key)
n = @root
key.each_char do |ch|
n = n[ch]
return unless n
end
n[:leaf]
end
end
trie = Trie.new
trie.insert("foobar", 1)
trie.insert("fooqux", 2)
trie.insert("foo", 3)
p trie.lookup("foobar") #=> 1
p trie.lookup("fooqux") #=> 2
p trie.lookup("foo") #=> 3
p trie.lookup("foobaz") #=> nil
```
This trie implementation uses Hash objects for each node of trie. The key type of hashes is a one-letter String, or a Symbol `:leaf`. The one-letter String key represents a character of an edge that starts from the node, and its value of the hash is the child node. The Symbol `:leaf` means that the node has an associated value for the string key of a trie, and its value of the hash is the associated value of trie.
Instead of `:leaf`, I can use another object (for example, `nil` or `Leaf = Object.new`), but I like it because it is simple and easy to understand.
----------------------------------------
Feature #14277: Improve strings vs symbols ambiguity
https://bugs.ruby-lang.org/issues/14277#change-69447
* Author: dsferreira (Daniel Ferreira)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
This is the ambiguity:
```ruby
alias_method :foo, :bar
alias_method "foo", "bar"
```
Ruby developers are using strings and symbols interchangeably as if they were the same thing.
This is happening in ruby core, in ruby gems and in ruby applications.
---
This discussion as started 5 years ago in two separate feature requests (both rejected):
* [5964](https://bugs.ruby-lang.org/issues/5964)
* [7792](https://bugs.ruby-lang.org/issues/7792)
I believe ruby will be much better once the ambiguity between strings and symbols is resolved for good
and ruby 3.0 is a very good opportunity to do so.
From further discussions I got a light of hope that a solution may be accepted if certain conditions are met.
Specifically, a clear transition path that could lead the community towards the break of backwards compatibility.
In the issue [Make symbols and strings the same thing](https://bugs.ruby-lang.org/issues/7792)
ko1 (Koichi Sasada) wrote:
> Please consider transition path for users who are using symbol and string difference like:
>
> key = ...
> ...
> when key
> case String
> ...
> case Symbol
> ...
> end
> How to find out such programs?
>
he also wrote:
> If you (or someone) find out any good transition path, we think we can consider again.
Can we discuss here what are the rules that would allow the transition path solution to be accepted?
Also what solutions for the problem are we envisioning?
1. Use current symbols syntax as yet another strings syntax and stop using Symbols?
2. Use current symbols syntax as yet another strings syntax and start use Symbols with a new syntax?
3. Use current symbols syntax as yet another strings syntax and use Symbols purely as a class?
From the challenge presented by Koichi I understand that the transition path to be accepted must allow the current code to raise a warning for the situation where the Symbol is not anymore a Symbol but a String.
Is this assumption correct?
If this is the case then all we need is to make `String::===(foo)` and `Symbol::===(foo)` to raise warnings every time `foo` is a string and it was created using former symbol syntax.
This means the `foo` object needs to contain encapsulated the information of the syntax used to define it.
Any drawbacks?
NOTE: (I'm only considering solutions 2. and 3. for the purpose of this analysis. Meaning Symbol class will still exist.)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>