[ruby-core:63395] [ruby-trunk - Feature #9992] Access Modifiers (Internal Interfaces)

From: danieldasilvaferreira@...
Date: 2014-06-28 19:41:28 UTC
List: ruby-core #63395
Issue #9992 has been updated by Daniel Ferreira.


 Hi Nobuyoshi,
=20
 The notion of Internal Interfaces is about being able to use the methods i=
dentified as =E2=80=98internal=E2=80=99 only in the context of a given modu=
le and all its subclasses and/or submodules.
=20
 That way if we develop a new gem lets call it=20
=20
 'gem foo'
=20
 We would be able to define an Internal Interface that would only be used i=
nternally by gem foo classes and modules and by any other gem foo extension=
 like for instance 'gem foo-bar=E2=80=99
=20
 Versioning of releases with this feature would be able to communicate in a=
 great more detailed to the users what nature of changes were made in each =
release.
=20
 We could identify:
 * Public Interface changes with broken backward compatibility - Critical (=
current =E2=80=98major')
 * Public Interface changes without backward compatibility - Major (current=
 'minor=E2=80=99)                       } order of priorities to be discuss=
ed!
 * Internal Interface changes with broken backward compatibility - Minor (c=
urrently doesn=E2=80=99t exist)  } order of priorities to be discussed!
 * Any other change
  - Bugs
  - Refactoring
  - Reengineering ( Internal Interface changes without backward compatibili=
ty) - Tiny (currently =E2=80=98patch=E2=80=99)
=20
 This would be very much useful to better use TDD (Test Drive Development) =
best practices.
=20
 I have much more to say and elaborate about this.
=20
 My idea is to leverage ruby further in order to be proper for uses inside =
the enterprise environment.
=20
 I work for a company that has more then 300 developers working with ruby a=
nd that is present in dozens of countries in the world.
=20
 This feature would be very helpful to allow us to define better our archit=
ecture.
=20
 Ruby give us all the freedom but when you work with such a big number of p=
eople it=E2=80=99s good to have tools that allows you in a clear and unders=
tandable way to define certain boundaries.
=20
 Happy to reply to any doubts and discuss with you this thoughts and what o=
ther alternatives may we have.
=20
 Cheers
=20
 Daniel
=20
 On 28 Jun 2014, at 20:17, nobu@ruby-lang.org wrote:
=20
 > Issue #9992 has been updated by Nobuyoshi Nakada.
 >=20
 > Description updated
 >=20
 > They don't seem to belong to same namespace.
 > Could you elaborate?
 >=20
 > ----------------------------------------
 > Feature #9992: Access Modifiers (Internal Interfaces)
 > https://bugs.ruby-lang.org/issues/9992#change-47437
 >=20
 > * Author: Daniel Ferreira
 > * Status: Open
 > * Priority: Normal
 > * Assignee:=20
 > * Category:=20
 > * Target version:=20
 > ----------------------------------------
 > Hi,
 >=20
 > I=E2=80=99m would like to discuss with you the concept of Internal Inter=
faces.
 >=20
 > Currently ruby offers three access modifiers choices to set methods visi=
bility:
 >=20
 > - public
 > - protected
 > - private
 >=20
 > 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.
 >=20
 > I would like to work with a new access modifier that would allow the cre=
ation of Internal methods.
 >=20
 > Internal methods would be object methods that could only be called withi=
n the namespace.
 >=20
 > Ex:
 >=20
 > ~~~ruby
 > module Foo; end
 >=20
 > class Foo::Bar
 >  def baz=20
 >     puts =E2=80=98baz=E2=80=99
 >  end
 >  internal :baz
 > end
 >=20
 > class Foo::Qux
 >  def baz
 >     ::Foo::Bar.new.baz
 >  end
 > end
 > ~~~
 >=20
 > Is this something that we can think about in a future implementation of =
ruby?
 > An extra feature that would not break backward compatibility.
 >=20
 > Cheers,
 > Daniel
 >=20
 >=20
 >=20
 > --=20
 > https://bugs.ruby-lang.org/

----------------------------------------
Feature #9992: Access Modifiers (Internal Interfaces)
https://bugs.ruby-lang.org/issues/9992#change-47438

* Author: Daniel Ferreira
* Status: Open
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
----------------------------------------
Hi,
=20
I=E2=80=99m would like to discuss with you the concept of Internal Interfac=
es.
=20
Currently ruby offers three access modifiers choices to set methods visibil=
ity:

- 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.
=20
I would like to work with a new access modifier that would allow the creati=
on of Internal methods.
=20
Internal methods would be object methods that could only be called within t=
he namespace.
=20
Ex:

~~~ruby
module Foo; end

class Foo::Bar
  def baz=20
     puts =E2=80=98baz=E2=80=99
  end
  internal :baz
end

class Foo::Qux
  def baz
     ::Foo::Bar.new.baz
  end
end
~~~

Is this something that we can think about in a future implementation of rub=
y?
An extra feature that would not break backward compatibility.
=20
Cheers,
Daniel



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

In This Thread

Prev Next