This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: goops/guile doc (was Re: Simple example program to illustrate Goops)


Lalo Martins <lalo@webcom.com> writes:

> On Sun, Jan 30, 2000 at 12:30:36AM -0330, Greg Harvey wrote:
> > Lalo Martins <lalo@webcom.com> writes:
> > 
> > > 
> > > Why not the same thing with well-behaved scheme?
> > > 
> > > (create-class Kons
> > >    (<int> car ('private))
> > >    (<int> cdr ('private))
> > >    (<int> car () () (car))
> > >    (<int> cdr () () (cdr))
> > >    (() cdr () (<int> val) (set! car val))
> > >    ; etc
> > >    )
> > 
> > We're trying to win over the people from java/c++, not scare the crap
> > out of 'em ;).
> 
> Hmm? I _am_ from c++... and I like what I see above :-) Perhaps
> we could shuffle some stuff around, and of course I forgot a ()
> for superclasses, but the overal form is pretty straightforward
> for someone coming from a c++ (probably /java) background.

> 
> Every now and then I try again to learn Perl, then I reach the
> conclusion that I and Larry Wall probably aren't from the same
> planet. Perl's concept of ``OOP'' is even worse, I don't like
> to think about it on account of a weak stomach.

Ick, I was so busy slaggin' on c++, I forgot to take a little
jab at perl ;). 

> Back to the discussion, here is what I think is worth trying to
> improve on my proposal for a ``create-class'' syntax:
> 
> - the ``options'' parameter sucks :-) is there a better way to
>   pass stuff like ``private''?

In this case, it might be best to go to something less schemely like

(private <int> car)

and implement it with a private macro that munges the name into
something not car, so that you end up with a pseudo-private variable
for someone who's really into encapsulation (as I recall, this is how
python does it). The actual syntax of the declarations could be
something like:

(<munger>* type name [<arguments> <body])

Where munger would be stuff like private, static, etc...

> - the order of return type, name and options is open to
>   discussion.
> - how to best represent something with undefined return
>   (``void'')?

Doesn't goops have something like unspecified? The natural solution
seems to be to use <void> as the type, and handle it with whatever
makes sense underneath.

> I really think this is a good sollution, because it's easy to
> make translators work on top of that. (As you see, most of my
> current efforts are related in one way or another to making
> translator lives easier ;-) )

For that purpose, it would be very useful to have something like the
syntax you described. I was getting more at something that could be
used as a sort of a object declaration language, useful for
introducing goops (and probably implementing it would be a good way
for someone not all that familiar with goops to learn it). Wrt to
experience, we aren't really be the target audience for the kind of
thing I had in mind ;). I'm thinking someone  who's probably only seen
java or c++ or something similar; it would take a bit of an easing in
process for them to really become comfortable with the scheme/goops
way of doing things. The problem with your syntax from that point of
view is that, even though it's saying the exact same things, it
doesn't look very `familiar' (from a quick browse of a few of the
latest threads, which is all I've had time to do lately, really, I
know we could start a long discussion on what familiar actually means,
but that would be soo not interesting >;'). The problem isn't so much
that it's a bad thing to do stuff differently (particularly when it's
better), but that people tend to like things to not be totally foreign
(at least at first, so you'd really like to ease them into it, rather
than throwing this big pile of stuff at them that, at a glance,
doesn't seem all that related to what they already know). This is (at
least, I think) a big reason why languages like java & perl gain a lot
of ground quickly; if you know c/c++, the leap isn't nearly as far to
java as it is to scheme/goops or cl/clos.


-- 
Gregh

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]