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

Serialising closures in arrays #6

Open
tpunt opened this issue Mar 3, 2018 · 0 comments
Open

Serialising closures in arrays #6

tpunt opened this issue Mar 3, 2018 · 0 comments

Comments

@tpunt
Copy link
Owner

tpunt commented Mar 3, 2018

Closures cannot be serialised inside of arrays. This is because arrays are simply serialised with PHP's internal serialiser. Closures require special handling with serialisation, and so arrays will need to be serialised differently if this is going to work. The ph_hashtable_t type should be reusable for this, so it should be a matter of mapping PHP's hash table to phactor's hash table.

Example:

<?php

use phactor\{ActorSystem, Actor, ActorRef};

$as = new ActorSystem(1);

class A extends Actor
{
    public function __construct(array $a){}
    public function receive(){}
}


$a = new ActorRef(A::class, [[function(){}]], 'a');

ActorSystem::shutdown();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant