Git Product home page Git Product logo

Comments (5)

christopheradams avatar christopheradams commented on September 28, 2024

Something like this?

  • Use the key: value shorthand syntax for all keys in maps that are atoms.

    # not preferred
    %{:a => 1, :b => 2, "c" => 0}
    
    # preferred
    %{"c" => 0, a: 1, b: 2}

from elixir_style_guide.

lobo-tuerto avatar lobo-tuerto commented on September 28, 2024

Yeah, that's a good start! :)

We could argue about being consistent first, and maybe only use that shorthand syntax only when all keys are atoms probably?

from elixir_style_guide.

christopheradams avatar christopheradams commented on September 28, 2024

We could argue about being consistent first, and maybe only use that shorthand syntax only when all keys are atoms probably?

Yes, I would agree with this.

from elixir_style_guide.

christopheradams avatar christopheradams commented on September 28, 2024

@lobo-tuerto What do you think of this?

  • Use the shorthand key-value syntax when all the keys in a map are atoms.

    # not preferred
    %{:a => 1, :b => 2, :c => 0}
    
    # preferred
    %{a: 1, b: 2, c: 3}
  • Use the verbose key-value syntax when not all the keys in a map are atoms.

    # not preferred
    %{"c" => 0, a: 1, b: 2}
    
    # preferred
    %{:a => 1, :b => 2, "c" => 0}

from elixir_style_guide.

lobo-tuerto avatar lobo-tuerto commented on September 28, 2024

@christopheradams That looks good!

from elixir_style_guide.

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.