From: Markus Fischer <markus@...>
Date: 2011-06-09T01:04:24+09:00
Subject: [ruby-core:36855] Per file context? Re:  [Ruby 1.9 - Feature #4824] Provide method Kernel#executed?

Hi,

I take the courtesy to hijack this because ...

On 08.06.2011 13:31, Rodrigo Rosenfeld Rosas wrote:
> Issue #4824 has been updated by Rodrigo Rosenfeld Rosas.
> 
> 
> Actually, maybe something like the snippet below would be ideal:
> 
> if defined?(__MAIN__) ...
> 
> This means __MAIN__ is still a constant, but one defined by the interpreter in some conditional way that is injected only in a single file (the main one).

This "injected only in a single file" makes me wonder about one thing:
does Ruby in some way provide a per file context?

I guess those familiar with Python will recognize this immediately, as a
file is treated as a (python) module which has it's on scoping and
provides the ability for others to "import" only certain features of a
module/file you want.

I though it would give a nice addition to Ruby but as I understand it,
it would be quite radical as Ruby has the module keyword already and
things work (quite?) differently.

- Markus