[#9869] a block argument within a block which argument has the same name leaks — <noreply@...>

Bugs item #7680, was opened at 2007-01-08 22:53

34 messages 2007/01/08
[#9871] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/08

Hi,

[#9872] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Evan Webb <evan@...> 2007/01/08

On Jan 8, 2007, at 2:30 PM, Yukihiro Matsumoto wrote:

[#9873] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/08

Hi,

[#9876] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — dblack@... 2007/01/09

Hi --

[#9878] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/09

Hi,

[#9879] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — dblack@... 2007/01/09

Hi --

[#9880] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/09

Hi,

[#9882] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Evan Phoenix <evan@...> 2007/01/09

[#9885] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/09

Hi,

[#9887] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Evan Phoenix <evan@...> 2007/01/09

[#9888] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Charles Oliver Nutter <charles.nutter@...> 2007/01/09

Evan Phoenix wrote:

[#9892] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/09

Hi,

[#9899] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Charles Oliver Nutter <charles.nutter@...> 2007/01/10

Yukihiro Matsumoto wrote:

[#9904] Re: [ ruby-Bugs-7680 ] a block argument within a block which argument has the same name leaks — Yukihiro Matsumoto <matz@...> 2007/01/10

Hi,

[#9960] Scoping and locating definitions — Jos Backus <jos@...>

Consider the following:

17 messages 2007/01/18
[#9964] Re: Scoping and locating definitions — Pit Capitain <pit@...> 2007/01/19

Jos Backus schrieb:

[#9966] Re: Scoping and locating definitions — Jos Backus <jos@...> 2007/01/19

On Fri, Jan 19, 2007 at 06:40:03PM +0900, Pit Capitain wrote:

[#9972] Re: Scoping and locating definitions — Jos Backus <jos@...> 2007/01/19

On Sat, Jan 20, 2007 at 02:18:19AM +0900, Jos Backus wrote:

[#9996] new method dispatch rule (matz' proposal) — SASADA Koichi <ko1@...>

Hi,

50 messages 2007/01/23
[#10002] Re: new method dispatch rule (matz' proposal) — Daniel DeLorme <dan-ml@...42.com> 2007/01/23

SASADA Koichi wrote:

[#10003] Re: new method dispatch rule (matz' proposal) — Yukihiro Matsumoto <matz@...> 2007/01/23

Hi,

[#10004] Re: new method dispatch rule (matz' proposal) — James Edward Gray II <james@...> 2007/01/23

On Jan 23, 2007, at 7:41 AM, Yukihiro Matsumoto wrote:

[#10017] Re: new method dispatch rule (matz' proposal) — Daniel DeLorme <dan-ml@...42.com> 2007/01/24

Yukihiro Matsumoto wrote:

[#10018] Re: new method dispatch rule (matz' proposal) — Yukihiro Matsumoto <matz@...> 2007/01/24

Hi,

[#10024] Re: new method dispatch rule (matz' proposal) — Daniel DeLorme <dan-ml@...42.com> 2007/01/24

Yukihiro Matsumoto wrote:

[#10027] Re: new method dispatch rule (matz' proposal) — Yukihiro Matsumoto <matz@...> 2007/01/24

Hi,

[#10048] Re: new method dispatch rule (matz' proposal) — Evan Phoenix <evan@...> 2007/01/25

The more this discussion goes on, the more I worry that Joe Q Public

[#10019] stable branch policy & schedule for 1.8.6 — "Akinori MUSHA" <knu@...>

Core developers,

29 messages 2007/01/24
[#10021] Re: stable branch policy & schedule for 1.8.6 — Charles Oliver Nutter <charles.nutter@...> 2007/01/24

Akinori MUSHA wrote:

[#10032] Re: stable branch policy & schedule for 1.8.6 — Joel VanderWerf <vjoel@...> 2007/01/24

Charles Oliver Nutter wrote:

[#10085] Collaborative Ruby Language Specification — "John Lam (CLR)" <jflam@...>

Hi Everyone,

36 messages 2007/01/28
[#10108] Re: Collaborative Ruby Language Specification — Charles Oliver Nutter <charles.nutter@...> 2007/01/29

M. Edward (Ed) Borasky wrote:

[#10112] Re: Collaborative Ruby Language Specification — "Eustaquio Rangel de Oliveira Jr." <eustaquiorangel@...> 2007/01/30

-----BEGIN PGP SIGNED MESSAGE-----

[#10114] add usage of uri.userinfo to open-uri.rb — <noreply@...>

Patches item #8309, was opened at 2007-01-30 15:25

16 messages 2007/01/30
[#10131] Re: [ ruby-Patches-8309 ] add usage of uri.userinfo to open-uri.rb — Yukihiro Matsumoto <matz@...> 2007/01/31

[#10132] Re: [ ruby-Patches-8309 ] add usage of uri.userinfo to open-uri.rb — Paulo Kh <paulo.koch@...> 2007/01/31

On 2007/01/31, at 06:07, Yukihiro Matsumoto wrote:

[#10137] Re: [ ruby-Patches-8309 ] add usage of uri.userinfo to open-uri.rb — Yukihiro Matsumoto <matz@...> 2007/01/31

Hi,

[#10139] Re: [ ruby-Patches-8309 ] add usage of uri.userinfo to open-uri.rb — Sam Roberts <sroberts@...> 2007/01/31

On Thu, Feb 01, 2007 at 01:19:34AM +0900, Yukihiro Matsumoto wrote:

[#10143] Re: [ ruby-Patches-8309 ] add usage of uri.userinfo to open-uri.rb — Yukihiro Matsumoto <matz@...> 2007/02/01

Hi,

Re: new method dispatch rule (matz' proposal)

From: "Brian Mitchell" <binary42@...>
Date: 2007-01-23 06:00:39 UTC
List: ruby-core #9997
On 1/23/07, SASADA Koichi <ko1@atdot.net> wrote:
> Hi,
>
> This post is translation of [ruby-dev:30107], a new method dispatch rule
> proposed by Matz.  I post it because I want to discuss about it widely.
>
>
> This change is to clarify "private" feature.
>
> (1) send(:foo) accesses only public methods.
>
> (2) send(:foo) and recv.foo (with receiver method dispatch) only skips
>     private methods.
>     In current Ruby, if any private method foo are there, raise exception.

The combination of 1 and 2 effectively gives private methods a
separate namespace it seems. I'd almost ask to just completely
separate the two with a simple private then public then method_missing
look-up order (see bellow). The main stop for me is how big of a
change this brings.

> (3) method dispatch as function like "foo()", introduce new method
> search ordering.
>
>     1. search *only private methods* in inheritance tree.
>     2. search public methods in inheritance tree from CLASS_OF(self).

I like this a lot. It keeps design focussed. While meta-programming in
Ruby is a big reason to avoid restrictions, the preceding changes make
this one less painful.

The main plus IMO is separating the method_missing calls out from
private look-up. That does leave the question open though, how would
method_missing work at this point? Would there be a good reason to
have separate methods to catch missing private and missing public
calls? Maybe function_missing in line with other names.

> (4) (unconfirmed) private method dispatch searches from caller method class.

This is really interesting as well. I like it in the end because I've
never really bothered to use protected much. it brings back the
meaning to private. It is a big change though and one I would take
with caution. It does discourage the bad styles of monkey patching
that have caused me a lot of pain in the past.

Of course, that does bring up the question of how this changes
protected behavior if at all. I would rather have protected function
more similar to private than public. It is the biggest problem I can
find with rule 4.

> (5) remove send!, __send! methods.  private method funcall is added.
>
>       funcall name, args...

I thought that it was going to originally provide a public interface
to calling. This would probably still work with instance_exec or
similar but somehow I still think public access might be simpler over
all. All assuming I am reading it right...

I can say, however, that I am in favor of the name funcall over send.
While the name is somewhat alien, I think it is something that will
become more familiar over time to rubyists. Considering that the
source of the message is highly restricted, the word method becomes
less meaningful on its own. #funcall seems to fit though I know others
would disagree. I think many underestimate the growing room Ruby has
left for itself.

>
> Japanese developer: please comment if there are any wrong statements or
> lack features.
>

You have done a wonderful job of helping some of us keep up with
ruby-dev in posts like this. Thank you.

>
> I feel C.new.foo returns "C1#m" is strange with following code (because
> of rule 3.1).
>
> class C1
>   def m
>     "C1#m"
>   end
>   private :m
> end
>
> class C2 < C1
>   def m
>     "C2#m"
>   end
>
>   def foo
>     m
>   end
> end

I've got some ideas surrounding the problem I think you are addressing
but I can't quite tell for sure. If you mean C2.new.foo then I would
feel odd about that as well. The look-up order should keep locality as
a primary goal. I think rules like 4 help with that but again, I think
we need some clarification.

In the case that we decide that it must call a private method when no
recv. is given, an idea I had was inheritance of access type from
superclasses with same-name methods. The problem that I see is that
this might incur the overhead of maintaining a complex cache table for
dispatch though I am not yet enough of a dispatch wizard to know if
this is true.

Thanks,
Brian.

In This Thread