From: Rocky Bernstein Date: 2011-10-26T05:51:05+09:00 Subject: [ruby-core:40372] Re: 2.0 feature questionnaire --bcaec51dd1798a2c4604b025b232 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Oct 24, 2011 at 10:29 PM, Charles Oliver Nutter wrote: > 2011/10/1 SASADA Koichi : > > - Remove Proc binding > > I added this one. Anyone who has ever attempted to optimize Ruby knows > this is one of the biggest roadblocks. If any time, any local state > can be seen by code you've passed a block to, you can't optimize any > of that code in a way that would make it inaccessible. > One could also say the same thing with eval'ing strings, but I doubt that folks have considered removing that. Does anyone have statistics on how often binding is used and what the costs is for not optimizing those portions? Binding in Ruby is used by debuggers or other dynamic introspection tools to give access to call stack objects. There are dynamic languages such as Perl and some of the POSIX shells (bash and zsh but not more recent ksh) that don't have something like binding; therefore debuggers in those languages can't provide reliable info regarding certain variables on the call stack other than the top-most frame. Does it matter? Some probably would argue it doesn't. I think access to locals on the call stack in a debugger is nice to have. > I'd also argue it breaks encapsulation in the same awful way that "retry" > did: > > def foo > password = get_password > transaction do > service.auth(password) > service.do_something > end > end > > ... > > def transaction(&block) # my evil patch > steal_password eval('password', block) > end > > Any library that can patch "transaction" can see the "password" local. > Shouldn't local variable encapsulation be sacred? > > Get rid of it. > > > - Getting parse tree > > If something like this goes in, please don't make it like Ripper. You > guys are killing us with MRI codebase-specific features like that. > There's no way to support Ripper unless you *actually* use MRI's > parser, which means we can't support it in JRuby. Please stop killing > us. > > > - Getting source code > > This is a far, far better way to allow people access to AST. Give them > access to the source for a given method or block and provide an > implementation-independent parsing library. That's the Javascript way, > and it should be the Ruby way too. > > - Charlie > > --bcaec51dd1798a2c4604b025b232 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Oct 24, 2011 at 10:29 PM, Charles Oliver Nutter &= lt;headius@headius.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border= -left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I'd also argue it breaks encapsulation in the same awful way that "= ;retry" did:

def foo
=A0password =3D get_password
=A0transaction do
=A0 =A0service.auth(password)
=A0 =A0service.do_something
=A0end
end

...

def transaction(&block) # my evil patch
=A0steal_password eval('password', block)
end

Any library that can patch "transaction" can see the "passwo= rd" local.
Shouldn't local variable encapsulation be sacred?

Get rid of it.

> - Getting parse tree

If something like this goes in, please don't make it like Ripper. You guys are killing us with MRI codebase-specific features like that.
There's no way to support Ripper unless you *actually* use MRI's parser, which means we can't support it in JRuby. Please stop killing us.

> - Getting source code

This is a far, far better way to allow people access to AST. Give them
access to the source for a given method or block and provide an
implementation-independent parsing library. That's the Javascript way,<= br> and it should be the Ruby way too.

- Charlie


--bcaec51dd1798a2c4604b025b232--