Archived

This forum has been archived. Please start a new discussion on GitHub.

Possible IceRuby bug?

Hello,

I am working with IceRuby-3.1.1 (slice2rb reports version 3.1.0) and Ruby "ruby 1.8.4 (2005-12-24) [i586-linux]" (SuSE). When I define in a Slice specification an uppercase identifier, I get errors from Ruby.

Here's an example Slice file:
module foo
{
 struct bar
 {
  int   UPPERCASE;
 };
};
...and a Ruby program:
require 'Ice'

Ice::loadSlice('./possible_bug.ice')

status = 0
communicator = nil

begin
    communicator = Ice::initialize(ARGV)

    f = Foo::checkedCast(communicator.stringToProxy("foo:tcp -h localhost -p 10000"))

    print f.UPPERCASE;
end
...and the error message when I run the program:
(eval):33:in `loadSlice': (eval):33:in `loadSlice': compile error (SyntaxError)
(eval):8: formal argument cannot be a constant
            def initialize(UPPERCASE=0)
                                    ^
(eval):8: parse error, unexpected '=', expecting ')'
            def initialize(UPPERCASE=0)
                                     ^
(eval):31: dynamic constant assignment
        T_Bar = ::Ice::__defineStruct('::foo::bar', Bar, [["UPPERCASE", ::Ice::T_int]])
               ^
(eval):33: parse error, unexpected kEND, expecting $    from possible_bug.rb:3

It appears that Ruby identifiers starting with uppercase letters become constants, but I wouldn't have expected that output from Slice without the "const" keyword.

Is this a known issue? I have checked the documentation, and did not see anything about this. If I've missed something, please accept my apologies in advance. :}

Thanks for letting me know, and also for developing such an excellent product.

_Jesse Williamson ;-};

Comments

  • mes
    mes California
    Hi,

    That looks like a bug in Ice. We need to modify Slice symbols like UPPERCASE so that they start with a lower-case letter.

    Thanks for reporting this problem.

    Take care,
    - Mark
  • Thanks!

    Thanks for the very swift reply!

    Keep up the great work. -J.