[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

const initialization

David Weldon

1/17/2007 9:25:00 PM

I think ruby does something strange when it decides if certain constants
have been initialized or not. Take this simple case:

#test.rb
require 'const'
require '/home/dave/foo/const'

#const.rb
DAVE=1

When I run this I get:

/home/dave/foo/const.rb:1: warning: already initialized constant DAVE

...and yes, const.rb is the same one used for both test1.rb and
test2.rb. It seems like ruby hashes the paths to the source files and
complains when they are different - even if both paths reference the
same file in the filesystem. Is there a good way to avoid this? Thanks!

--
Posted via http://www.ruby-....

10 Answers

Gavin Kistner

1/17/2007 9:44:00 PM

0

David Weldon wrote:
> I think ruby does something strange when it decides if certain constants
> have been initialized or not.
[snip]

It has nothing to do with constants in particular, but (as you were
referring to at the end) whether or not Ruby thinks two required files
are the same. See this:

C:\>type tmp.rb
p( require( 'const' ) )
p( require( 'const.rb' ) )
p( require( 'c:/const.rb' ) )

C:\>ruby tmp.rb
true
false
c:/const.rb:1: warning: already initialized constant FOO
true

The 'false' means that Ruby could tell that it was the same file, and
didn't re-include it. The last 'true' means that Ruby didn't realize
that the two path specifications ended pointed to the same file, and
re-included it. That's when the warning goes off.

Ara.T.Howard

1/17/2007 10:09:00 PM

0

Patriot Games

7/4/2007 1:38:00 PM

0

"Phlip" <phlipcpp@yahoo.com> wrote in message
news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>> Are you, or not, surprised that all of your replies IGNORED Socialism and
>> diverted discussion to Iraq??
> Which is the bigger problem right now?

Socialism.

Biscuits and Books

7/4/2007 2:33:00 PM

0

"Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
news:468ba2b3$0$24703$4c368faf@roadrunner.com...
> "Phlip" <phlipcpp@yahoo.com> wrote in message
> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>> Are you, or not, surprised that all of your replies IGNORED Socialism
>>> and diverted discussion to Iraq??
>> Which is the bigger problem right now?
>
> Socialism.

Yeah, like the GI Bill , Interstate highways, mortgage deduction, yeah, awl
baaaad things....
What you call socialism made us a vibrant middle class, which your asshole
friends are trying to destroy.


?tarkiller?

7/4/2007 3:05:00 PM

0

On Wed, 04 Jul 2007 14:33:01 GMT, "Biscuits and Books"
<Cheney_did_Barney@earthlink.net> wrote:

>"Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
>news:468ba2b3$0$24703$4c368faf@roadrunner.com...
>> "Phlip" <phlipcpp@yahoo.com> wrote in message
>> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>>> Are you, or not, surprised that all of your replies IGNORED Socialism
>>>> and diverted discussion to Iraq??
>>> Which is the bigger problem right now?
>>
>> Socialism.
>
>Yeah, like the GI Bill , Interstate highways, mortgage deduction, yeah, awl
>baaaad things....
>What you call socialism made us a vibrant middle class, which your asshole
>friends are trying to destroy.
>
Where did he call those things socialist?

If you can't TROLL any better than that then you need to go back to
the kiddie groups where your intellect can be more at home.





Regards


Starkiller?


"Eta Kooram Nah Smech!"

Jim Alder

7/4/2007 3:11:00 PM

0

"Biscuits and Books" <Cheney_did_Barney@earthlink.net> wrote in
news:xcOii.4082$zA4.1636@newsread3.news.pas.earthlink.net:

> "Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
> news:468ba2b3$0$24703$4c368faf@roadrunner.com...
>> "Phlip" <phlipcpp@yahoo.com> wrote in message
>> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>>> Are you, or not, surprised that all of your replies IGNORED Socialism
>>>> and diverted discussion to Iraq?? Which is the bigger problem right
>>>> now?
>>
>> Socialism.
>
> Yeah, like the GI Bill , Interstate highways, mortgage deduction, yeah, awl
> baaaad things....
> What you call socialism made us a vibrant middle class, which your asshole
> friends are trying to destroy.

Bull. Capitalism and freedom made us a great nation. Socialism has turned
us back in the opposite direction.

Interstate highways? Do you really think two states couldn't figure out how
to make a road meet at the border without the help of Washington DC taking
billions in tax money then giving it back to the states, after keeping an
obscene percentage for 'expenses'?

And that little side issue about blackmailing the states into doing things
their way or they withhold those funds? That doesn't bother you?

--
President Bush was so buoyed by the warm reception he was given in Albania
that he immediately gave all 3 million Albanians American citizenship,
provided they learn Spanish. - Ann Coulter

Sid9

7/4/2007 3:29:00 PM

0

Jim Alder wrote:
> "Biscuits and Books" <Cheney_did_Barney@earthlink.net> wrote in
> news:xcOii.4082$zA4.1636@newsread3.news.pas.earthlink.net:
>
>> "Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
>> news:468ba2b3$0$24703$4c368faf@roadrunner.com...
>>> "Phlip" <phlipcpp@yahoo.com> wrote in message
>>> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>>>> Are you, or not, surprised that all of your replies IGNORED
>>>>> Socialism and diverted discussion to Iraq?? Which is the bigger
>>>>> problem right now?
>>>
>>> Socialism.
>>
>> Yeah, like the GI Bill , Interstate highways, mortgage deduction,
>> yeah, awl baaaad things....
>> What you call socialism made us a vibrant middle class, which your
>> asshole friends are trying to destroy.
>
> Bull. Capitalism and freedom made us a great nation. Socialism has
> turned us back in the opposite direction.
>
> Interstate highways? Do you really think two states couldn't figure
> out how to make a road meet at the border without the help of
> Washington DC taking billions in tax money then giving it back to the
> states, after keeping an obscene percentage for 'expenses'?

No.

>
> And that little side issue about blackmailing the states into doing
> things their way or they withhold those funds? That doesn't bother
> you?


Jim Alder

7/4/2007 5:00:00 PM

0

"Sid9" <sid9@bellsouth.net> wrote in news:v1Pii.21913$19.6036
@bignews5.bellsouth.net:

> Jim Alder wrote:
>> "Biscuits and Books" <Cheney_did_Barney@earthlink.net> wrote in
>> news:xcOii.4082$zA4.1636@newsread3.news.pas.earthlink.net:
>>
>>> "Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
>>> news:468ba2b3$0$24703$4c368faf@roadrunner.com...
>>>> "Phlip" <phlipcpp@yahoo.com> wrote in message
>>>> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>>>>> Are you, or not, surprised that all of your replies IGNORED
>>>>>> Socialism and diverted discussion to Iraq?? Which is the bigger
>>>>>> problem right now?
>>>>
>>>> Socialism.
>>>
>>> Yeah, like the GI Bill , Interstate highways, mortgage deduction,
>>> yeah, awl baaaad things.... What you call socialism made us a vibrant
>>> middle class, which your asshole friends are trying to destroy.
>>
>> Bull. Capitalism and freedom made us a great nation. Socialism has
>> turned us back in the opposite direction.
>>
>> Interstate highways? Do you really think two states couldn't figure
>> out how to make a road meet at the border without the help of
>> Washington DC taking billions in tax money then giving it back to the
>> states, after keeping an obscene percentage for 'expenses'?
>
> No.
Of course you don't. Liberals have contempt for everyone who isn't them.

--
President Bush was so buoyed by the warm reception he was given in Albania
that he immediately gave all 3 million Albanians American citizenship,
provided they learn Spanish. - Ann Coulter

Patriot Games

7/8/2007 1:23:00 PM

0

"Biscuits and Books" <Cheney_did_Barney@earthlink.net> wrote in message
news:xcOii.4082$zA4.1636@newsread3.news.pas.earthlink.net...
> "Patriot Games" <Crazy_Bastard@The_Beach.com> wrote in message
> news:468ba2b3$0$24703$4c368faf@roadrunner.com...
>> "Phlip" <phlipcpp@yahoo.com> wrote in message
>> news:C9KdnZYRP4XlVxrbnZ2dnUVZ_tyinZ2d@adelphia.com...
>>>> Are you, or not, surprised that all of your replies IGNORED Socialism
>>>> and diverted discussion to Iraq??
>>> Which is the bigger problem right now?
>> Socialism.
> Yeah, like the GI Bill,

One had to serve to get the GI Bill, therefore NOT Socialism.

> Interstate highways,

That's just national infrastructure.

> mortgage deduction,

One has to have a mortgage to get the deduction, therefore NOT Socialism.

> What you call socialism made us a vibrant middle class, which your asshole
> friends are trying to destroy.

Wrong.

Governor Swill

7/8/2007 3:55:00 PM

0

On Sun, 8 Jul 2007 09:22:50 -0400, "Patriot Games"
<Crazy_Bastard@The_Beach.com> wrote:
>>>> Which is the bigger problem right now?
>>> Socialism.
>> Yeah, like the GI Bill,

>One had to serve to get the GI Bill, therefore NOT Socialism.

>> Interstate highways,

>That's just national infrastructure.

>> mortgage deduction,

>One has to have a mortgage to get the deduction, therefore NOT Socialism.

>> What you call socialism made us a vibrant middle class, which your asshole
>> friends are trying to destroy.

>Wrong.

He probably thinks that every time the US Cavalry showed up to save a
wagon train from an Indian attack, a socialist got his wings.

Swill