[#84280] [Ruby trunk Bug#14181] hangs or deadlocks from waitpid, threads, and trapping SIGCHLD — nobu@...
Issue #14181 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/12/15
[#84398] [Ruby trunk Bug#14220] WEBrick changes - failures on MSWIN, MinGW — Greg.mpls@...
Issue #14220 has been reported by MSP-Greg (Greg L).
3 messages
2017/12/22
[#84472] Re: [ruby-dev:50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — Eric Wong <normalperson@...>
Shouldn't English posts be on ruby-core instead of ruby-dev?
3 messages
2017/12/26
[ruby-core:84336] [Ruby trunk Feature#9992] Access Modifiers (Internal Interfaces)
From:
danieldasilvaferreira@...
Date:
2017-12-18 14:49:45 UTC
List:
ruby-core #84336
Issue #9992 has been updated by dsferreira (Daniel Ferreira).
What about this use case:
~~~ruby
module Foo; end
##
# Template class
#
# ==== Example
#
# Foo::SubClass.run(:arg1)
# #=> ...
class Foo::Base
def self.run(*args)
self.new(*args).perform
end
public_class_method :run
##
# Override abstract method
def perform
raise NotImplementedError
end
internal :perform
end
##
# Test subclass.
#
# ==== Example
#
# Foo::Bar.run("Hello!")
# # => My argument is Hello!
class Foo::Bar < Foo:Base
def perform(arg1)
puts "My argument is: " + arg1
end
internal :perform
end
~~~
Currently we need to make `perform` method public but it would be great if we could have the public interface showing only the singleton `run` method.
----------------------------------------
Feature #9992: Access Modifiers (Internal Interfaces)
https://bugs.ruby-lang.org/issues/9992#change-68502
* Author: dsferreira (Daniel Ferreira)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Hi,
I’m would like to discuss with you the concept of Internal Interfaces.
Currently ruby offers three access modifiers choices to set methods visibility:
- public
- protected
- private
Public methods define what we may call the Public Interface.
Private methods are private to the class and its subclasses.
Protected methods are public for the subclasses.
I would like to work with a new access modifier that would allow the creation of Internal methods.
Internal methods would be object methods that could only be called within the namespace.
Ex:
~~~ruby
module Foo; end
class Foo::Bar
def baz
puts ‘baz’
end
internal :baz
end
class Foo::Qux
def baz
::Foo::Bar.new.baz
end
public :baz
end
~~~
What about this use case:
~~~ruby
module Foo; end
##
# Template class
#
# ==== Example
#
# Foo::SubClass.run(:arg1)
# #=> ...
class Foo::Base
def self.run(*args)
self.new(*args).perform
end
public_class_method :run
##
# Override abstract method
def perform
raise NotImplementedError
end
internal :perform
end
##
# Test subclass.
#
# ==== Example
#
# Foo::Bar.run("Hello!")
# # => My argument is Hello!
class Foo::Bar < Foo:Base
def perform(arg1)
puts "My argument is: " + arg1
end
internal :perform
end
Is this something that we can think about in a future implementation of ruby?
An extra feature that would not break backward compatibility.
Cheers,
Daniel
--
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>