ryanwinchester
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 21 to 30- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Oooo, I did not know it had this inconsistency… I may need to start adding an ending optional ignored argument to all my multi-line (mostly macro) functions so I can keep
,at the end.The language has a ton of ‘surprising’ cases like this already, this would actually remove one of the surprises if trailing commas were allowed inside parenthesis.
nathanl
I hadn’t considered that.
However, it seems that the root cause of the ambiguity is that parentheses are optional. There’s nothing ambiguous about this, is there?
If there’s a closing parenthesis, couldn’t the parser notice that and ignore the trailing comma?
I totally agree. Making parentheses required for function calls would remove the ambiguity, at some (arguable) aesthetic cost.
OvermindDL1
Indeed, I’d have the parser only accept trailing commas if it is inside parenthesis, otherwise it’d be disallowed.
nathanl
Yes - or inside
[].ericmj
Yes, that’s what we do inside brackets. But we don’t want to add it for function calls because, like I said earlier, we can’t support it for parenthesis-less functions and we feel it would be inconsistent and confusing to only support it for some function calls.
That would be a breaking change and would not possible until Elixir 2.0.
mgwidmann
I’m not sure this topic is worth discussing any longer. I think everyone feels like the loss of the trailing comma is worth losing over losing optional parenthesis. I remember the backlash when elixir started warning about omitting parenthesis when piping and I’m fairly positive thats not something the community would be willing to trade.
wmnnd
I wonder why you would want trailing commas in function calls.
Functions in Elixir and Erlang are defined by their name and arity. A trailing comma in a function call seems to introduce unnecessary ambiguity when it comes to the arity of the called function.
Does
foo(bar,)refer tofoo/1orfoo/2with the second parameter accidentally omitted?OvermindDL1
Multi-line, especially useful for macro’s:
Convoluted example, but it gets the point across. Plus it unifies the trailing comma syntax with
[]and{}and%{}too, thus making things more consistent.I’d never recommend a trailing comma in a single-liner, not in any of those.
wmnnd
But in this example, you’re still using the trailing comma for a keyword list and not for function parameters.
OvermindDL1
Each of those lines were intended to be exampled stand-alone. ^.^