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)


Gregg Reynolds <greynolds@enteract.com> writes:

> Neil Jerram wrote:
> > 
> > Julien Rousseau writes:
> > 
> >    Hi everyone,
> > 
> >    I read (quite all) the GOOPS tutorial yesterday and
> >    was wondering where I could find a program using it
> >    that would be simple enough for a newbie to grasp it
> >    (that is not to big, nor using obscure features of
> >    Goops) but complete enough to illustrate its use.
> > 
> >    If there is no such program (yet) I may take the time
> >    (although not before at least next week) to make such
> >    one when I understand Goops better and if people are
> >    interested/can give me some clue about what it should
> >    cover.
> > 
> > Take a look at the following.  It's undocumented, sadly, but it does
> > at least demonstrate
> > - defining a class
> > - defining methods for that class
> > - use of slot accessors.
> > 
> > Does this help you at all?
> > 
> 
> Helps me for one, but I'm afraid if I showed it to the pythonites at the
> office it would only reinforce their Fear of Scheme.
> 
> One of the things Python has going for it is that the OO parts _look_
> like OO parts - you can visually pick out, at a glance, the OO
> structure.  (Assuming that for 90% of the tech world C++ and/or VB
> defines OOness.)  I think for simple example intended to give newbies a
> quick grasp of the essence of goops we need a standard animal/dog/cat or
> shape/rectangle/circle example.  Also, I would recommend adopting the
> assumption that new readers already have some familiarity with OO, and
> that said familiarity was bred in the quagmire of C++, VB, possibly
> Perl.  Or maybe two intros are needed, one for complete neophytes and
> another tailored for experienced OO programmers trying to break their
> bad habits.  In particular, it would be good to specifically compare
> goops code with the equivalent code in other languages.


Actually, it might make an interesting little project to provide a
translator from a limited OO style of declaring classes (maybe
something javaish, without some of the funkiness of java) to the
corresponding goops code. So, you could have something like:

class Kons {
        private long car, cdr;
        public long car() (car);
        public long cdr() (cdr);
        public void set-car! (long val) (set! car val);
        /*etc..*/
        }

and have that generate goops code that does the same thing (note the
cheating, by having scheme for the method code :).  This wouldn't be
something that you'd want to use for real programming, but it could
provide a way for someone coming from the java/c++ style of oo
programing to see how to do the same sorts of things with goops (yeah,
I know we don't really have private, but neither does python, really,
so we'll take the same liberties ;); of course, someone could probably
work from this and provide a full java interpreter. This might be
enough to make an easy migration, which can the be built upon by
discovering the really cool things you can do with goops (also means
that someone can spend time documenting goops itself, rather than
having to worry about showing how all the various programming
languages would implement something similar).

-- 
Gregh: discovering he doesn't hate java as much as he thought he
did... c++ is still the language of pure evil, tho.

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