Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Big problem with debian ruby 1.8.0-1

Reply
Thread Tools

Big problem with debian ruby 1.8.0-1

 
 
Ferenc Engard
Guest
Posts: n/a
 
      10-05-2003
Hello,

I have just upgraded ruby on my debian unstable to ruby 1.8.0-1
(2003-10-05), and my program has crashed. Here is the stripped down
version of my code:

----------------------------------------------------------------------
#!/usr/bin/ruby1.8

class Action < Proc
attr_accessor :name
def initialize
puts "Action#init"
@name='not defined'
super
end
end

class Actions
def initialize
@actions=Hash.new
end

#~ def register(name,action=nil)
def register(name,action=nil,&bl)
if action.nil? && block_given?
puts "Before Action.new"
action=Action.new(&bl)
#~ action=Action.new
puts "After Action.new"
end
puts action.inspect
action.name=name
@actions[name]=action
action
end
end

actions=Actions.new
actions.register('exit') {puts "yes"}
----------------------------------------------------------------------

This program now outputs the following:

fery@domesticus:~/work/tudomany/implementation$ ./gui_test.rb
Before Action.new
After Action.new
#<Proc:0x40276854@./gui_test.rb:32>
../gui_test.rb:25:in `register': undefined method `name=' for
#<Proc:0x40276854@./gui_test.rb:32> (NoMethodError)
from ./gui_test.rb:32
fery@domesticus:~/work/tudomany/implementation$


So, instead of Action, action is a Proc! :-O

Note, if I remove the &bl from the Actions#register(), then this code do
not show this behavior, although, there is not so much sense using a
Proc-derived class without a proc... (

What is the problem?

Thanks:
Ferenc

PS: The previous ruby version was also 1.8.0 (I do not remember the
exact date).
 
Reply With Quote
 
 
 
 
Yukihiro Matsumoto
Guest
Posts: n/a
 
      10-06-2003
Hi,

In message "Big problem with debian ruby 1.8.0-1"
on 03/10/06, Ferenc Engard <> writes:

|I have just upgraded ruby on my debian unstable to ruby 1.8.0-1
|(2003-10-05), and my program has crashed. Here is the stripped down
|version of my code:

A bug.

--- eval.c 5 Oct 2003 14:07:07 -0000 1.549
+++ eval.c 6 Oct 2003 00:33:39 -0000
@@ -6930,3 +6930,3 @@ proc_alloc(klass, proc)

- if (!proc && ruby_block->block_obj) {
+ if (!proc && ruby_block->block_obj && CLASS_OF(ruby_block->block_obj) == klass) {
return ruby_block->block_obj;

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] Builds of PyWebkitGtk and Webkit-Glib-Gtk(r39359+#16401.master) for Debian i386,Debian AMD64 and Macports MacOSX 10.4 Luke Kenneth Casson Leighton Python 0 12-31-2008 08:23 PM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net 0 12-26-2008 09:29 AM
GIDS 2009 .Net:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf ASP .Net Web Controls 0 12-26-2008 06:11 AM
GIDS 2009 Java:: Save Big, Win Big, Learn Big: Act Before Dec 29 2008 Shaguf Python 0 12-24-2008 07:35 AM
[Debian] Upgrading to kernel 2.6 in Debian DUser NZ Computing 0 01-11-2004 12:38 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57