[#14696] Inconsistency in rescuability of "return" — Charles Oliver Nutter <charles.nutter@...>

Why can you not rescue return, break, etc when they are within

21 messages 2008/01/02
[#14699] Re: Inconsistency in rescuability of "return" — Gary Wright <gwtmp01@...> 2008/01/02

[#14738] Enumerable#zip Needs Love — James Gray <james@...>

The community has been building a Ruby 1.9 compatibility tip list on

15 messages 2008/01/03
[#14755] Re: Enumerable#zip Needs Love — Martin Duerst <duerst@...> 2008/01/04

Hello James,

[#14772] Manual Memory Management — Pramukta Kumar <prak@...>

I was thinking it would be nice to be able to free large objects at

36 messages 2008/01/04
[#14788] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/05

I would only like to add that RMgick for example provides free method to

[#14824] Re: Manual Memory Management — MenTaLguY <mental@...> 2008/01/07

On Sat, 5 Jan 2008 15:49:30 +0900, Marcin Raczkowski <mailing.mr@gmail.com> wrote:

[#14825] Re: Manual Memory Management — "Evan Weaver" <evan@...> 2008/01/07

Python supports 'del reference', which decrements the reference

[#14838] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/08

Evan Weaver wrote:

[#14911] Draft of some pages about encoding in Ruby 1.9 — Dave Thomas <dave@...>

Folks:

24 messages 2008/01/10

[#14976] nil encoding as synonym for binary encoding — David Flanagan <david@...>

The following just appeared in the ChangeLog

37 messages 2008/01/11
[#14977] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14978] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14979] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Dave Thomas wrote:

[#14993] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14980] Re: nil encoding as synonym for binary encoding — Gary Wright <gwtmp01@...> 2008/01/11

[#14981] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14995] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Yukihiro Matsumoto writes:

[#15050] how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...>

Core Rubies:

17 messages 2008/01/13
[#15060] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 08:54 AM, Phlip wrote:

[#15062] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...> 2008/01/14

Eric Hodel wrote:

[#15073] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 20:35 PM, Phlip wrote:

[#15185] Friendlier methods to compare two Time objects — "Jim Cropcho" <jim.cropcho@...>

Hello,

10 messages 2008/01/22

[#15194] Can large scale projects be successful implemented around a dynamic programming language? — Jordi <mumismo@...>

A good article I have found (may have been linked by slashdot, don't know)

8 messages 2008/01/24

[#15248] Symbol#empty? ? — "David A. Black" <dblack@...>

Hi --

24 messages 2008/01/28
[#15250] Re: Symbol#empty? ? — Yukihiro Matsumoto <matz@...> 2008/01/28

Hi,

Re: [Bug?] Module/Class definitions cannot take non literal blocks

From: "Robert Dober" <robert.dober@...>
Date: 2008-01-16 13:34:13 UTC
List: ruby-core #15094
On Jan 16, 2008 1:23 PM, David A. Black <dblack@rubypal.com> wrote:
> Hi --
>
> On Wed, 16 Jan 2008, Robert Dober wrote:
>
> > Hi list
> >
> > I was just about to rewrite pure-traits to be 1.9 compatible just to
> > discover that the following does not work anymore
> >
> > def taint &blk
> >   ...
> >   Module::new &blk
> >   ...
> > end
> >
> > I did not find any workarounds :(
>
> On 1.9.0.0 it seems to work:
>
> >> RUBY_VERSION
> => "1.9.0"
> >> def x(&block); Module.new(&block); end
> => nil
> >> m = x { }
> => #<Module:0x53ebac>
>
> What does it do, or not do, when you do it?
So sorry David, I am really not a good bug reporter, here we go:
As a resume there seem to be two bugs:
Literally passing a block to ClassOrModule::new works as in 1.8
Passing a &blk to ClassOrModule seems to make the methods defined in
the block private *and* their name cannot be seen in
Module#private_instance_methods while it can be perfectly seen in
Class#private_instance_methods *even* when included from a module
where it cannot be seen:
Confusing? I guess so, here come some examples:

puts RUBY_VERSION

def assert condition, text
  puts condition ? "#{text} . . . ok" : "#{text} . . . failed"
end
def make_a_module mod_or_class, &blk
  mod_or_class::new &blk
end

m1 = make_a_module( Module ){ def a; 42 end }
assert m1.instance_methods.include?( :a ), "Block Var: Module Instance
Method name visible"
assert m1.private_instance_methods.include?( :a ), "Block Var: Module
Private Instance Method name visible"

m2 = Module::new { def a; 42 end }
assert m2.instance_methods.include?( :a ), "Literal Block: Module
Instance Method name visible"

c1 = make_a_module( Class ){ def a; 42 end }
assert c1.instance_methods.include?( :a ), "Block Var: Class Instance
Method name visible"
assert c1.new.send(:a) == 42, "Block Var: Private Class Instance
Method callable and correct result"
assert c1.private_instance_methods.include?( :a ), "Block Var: Private
Instance Method visible"
begin
  assert c1.new.a == 42, "Block Var: Class Instance Method callable
and correct result"
rescue NoMethodError => error
  puts "Block Var: Class Instance Method callable . . . Error #{error}"
end

c2 = Class::new{ def a; 42 end }
assert c2.instance_methods.include?( :a ), "Literal Block: Class
Instance Method name visible"
assert c2.new.send(:a) == 42, "Literal Block: Private Class Instance
Method callable and correct result"
assert c2.new.a == 42, "Literal Block: Class Instance Method callable
and correct result"

c1 = Class::new{ include m1 }
assert c1.instance_methods.include?( :a ), "Block Var: Class Included
Instance Method name visible"
assert c1.private_instance_methods.include?( :a ), "Block Var: Class
Included Private Instance Method name visible"
begin
  assert c1.new.a == 42, "Class Included Instance Method callable and
correct result"
rescue NoMethodError => error
  puts "Block Var: Class Included Instance Method callable . . . Error #{error}"
end

1.9.0
Block Var: Module Instance Method name visible . . . failed
Block Var: Module Private Instance Method name visible . . . failed
Literal Block: Module Instance Method name visible . . . ok
Block Var: Class Instance Method name visible . . . failed
Block Var: Private Class Instance Method callable and correct result . . . ok
Block Var: Private Instance Method visible . . . ok
Block Var: Class Instance Method callable . . . Error private method
`a' called for #<#<Class:0xb7d17998>:0xb7d17808>
Literal Block: Class Instance Method name visible . . . ok
Literal Block: Private Class Instance Method callable and correct
result . . . ok
Literal Block: Class Instance Method callable and correct result . . . ok
Block Var: Class Included Instance Method name visible . . . failed
Block Var: Class Included Private Instance Method name visible . . . ok
Block Var: Class Included Instance Method callable . . . Error private
method `a' called for #<#<Class:0xb7d17588>:0xb7d17484>

In This Thread