[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Ruby - C++ extension

Elias Athanasopoulos

11/23/2003 8:45:00 AM

Hello!

I am trying to create a new Ruby extension, which eventually will
give to Ruby the functionality of a C++ project.

So far, the extension is going fine. However I have two issues:

(1) C++ Type Casting
(2) Multiple Inheritance

Is there a generic approach to solve the above?

As far as C++ Type Casting is concerned I am thinking of creating
to_xxx methods. I.e.

foo = (Foo *) Bar->dump();

will be in Ruby:

foo = Bar.dump.as_Foo

As far as Multiple Inheritence is concerned, I think the only way
to go through is to define modules and include them in other modules.
Howver the C++ project I'm trying to create Ruby Bindings for, has a very
complex inheritence tree. Is there any other workaround?

Regards,
--
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky



24 Answers

Jim Freeze

11/24/2003 2:02:00 AM

0

On Sunday, 23 November 2003 at 17:44:39 +0900, Elias Athanasopoulos wrote:
> Hello!
>
> I am trying to create a new Ruby extension, which eventually will
> give to Ruby the functionality of a C++ project.
>
> So far, the extension is going fine. However I have two issues:
>
> (1) C++ Type Casting
> (2) Multiple Inheritance

I haven't checked the specifics, but have you read Lyle's talk
from the 2002 Rubyconf?

http://www.zenspider.com/Languages/Ruby/Rub...

--
Jim Freeze
----------
Klein bottle for sale ... inquire within.


Paul Brannan

11/26/2003 9:22:00 PM

0

On Sun, Nov 23, 2003 at 05:44:39PM +0900, Elias Athanasopoulos wrote:
> As far as C++ Type Casting is concerned I am thinking of creating
> to_xxx methods. I.e.
>
> foo = (Foo *) Bar->dump();

This is not C++ type casting; this is a C-style cast. In C++, you
generally want to avoid C-style casts because C-style casts are far too
powerful (they let you lie to the compiler far too easily). Please
consider using static_cast<> and dynamic_cast<> whenever possible.

> will be in Ruby:
>
> foo = Bar.dump.as_Foo

I'm not sure this really applies well to Ruby. Because Ruby is
dynamically typed, there's no reason why dump() can't just return an
object of the appropriate type (e.g. return a Foo if you really have a
Foo or return a Bar if you really have a Bar).

> As far as Multiple Inheritence is concerned, I think the only way
> to go through is to define modules and include them in other modules.
> Howver the C++ project I'm trying to create Ruby Bindings for, has a very
> complex inheritence tree. Is there any other workaround?

Yes, modules are the way to go. See [ruby-talk:66580] and my suggestion
in [ruby-talk:66624].

Paul


Elias Athanasopoulos

12/2/2003 6:31:00 PM

0

On Thu, Nov 27, 2003 at 06:21:54AM +0900, Paul Brannan wrote:
> On Sun, Nov 23, 2003 at 05:44:39PM +0900, Elias Athanasopoulos wrote:
> > As far as C++ Type Casting is concerned I am thinking of creating
> > to_xxx methods. I.e.
> >
> > foo = (Foo *) Bar->dump();
>
> This is not C++ type casting; this is a C-style cast. In C++, you
> generally want to avoid C-style casts because C-style casts are far too
> powerful (they let you lie to the compiler far too easily). Please
> consider using static_cast<> and dynamic_cast<> whenever possible.

Thanks for all the replies in my question. I was to busy to answer.
My apologies for the delay.

Regards,
--
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky




pv+usenet

9/17/2008 6:47:00 PM

0

"Chuck" <sendmespam@thevolleyball.net> writes:
>Agi, then ap. And don't overlook hit rating, which caps at 143. Great dps
>is useless if it misses.

Strike that and reverse it. Agi is good for a hunter, but due to how
itemization works you'll get more bang from direct AP items, and even more
from RANGED AP items. *
--
* PV something like badgers--something like lizards--and something
like corkscrews.

Chuck

9/17/2008 7:17:00 PM

0

>>Agi, then ap. And don't overlook hit rating, which caps at 143. Great
>>dps
>>is useless if it misses.
>
> Strike that and reverse it. Agi is good for a hunter, but due to how
> itemization works you'll get more bang from direct AP items, and even more
> from RANGED AP items. *

We'll have to agree to disagree. In a raid setting, the agi increases ap,
armor, crit and dodge. And it scales better with raid buffs in general.

Ap increases..... ap.

I'll take my four benefits over your one benefit.


Catriona R

9/17/2008 7:30:00 PM

0


On Wed, 17 Sep 2008 15:17:16 -0400, "Chuck"
<sendmespam@thevolleyball.net> wrote:

>>>Agi, then ap. And don't overlook hit rating, which caps at 143. Great
>>>dps
>>>is useless if it misses.
>>
>> Strike that and reverse it. Agi is good for a hunter, but due to how
>> itemization works you'll get more bang from direct AP items, and even more
>> from RANGED AP items. *
>
>We'll have to agree to disagree. In a raid setting, the agi increases ap,
>armor, crit and dodge. And it scales better with raid buffs in general.
>
>Ap increases..... ap.
>
>I'll take my four benefits over your one benefit.

But as a hunter in a *raid* you don't want or need armor or dodge, so
you can immediately discount those. You're dps - if you're being hit
there's something very wrong...

So your agility gives half the ap that an item with the same budget
spent on ap would have. The question is; is the accompanying crit worth
it? Both my hunter and rogue went all out for attack power because I
didn't believe it to be worthwhile losing a ton of it just to gain some
crit; maybe I'm flawed in that guess, but it's certainly not a certainty
as to one being better than the other. Hit harder more consistently, or
less hard but with more crit spikes. Frankly I'd say the steady damage
is better in a raid setting, but what do I know...
--
EU-Draenor:
Sagart (70 Undead Priest)
Eilnich (70 Blood Elf Warlock)
Buinne (70 Troll Shaman)
Tairbh (62 Tauren Druid)
Balgair (70 Human Rogue)
Naomh (70 Draenei Priest)
Rosad (70 Human Warlock)
Sealgair (70 Dwarf Hunter)
Beag (60 Dwarf Paladin)

Chuck

9/17/2008 7:59:00 PM

0

>>We'll have to agree to disagree. In a raid setting, the agi increases ap,
>>armor, crit and dodge. And it scales better with raid buffs in general.
>>
>>Ap increases..... ap.
>>
>>I'll take my four benefits over your one benefit.
>
> But as a hunter in a *raid* you don't want or need armor or dodge, so
> you can immediately discount those. You're dps - if you're being hit
> there's something very wrong...
>
> So your agility gives half the ap that an item with the same budget
> spent on ap would have. The question is; is the accompanying crit worth
> it? Both my hunter and rogue went all out for attack power because I
> didn't believe it to be worthwhile losing a ton of it just to gain some
> crit; maybe I'm flawed in that guess, but it's certainly not a certainty
> as to one being better than the other. Hit harder more consistently, or
> less hard but with more crit spikes. Frankly I'd say the steady damage
> is better in a raid setting, but what do I know...

Nope, I agree with you. Dodge and armor are not important in a raid setting
for the exact reasons that you mentioned. But some extra armor never hurt
me. It's not always a single target mob, tank and spank style. Hunters DO
get hit during raids, and staying alive is preferred. Not worth getting
stam gems/gear/enchants, but not a bad perk from the agi gems. Dead dps=no
dps.

The extra crit IS worth it for me, due to needing the extra focus from Go
for the Throat to keep my windserpent spewing out the Lightning Breath.
Agreed that steady and predictable is better than occasional and optimistic.
But there are so many variables to consider, it's hard to tell someone what
would be better for their specific need.

I still like the agi over ap for my pve gear, if it's apples to apples.
I'm not a math geek, but have researched it for my needs. There are just as
many convinced that ap is the way to go for pve raids as there are for agi.
I just like how agi stacks with the raid buffs for my liking.

FWIW, isn't it still 1agi = 2 ap? Meaning a +10 agi gem = +20 ap gem? So
the +10 agi gives the same ap with the added benefits, useless or not? In a
nutshell, that's the way I see it.

PS. This isn't an argument, merely an open discussion. I'm still learning,
been playing Wow since its beta release.


John Gordon

9/17/2008 8:06:00 PM

0

In <VsKdnYTLxr07_EzVnZ2dnUVZ_jWdnZ2d@comcast.com> "Chuck" <sendmespam@thevolleyball.net> writes:

> FWIW, isn't it still 1agi = 2 ap? Meaning a +10 agi gem = +20 ap gem?

No. It was changed a while ago to 1 agi = 1 ap.

--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

Chuck

9/17/2008 8:13:00 PM

0

>> FWIW, isn't it still 1agi = 2 ap? Meaning a +10 agi gem = +20 ap gem?
>
> No. It was changed a while ago to 1 agi = 1 ap.

Thanks, John.

See? I'm still learning!


Catriona R

9/17/2008 8:20:00 PM

0


On Wed, 17 Sep 2008 15:59:28 -0400, "Chuck"
<sendmespam@thevolleyball.net> wrote:

>>>We'll have to agree to disagree. In a raid setting, the agi increases ap,
>>>armor, crit and dodge. And it scales better with raid buffs in general.
>>>
>>>Ap increases..... ap.
>>>
>>>I'll take my four benefits over your one benefit.
>>
>> But as a hunter in a *raid* you don't want or need armor or dodge, so
>> you can immediately discount those. You're dps - if you're being hit
>> there's something very wrong...
>>
>> So your agility gives half the ap that an item with the same budget
>> spent on ap would have. The question is; is the accompanying crit worth
>> it? Both my hunter and rogue went all out for attack power because I
>> didn't believe it to be worthwhile losing a ton of it just to gain some
>> crit; maybe I'm flawed in that guess, but it's certainly not a certainty
>> as to one being better than the other. Hit harder more consistently, or
>> less hard but with more crit spikes. Frankly I'd say the steady damage
>> is better in a raid setting, but what do I know...
>
>Nope, I agree with you. Dodge and armor are not important in a raid setting
>for the exact reasons that you mentioned. But some extra armor never hurt
>me. It's not always a single target mob, tank and spank style. Hunters DO
>get hit during raids, and staying alive is preferred. Not worth getting
>stam gems/gear/enchants, but not a bad perk from the agi gems. Dead dps=no
>dps.

I'd think it's pretty rare you'd be hit by any physical damage though?
Magic aoes I can see, yep, but armour doesn't help against them anyway.
I've never raided beyond Kara/ZA/Gruul, maybe there's something at
higher levels, but as far as I've gone it's not much help for a dpser.

>The extra crit IS worth it for me, due to needing the extra focus from Go
>for the Throat to keep my windserpent spewing out the Lightning Breath.
>Agreed that steady and predictable is better than occasional and optimistic.
>But there are so many variables to consider, it's hard to tell someone what
>would be better for their specific need.

Ahh, now that makes sense - I never grouped much on my hunter and he
only had a bear anyway - didn't realise the lightning breath thing!

>I still like the agi over ap for my pve gear, if it's apples to apples.
>I'm not a math geek, but have researched it for my needs. There are just as
>many convinced that ap is the way to go for pve raids as there are for agi.
>I just like how agi stacks with the raid buffs for my liking.

That's true, I can well see Kings benefitting it. I think I made some
mistakes on my rogue by going for ap/crit rating gems instead of agi in
a few cases; a few of those would probably have been more beneficial
going with agi instead - particularly as a rogue makes a lot of use of
dodge when soloing! Live and learn I guess, if I eventually get back to
the rogue in WotLK I'll be wiser and hopefully itemise better, although
overall I still prefer ap given a direct choice between it and agi.

>FWIW, isn't it still 1agi = 2 ap? Meaning a +10 agi gem = +20 ap gem? So
>the +10 agi gives the same ap with the added benefits, useless or not? In a
>nutshell, that's the way I see it.

Nope, it was changed around patch 2.0, as I remember my hunter's ap
suddenly roughly halved since I'd gone all out for agi, there not being
much ap gear available pre-TBC... :-( Enhancement shamans will soon go
the same way as well I think, so the two classes can use much the same
gear (or go for rogue leather)

>PS. This isn't an argument, merely an open discussion. I'm still learning,
>been playing Wow since its beta release.

Understood, nice to discuss these things as I've got a fair bit to learn
too - my hunter *is* 70, but soloed most of the way only running the odd
5-mans, so it's handy learning what makes them tick in group situations
:-)
--
EU-Draenor:
Sagart (70 Undead Priest)
Eilnich (70 Blood Elf Warlock)
Buinne (70 Troll Shaman)
Tairbh (62 Tauren Druid)
Balgair (70 Human Rogue)
Naomh (70 Draenei Priest)
Rosad (70 Human Warlock)
Sealgair (70 Dwarf Hunter)
Beag (60 Dwarf Paladin)