Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Envelope a reference type again #6137

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ namespace Akka.Actor
protected virtual bool SpecialHandle(object message, Akka.Actor.IActorRef sender) { }
protected override void TellInternal(object message, Akka.Actor.IActorRef sender) { }
}
public struct Envelope
public sealed class Envelope
{
public Envelope(object message, Akka.Actor.IActorRef sender, Akka.Actor.ActorSystem system) { }
public Envelope(object message, Akka.Actor.IActorRef sender) { }
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka/Actor/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Akka.Actor
/// <summary>
/// Envelope class, represents a message and the sender of the message.
/// </summary>
public struct Envelope
public sealed class Envelope
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically not a "binary compatible change" but I don't think it'll have any breaking changes on end-users:

  1. Envelope, although a public type, is not accessed directly by users typically;
  2. Even if it was, none of the public signatures have changed as this change is source-compatible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a (I think I'm at) tertiary curveball, did we see what happened if we made it a readonly struct? Will admit I am not exactly confident it will be better but I still wonder about certain locality aspects around dispatch.

{
/// <summary>
/// Initializes a new instance of the <see cref="Envelope"/> struct.
Expand Down Expand Up @@ -44,13 +44,13 @@ public Envelope(object message, IActorRef sender)
/// Gets or sets the sender.
/// </summary>
/// <value>The sender.</value>
public IActorRef Sender { get; private set; }
public IActorRef Sender { get; }

/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>The message.</value>
public object Message { get; private set; }
public object Message { get; }

/// <summary>
/// Converts the <see cref="Envelope"/> to a string representation.
Expand Down