Code Monkey home page Code Monkey logo

Comments (4)

essen avatar essen commented on June 14, 2024

I would like to see a better fledged interface proposal. Know which messages it is expected to replace, how it deals with data or trailers and so on.

I would favor changing reply_to to accept a {fun ..., St}. I don't know if that St should be allowed to change or not. Let's see if there's any benefits one way or the other. The St would be a way to give the Pid if you use a fun F/A form.

from gun.

zuiderkwast avatar zuiderkwast commented on June 14, 2024

If reply_to can be just a fun, then the fun can encapsulate a custom pid, like

reply_to => fun(Response) -> my_response_handler(MyPid, Response) end

I think it is almost equivalent to

reply_to => {fun my_response_handler/2, MyPid}

I don't mind the latter, but I don't think it is necessary. If St is allowed to change, then the fun use it to accumulate the response until IsFin is true, but I think it might be too complex. The user can do that in their own process instead, so we don't complicate the interface too much.

from gun.

essen avatar essen commented on June 14, 2024

Those funs don't survive module reloads. So we need to have a tuple at least as an option.

from gun.

zuiderkwast avatar zuiderkwast commented on June 14, 2024

Interesting. I didn't think about funs that become invalid when their module's old code is purged. Is it only a fun with explicit module like fun M:F/A that can survive a purge, i.e. not even fun F/A can survive?

Regarding the possibility to update St, we don't need it now but I think we can't add it later if we don't add in from the start.

So how about this proposal: reply_to => {Fun, St} where Fun is called as Fun(Response, St). If it returns {ok, NewSt} we keep NewSt, but otherwise (any other return value) the old St is kept.

To keep the inteface simple, it would receive exactly the same messages as the existing ReplyTo pid does.

from gun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.