Forum: Ruby rb_load_file crashes when there no bracket is provided

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D72af7a8d7d056c14e783726b575c118?d=identicon&s=25 Saravanan Sar (saravanan77)
on 2007-07-16 15:20
Hi,

When i tried to load the below mentioned code using rb_load_file it
works

def Category(pArg1)
    lvalue = ("\"" + "CatA" + "\"" + pArg1)
    eval "#{lvalue}"
end

def is(pArg1)
    return "==\"" + pArg1 + "\""
end

i = Category(is('CatB'))

But when i changed the line
i = Category(is('CatB')) to
i = Category is 'CatB' #removing the brackets
rb_load_file crashes. btw i am using borland c++ 6.0

How to solve this problem?

Thanx in advance.

Cheers,
Saravanan A
B4b39bb32dcaa75317b5ccea71080c36?d=identicon&s=25 Phil Meier (Guest)
on 2007-07-16 16:02
(Received via mailing list)
> But when i changed the line
> i = Category(is('CatB')) to
> i = Category is 'CatB' #removing the brackets
>
Why do you need to remove brackets?
D72af7a8d7d056c14e783726b575c118?d=identicon&s=25 Saravanan Sar (saravanan77)
on 2007-07-16 16:11
Phil Meier wrote:
>> But when i changed the line
>> i = Category(is('CatB')) to
>> i = Category is 'CatB' #removing the brackets
>>
> Why do you need to remove brackets?

This is basically a set of rules that our client will define.  I am
writing DSL so that it will be easy for our client. When i execute the
same using ruby.exe it works but with bracket warning.  I think
rb_load_file is crashing because of this warning message.

Please help me

Regards,
Saravanan A
D72af7a8d7d056c14e783726b575c118?d=identicon&s=25 Saravanan Sar (saravanan77)
on 2007-07-16 16:59
when rb_gv_set("VERBOSE", Qnil)is executed, it works fine.  Basically
this will suppress all the warnings. This is equivalent to "ruby -w"

Saravanan Sar wrote:
> Phil Meier wrote:
>>> But when i changed the line
>>> i = Category(is('CatB')) to
>>> i = Category is 'CatB' #removing the brackets
>>>
>> Why do you need to remove brackets?
>
> This is basically a set of rules that our client will define.  I am
> writing DSL so that it will be easy for our client. When i execute the
> same using ruby.exe it works but with bracket warning.  I think
> rb_load_file is crashing because of this warning message.
>
> Please help me
>
> Regards,
> Saravanan A
This topic is locked and can not be replied to.