aether icon indicating copy to clipboard operation
aether copied to clipboard

Rework message naming/definition conventions

Open ecpeterson opened this issue 3 years ago • 0 comments

Messages are not currently named consistently, stored in consistent places in files, … . Their organization has some of the same flavor as the organization of commands making up a procedure (#6), whose solution might enable some better compile-time checks (#11).

In the message specification case, one thing you might hope to track are the intended senders / receivers of messages. In applications, we've tried renaming the message classes to follow the format sender->receiver~message-type, but the associated constructors make-sender->receiver~message-type and slot accessors sender->receiver~message-type-slot-name start to look really unwieldy. I think it would be far preferable for Lisp to make use of this message typing information directly: a message type could be defined along the lines of

(defmessage message-type
  (:sender type
   :receiver type)
  (&rest direct-slots))

Then make-message, send-message, and receive-message could all be updated to validate that message generators/receivers are typed as specified by the defmessage payload, rather than putting this burden on the programmer (both their brain and their fingertips).

ecpeterson avatar Nov 12 '20 03:11 ecpeterson