+;; This is the internal, generalized message sending method.
+;; Users shouldn't use it! Use the <-foo forms instead.
+
+;; @@: Could we get rid of some of the conditional checks through
+;; some macro-foo?
+(define-inlinable (send-message xtra-params from-actor to-id action
+ replying-to-message wants-reply?
+ message-body-args)
+ (if replying-to-message
+ (set-message-replied! replying-to-message #t))
+ (let* ((hive (actor-hive from-actor))
+ (new-message
+ (make-message (hive-gen-message-id hive) to-id
+ (actor-id from-actor) action
+ message-body-args
+ #:wants-reply wants-reply?
+ #:in-reply-to
+ (if replying-to-message
+ (message-id replying-to-message)
+ #f))))
+ ;; TODO: add xtra-params to both of these
+ (if wants-reply?
+ (abort-to-prompt (hive-prompt (actor-hive from-actor))
+ from-actor new-message)
+ (8sync (hive-process-message hive new-message)))))
+
+