Transformers and effect libraries #469
-
I'm having trouble integrating my existing code to be invoked within |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
Before I can entertain the possibility of providing such an instance, I'd need to know what are you trying to accomplish and why you want |
Beta Was this translation helpful? Give feedback.
-
As I said I have handlers for a CLI tool I've made, that I've implemented as Sorry if it's a bit hairy, let me know if you need a code example |
Beta Was this translation helpful? Give feedback.
-
Perhaps I missed something, but I don't see where you mentioned this.
Does this mean that you are hoping to run external commands and do network I/O from within your Brick event handlers?
A code example would not help me since I am more concerned with understanding your design objective. |
Beta Was this translation helpful? Give feedback.
-
Okay, thanks, this is very helpful to know! The reason I wanted to understand your intentions better is because doing I/O of this sort in the event handler itself is going to cause rendering latency or flat-out application unresponsiveness. Instead of doing I/O in the event handler -- particularly blocking I/O -- I recommend doing it in another thread. There are lots of ways one could do that, but I often take an approach that I described in this thread. Since equipping |
Beta Was this translation helpful? Give feedback.
-
I see. So making another thread that would receive events and perform the requested IO would be the proper way to go then ? Also regarding blocking IO, I've actually had this problem a few years ago when I made another TUI with |
Beta Was this translation helpful? Give feedback.
-
Yes, exactly - you can see a sketch of such a thing in the thread I linked. I'm happy to discuss it more if that would be helpful!
Yeah, I could see this approach being practical, perhaps just when the application first starts up. Matterhorn (a chat client I work on) does this in its own way, where the main UI is not even shown until the initial HTTP fetches of application data have completed. But that's the only time that sort of thing happens, and after that, the main UI is always shown and all I/O is asynchronous. |
Beta Was this translation helpful? Give feedback.
Okay, thanks, this is very helpful to know! The reason I wanted to understand your intentions better is because doing I/O of this sort in the event handler itself is going to cause rendering latency or flat-out application unresponsiveness. Instead of doing I/O in the event handler -- particularly blocking I/O -- I recommend doing it in another thread. There are lots of ways one could do that, but I often take an approach that I described in this thread.
Since equipping
EventM
to better support I/O is in some ways a miscommunication of how Brick applications should be designed, I am not currently open to adding more support toEventM
along the lines that …