guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Article about GNU Guile and GOOPS


From: Jan Wedekind
Subject: Re: Article about GNU Guile and GOOPS
Date: Tue, 4 Mar 2014 17:41:01 +0000 (GMT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Tue, 4 Mar 2014, Thompson, David wrote:

On Tue, Mar 4, 2014 at 7:57 AM, Jan Wedekind <address@hidden> wrote:
Hi,
  I have written a small blog post about object-oriented programming with
GNU Guile and GOOPS [1]. Having used the Ruby programming language for some
time, I am quite spoiled when it comes to objects ;)
  It took me a while to figure out defining constructors and dynamic
instantiation of OO primitives. I hope it'll save somebody else some time
one day.
  Any comments and suggestions are welcome.

Regards
Jan

[1] http://wedesoft.de/oop-with-goops.html

Hi Jan,

I think it's a nice little introduction to GOOPS.

I want to discuss this particular point from the post, because it is
shared by many other people: "... one thing I don't like about Scheme
is that there are different function names for each type of arguments.
E.g. adding numbers is done with +, adding lists is done with append,
and adding strings is done with string-append."

Having spent many years now working with object oriented programming
languages, I hold the opposite opinion.  I think it's awkward to have
a single '+' operator for all sorts of different operations on many
different types.  Adding numbers is different than concatenating
strings or lists and using the same symbol for them leads to
confusion.  Look at JavaScript for all of the crazy things that happen
when you add together different types of data: The expression 1 +
"foo" returns "1foo"!  [] + {} returns "[object Object]"! WTF?  Ruby
tends to be a bit more sane in this regard, but I think the point
still stands that operator overloading leads to confusion and strange
behavior.

WDYT?

- Dave


Hi,
I agree, I wouldn't define 1+"foo" or []+{} (and I haven't done so in my article). I guess you have the "WAT" talk [2] at "Destroy all Software" in mind ;)
  I think that GOOPS makes sense because without being able to extend '+',
user-defined numeric classes (e.g. hypercomplex numbers) always would be second class citizens compared to Guile's integers, floating point numbers, and complex numbers. Anyway, I need to collect some experience with this in Scheme myself. But I hope it will work out well.

Regards
Jan

[2] https://www.destroyallsoftware.com/talks/wat





reply via email to

[Prev in Thread] Current Thread [Next in Thread]