+;; 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 send-options 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))))
+ (if wants-reply?
+ (abort-to-prompt (hive-prompt (actor-hive from-actor))
+ from-actor new-message send-options)
+ ;; @@: It might be that eventually we pass in send-options
+ ;; here too. Since <-wait and <-reply-wait are the only ones
+ ;; that use it yet, for now it kind of just makes things
+ ;; confusing.
+ (8sync (hive-process-message hive new-message)))))
+
+