-
Notifications
You must be signed in to change notification settings - Fork 62
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
Proposal: Make frame render functions return the frame. #474
base: main
Are you sure you want to change the base?
Proposal: Make frame render functions return the frame. #474
Conversation
743cb75
to
915aea0
Compare
We can't do these changes, because it means any code today that does |
I see. The problem would be if you create a frame in one cell, then update/render it in another. Without a I tend to co-locate my frames with the code necessary to render into them in the same cell, which (without a fluent API) necessarily means the frame can't be the implicit output. (I have to assign it, render with But yeah, dividing the frame creation and rendering between cells could lead to double-embedding issues, makes sense.
Would it make sense to have them return a more intention-revealing |
I'm not convinced that this DX is a bad thing: if you are creating a frame in one cell and using it in another, you are probably experimenting with frames (and might want to see the intermediary output). As opposed to building a re-renderable UI in a single cell (and necessarily co-locating listeners after frame initialization, where you need a handle to it). A simple |
Side note: if we do decide on this, releasing as a potentially breaking change, we can probably drop the |
This accomplishes three things in the name of pipe-ability:
Kino.Frame.render
consistent withKino.render
This also lets you do things like this:
Kino.Frame.append(frame, term)
more chainableFor example:
Kino.Frame.clear(frame)
chainableFor example:
This implementation wraps the
GenServer.call
s withwith
, which technically may return something other than:ok
, but effectively makes the same assumptions that the previous typespec did that it will always be:ok
. We could just match on:ok
(like inclear
'scast
) or even ignore the result of the call, but this is the most backwards-compatible with any existing code today that tries to handle non-:ok
GenServer.call
results (I would be suprised if any such code was out there, though).