[#88240] [Ruby trunk Feature#14759] [PATCH] set M_ARENA_MAX for glibc malloc — sam.saffron@...
Issue #14759 has been updated by sam.saffron (Sam Saffron).
[#88251] Re: [ruby-alerts:8236] failure alert on trunk@P895 (NG (r64134)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
[#88305] [Ruby trunk Bug#14968] [PATCH] io.c: make all pipes nonblocking by default — normalperson@...
Issue #14968 has been reported by normalperson (Eric Wong).
[#88331] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — samuel@...
Issue #13618 has been updated by ioquatix (Samuel Williams).
[#88342] [Ruby trunk Feature#14955] [PATCH] gc.c: use MADV_FREE to release most of the heap page body — ko1@...
Issue #14955 has been updated by ko1 (Koichi Sasada).
[#88433] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — ko1@...
SXNzdWUgIzEzNjE4IGhhcyBiZWVuIHVwZGF0ZWQgYnkga28xIChLb2ljaGkgU2FzYWRhKS4KCgpX
a28xQGF0ZG90Lm5ldCB3cm90ZToKPiBJc3N1ZSAjMTM2MTggaGFzIGJlZW4gdXBkYXRlZCBieSBr
[#88475] [Ruby trunk Misc#14937] [PATCH] thread_pthread: lazy-spawn timer-thread only on contention — ko1@...
Issue #14937 has been updated by ko1 (Koichi Sasada).
[#88491] Re: [ruby-cvs:71466] k0kubun:r64374 (trunk): test_function.rb: skip running test — Eric Wong <normalperson@...>
k0kubun@ruby-lang.org wrote:
SSBzZWUuIFBsZWFzZSByZW1vdmUgdGhlIHRlc3QgaWYgdGhlIHRlc3QgaXMgdW5uZWNlc3Nhcnku
Takashi Kokubun <takashikkbn@gmail.com> wrote:
[#88523] [Ruby trunk Bug#14999] ConditionVariable doesn't reacquire the Mutex if Thread#kill-ed — eregontp@...
Issue #14999 has been updated by Eregon (Benoit Daloze).
eregontp@gmail.com wrote:
[#88549] [Ruby trunk Bug#14999] ConditionVariable doesn't reacquire the Mutex if Thread#kill-ed — eregontp@...
Issue #14999 has been updated by Eregon (Benoit Daloze).
[#88676] [Ruby trunk Misc#15014] thread.c: use rb_hrtime_scalar for high-resolution time operations — ko1@...
Issue #15014 has been updated by ko1 (Koichi Sasada).
ko1@atdot.net wrote:
On 2018/08/27 16:16, Eric Wong wrote:
[#88716] Re: [ruby-dev:43715] [Ruby 1.9 - Bug #595] Fiber ignores ensure clause — Eric Wong <normalperson@...>
Koichi Sasada wrote:
[#88723] [Ruby trunk Bug#15041] [PATCH] cont.c: set th->root_fiber to current fiber at fork — ko1@...
Issue #15041 has been updated by ko1 (Koichi Sasada).
[#88767] [Ruby trunk Bug#15050] GC after forking with fibers crashes — ko1@...
Issue #15050 has been updated by ko1 (Koichi Sasada).
Koichi Sasada <ko1@atdot.net> wrote:
[#88774] Re: [ruby-alerts:8955] failure alert on trunk@P895 (NG (r64594)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
[ruby-core:88446] [Ruby trunk Feature#14982] Introduce new namespace system to ruby to avoiding top-level names chaos
Issue #14982 has been reported by jjyr (jy j).
----------------------------------------
Feature #14982: Introduce new namespace system to ruby to avoiding top-level names chaos
https://bugs.ruby-lang.org/issues/14982
* Author: jjyr (jy j)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
## Why
Ruby has evaluation all class/module names in top-level context(aka TOPLEVEL_BINDING).
As a user we basically hard to know how many names in the current context, is causing chaos in some cases. For example:
case 1:
Put common used errors class in a single file, like below
``` ruby
# utils/errors.rb
class FooError
end
class BarError
end
```
In other files under 'utils' we want to use those errors, so the best practice is to use `require_relative 'errors'` in each file we need.
``` ruby
# utils/binary_helper.rb
# we forget require errors
module BinaryHelper
# ...
raise BarError
# ...
end
```
But sometime we may forget to require dependencies in a file, it's hard to notice because
if RubyVM already execute the requires we still can access the name BarError,
but if user directly to require 'utils/binary_helper', he/she will got an NameError.
case 2:
Two gems use same top-level module name, so we can't use them together
## The Reason of The Problem
The reason is we let module author to dicision which module user can use. ('require' is basically evaluation, highly dependent on the module author's design)
But we should let users control which names to use and available in context. As many other popular languages dose(Rust, Python..)
I think the solution is basically the same philosophy compares to refinement feature.
## The Design
I propose a namespace system to Ruby, to solve the problems and still compatible with the current Ruby module system.
``` ruby
class Foo
end
# introduce Kernel#namespace
namespace :Hello do
# avoiding namespace chaos
# Foo -> NameError, can't access TOPLEVEL_BINDING directly
# Kernel#import method, introduce Foo name from TOPLEVEL_BINDING
import :Foo
# in a namespace user can only access imported name
Foo
# import constant to another alias name
# can avoid writing nested module/class names
import :"A::B::C::D", as: :E
# require then import, for convenient
import :"A::B::C::D", as: :E, from: 'some_rb_file'
# import same name from two gems
import :"Foo", as: :Foo_A, from: 'foo_a'
import :"Foo", as: :Foo_B, from: 'foo_b'
# import names in batch
import %i{"A::B::C::D", "AnotherClass"}, from: 'some_rb_file'
# import and alias in batch
import {:"A::B::C::D" => :E, :Foo => Foo2}, from: 'some_rb_file'
class Bar
def xxx
# can access all names in namespace scope
[Foo, Foo_A, Foo_B]
end
end
end
Hello.class # -> module. namespace is just a module
Hello::Bar # so we do not broken current ruby module design
# namespace system is intent to let user to control names in context
# So user can choose use the old require way
require 'hello'
Hello::Bar
# Or user can use namespace system as we do in hello.rb
namespace :Example do
import :"Hello::Bar", as: :Bar
Bar # ok
Foo # name error, cause we do not import Foo in :Example namespace
end
Foo # ok, cause Foo is loaded in TOPLEVEL_BINDING
# define nested namespace
# more clear syntax than module Example1::NestedExample
namespace :Example1, under: NestedExample do
end
namespace :Example2 do
namespace :NestedExample do
end
end
```
Pros:
* Completely compatible with the current module system, a gem user can completely ignore whether a gem is write in Namespace or not.
* User can completely control which names in current context/scope.
* may solve the top module name conflict issue(depends on VM implementation).
Cons:
* Need to modify Ruby VM to support the feature.
--
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>