[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help for upgrading my sources from ruby 1.6.8 to 1.8.x

Burkhard Boerner

1/19/2006 10:56:00 AM

Hello,

1. question:
in 1.6.8 the line

rb_protect(rb_thread_stop, self, &iRes);

is working well, in 1.8.2 it produces an compile error.

Looking into "intern.h" shows a difference between both versions
1.6.8:
VALUE rb_protect _((VALUE (*)(), VALUE, int*));
VALUE rb_thread_stop _((void));

1.8.2:
VALUE rb_protect _((VALUE (*)(VALUE), VALUE, int*));
VALUE rb_thread_stop _((void));

Is this a bug or is it not longer allowed to give rb_thread_stop as
first parameter?

2. question:
Because we are developing for railway organizations, we have a
track-element called "Signal". Therefore we have also created a
corresponding class Signal (using it a long time and in many
applications). This is in conflict with ruby 1.8.
Do we have any chance to omit the change of the class name to be
compliant with 1.8?

With kind regards

Burkhard Boerner

--
+-------V-------+ Burkhard Boerner *** TB/AEZ ***
+ A L C A T E L + Transport Automation Systems Berlin
+---------------+ D-12099 Berlin, Colditzstr. 34-36
TELECOM Phone: +49 30 7002 3269 / Fax: 3851
mailto:Burkhard.Boerner@alcatel.de



4 Answers

Nobuyoshi Nakada

1/19/2006 2:42:00 PM

0

Hi,

At Thu, 19 Jan 2006 19:55:49 +0900,
Burkhard Boerner wrote in [ruby-talk:176150]:
> 1. question:
> in 1.6.8 the line
>
> rb_protect(rb_thread_stop, self, &iRes);
>
> is working well, in 1.8.2 it produces an compile error.

It should be a warning in C.

> Looking into "intern.h" shows a difference between both versions
> 1.6.8:
> VALUE rb_protect _((VALUE (*)(), VALUE, int*));
> VALUE rb_thread_stop _((void));
>
> 1.8.2:
> VALUE rb_protect _((VALUE (*)(VALUE), VALUE, int*));
> VALUE rb_thread_stop _((void));
>
> Is this a bug or is it not longer allowed to give rb_thread_stop as
> first parameter?

You just need a cast.

> 2. question:
> Because we are developing for railway organizations, we have a
> track-element called "Signal". Therefore we have also created a
> corresponding class Signal (using it a long time and in many
> applications). This is in conflict with ruby 1.8.
> Do we have any chance to omit the change of the class name to be
> compliant with 1.8?

module Railway
class Signal
end
end

--
Nobu Nakada


Stefan Mahlitz

1/19/2006 5:48:00 PM

0

nobu@ruby-lang.org wrote:
>> 2. question:
>> Because we are developing for railway organizations, we have a
>> track-element called "Signal". Therefore we have also created a
>> corresponding class Signal (using it a long time and in many
>> applications). This is in conflict with ruby 1.8.
>> Do we have any chance to omit the change of the class name to be
>> compliant with 1.8?
>
> module Railway
> class Signal
> end
> end

But code using

Signal::SomeConstant

will have to be changed to

Railway::Signal::SomeConstant

module Railway
class Signal
SomeConstant = "FOO"
end
end

p Railway::Signal::SomeConstant # prints "FOO"

include Railway

p Signal::SomeConstant
# raises a name error NameError: uninitialized constant
# Signal::SomeConstant

One can do

module Signal
SomeConstant = Railway::Signal::SomeConstant
end


::: good news runner :::

7/29/2008 10:48:00 PM

0

Schwein hund

In news:j65v84p4kefaqg70q2e2drq2krqp0c110g@4ax.com,
NOSPAM <nospam@nospam> typed:


<Kelly>

7/30/2008 12:32:00 AM

0

On Jul 29, 3:08 pm, NOSPAM <nospam@nospam> wrote:

> Schwein hund

That reminds me of this (it's the song "Spider Pig" from "The Simpsons
Movie" in German)

Spinnen-Schwein, Spinnen-Schwein.
Tut, was auch immer ein Spinnen-Schwein tut.
Kann sie von einem Netz schwingen?
Kein kann sie nicht Sie ist ein Schwein.
Schauen Sie heraus!
Sie ist ein Spinnen-Schwein!

I don't like The Simpsons, but I think that song is hilarious.