On Oct 16, 5:44 pm, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:
> What's the rule of thumb for deciding whether a function name should
> end with an exclamation point? I thought maybe it was when the
> function modifies its first argument, but it seems there are functions
> that do that and do not have such names.
>
> For example, set-validator! and add-watch. Why don't they either both
> end with ! or both not do that.

add-watch doesn't really affect the object itself, while set-
validator! certainly does, so I think the naming is consistent.
I think it might be a good rule of thumb to add the ! if the operation
either mutates the object (set!) or invalidates old values/references
to it, like persistent! or set-validator!. However, even core.clj
doesn't seem to follow this...

The exceptions seem to be the "alter" operations for reference types;
alter, commute, alter-var-root, and for some reason, ref-set.

--
Jarkko
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to