[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Using Ruby as a scripting language within a C app

forgottenwizard

9/23/2008 6:15:00 AM

On 05:58 Tue 23 Sep, Brian Candler wrote:
> Ken Bloom wrote:
> > On Mon, 22 Sep 2008 02:41:12 -0500, Brian Candler wrote:
> >
> >> Scroll down to "A Sponsored Dragon-Slaying" and enjoy.
> > Aside from being entertaining, what does this have to do with embedding
> > Ruby in a C-based MUD engine?
>
> OK, I missed the smiley, <aside> tag etc.
>
> For a more useful link, see
> http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext...
>
> The section "Embedding a Ruby Interpreter" is brief, but much of the
> preceding stuff about VALUE and so on is relevant. There's enough to get
> started with experimenting anyway.
>
> In any case, a simple Google for "embedded ruby" turns up a bunch of
> useful stuff. The first hit is http://metaeditor.sourceforge....
>
> None of that is specific to the problem domain of MUDs (apart from
> _why's page), but once you have an embedded ruby interpreter, what you
> do with it is up to you.
>
> I'd question why you'd want to write any of the rest of it in C, but
> that's a different issue :-)
> --
> Posted via http://www.ruby-....
>

I'm starting off of an existing codebase, and trying to rewrite it into
Ruby seems like a waste.
--
I'm not anti-social, I'm just not user friendly


2 Answers

Marc Heiler

9/23/2008 8:04:00 PM

0

> I'd question why you'd want to write any of the rest of it in C, but
> that's a different issue :-)

I am not the original author, but personally I always enjoy it when
people do not ask why I want to do something that way, but rather help
how i do it.

In my experience way too often people who tried to ask for the why also
tried to persuade me that the way is wrong. Which may be fine but it
wastes my time as well in like 95% of the cases I personally experienced
and does not really help me as well. ;)
--
Posted via http://www.ruby-....

David Masover

9/24/2008 2:31:00 AM

0

On Tuesday 23 September 2008 15:03:42 Marc Heiler wrote:
> > I'd question why you'd want to write any of the rest of it in C, but
> > that's a different issue :-)
>
> I am not the original author, but personally I always enjoy it when
> people do not ask why I want to do something that way, but rather help
> how i do it.

There are advantages to both. Consider the hypothetical question:
"How can I delete every file on my hard drive with a single command?"

If there's an easy way to do what I want to do, I'd like to know it.
"rm -rf /"

However, in the same message, it might be helpful to suggest other ways of
thinking about the problem:

"Well, if you really want the data gone (to hide it), best 'dd if=/dev/zero
of=/dev/sda'. And if you only need to nuke a particular directory, you
can 'rm -rf /foo' -- but you may want to look up 'shred' first."

I might learn something. It might even save me weeks of work -- might stop me
from nuking my whole hard drive, in the above (contrived) example.

If not, it doesn't waste very much time to read them and ignore them.

So, I think Brian's post was actually helpful in that he's pointed out a few
useful resources for embedding a Ruby interpreter, and also suggested that it
might be better to write it in Ruby. (I'd second that -- a MUD doesn't have
to be fast, but it's better if it's flexible, and it really shouldn't take
long.)