GithubHelp home page GithubHelp logo

Comments (7)

etrepum avatar etrepum commented on July 22, 2024

What's the use case for having start not link? Do you have a proposal to do this in a backwards compatible way?

from mochiweb.

yrashk avatar yrashk commented on July 22, 2024

My use case was when I need to try starting mochiweb, but if its returning {error, eaddrinuse}, do something else. start/1 tricked me into believing that it does not link to the current process. Since it did, it actually crashed my gen_server, so I had to resort to gen_tcp:listen to try port's availability first.

Besides, it's just breaking the convention that start doesn't link but start_link does. I don't think this adjustment can be done in a backwards compatible way.

One option that I see is to add {link, boolean()} option to disable linking when necessary. It will not solve the problem of figuring out that start does something it is not supposed to do, but at least it will provide a way to get around of that behaviour.

from mochiweb.

etrepum avatar etrepum commented on July 22, 2024

I agree that it would be ideal that start did not link, but backwards compatibility is a more important goal for us right now. The mistake was made several years ago, LOTS of code uses mochiweb (most of which we don't have any control over), and this is the first request to change that behavior to my knowledge.

Perhaps we could add a start_link, start/2, and add a deprecation message to start/1 or something like that. Definitely not something we could just fix very quickly.

from mochiweb.

yrashk avatar yrashk commented on July 22, 2024

start_link plus an option for using start in a way that it won't link ({link, false} option) will be great. Plus a documentation saying that until this is deprecated, start actually does link so people can have easier time figuring this out.

from mochiweb.

etrepum avatar etrepum commented on July 22, 2024

So I think I'm going to add a start_link/1 where appropriate and add a {link, false} option to start/1 with no deprecation warnings yet. I'll leave some comments in the code so that we know how to phase out the linked start/1 behavior carefully (will take a while to do it smoothly: add {link, false} and start_link/1, deprecation of start/1 without {link, false}, change default behavior, add deprecation warning for {link, false}, removal of {link, false}).

from mochiweb.

etrepum avatar etrepum commented on July 22, 2024

I think this should solve your request for now, with the expectation that we'll eventually phase out the current (stupid) default. Please re-open if you think something else needs to change.

fb4a292

from mochiweb.

yrashk avatar yrashk commented on July 22, 2024

thanks a lot! that was really quick :)

from mochiweb.

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.