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: deeper constification


Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:

> Mutators: <collection type>-<operation>-<element type>!
> Informators: <collection type>-ref-<element type>

On both C and Scheme levels, the convention we follow currently is:

* as a general rule, name parts should be placed in order of
  increasing significance

* selectors typically have the form <prefix><type><component>

* `set' is placed as far left as possible

Example:

port-filename
set-port-filename!

> R5RS doesn't have mutators where both, the collection type and
> element type are implicit, but environments have:
> 
> eval-environment -  set      - imported       !
> import-env.      -  set      - imports        !

Acoording to the convention these should have names

eval-environment-imported
set-eval-environment-imported!

> BTW: Guile exports some functions which break this convention.  While
> set-symbol-property! is correct, symbol-property-remove! is not.

They are correct in the sense that they follow the convention which
was ruling when these names were chosen.

> In
> an environment context their names are:
> environment-set-symbol-property! and
> environment-remove-symbol-property!

These are apples and pears.  The type in this latter example seems to
be `environment'.  The type in the previous example is `symbol'.


I think the naming convention you describe is reasonable, but it is
not the one which Guile developers currently should follow.  This is
nothing we should change on a per-name basis.

However, we can discuss changing the "official" naming convention.  On
the C level, this is a big change, since the convention I describe
above has been used extensively.  But on the Scheme level it has not
been followed as extensively.

We can also have different naming conventions on the different levels.

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