[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: "stereotyping" thread

dblack

11/20/2003 5:21:00 AM

4 Answers

Hal E. Fulton

11/20/2003 5:33:00 AM

0

David A. Black wrote:
> Hi --
>
> On Thu, 20 Nov 2003, Wesley J Landaker wrote:
>
>
>>Why not just use empty modules for all this type-checking? This isn't
>
>
> Because class/module ancestry doesn't tell you about type. See the
> previous 120 messages or so :-)

Ehh, I swore I'd stay out of this. But here I am.

I think what Wesley is talking about is different. He's proposing (or
not really proposing, since he's only asking "Why don't the people
who want this do that?") -- as I understand it -- creating modules
whose sole purpose is to identify the high-level properties of an
object.

And someone will say, "Yes, but I could mix in that module even if
the object didn't have those properties."

And someone else will say, "Yes, but that would be a BUG."

And the never-ending thread goes on.

"The thread goes ever, ever on,
Down from the post where it began...."

Hal




Wesley J. Landaker

11/20/2003 6:03:00 AM

0

On Wednesday 19 November 2003 10:33 pm, Hal Fulton wrote:
> David A. Black wrote:
> > Hi --
> >
> > On Thu, 20 Nov 2003, Wesley J Landaker wrote:
> >>Why not just use empty modules for all this type-checking? This
> >> isn't
> >
> > Because class/module ancestry doesn't tell you about type. See the
> > previous 120 messages or so :-)
>
> Ehh, I swore I'd stay out of this. But here I am.

Yeah, maybe I should have stayed out of it too. ;)

> I think what Wesley is talking about is different. He's proposing (or
> not really proposing, since he's only asking "Why don't the people
> who want this do that?") -- as I understand it -- creating modules
> whose sole purpose is to identify the high-level properties of an
> object.

That's right, Hal; I read through the previous 120 messages or so, and
thought "I really don't want that, but for the people who do, and say
they want features x, y, and z, why don't they just do this?".

Bah, well, let's just pretend I didn't say anything. ;)

> And someone will say, "Yes, but I could mix in that module even if
> the object didn't have those properties."
>
> And someone else will say, "Yes, but that would be a BUG."
>
> And the never-ending thread goes on.

(Completely off-topic, but more interesting to me):

Sometime I'll have to post about my C++ preprocessor that lets you embed
ruby in C++. Unlike other implementations I've seen, it's two-way --
you can put variables in, and get them back out. ;)

#include <stdio.h>
#include <string>
#include <iostream>
using std::string;
using std::cout;

#include <inline_ruby.h>

int main() {
int x = 9;
int y = 12;
string s = "fooxar";
printf("My favorite words are %s.\n",
inline_ruby<string> { %{s}.sub('x','b') + " and " + "bar" });
int z = inline_ruby<int> { %{x} + %{y} };
inline_ruby { %{s} = "Hello, World!\n" }
cout << s;
Ruby::Value v = inline_ruby { Object.new }
inline_ruby { p %{v} }
}

Ah, I need to package that up for release, it's lots of fun. =)

> "The thread goes ever, ever on,
> Down from the post where it began...."

"This is the thread that never ends! ...
Yes it goes on and on my friends! ..."

--
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2

Bill Kelly

11/20/2003 7:25:00 AM

0

From: "Wesley J Landaker" <wjl@icecavern.net>
>
> Sometime I'll have to post about my C++ preprocessor that lets you embed
> ruby in C++. Unlike other implementations I've seen, it's two-way --
> you can put variables in, and get them back out. ;)
[...]
> string s = "fooxar";
> printf("My favorite words are %s.\n",
> inline_ruby<string> { %{s}.sub('x','b') + " and " + "bar" });


Wow! That's really neat!!


> Ah, I need to package that up for release, it's lots of fun. =)

I'm definitely eager to try it out !


Regards,

Bill




Wesley J. Landaker

11/20/2003 1:46:00 PM

0

On Thursday 20 November 2003 12:24 am, Bill Kelly wrote:
> From: "Wesley J Landaker" <wjl@icecavern.net>
>
> > Sometime I'll have to post about my C++ preprocessor that lets you
> > embed ruby in C++. Unlike other implementations I've seen, it's
> > two-way -- you can put variables in, and get them back out. ;)
>
> [...]
>
> > string s = "fooxar";
> > printf("My favorite words are %s.\n",
> > inline_ruby<string> { %{s}.sub('x','b') + " and " + "bar" });
>
> Wow! That's really neat!!

I wrote it specifically for use in a project, but I need to clean it up
so that I'm not totally embarassed when I post code. ;) heh heh.
(Actually, it works well, but I haven't used it in a while.)

It really is cool, though. Right now it uses an embedded ruby
interpreter. One possible TODO I'd perhaps like to try is to use the
same interface, but make the backend communicate with ruby in another
process. (It's a long story, but the reason behind that would be to be
able to have multiple independant "embedded" ruby interpreters...
something that last time I tried to do I gave up fairly quickly after
seeing all the global variables!)

> > Ah, I need to package that up for release, it's lots of fun. =)
>
> I'm definitely eager to try it out !

I'd actually almost forgotten about it. I'll dig it back up, clean it
up, and post more info here in a few days. (Err, unless I don't get to
it before I go out of town for the thanksgiving holidy here in the
US...) Okay, so, a few weeks. ;) I'll probably throw it on a subversion
server here at icecavern, but I'll put the project page on rubyforge.

--
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2