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

Achieve complete type safe of typed_broker #317

Merged

Conversation

ufownl
Copy link
Contributor

@ufownl ufownl commented Jun 18, 2015

Relates #309 .

We can just enforcing all message handlers on the typed actors that they are used as server.

@Inet-Jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@ufownl ufownl force-pushed the topic/Achieve_complete_type_safe branch from 490c7a1 to 67cb854 Compare June 19, 2015 04:21
@ufownl
Copy link
Contributor Author

ufownl commented Jun 19, 2015

I tried to use std::is_convertible but it didn't work.

@ufownl ufownl force-pushed the topic/Achieve_complete_type_safe branch from 67cb854 to f20070b Compare June 19, 2015 05:56
@Neverlord
Copy link
Member

It does, my example code was a bit incorrect. It used to be handle::extend<...>::type, which is a bit verbose for my taste anyway. I changed it to accept handle::extend<...> instead [1] and also verified that std::is_convertible works as expected in the typed_spawn unit tests.

So the preferred syntax should work for you after a rebase.

[1] 0dc6005

@ufownl
Copy link
Contributor Author

ufownl commented Jun 19, 2015

It does, my example code was a bit incorrect. It used to be handle::extend<...>::type, which is a bit verbose for my taste anyway.

I don't mean that.

// check invariants of type system
using dummy1 = typed_actor<reacts_to<int, int>,
                           replies_to<double>::with<double>>;

//using dummy2 = dummy1::extend<reacts_to<ok_atom>>;
using dummy2 = typed_actor<reacts_to<ok_atom>>;

static_assert(std::is_convertible<dummy2, dummy1>::value,
              "handle not assignable to narrower definition");

It has no compilation error on my computer, does it work as expected?

@ufownl ufownl force-pushed the topic/Achieve_complete_type_safe branch from f20070b to cdf4f11 Compare June 19, 2015 14:18
@Neverlord
Copy link
Member

It has no compilation error on my computer, does it work as expected?

Crap. The handles are always assignable and only check via static_assert if the assignment is correct. I'm working on a fix.

@Neverlord
Copy link
Member

I'm really sorry for not double-checking this prior to pushing the code to GitHub. I've added a counter-test to the unit test and use SFINAE to make assigning invalid handles impossible: b6a1811

Thank you for your patience (and double-checking the nonsense I wrote). :)

@ufownl ufownl force-pushed the topic/Achieve_complete_type_safe branch from cdf4f11 to 3b6f726 Compare June 19, 2015 16:10
@ufownl
Copy link
Contributor Author

ufownl commented Jun 19, 2015

Now, it works fine! And the newest commit has been pushed. :)

@Neverlord
Copy link
Member

@Inet-Jenkins ok to test

@ufownl
Copy link
Contributor Author

ufownl commented Jun 20, 2015

Jenkins didn't work, what's wrong with it?

@Neverlord
Copy link
Member

Sometimes Jenkins picks up the wrong hash for some reason.

@Inet-Jenkins retest this please

@ufownl
Copy link
Contributor Author

ufownl commented Jun 20, 2015

Seems Jenkins hates this PR.

@Neverlord
Copy link
Member

Looks like it..

Neverlord added a commit that referenced this pull request Jun 21, 2015
@Neverlord Neverlord merged commit 9fe8650 into actor-framework:develop Jun 21, 2015
@ufownl ufownl deleted the topic/Achieve_complete_type_safe branch June 22, 2015 01:53
@Neverlord Neverlord mentioned this pull request Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants