guile-user
[Top][All Lists]
Advanced

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

Re: GOOPS constructors


From: Marko Rauhamaa
Subject: Re: GOOPS constructors
Date: Wed, 23 Jul 2014 20:42:16 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Barry Fishman <address@hidden>:

> If you need to redefine "initialize" to do what you want, this is a
> clear indication that you might using the wrong abstraction.

If I have an IS-A relation, that is often described as class hierarchy.
The general question here is, is IS-A-WHOSE a valid basis for class
derivation?

For example,

   A thunk IS-A function WHOSE argument list is empty.

   A square IS-A rectangle WHOSE width equals its height.

   Green light IS electro-magnetic radiation WHOSE wavelength is 520 nm.

   A Texan IS-AN American WHOSE permanent address is in Texas.

In many programming languages, such restrictions are routinely expressed
in object constructors:

    class GreenLight(Radiation):
         def __init__(self):
              Radiation.__init__(self, wavelength=520e-9)


Marko



reply via email to

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