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

Could spawn return a "type-safe" process item (ProcessId)? #7

Open
StefanBertels opened this issue May 31, 2017 · 1 comment
Open

Comments

@StefanBertels
Copy link
Contributor

Is there a reason for having ProcessId typeless?

I guess this might have something todo with generic handling of processes but isn't something like this more typesafe:

public static Unit tell<T>(ProcessId<T> pid, T message, ProcessId sender = default(ProcessId))

public static ProcessId<T> spawn<T>(ProcessName Name, Action<T> Inbox, ...)

Together with making ProcessId implement some (typeless) IProcessId or just allow casting ProcessId to ProcessId this might be compatible with the existing typeless ProcessId system.

(Of course ProcessId could be named ProcessIdTypesafe or anything else.)

So we could have typesafe wiring of actors:

var actorHandler = spawn<string>("my actor", Console.WriteLine);
tell(actorHandler , "hello world"); // compiles
tell(actorHandler, 123); // compile time error
@louthy
Copy link
Owner

louthy commented Jun 1, 2017

ProcessId is just the address of the process, and needs to be serialisable. However I was considering having a typed ProcessId as well for convenience within the app.

Probably won't happen soon though, as I'm seriously bogged down with other work at the moment.

louthy pushed a commit that referenced this issue Jul 16, 2019
louthy pushed a commit that referenced this issue Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants