Giter Site home page Giter Site logo

Comments (15)

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

@igaray y @jfacorro can you help me on this while i finish gutenberg code?

You can use https://github.com/unbalancedparentheses/genserver-gutenberg-generator and https://github.com/unbalancedparentheses/supervisor-gutenberg-generator as examples for file generation.

from gut.

jfacorro avatar jfacorro commented on June 21, 2024

@unbalancedparentheses I can do gen_fsm, gen_event and lasse cowboy. I'm not really sure what worker_pool is supposed to include.

from gut.

igaray avatar igaray commented on June 21, 2024

@jfacorro lets sync up in the gitter room

from gut.

igaray avatar igaray commented on June 21, 2024

@unbalancedparentheses @jfacorro
please review two new generators:
https://github.com/igaray/cowboy-rest-basic-gutenberg-generator
https://github.com/igaray/cowboy-rest-full-gutenberg-generator

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

No records please. In 99% cases they are superseded by maps. Since gut needs Erlang 17, we can use them.

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

I think it is better to add the comments of what a function do in top of the header of the function and not inside of it:
https://github.com/igaray/cowboy-rest-full-gutenberg-generator/blob/master/name.erl#L73

from gut.

igaray avatar igaray commented on June 21, 2024

I disagree, as you said, maps do not replace all record use cases, and IMHO maintaining process state is precisely the 1%.

edit: comments moved outside of functions.

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

Why a reacord would be better for managing the state of a handler? It has the same feautres as a map but with much more cubersome syntax. Cowboy 2 will even use maps as the default.

We were using maps for managing state in all the new projects. Even brujo was the one that told me to migrate everything.

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

Why the long wait? - we wanted maps to be a replacement for records and to be as efficient as records, and its not blindingly obvious how to do so.
https://joearms.github.io/2014/02/01/big-changes-to-erlang.html

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

"Maps is the only dynamic key/value data structure in Erlang that we can match directly to extract values, allowing users to greatly simplify their code as they don't need to call functions to do everything anymore."
http://ninenines.eu/articles/cowboy2-qs/

Maps let's you code the same thing a lot less lines of code and you with a better syntax than records.

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

The only advantage of the records is that all keys are known at compile-time. In a LOT of cases you do not know all the keys at compile time in a http handler.

from gut.

jfacorro avatar jfacorro commented on June 21, 2024

I think using maps makes the code a lot more readable. In my opinion there is no advantage to using records over maps, at least not when maintaining a process' state. Records are awkard to work with, maps are more flexible in all regards. There might be some use cases where records are preferable to maps, but I can't think of any.

That said, at the end of the day, 'tis all love.

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

We need an elli https://github.com/knutin/elli project. @jfacorro can you create one?

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

You can check: https://github.com/unbalancedparentheses/tinyerl/tree/master/elli

from gut.

unbalancedparentheses avatar unbalancedparentheses commented on June 21, 2024

@jfacorro let me know when you have done elli project, gen event and worker pool so that I close the issue

from gut.

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.