jeroenbourgois

jeroenbourgois

Syntactic sugar map idea

Just a random idea that keeps popping up in my head whenever I am pattern matching on maps. In Javascript es6 notation, there is this concept of a shorthand format to create objects, which I find very concise:

// pre es6
const someObject = {cat: cat, dog: dog, bird: bird}

// es6
const someObject = {cat, dog, bird}

Whenever I am pattern matching in Elixir I wonder how handy this would be to have, say:

def decorate_name(%{id, firstname, lastname}) do
  "Hi, #{firstname} #{lastname}"
end 

As opposed to

def decorate_name(%{id: id, firstname: firstname, lastname: lastname}) do
  "Hi, #{firstname} #{lastname}"
end 

Any thoughts?

Most Liked

wojtekmach

wojtekmach

Hex Core Team

It’s been proposed many times, there’s a couple libraries on Hex for it. This is a good read about it: A story of regret and retiring a library from Hex – Andrea Leopardi.

rvirding

rvirding

Creator of Erlang

TANSTAAFL I’m afraid.

NobbZ

NobbZ

I got a result… A German Wikipediapage, which linked to this: No such thing as a free lunch - Wikipedia

Where Next?

Popular in Discussions Top

mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
arpan
Hello everyone :wave: Today I am very excited to announce a project that I have been working on for almost 3 months now. The project is...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
paulanthonywilson
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things. But I don’t think this is ...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New

Other popular topics Top

chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement