It seems two things are needed for your request.

1) Define nested modules with one statement

2) Add implicit "end" statements at the end of each source file

Nested modules can already be defined in one statement, but the parent =
modules need to be pre-defined:

module Foo; end
module Foo::Bar; end

It seems like you would like `module Foo::Bar; end` to create module Foo =
(if it doesn't already exist) and then module Bar under module Foo (i.e. =
Foo::Bar) all in one step (i.e. without having to declare module Foo =
first).

The second thing is just adding implicit "end" statements at EOF (or =
__END__) as needed to close out any unclosed modules or classes(?) or =
methods(??) or blocks(???).

With those two things, you would be able to write:

````
module Foo::Bar

class Baz
  # ...
end
````

which would create modules Foo and Foo::Bar and class Foo::Bar::Baz.

I'm not sure the implicit "end" statements are really saving a lot, but =
I kind of like the idea of being able to create nested modules in one =
statement.

Dave

On Oct 30, 2013, at 11:16 AM, rosenfeld (Rodrigo Rosenfeld Rosas) wrote:

>=20
> Issue #9064 has been reported by rosenfeld (Rodrigo Rosenfeld Rosas).
>=20
> ----------------------------------------
> Feature #9064: Add support for packages, like in Java
> https://bugs.ruby-lang.org/issues/9064
>=20
> Author: rosenfeld (Rodrigo Rosenfeld Rosas)
> Status: Open
> Priority: Normal
> Assignee: matz (Yukihiro Matsumoto)
> Category: core
> Target version:=20
>=20
>=20
> In Java, it's easy to define a package for a certain class:
>=20
> package com.company.MyClass
>=20
> We don't use that convention in Ruby but we have another way of =
packaging classes:
>=20
> module MyLibrary
>  module InnerNamespace
>    class MyClass
>    end
>  end
> end
>=20
> I'd prefer to be able to use something like this instead meaning =
exactly the same thing:
>=20
> package MyLibrary::InnerNamespace # or MyLibrary.InnerNamespace, I =
don't really care
> class MyClass
> end
>=20
> Could you please consider this idea?
>=20
>=20
> --=20
> http://bugs.ruby-lang.org/