Skip to content

Conversation

keciman
Copy link

@keciman keciman commented Oct 20, 2022

@gaaclarke I feel like the wording should be better here. It was quite missleading to me and also for other people from what I've seen.
About two things:

  1. That it is synchronous. Which is only on the native side and it makes a person think that it is also sync on the Flutter part
  2. That is is "faster" even tho it is based on MethodChannel.

@gaaclarke I feel like the wording should be better here. It was quite missleading to me and also for other people. About two things:
1. That it is synchronous. Which is only on the native side and it makes a person think that it is also sync on the Flutter part
2. That is is "faster" even tho it is based on MethodChannel.

I hope this note from me makes sense and will help to make this SDK a better tool.
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

I appreciate the sentiment. I think there is room for improvement but these changes aren't doing a better job at informing users.

Comment on lines 94 to 96
By default Pigeon will generate synchronous handlers for messages on the native side.
The Flutter part is not asynchronous! If you want to be able to respond to
a message asynchronously you can use the `@async` annotation as of version 0.1.20.
Copy link
Member

Choose a reason for hiding this comment

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

What is generated on the native side depends on if you have a @HostApi or @FlutterApi.

Using an exclamation isn't really the right tone for the document =)

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your reply. I totally agree. Just wanted to point it out and I was not sure what is the best way.
Should I try to come up with better wording or can you assign it to somebody to rephrase these two parts ? :)

Copy link
Member

Choose a reason for hiding this comment

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

It's you, I believe in you, you got this. You ran into something that frustrates you in the documentation. You have all the information on how to make this better. Make it better, make it accurate, make it professional and it's in =)

Copy link
Author

Choose a reason for hiding this comment

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

Ok hopefully this version will be more understandable for users :)

P.S.: So glad to start giving back to the community after developing in Flutter for 3 years.

@@ -1,7 +1,7 @@
# Pigeon

Pigeon is a code generator tool to make communication between Flutter and the
host platform type-safe, easier and faster.
host platform type-safe, easier and faster to implement.
Copy link
Member

Choose a reason for hiding this comment

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

While pigeon right now runs at the same speed and platform channels. We are about to land a change that makes them faster. That was always the goal. Once we can abstract away the medium, we can start making improvements.

Copy link
Author

Choose a reason for hiding this comment

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

I understand it is the goal. But the main problem why I want this text to change is I spent one working day implementing pigeon to make my code run faster and after testing if it is faster and how much to realize it is the same speed :( So I want it to be clear for others too.
So should i just delete the whole word "faster" for now?

But I am looking forward for the faster version 💯

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, since this was authored now for the same feature set, pigeon is faster than MethodChannels. I don't think it's misleading to say that it is faster.

Copy link
Member

Choose a reason for hiding this comment

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

(note too that it was always faster than method channels because of one less layer of indirection that results from multiplexing the channels)

Copy link
Collaborator

Choose a reason for hiding this comment

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

"MethodChannels" doesn't appear in the sentence anywhere. Someone could easily assume that the comparison is with message channels, not method channels, and it certainly isn't faster that the thing it is implemented using.

Comment on lines +94 to +97
By default Pigeon will generate synchronous handlers for messages.
The API can return data synchronously but the request function is always asynchronous.

If you want to be able to respond to a message asynchronously you can use the `@async`
Copy link
Member

Choose a reason for hiding this comment

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

How about:

By default Pigeon will generate synchronous handlers for messages (i.e. the host code for @HostApi's and the Flutter code for @FlutterApi's). Using the @async annotation on a method in the Pigeon file makes the generated methods respond asynchronously instead.

Copy link
Author

Choose a reason for hiding this comment

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

I try to clarifiy something else that does not have to be obvious to people that see the package for the first time.
That is that the other side will be always async no matter what you do. First time I just saw info that it is synchronous and from the context I did not know it is only one sided synchronous code. I understand that from perspective of a person that is doing this often it might look different and there might be obvious reasons for which it wouldnt make sense that it would be both sides sync. But thats what I thought combined with the info that it is also faster. I can rephrase it a bit more so its obvious from your technical point of view and maybe the more naive point of view.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is still a bit confusing because "request function" isn't a term we use. I think there is some confusion in vocabulary between the generated function the client calls and the handler that gets invoked as a result.

I'd refer to the former as "generated methods" and "handlers". So the generated methods are always asynchronous, but the handlers are synchronous by default but can be asynchronous with the @async annotation. I don't think this clarifies.

Copy link
Member

Choose a reason for hiding this comment

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

suggestion:

By default Pigeon will generate synchronous handlers for messages and asynchronous methods. If you want a handler to be able to respond to a message asynchronously you can use the @async annotation as of version 0.1.20.

@stuartmorgan-g
Copy link
Collaborator

@gaaclarke It looks like this is ready for another round of review/discussion.

@stuartmorgan-g
Copy link
Collaborator

@gaaclarke Ping on this review, from triage.

@stuartmorgan-g
Copy link
Collaborator

@gaaclarke Ping on this review again.

@@ -1,7 +1,7 @@
# Pigeon

Pigeon is a code generator tool to make communication between Flutter and the
host platform type-safe, easier and faster.
host platform type-safe, easier and faster to implement.
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, since this was authored now for the same feature set, pigeon is faster than MethodChannels. I don't think it's misleading to say that it is faster.

Comment on lines +94 to +97
By default Pigeon will generate synchronous handlers for messages.
The API can return data synchronously but the request function is always asynchronous.

If you want to be able to respond to a message asynchronously you can use the `@async`
Copy link
Member

Choose a reason for hiding this comment

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

I think this is still a bit confusing because "request function" isn't a term we use. I think there is some confusion in vocabulary between the generated function the client calls and the handler that gets invoked as a result.

I'd refer to the former as "generated methods" and "handlers". So the generated methods are always asynchronous, but the handlers are synchronous by default but can be asynchronous with the @async annotation. I don't think this clarifies.

Comment on lines +94 to +97
By default Pigeon will generate synchronous handlers for messages.
The API can return data synchronously but the request function is always asynchronous.

If you want to be able to respond to a message asynchronously you can use the `@async`
Copy link
Member

Choose a reason for hiding this comment

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

suggestion:

By default Pigeon will generate synchronous handlers for messages and asynchronous methods. If you want a handler to be able to respond to a message asynchronously you can use the @async annotation as of version 0.1.20.

@gaaclarke gaaclarke mentioned this pull request Jan 17, 2023
11 tasks
@gaaclarke
Copy link
Member

Thanks for the feedback and working through some iterations. Since this got buried I didn't want to ask you to have to come back to it. I addressed the feedback in #3058. Please take a look. The big confusion was asynchronous methods being an invariant to the @async annotation. I think this clears that up in the simplest way possible.

@gaaclarke gaaclarke closed this Jan 18, 2023
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.

3 participants