This is the mail archive of the guile@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: records


Jost Boekemeier wrote:
> 
> Chris Bitmead <chris@tech.com.au> writes:
> 
> > There's no such thing as "can't"...
> >
> > (define (display a) (let ((old-disp display))
> >       (if (foobartype? a) (display-foobar a) (old-disp a))))
> 
> The question "is a foobartype?" would not be necessary in a
> polymorphic system.  Also the 1000 type checks used in each
> scm_* function would not be necessary.

The above two lines merely proves it's possible. Read the source code to
tclos.scm to see how it can be done without foobartype?.
 
> I think the biggest problem scheme has is that it has no 
> explicit type system. All functions are generic.  If you create
> complex types and don't document them your code will be 
> unreadable.

When you say an explicity type system, I assume you mean a static type
system. All I can say is I've used both, both have their advantages and
disadvantages, but I love the simplicity, practicality and just plain
understandability of code without being cluttered by explicit types.
When you are doing really complicated stuff in C++, all the
class::<type>.<type>(type *) clutters everything up to such an extent
that you can't figure out what the actual algorithm is. Scheme is pure
code, with minimum clutter for implementation details of what type we
are dealing with at the moment. Plus the dynamic typing actually makes
code smaller because you can write generic code in Scheme that you would
have to jump through hoops to get to happen in Eiffel or C++.

> All you see are caddr/cdadar etc. but you would not have a 
> chance to understand what they mean.

If you don't care for caddr, write your own abstractions instead -
collections, dictionaries whatever you like. The power of Scheme is you
are not locked into any one paradigm.

-- 
Chris Bitmead
mailto:chris@tech.com.au

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