Re: [elixir-core:9670] System.get_env/0 Performance Improvement

2020-08-18 Thread Alexei Sholik
gt; 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-l...@googlegroups.com. >>>> To view this discussion on

Re: [elixir-core:9668] System.get_env/0 Performance Improvement

2020-08-18 Thread Alexei Sholik
; . >> > -- > 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-core+unsubscr...@googlegroups.com. > To view this discussion on th

Re: [elixir-core:9572] Loading arbitrary packages during plain iex sessions

2020-06-15 Thread Alexei Sholik
ps.google.com/d/msgid/elixir-lang-core/40ef0ab9-7d92-4601-b445-de7c5796c046o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Best regards Alexei Sholik -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsu

Re: [elixir-core:9547] [Proposal] Add Map.put_if/4

2020-06-05 Thread Alexei Sholik
. >>>> >>> >>> -- >>> 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-

Re: [elixir-core:9419] [Proposal] Mix deps.get option to avoid updating the lockfile

2020-03-17 Thread Alexei Sholik
errDrRsa7g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > > -- > 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 > ema

Re: [elixir-core:9300] [Proposal] defrecord syntactic sugar like defstruct

2020-01-03 Thread Alexei Sholik
And it's also possible to update selected fields of an existing record. This is all described in the docs: iex(5)> r = bb() {:bb, 1} iex(6)> r1 = bb(r, a: 2) {:bb, 2} iex(7)> bb(r1, :a) 2 iex(8)> bb(a: x) = r1 {:bb, 2} iex(9)> x 2 On Fri, Jan 3, 2020 at 11:19 AM Alexei Sh

Re: [elixir-core:9299] [Proposal] defrecord syntactic sugar like defstruct

2020-01-03 Thread Alexei Sholik
e 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-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.

Re: [elixir-core:9109] Prefix/Suffix map keys proposal

2019-09-20 Thread Alexei Sholik
It's functionality that is very specific to a particular use case to be added to a standard library module. Plus, it either needs to create new atoms (which standard library will never do) or fail for some inputs (which is again not generally useful): iex(1)> m = %{key_1: :val_1, key_2: :val_2} ie

Re: [elixir-core:9058] [Proposal] Map.filter/2 based on :maps.filter

2019-08-15 Thread Alexei Sholik
The simplest alternative is to use :maps.filter(). It's not as easy to pipe into, but that's a minor concern for me. As another alternative, this should be faster and have lower memory footprint than using Enum, although you'd need to benchmark it as well to be sure: map |> Stream.filter(predicat

Re: [elixir-core:8513] Aliases of non existent modules

2019-03-01 Thread Alexei Sholik
Mix does warn about it when you try to call a function from a non-existent module: $ mix compile Compiling 1 file (.ex) warning: function This.Module.Does.Not.Exist.foo/0 is undefined (module This.Module.Does.Not.Exist is not available) It does so because `mix xref` runs automatically on each com

Re: [elixir-core:8382] Enum.sum/2

2018-12-02 Thread Alexei Sholik
The first advantage (write less code) is defeated by adding one more function to the module, thereby increasing the API surface. As for the second one, this code does one pass through the list: Stream.map([1,2,3], & &1*2) |> Enum.sum On Sat, Dec 1, 2018 at 6:19 PM Sean Handley wrote: > Hello,

Re: [elixir-core:7426] [Proposal] Support keyword list short hand with the cons operator

2017-09-14 Thread Alexei Sholik
Questions like this should be asked on the Elixir Forum. The problem with the expression `[x: 1, y: 2 | [z: 3]]` is that it is parsed as `[x: 1, y: (2 | [z: 3])]`. As you may guess, the subexpression `2 | [z: 3]` does not make sense. There's actually a working way to build the keyword list you wa

[elixir-core:6392] Proposal: Introduce `use GenServer, strict: true`

2016-09-23 Thread Alexei Sholik
Hi, We all love the ability to `use GenServer` in order to provide default stubs for callback functions, saving us time and effort of writing the same boilerplate over and over again. However, I'm sure many of you have also been bitten by this very feature where you made a typo in the signature o

Re: [elixir-core:6224] Elixir way to handle errors in pipes

2016-08-15 Thread Alexei Sholik
The Elixir way is to use the pipe and `with` where each is more suitable for the task. So if you need to write a sequence of function calls where some or all are expected to return an error, `with` would be the most appropriate tool to use. One key difference between a pipeline and `with` is that

Re: [elixir-core:6140] Feature Request: @see_also attribute

2016-07-19 Thread Alexei Sholik
ExDoc already supports auto-linking for modules and functions inside the docstring. See, for example, http://elixir-lang.org/docs/stable/elixir/Enum.html#filter/2. On Tue, Jul 19, 2016 at 1:41 AM, eksperimental wrote: > I have been craving for this feature for a long time. > I think it will help

Re: [elixir-core:6052] The 'else' clause in 'with' does not support guards

2016-07-07 Thread Alexei Sholik
https://github.com/elixir-lang/elixir/issues/4957 On Thu, Jul 7, 2016 at 4:31 PM, José Valim wrote: > Accidental omission. Please open up an issue. :) > > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > On Thu, Jul

[elixir-core:6049] The 'else' clause in 'with' does not support guards

2016-07-07 Thread Alexei Sholik
Trying to compile the following piece of code with :ok <- {:error, :foo} do :ok else {:error, reason} when reason in [:foo, :bar] -> :some_error {:error, _} -> :generic_error end results in this error ** (CompileError) iex:1: cannot invoke local when/2 inside match, called as: {:e

Re: [elixir-core:5863] Proposal: Enum.find_map/4

2016-05-27 Thread Alexei Sholik
Greg is right. In Elixir 1.3 it'll become possible to access map fields when using get_in(). So the first code snippet from the original post may become this foo = get_in(Enum.find(list, &some_check/1), [Access.field(:bar)]) However, given the fact that OP uses both field access and Map.get, it'