Giter VIP home page Giter VIP logo

di-polysemy's Introduction

di-polysemy's People

Contributors

simmsb avatar

Stargazers

 avatar

Watchers

 avatar

di-polysemy's Issues

Misuse of new

Hi! I just came across your article. Cool stuff! Thanks for sharing it!

I noticed there, however, a misuse of the new function.

Essentially, di-polysemy should not be using the new function, nor trying to construct a Di value at all. Instead, the various runXxx functions in your library should take a Di value as a parameter.

You can think of the Di value as file handle or MVar that will be accessed from multiple places in the application, possibly from different threads, with and without polysemy. If you construct a new Di value each time diToIO runs, then there's no guarantee that the log messages that are finally rendered to the outside world will happen in an absolute order, and if you attempt to log things from multiple threads you'll most definitely see log messages stepping on each other on stderr or similar.

new is expected to be used just once, in main, as soon as the application starts, and the resulting Di value should be given as argument to the various runXxx functions, and to the logging functions such as info, notice, etc. It's perfectly safe to use this one Di value, as is, from multiple threads.

As a convenience, to keep things simple in end-user applications (that is, in applications that depend on di-polysemy), you'll probably want to call Di.new from the di package, which is a bit higher-level than Di.Core.new.

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.