S
Shannon Fang
Hi,
I have a program which runs ok for a very long time, today I try to modify
it some strange error pops up (before I modify):
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__':
/dbload.rb:110: void value expression (SyntaxError)
return (@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash)
^ from
c:/ruby/lib
/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
from F:/work/svn/dproc/dproc.rb:5
The problematic source codes are as follow:
dproc.rb:
require 'something'
require 'dbload'
... ...
dbload:
... ...
def loaded?
return (@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash)
end
... ...
Now I add a () in the loaded? function make it like:
return ((@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash))
The error disappeared!
My question is, which operator has higher priority? return or and?
I have used this code for a long time, but never had this problem before...
Any change in v1.8 probably?
Thank you!
Shannon
I have a program which runs ok for a very long time, today I try to modify
it some strange error pops up (before I modify):
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__':
/dbload.rb:110: void value expression (SyntaxError)
return (@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash)
^ from
c:/ruby/lib
/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require'
from F:/work/svn/dproc/dproc.rb:5
The problematic source codes are as follow:
dproc.rb:
require 'something'
require 'dbload'
... ...
dbload:
... ...
def loaded?
return (@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash)
end
... ...
Now I add a () in the loaded? function make it like:
return ((@acc.class == Hash) and (@auth.class == Hash) and (@cat.class ==
Hash))
The error disappeared!
My question is, which operator has higher priority? return or and?
I have used this code for a long time, but never had this problem before...
Any change in v1.8 probably?
Thank you!
Shannon