Re: [elixir-core:11535] Support using brackets to access an index of a list

2023-09-21 Thread 'Justin Wood' via elixir-lang-core
> Languages that support it via square brackets: Rust, Ruby, Javascript, > Python, C, Julia. All of these languages (other than maybe Julia? I have not used it at all.) are actually using arrays and not lists. It is fairly natural to have easy index based lookup for arrays. After all, it is

Re: [elixir-core:11531] Support using brackets to access an index of a list

2023-09-21 Thread 'Justin Wood' via elixir-lang-core
> It was pointed out that perhaps we don't do this to express that indexing a > list is not fast in Elixir like it is in other languages, but I'm not sure if > that is sufficient reason IMO to leave out a typically very standard feature > of lists. > > Thoughts? Can you give an example of a

Re: [elixir-core:11454] [Proposal] Overload capture operator to support tagged variable captures

2023-06-28 Thread 'Justin Wood' via elixir-lang-core
This proposal mentions OCaml, Haskell and JS as prior works of art for this type of feature. I think a key thing to point out is that in those languages, they did not need to add additional syntax in order to support this. In OCaml, the syntax goes from { foo = foo; bar = bar } to { foo; bar }

Re: [elixir-core:11431] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread 'Justin Wood' via elixir-lang-core
For what's it's worth, I generally see people wanting this for map deconstruction instead of construction. When it comes to deconstruction, we already have a different syntax for maps with atom keys. foo = %{bar: "baz"} foo.bar > Here is a really contrived example: > >

Re: [elixir-core:9463] Proposal: [DDD] A new operator for making tagged tuples to express domain business rules for data of primitive types.

2020-04-14 Thread 'Justin Wood' via elixir-lang-core
> Is it a ridiculous idea to add one of those symbols as a new operator > with the right to left associativity? As an Emacs (and light Vim) user, I would personally suggest against something like this. At least in Emacs, it is not as simple as just alt+keys in order to get these characters. And

Re: [elixir-core:9041] Shorthand pattern matching for maps

2019-08-10 Thread 'Justin Wood' via elixir-lang-core
There has been a lot of conversation around something like this in the past[1][2]. I'm sure there are other examples as well. If I recall properly, the short answer to this proposal is no, unless someone can come up with a new spin to it. The languages that have this feature generally have a

Re: [elixir-core:8976] multiway control structures

2019-07-22 Thread 'Justin Wood' via elixir-lang-core
On Mon Jul 22, 2019 at 2:52 PM Rich Morin wrote: > Every so often, I try to match a regexp using the case control structure, eg: > > case get_string() do > ~r{^Foo} -> foo() > ~r{^Bar} -> bar() > _ -> baz() > end > > This (AFAICT) tries to match a_string to the regexps, fails,

Re: [elixir-core:8572] New feature Enum.reverse_map

2019-03-31 Thread 'Justin Wood' via elixir-lang-core
Is there a reason you are not using List.foldl/3? List.foldl list, [], (fn elem, acc -> [f(x) | acc] end) Can I ask why you are reversing a list, traversing it, just to reverse it again? ‐‐‐ Original Message ‐‐‐ On Sunday, 31 March 2019 11:58, Robert Dober wrote: > Hi there > > I do

Re: [elixir-core:7977] Re: Proposal/Enhance for Elixir Formatter: Format Options (for Numbers)

2018-04-27 Thread 'Justin Wood' via elixir-lang-core
Forgive me if I am missing something obvious, but I don't quite understand how the underscores are making your tests fail. The compiler removes them. It is only syntactic sugar for us humans who are bad at parsing long sequences of numbers. Would you be able to provide an example of how these