::

Hello

What is the difference between . and :: ? (x.method, x::method work !)
Are they the same (for the interpreter), and just for the humans?

When should I use whicn one?

Do Contants define Namespaves?

Where is a good documentation of Namespaces (including
Namespace-inheritance [vs Class/Object-inheritance] ),

or can s.o. describe it in a short way?

thanks, Andrew

Hi,

They are basically same. We used '::' for class methods as a convention.
But they are less used recently.

              matz.

···

In message "Re: ::" on Sun, 12 Jul 2020 09:27:10 +0200, Die Optimisten <inform@die-optimisten.net> writes:

Hello

What is the difference between . and :: ? (x.method, x::method work !)
Are they the same (for the interpreter), and just for the humans?

When should I use whicn one?

I tend to use double-colon for indicating inheritance, as in

MobilePage < SitePrism::Page

Regarding namespacing, if I am correct, namespaces are defined with the
module and class keywords.
https://www.ruby-lang.org/en/documentation/faq/8/

ps. Hello Matz :slight_smile: :slight_smile: We met in 2014 or 2015 in San Francisco, of course you
don't remember me but I remember you. :slight_smile: Thank you for Ruby :slight_smile: #MINASWAN

···

On Sun, Jul 12, 2020 at 12:27 AM Die Optimisten <inform@die-optimisten.net> wrote:

Hello

What is the difference between . and :: ? (x.method, x::method work !)
Are they the same (for the interpreter), and just for the humans?

When should I use whicn one?

Do Contants define Namespaves?

Where is a good documentation of Namespaces (including
Namespace-inheritance [vs Class/Object-inheritance] ),

or can s.o. describe it in a short way?

thanks, Andrew

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow

Hey,

When used before a method, as Matz told us (thank you!), It's the same.

Other than that, it just "walks" into a module.

No, constants don't represent namespaces. They are essentially the same as variables but can be accessed from anywhere (and the interpreter will warn you when you change the value).

Ruby doesn't really have namespaces. It has modules instead. Classes act as modules too (Class is a subclass of Module).

I REALLY recommend you to read the chapter on modules in "The Ruby Programming Language" book written by Matz and David Flanagan. It's incredibly important part of the language so you should learn it as a whole, not receive bits and pieces here:)

···

Sent from my iPhone

On 12 Jul 2020, at 08:27, Die Optimisten <inform@die-optimisten.net> wrote:

Hello

What is the difference between . and :: ? (x.method, x::method work !)
Are they the same (for the interpreter), and just for the humans?

When should I use whicn one?

Do Contants define Namespaves?

Where is a good documentation of Namespaces (including
Namespace-inheritance [vs Class/Object-inheritance] ),

or can s.o. describe it in a short way?

thanks, Andrew

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>