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

Keywords and names of setters



I've been banging on Meroon quite a lot recently, and I like it a lot.
Here are two small issues that came up that might be relevant to this
SRFI.

The SRFI gives the example:

(define-class Foo Object
  ((= bar :immutable)
   (* hux :initializer (lambda (i) i)) ) )

Here is the signature of the generated functions: 

(Foo? anySchemeValue) -> boolean
(Foo-bar aFooInstance) -> anySchemeValue
(Foo-hux aFooInstance aNaturalNumber) -> anySchemeValue
(set-Foo-hux! aFooInstance anySchemeValue aNaturalNumber) -> unspecified
(Foo-hux-length aFooInstance) -> aNaturalNumber

which is OK when the names are Foo, bar, and hux, but I've been using
classes like

(define-class Linear-finite-element-operator Operator
  ((= indices)
   (= coefficients maybe-uninitialized:)
   (= domain-fes)
   (= range-fes)
   (= matrix-implementation maybe-uninitialized:)))

and I would prefer to say

(Linear-finite-element-operator-matrix-implementation-set! o m)

rather than

(set-Linear-finite-element-operator-matrix-implementation ! o m)

because I kept making enough mistakes putting the set- on the left and
the ! on the right that it became irritating.  Christian was kind enough
to show me how to do this with Meroon's MOP, but this is a bare-bones
SRFI without a MOP, I would like to get my preferences stated early on.

Also, keywords are specified with the colon at the left, and DSSSL
keywords have the colon at the right.  If you use a Scheme implementation
that supports DSSSL keywords as objects distinct from symbols, as Gambit-C
does, then I think it would be good to have the keywords in define-class
be true keywords of the implementation. (I don't like having to explain
that you use DSSSL keywords in extended argument lists and some other type
of pseudo-keywords in class definitions.)  Christian again modified Meroon
to make this possible, but I would like to suggest that the keywords in
this SRFI be DSSSL keywords, i.e., with the colon on the right.

Brad Lucier