--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/995a7fec-5992-484a-88c2-5aae3844f60fn%40googlegroups.com.
The "accidentally being a tuple" issue with that syntax goes away for 99% of cases conveniently with the type system FWIW :)
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/mjfbtnkp.954e6b90-10b6-4145-b303-cfd43ae40333%40we.are.superhuman.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/e74caae5-3239-4c68-a0e9-5a3046450accn%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/8f903968-880c-44d2-8d4c-4c5a20be3c61%40app.fastmail.com.
bin/elixir -e '%{foo:, bar:} = %{foo: 1, bar: 2}; IO.inspect({foo, bar})'
You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-core/qyB5diWvJh8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/8f903968-880c-44d2-8d4c-4c5a20be3c61%40app.fastmail.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/CAL2xsVjSNWTRBL9Cu9oU_%2BEyH6rKMFYCuwezuZufBcK09TyyKg%40mail.gmail.com.
Please do not do this WITH THIS SYNTAX (but I really do want destructuring/etc).
It looks like an error, no matter how hard you squint, nor rationalize.
There is no reason to repeat Ruby's mistakes, nor other languages doing the same. "because they are doing it" is not a reason.
The other problem with this is it is optimizing for the /advanced/ user, and not the common and new user. The community should be focused on making it EASIER to get into elixir, not harder.
New users coming from the biggest languages out there are what we should consider, not those with less popular languages. And like it or not, the popular languages are Java, Python, Javascript. None of them support the proposed visually borked syntax.
if anything, of those top three languages, Javascript does it with bare variables—so the only argument with weight (imho) that "other languages do it" would be for bare vars. But José has declined that syntax (I forget the reasons).
If the option for bare vars is off the table completely and forever, perhaps consider another token?
Asterisk almost could work. In spirit it almost hearkens back to C's pointer. And in this case used as a unary operation it wouldn't collide with multiplication, which is a binary operation.
I don't love it, but fwiw:
```
asdf = "foo"
%{*asdf}
```
=> `%{asdf: "foo"}`
```
%{*foo, *bar} = %{foo: "narf", bar: "boop"}
IO.inspect({foo,bar})
```
=> {"narf", "boop"}
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/61b6c3c4-add7-4ee4-85f4-13273c49d07d%40cold.org.
I'm trying to avoid being too argumentative here, but leaning back on "its used in ruby so it can't be hard to learn" just doesn't correlate. That it is in ruby doesn't implicitly make it easy to learn. As I said: we don't have to repeat another language's mistakes 😂
FWIW, I have never liked ruby. 😂 I don't code in it, despite trying a few times. I don't think of Elixir as still a derivative of Ruby, and I'd suggest decoupling that notion, TBH. We should focus on Elixir, as itself. not as a derivative of something else. And I think we should focus on expanding the dev pool /outside/ of ruby, not limiting within it.
As I hire new devs and train them into things, they come knowing other popular languages like python and javascript. I generally don't target ruby devs. And they're as rare as Elixir devs, TBH.
I hadn't considered a spread assignment (or whatever you want to call it) as it would apply to keywords. Me personally? I'd only ever use it with maps, so I'd be 100% fine if it was simply limited to maps. Keywords already have a lot of differences from maps anyway. On that assertion, I'm not sure what other objects there are to using it only with maps.
Splat operator: Sure. It was just an off-the-cuff suggestion. Saying there could be something else. Fixation on something that's a broken syntax in any of the top3 languages just makes it harder and more eldritch, also raising the bar for new devs.
All the arguments I've heard for the colon syntax center around "Ruby & a few others do it this way" (and IMHO because somebody else does it isn't ever a good reason), and "I want it, so is this a good enough concession?"
If this type of feature is really needed, I'd suggest even a working group session of interested parties, and just wipe the slate clean. Star by clearly defining the core desire/need, then talk through all the various challenges, throw out 5~10 more options, discuss, etc. (I don't know if this is already a thing the community does, or not).
But to me this isn't something that should be done via a PR and an email conversation with a few people who happened to be noticing things on the list during a holiday season.
Just my "two cents" as it were, from one normally watching in the peanut gallery.
-Brandon Gillespie
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3CtcdBWnHKJkafmS8rtyCZYbbO053Asw2XsPtMgO5x4cOg%40mail.gmail.com.
I understand the concerns about adding syntax and about Elixir having its own identity. I’m not arguing that Elixir should copy Ruby, or that Ruby’s choices are automatically good for Elixir.
That said, it’s also true that a significant portion of Elixir users historically come from the Ruby ecosystem. Elixir has often been described (rightly or wrongly) as having a Ruby-like surface syntax with Erlang semantics, and that has been part of its approachability for many people — myself included.
In that context, the Ruby comparison isn’t about imitation, but about shared expectations around readability and ergonomics. Ruby 3.1’s{a:, b:}is not a novelty feature; it’s a conservative form of value omission inside already-keyed syntax. The proposal here does the same thing: it removes duplication from%{a: a}without introducing new semantics or implicit behavior.
Importantly, this syntax is purely optional. Existing explicit forms remain valid and idiomatic. I intentionally did not enforce it via the formatter, precisely to avoid pushing it onto users who don’t want it or don’t find it clearer.
From a learning perspective, this doesn’t raise the floor: users already must learn atom keys and keyword syntax. This only shortens an expression they already understand, and only when the variable name already matches the key.
I fully agree that clarity should trump cleverness. My argument is that %{a:, b:} stays within Elixir’s existing visual and semantic rules, while addressing a very common repetition pattern that many users encounter in real codebases.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/bb6af636-7fae-4ff2-b5da-eb766c755279%40cold.org.
Please do not do this WITH THIS SYNTAX (but I really do want destructuring/etc).
It looks like an error, no matter how hard you squint, nor rationalize.
There is no reason to repeat Ruby's mistakes, nor other languages doing the same. "because they are doing it" is not a reason.
The other problem with this is it is optimizing for the /advanced/ user, and not the common and new user. The community should be focused on making it EASIER to get into elixir, not harder.
New users coming from the biggest languages out there are what we should consider, not those with less popular languages. And like it or not, the popular languages are Java, Python, Javascript. None of them support the proposed visually borked syntax.
if anything, of those top three languages, Javascript does it with bare variables—so the only argument with weight (imho) that "other languages do it" would be for bare vars. But José has declined that syntax (I forget the reasons).
If the option for bare vars is off the table completely and forever, perhaps consider another token?
Asterisk almost could work. In spirit it almost hearkens back to C's pointer. And in this case used as a unary operation it wouldn't collide with multiplication, which is a binary operation.
I don't love it, but fwiw:
```
asdf = "foo"
%{*asdf}
```
=> `%{asdf: "foo"}`
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/61b6c3c4-add7-4ee4-85f4-13273c49d07d%40cold.org.
Why can’t this be done with a sigil, which also has precedence for shorthands like this. Elixir even states that it is build to be extendable without the need for syntax changes. Personal I dislike prior art justifications for shorthands and syntax changes like this, as it can potentially block or limit syntax changes in the future for new data structures. I think we would all be better off with a sigil, that way we also don’t limit ourselves to atom keys.On Sunday, December 21, 2025 at 5:07:33 PM UTC-5 ry...@winchester.dev wrote:
I wish for this often.
I would happily settle for this just to have it, although I don’t like the syntax and also prefer the %{a, b} syntax like other languages (JS/TS, Rust, ...)
On Sunday, December 21, 2025 at 2:12:13 AM UTC-4 zachary....@gmail.com wrote:
I'm in support of this 👌It's a reasonable trade off from other concerns and as someone who works with people moving from other languages to Elixir often, they are *constantly* looking for this syntax. Given that this exact syntax is used in other languages also adds some regularity to it, despite my personal preference for js style %{a, b}. The "accidentally being a tuple" issue with that syntax goes away for 99% of cases conveniently with the type system FWIW :)
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/7061e91f-b05c-40d3-8b46-5744e1a8f399n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/bb6af636-7fae-4ff2-b5da-eb766c755279%40cold.org.