Re: [elixir-core:9639] Re: [Proposal] Add Enum.key_by/3

2020-07-25 Thread Zach Daniel
TIL: I knew about Enum.into but not Map.new. On Sat, Jul 25, 2020 at 3:08 AM José Valim wrote: > Hi Sabiwara, > > This is very close to Map.new/2 (and Enum.into/3): > > User |> Repo.all() |> Map.new(fn user -> {user.id, user} end) > > So my suggestion is to use Map.new/2 instead of adding a new

Re: [elixir-core:9799] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
I agree on the name feeling subpar :) I’ll take a look and see if I can find other examples. On Thu, Dec 3, 2020 at 12:21 PM José Valim wrote: > Thanks Zach! I like this idea but the proposed name, for some reason, > doesn't sit right with me. Is there any prior art from other langs we could > l

Re: [elixir-core:9800] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
Nothing is jumping out at me from elsewhere yet, but another option might be accepting options in `Enum.count`, like `Enum.count(list, max: 4)`. I’ll keep searching though. On Thu, Dec 3, 2020 at 1:31 PM Zach Daniel wrote: > I agree on the name feeling subpar :) I’ll take a look and see i

Re: [elixir-core:9801] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
Another benefit to the options list would be supporting it for count with a predicate, e.g Enum.count(enum, &some_predicate/1, max: 4) On Thu, Dec 3, 2020 at 1:35 PM Zach Daniel wrote: > Nothing is jumping out at me from elsewhere yet, but another option might > be accepting

Re: [elixir-core:9802] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
be expected to enumerate them, so maybe only something like List.count 🤷‍♂️ On Thu, Dec 3, 2020 at 1:42 PM Zach Daniel wrote: > Another benefit to the options list would be supporting it for count with > a predicate, e.g Enum.count(enum, &some_predicate/1, max: 4) > > On Thu, Dec

Re: [elixir-core:9804] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
mpiler? Probably wouldn’t be good for all Enums, since counting would be > expected to enumerate them, so maybe only something like List.count 🤷‍♂️ > > > > On Thu, Dec 3, 2020 at 1:42 PM Zach Daniel > wrote: > > Another benefit to the options list would be supporting it

Re: [elixir-core:9807] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-03 Thread Zach Daniel
t would require at least two > function calls. > > > > > Allen Madsen > > http://www.allenmadsen.com > > > > > > On Thu, Dec 3, 2020 at 6:51 PM Zach Daniel > > wrote: > > > > > Well, List.count doesn’t exist yet, but either way it sounds like > >

Re: [elixir-core:9812] Proposal `Enum.more_than?/2` or `List.more_than?/2`

2020-12-04 Thread Zach Daniel
ed the number? After all, if I >>> am interested in knowing if something has less than 10, 10, or more than >>> 10, I just need to count until eleven. Returning a number seems to be more >>> flexible too. Therefore, what do you think about: count_until(enum, va

Re: [elixir-core:9836] Enum.index/2

2020-12-08 Thread Zach Daniel
I commonly need to flip the keys/values when using Map.new, why not add an option to Map.new? I don’t like this name, but this reads pretty nicely to me list |> Enum.with_index() |> Map.new(flip: true) On Tue, Dec 8, 2020 at 4:35 PM Austin Ziegler wrote: > I’m not opposed to the idea, but would

Re: [elixir-core:9839] Enum.index/2

2020-12-08 Thread Zach Daniel
I like that idea a lot Bruce. Let’s you do something like: maps |> Enum.with_index(&Map.put(&1, :index, &2)) On Tue, Dec 8, 2020 at 4:50 PM Bruce Tate wrote: > Maybe a transform function on with_index? > > Enum.with_index([:a, :b, :c], &{&2, &1}) > > -bt > > On Tue, Dec 8, 2020 at 3:05 PM José

Re: [elixir-core:9876] import a function having default values: we must specify each arity used

2020-12-25 Thread Zach Daniel
There are theoretical name conflicts from not being able to say “only import this story” (e.g if you have a function with the same name but one less argument) what about import Mod, only: [func: 1..3]? On Fri, Dec 25, 2020 at 5:36 PM thojan...@gmail.com wrote: > Say function `foo` has multiple

Re: [elixir-core:9876] import a function having default values: we must specify each arity used

2020-12-25 Thread Zach Daniel
Sorry, meant to say “in being able to say only import this *function*”, not story :) On Fri, Dec 25, 2020 at 5:42 PM Zach Daniel wrote: > There are theoretical name conflicts from not being able to say “only > import this story” (e.g if you have a function with the same name but one

Re: [elixir-core:9881] import a function having default values: we must specify each arity used

2020-12-26 Thread Zach Daniel
:03 PM UTC+1 zachary@gmail.com >> wrote: >> >>> Sorry, meant to say “in being able to say only import this *function*”, >>> not story :) >>> >>> On Fri, Dec 25, 2020 at 5:42 PM Zach Daniel >>> wrote: >>> >>>> There are

Re: [elixir-core:9891] [Proposal] Inspection using a function

2020-12-28 Thread Zach Daniel
Yeah, this is a great idea. I would love this :) I also agree that it would better to do it with an option though. On Mon, Dec 28, 2020 at 3:01 PM Felipe Stival wrote: > I'm 100% in for this as a `:with` or `:apply` option for IO.inspect/2. I > believe adding it as a new function may add unneces

Re: [elixir-core:9894] [Proposal] Inspection using a function

2020-12-28 Thread Zach Daniel
roduce a > general approach to this, such that: > > |> tap(&IO.inspect(Map.keys(&1)) > > But we always got stuck on what to call said function. > > On Mon, Dec 28, 2020 at 21:07 Zach Daniel > wrote: > >> Yeah, this is a great idea. I would love this :) I

Re: [elixir-core:9897] [Proposal] Inspection using a function

2020-12-28 Thread Zach Daniel
That takes it a bit too far for my taste. That part can easily be done by passing an anonymous function and calling a series of functions. On Mon, Dec 28, 2020 at 9:55 PM Kevin Johnson wrote: > I would prefer to introduce a general approach to this, such that: > > How general do you want it to

Re: [elixir-core:9907] [Proposal] Inspection using a function

2020-12-29 Thread Zach Daniel
That variant doesn’t really work because what if you want to pass a function as the first argument to what you’re calling? I don’t think muddying the behavior of “apply” is worth the extra confusion. I think either `tap/2` or a `with` Inspect option is the way. People will ultimately need to look t

Re: [elixir-core:9909] [Proposal] Inspection using a function

2020-12-29 Thread Zach Daniel
nd]) > #Function<21.126501267/0 in :erl_eval.expr/5> > iex(2)> apply(& &1, 3) > ** (ArgumentError) argument error > :erlang.length(3) > iex(2)> apply(& &1, [3]) > 3 > iex(3)> apply(& &1, []) > ** (BadArityError) #Function<7.126501267

Re: [elixir-core:9925] Validating keywords keys

2020-12-30 Thread Zach Daniel
What would be really awesome is some kind of "rubric" for answering the question "does this belong in the standard library". It could be as simple as something like a set of criteria like "ubiquity", "utility", "new value add", and some scores that it needs to exceed, e.g perhaps greater than a 7/1

Re: [elixir-core:10319] [Proposal] Strict matching comprehensions

2021-06-15 Thread Zach Daniel
I like the new operator concept as well. The semantics of it could be extended to `with`, E.g with {:ok, res} <- thing(), {:ok, handled} <<- handle_res(thing), … On Fri, Jun 11, 2021 at 2:11 PM Paul Schoenfelder < paulschoenfel...@fastmail.com> wrote: > In my opinion, internal c

Re: [elixir-core:10325] [Proposal] Strict matching comprehensions

2021-06-15 Thread Zach Daniel
Ultimately if we don’t prefer the operator, I’d rather just see: for var <- list do %{destructured: data} = var end Over the `for!` operator. I don’t know why the operator seems so much better than `for!` to me though. > On Jun 15, 2021, at 1:45 PM, Stefan Chrobot wrote: > > Ideally, <- and

Re: [elixir-core:10341] [Question] Why does elixir not check source content to detect modifications?

2021-06-21 Thread Zach Daniel
This question may be tangentially related, but I'll bring it up here: It seems that, even if it is just the last module that has to compile that fails, nothing is cached/saved, and on subsequent compilations, the entire application will need to be recompiled. I'm unsure if there are technical li

Re: [elixir-core:10344] [Question] Why does elixir not check source content to detect modifications?

2021-06-21 Thread Zach Daniel
l.erl:685: :erl_eval.do_apply/6 >> >> Then I fixed it: >> >> ~/ML/livebook[jv-eval-compile *]$ mix test >> Compiling 1 file (.ex) >> >> ......

Re: [elixir-core:10438] [Proposal] List.rotate/4

2021-09-04 Thread Zach Daniel
Fwiw, “slide” sounds like a much more intuitive name than rotate, to me. Rotate sounds like a 2d matrix operation (often commonly done on lists). Additionally, we should probably support a range *or* an index as the second argument, since moving one thing is still useful, and would be a good f

Re: [elixir-core:10519] [Proposal] Map.filter_by_key/2, filter_by_value/2, and corresponding reject functions

2021-11-07 Thread Zach Daniel
Just want to chime in and say that I somehow missed the addition of `Map.map`, `Map.filter` and `Map.reject` and I am *thrilled* by those additions :D Sent via Superhuman ( https://sprh.mn/?vip=zachary.s.dan...@gmail.com ) On Sun, Nov 07, 2021 at 3:19 PM, Tyler Young < s3c...@gmail.com > wrote:

Re: [elixir-core:10589] Proposal: Map.split_with/2

2021-12-14 Thread Zach Daniel
For some reason, this seems off to me. It seems to me like something like a.) allowing enumerable implementors to override the method of splitting, and then b.) allowing `split_with` to specify an option that says "I expect the original type back", might be better? My perspective here is based o

Re: [elixir-core:10624] Introduce :let in for-comprehensions

2021-12-17 Thread Zach Daniel
I may not fully be understanding what we're looking for here, but it seems like this would effectively be the equivalent of: ``` result = for foo ← [1, 2, 3], reduce: %{acc: [], counter: 0} do %{acc: acc, counter: counter} -> new_acc = some_calc(acc) %{acc: new_acc, counter: counter + 1} end act

Re: [elixir-core:10624] Introduce :let in for-comprehensions

2021-12-17 Thread Zach Daniel
n Fri, Dec 17, 2021 at 12:59 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > I may not fully be understanding what we're looking for here, but it seems > like this would effectively be the equivalent of: > > > > ``` > result = > for foo ← [1, 2, 3]

Re: [elixir-core:10627] Introduce :let in for-comprehensions

2021-12-17 Thread Zach Daniel
ee > that you will need to accumulate elements, add Enum.reverse/1, etc. All > which will make the solution noisier. > > On Fri, Dec 17, 2021 at 6:59 PM Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote: > > >> I ma

Re: [elixir-core:10630] Introduce :let in for-comprehensions

2021-12-17 Thread Zach Daniel
hat the > fact the accumulator is matched in a clause inside do-end is a specific > behavior to for that we partly accept because we got used to it! > > On Fri, Dec 17, 2021 at 19:19 Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote: > >

Re: [elixir-core:10663] Introduce let and reduce qualifiers to for

2021-12-21 Thread Zach Daniel
I really like this, and would be happy with it as is 😁 I have one thought though, with the way that we are already doing a bit of “magic” (I don’t mean that in a negative way) to map the “let” variable to the second element of the tuple, could we support multiple assignments without the tuple in

Re: [elixir-core:10664] Introduce let and reduce qualifiers to for

2021-12-21 Thread Zach Daniel
for let x = 10, let y = 12, foo <- list do {result, x, y} end Sent via Superhuman iOS ( https://sprh.mn/?vip=zachary.s.dan...@gmail.com ) On Tue, Dec 21 2021 at 4:35 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > I really like this, and would be happy with it as i

Re: [elixir-core:10668] Introduce let and reduce qualifiers to for

2021-12-21 Thread Zach Daniel
> > I also considered this and I think the "multiple lets" and "multiple > reduces" could get confusing. Can I have both? Can I declare them > anywhere? The answer is no. Given you can't combine them and only use them > at the beginning, it feels like having only one is the more appropriate > choi

[elixir-core:10739] [Proposal] Formatter plugin to pre-format (or re-format) elixir files

2022-02-02 Thread Zach Daniel
I've tried setting the extensions list to `[".ex", ".exs"]`, but it looks like it isn't possible to write a custom formatter that would run on elixir files. The use case (something that Ash users are currently asking for) is a way to enforce consistency in their usage of the DSL using a formatte

Re: [elixir-core:10741] [Proposal] Formatter plugin to pre-format (or re-format) elixir files

2022-02-02 Thread Zach Daniel
oh, excellent! Thanks! On Wednesday, February 2, 2022 at 10:46:52 AM UTC-5 José Valim wrote: > We have added support for overwriting the formatter for .ex and .exs in > the v1.13 branch. It may have been released on v1.13.2 already. > > On Wed, Feb 2, 2022 at 4:40 PM Zach D

[elixir-core:10894] Support explicitly marking an alias as used

2022-05-09 Thread Zach Daniel
This is something coming from a compile time optimization that Ash Framework does. In an Ash resource there is something called a change its basically like a plug but it operates on an Ash.Changeset So you might see something like this: ``` # in the resource actions do create :create_with_

[elixir-core:10896] Re: Support explicitly marking an alias as used

2022-05-09 Thread Zach Daniel
Also, I forgot to mention, it was @icecreamcohen on discord who had the idea that redefining alias may work (although they didn't really condone it), don't want to take credit for anyone elses ideas though. On Monday, May 9, 2022 at 1:53:50 PM UTC-4 Zach Daniel wrote: > This is som

Re: [elixir-core:10898] Re: Support explicitly marking an alias as used

2022-05-09 Thread Zach Daniel
nly be used if you indeed don't use it at > compile time. > > On Mon, May 9, 2022 at 7:56 PM Zach Daniel wrote: > >> Also, I forgot to mention, it was @icecreamcohen on discord who had the >> idea that redefining alias may work (although they didn't really condo

Re: [elixir-core:10899] Re: Support explicitly marking an alias as used

2022-05-09 Thread Zach Daniel
é Valim wrote: >> >> >>> Btw, we will also have a public API on Elixir v1.14 for expanding >>> literals, so the problem shall disappear altogether. However, you must be >>> extremely careful: this should only be used if you indeed don't use it at >>> com

Re: [elixir-core:10918] [Proposal] List.delete support for delete multiple fields inside a list

2022-06-07 Thread Zach Daniel
You wouldn't be able to pattern match on the input being a list regardless because you could have a list of lists and be wanting to delete one of those lists. For example: ```elixir List.delete([[:a, :b], [:c, :d]], [:a, :b]) #=> [[:c, :d]] ``` And I generally agree with others that the Enum

Re: [elixir-core:10920] [Proposal] List.delete support for delete multiple fields inside a list

2022-06-07 Thread Zach Daniel
The `--` operator has an important difference in behavior from Enum.filter/reject, though. [:a, :a, :a] -- [:a] [:a, :a] On Tue, Jun 07, 2022 at 1:30 PM, Wojtek Mach < woj...@wojtekmach.pl > wrote: > > The  --/2 operator already does this. :) > > > iex(1)> [:a, :b, :c, :d, :e] -- [:a, :b] >

Re: [elixir-core:10955] [Proposal] Add Enum.none?/2

2022-06-22 Thread Zach Daniel
I think there is a really important function of a standard library for things like this. This conversation has effectively generated knowledge, specifically that the best way to implement `Enum.none?/2` is simply by negating `Enum.any?/2`. And while it is very easy for anyone to add this code to

Re: [elixir-core:10963] [Proposal] Add Enum.none?/2

2022-06-23 Thread Zach Daniel
:26:57 -0700 >>>> Kurtis Rainbolt-Greene wrote: >>>> >>>> > While quippy `!Enum.any?` also just doesn't work in some cases: >>>> > >>>> > ``` >>>> > iex(2)> ["a","b","c"] |> !Enu

Re: [elixir-core:10969] Re: Support explicitly marking an alias as used

2022-07-11 Thread Zach Daniel
currently doing things. The primary issue here is that the things using `expand_alias_no_require/2` currently are marked as unused alias, and from what I can tell `expand_literal/2` doesn't solve for that issue. On Monday, May 9, 2022 at 4:33:58 PM UTC-4 Zach Daniel wrote: > Awesome, thanks!

Re: [elixir-core:10970] Re: Support explicitly marking an alias as used

2022-07-11 Thread Zach Daniel
g), do: 10 end ``` On Mon, Jul 11, 2022 at 1:42 PM, José Valim < jose.va...@dashbit.co > wrote: > > In this case you pass lexical_tracker: nil indeed, that's what we do for > defimpl for now, although it is a private API for now. > > > On Mon, Jul 11, 2022 at 7

Re: [elixir-core:10971] Re: Support explicitly marking an alias as used

2022-07-11 Thread Zach Daniel
alias Baz` warning. On Mon, Jul 11, 2022 at 1:48 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > Interesting…I'll do some spelunking and try to figure out why `defimpl` > doesn't yield the same unused alias warnings that my code does then > > > >

Re: [elixir-core:10974] Re: Support explicitly marking an alias as used

2022-07-11 Thread Zach Daniel
37 PM José Valim < jose. valim@ dashbit. co ( > jose.va...@dashbit.co ) > wrote: > > >> I see. Great find. Back to the drawing board. >> >> >> On Mon, Jul 11, 2022 at 8:34 PM Zach Daniel < zachary. s. daniel@ gmail. com >> ( zachary.s.dan...@gmail

Re: [elixir-core:10980] Proposal: New function on List module

2022-07-15 Thread Zach Daniel
An interesting question that should be defined that highlights the main difference between MapSet and List: what is the result of `List.includes_sublist?([1, 2, 3], [1, 1, 1])`? If the answer is `true` then I think the function should still be called `List.subset` because that is what its reall

Re: [elixir-core:10982] Proposal: New function on List module

2022-07-15 Thread Zach Daniel
ntained? and none_contained? > > > I think all_contained? is not clear about the strict order of the > elements... > > > > Probably think on the function name is hardest than the logic behind... :) > > > > > > El vie, 15 jul 2022 a las 11:21,

[elixir-core:11044] Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-11 Thread Zach Daniel
In Ash Framework, we have declarative ways to construct runtime behavior using behaviors. So an Ash resource might look like this: ```elixir defmodule MyApp.User do use Ash.Resource alias MyApp.User.Changes.HashPassword attributes do uuid_primary_key :id end actions do

[elixir-core:11045] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-11 Thread Zach Daniel
For clarity, the dependency I'm talking about there is the dependency from `MyApp.User` to `MyApp.User.Changes.HashPassword`. On Sunday, September 11, 2022 at 1:55:51 PM UTC-4 Zach Daniel wrote: > In Ash Framework, we have declarative ways to construct runtime behavior > using behav

Re: [elixir-core:11047] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-11 Thread Zach Daniel
er 11, 2022 at 2:31:42 PM UTC-4 José Valim wrote: > Sorry, I don't understand the proposal. You mentioned expand_literal, > which already removes the compile-time dependency but keeps the remaining > functionality such as warnings. Can you please expand? > > On Sun, Sep 11, 20

Re: [elixir-core:11049] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-11 Thread Zach Daniel
module >> at runtime, you must not remove the compile time dependency. >> >> >> On Sun, Sep 11, 2022 at 8:52 PM Zach Daniel < zachary. s. daniel@ gmail. com >> ( zachary.s.dan...@gmail.com ) > wrote: >> >> >>> `expand_literal` re

Re: [elixir-core:11052] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-11 Thread Zach Daniel
ncies > when they are explicitly listed in the code as above. When done via > configuration, at least you are not literally listing it. > > On Sun, Sep 11, 2022 at 8:59 PM Zach Daniel wrote: > >> So all we we do is hold onto the module, and then at runtime we go >> through t

Re: [elixir-core:11065] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-13 Thread Zach Daniel
like what Ash provides? On Sun, Sep 11, 2022 at 3:08 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > Hm...yeah, that makes sense. Are there other things a runtime dependency > is meant to do aside from ensure that transitive compile time dependencies > are properly

Re: [elixir-core:11067] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-13 Thread Zach Daniel
ose.va...@dashbit.co > wrote: > > As I mentioned, the issue on transitive compile-time dependencies are the > compile-time deps, not the runtime ones. So I would focus on how to > eliminate those. Otherwise I am not sure we will agree on the problem > statement. :) > > > On

Re: [elixir-core:11074] Re: Provide a way to remove runtime dependencies, similar to `expand_literal/2`

2022-09-19 Thread Zach Daniel
configuration in a module attribute. Users are aware that you >>>>> can't call these pluggable modules at compile time. Only the framework >>>>> code calls those modules. The above example is contrived, of course, I'm >>>>> not suggesting that we need a feature to make *that* work, j

Re: [elixir-core:11123] Re: Proposal: Named Function Arguments

2022-10-27 Thread Zach Daniel
What if a syntax for matching on keyword lists that allowed for items in any position was added to Elixir? Something like (just shooting from the hip) `[…foo: bar]` ? Then you could have your cake and eat it too, right? On Thu, Oct 27 2022 at 5:25 PM, Brandon Gillespie < bran...@cold.org > wrote

[elixir-core:11125] Set `MAP_SMALL_MAP_LIMIT` to 1 in dev/test

2022-10-27 Thread Zach Daniel
Myself and many other developers have been bitten by the fact that maps are sorted if they have less than 33 elements. Not because we believed that we should rely on the sort ordering of a map, but because we *accidentally* wrote an implementation that did, and didn't test it with more than 32

Re: [elixir-core:11126] Set `MAP_SMALL_MAP_LIMIT` to 1 in dev/test

2022-10-27 Thread Zach Daniel
p with said assumptions. > > On Fri, Oct 28, 2022 at 06:20 Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote: > > >> Myself and many other developers have been bitten by the fact that maps >> are sorted if they have less than 3

Re: [elixir-core:11128] Set `MAP_SMALL_MAP_LIMIT` to 1 in dev/test

2022-10-27 Thread Zach Daniel
t; >> >> >> On Fri, Oct 28, 2022 at 12:34 AM, José Valim < jose. valim@ dashbit. co ( >> jose.va...@dashbit.co ) > wrote: >> >>> Can you please provide the documentation for said environment variable >>> from Erlang? >>> >>> >

Re: [elixir-core:11136] Re: Proposal: Named Function Arguments

2022-10-28 Thread Zach Daniel
Couldn’t anyone who wants to do something like this just use a tool like nimble_options (at least in the near to mid term)? That’s what I do. https://github.com/dashbitco/nimble_options On Fri, Oct 28 2022 at 12:35 PM, Wiebe-Marten Wijnja < w...@resilia.nl > wrote: > > > > Thank you for star

Re: [elixir-core:11142] Set `MAP_SMALL_MAP_LIMIT` to 1 in dev/test

2022-10-29 Thread Zach Daniel
simple key/value data structure which gets accessed through > direct work with a key or pattern matched against > > >> On 28 Oct 2022, at 06:20, Zach Daniel < zachary. s. daniel@ gmail. com ( >> zachary.s.dan...@gmail.com ) > wrote: >> >> > > > &g

Re: [elixir-core:11146] Set `MAP_SMALL_MAP_LIMIT` to 1 in dev/test

2022-10-30 Thread Zach Daniel
on to a list you expect is unclear given that strings > sorted differently than numbers ( "9" > "100" => true ). > > >> On 30 Oct 2022, at 00:27, Zach Daniel < zachary. s. daniel@ gmail. com ( >> zachary.s.dan...@gmail.com ) > wrote: >> >&

Re: [elixir-core:11190] Re: Proposal: Introduce string limit function.

2022-11-19 Thread Zach Daniel
It would be great to come up with some kind of heuristic and/or consistent philosophy on what belongs in the standard library, to guide these discussions. Some kind of rubric could make these kinds of conversations easier or even prevent them entirely. For me, the main guiding principles are whe

Re: [elixir-core:11195] Re: Proposal: Introduce string limit function.

2022-11-20 Thread Zach Daniel
ne of the concerns I raised in the original PR and your solution is quite > elegant. > > > Which also brings another point: if the implementation is 6 LOC (I believe > the first two clauses are not strictly necessary), then there is even less > reason to add it to Elixir. >

Re: [elixir-core:11197] Re: Proposal: Introduce string limit function.

2022-11-20 Thread Zach Daniel
velopment.html ) > > > However we can give more leeway to functions compared to features. > > > On Sun, Nov 20, 2022 at 16:25 Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote: > > >> This is the kind of thing I mean w

Re: [elixir-core:11201] Re: Proposal: Introduce string limit function.

2022-11-21 Thread Zach Daniel
cy requires normalization of each string. The >>> solution is very non-obvious, and many wouldn't even think to seek out >>> something better than string1 == string2. So that would pass #2 and #3 on >>> the rubric. >>> >>> Just some ideas. >>&

Re: [EXTERNAL] Re: [elixir-core:11223] [proposal] Use patterns to filter data (good for pipes)

2022-12-15 Thread Zach Daniel
Maybe a ridiculous idea, but could we support the actual core pattern matching syntax in some way to support this kind of thing? If so, it could make pattern matching even more powerful than it already is. This is *not* a good suggestion for the syntax I think its very very ugly and not good, I

Re: [elixir-core:11237] [Proposal] Add macro is_real_map

2023-01-03 Thread Zach Daniel
Wouldn't this suffice? ``` defguard is_real_map(x) when is_map(x) and not is_struct(x) ``` On Tue, Jan 03, 2023 at 11:34 PM, Andrey Yugai < andr...@pm.me > wrote: > > There's also an option of pattern matching any struct, not exactly a > guard, but changing your code a bit shouldn't be a prob

Re: [elixir-core:11239] Handling of changelogs in elixir core

2023-01-13 Thread Zach Daniel
My library git_ops https://github.com/zachdaniel/git_ops is a native elixir solution for managing a change log with tags for releases. Im sure it could be improved, but it’s a solid foundation that a lot of people are using today. Plus, the conventional commit format is a well known already spec

Re: [elixir-core:11239] Handling of changelogs in elixir core

2023-01-13 Thread Zach Daniel
Forgot the most relevant point: it can automatically include the generated release notes in the git tag that is generated which translates to release notes when pushed. On Fri, Jan 13 2023 at 9:31 AM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > My library git_ops https:

Re: [elixir-core:11242] Handling of changelogs in elixir core

2023-01-13 Thread Zach Daniel
m > wrote: > > >> Forgot the most relevant point: it can automatically include the generated >> release notes in the git tag that is generated which translates to release >> notes when pushed. >> >> >> >> >> On Fri, Jan 13 2023 at 9:31 AM

Re: [elixir-core:11244] Handling of changelogs in elixir core

2023-01-13 Thread Zach Daniel
> conventional commits and I hate writing commits there, because the title > should be short but meaningful, and that’s hard in 52 characters. > > > -a > (Sorry. I’ve not really had a place to rant about this because I stopped > blogging years ago, I’ve given up on Twitter

Re: [elixir-core:11295] Multi-letter (uppercase) sigils

2023-03-04 Thread Zach Daniel
Yes please :) that’s is all. On Sat, Mar 4 2023 at 3:15 AM, José Valim < jose.va...@dashbit.co > wrote: > > Sigils in Elixir are currently limited to a single letter. We had many > discussions in the past about allowing more letters but they were > ultimately rejected because of lowercase sigils

Re: [elixir-core:11315] Dependency/Library as part of umbrella?

2023-03-10 Thread Zach Daniel
This does actually strike a chord for me and I'm realizing this is likely a related question or perhaps the same question in another form. Is there some way to define a module that a dependency can use at compile time or at runtime without these warnings? Like a module that you want compiled bef

Re: [elixir-core:11357] wishlist: macro/modern argparser

2023-04-29 Thread Zach Daniel
You could consider using Spark :) https://github.com/ash-project/spark Its used for Ash Framework, as well as ChannelHandler: https://felt.com/blog/pheonix-channel-routing-patterns On Sat, Apr 29, 2023 at 12:00 PM Brandon Gillespie wrote: > I realize CLI tooling isn't elixir's focus, but what

Re: [elixir-core:11383] [Proposal] Enhancements in the API for optional dependencies

2023-05-15 Thread Zach Daniel
I'd amend the proposal: To make a dependency only present when a feature is used ```elixir {:optional_dep, …, optional: [:feature1, :feature2]} ``` To use a dependency with features ```elixir {:dep, …, features: [:feature1]} ``` And then build features into `Mix` (which is available at com

Re: [elixir-core:11389] [Proposal] Enhancements in the API for optional dependencies

2023-05-16 Thread Zach Daniel
Yes, if you want something with maximal flexibility you’d use application config and regular optional dependencies. The idea is to find a middle ground. Because we cannot run arbitrary code every time we want to solve versions. A package published to hex must know *all* potential dependencies.

Re: [elixir-core:11390] [Proposal] Enhancements in the API for optional dependencies

2023-05-16 Thread Zach Daniel
But also I think we should remove the `module` part from the proposed behavior. That’s the point I’m making, it’s not flexible as you’ve pointed out. But the features-> deps part must be static and simple. On Tue, May 16 2023 at 6:52 AM, Zach Daniel < zachary.s.dan...@gmail.com &g

Re: [elixir-core:11392] Proposal: Deprecate ~U in favour of ~UTC

2023-05-16 Thread Zach Daniel
Agreed. On Tue, May 16 2023 at 8:06 AM, Bruce Tate < br...@grox.io > wrote: > > It's only an incremental move in the right direction, but a good one. I am > strongly in favor of this proposal. > > > -bt > > On Tue, May 16, 2023 at 3:59 AM Wojtek Mach < woj...@wojtekmach.pl > wrote: > > > >

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

2023-06-26 Thread Zach Daniel
I think the proposed syntax  adds value and should be implemented as part of the core Elixir syntax. I also think it should not be considered for string keys, only for atom keys. Here is a really contrived example: `%Struct{some_xy1_stup4d_8345324_name: some_xy1_stup4d_8354324_name} = value` `

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

2023-06-26 Thread Zach Daniel
The point wasn't about not typing long names :) Or about remapping. It was about knowing when I have to know that the keys and corresponding variable names were different, and when I don't. Ultimately I think this either lives in core or nowhere else, and that if people on a given project didn'

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

2023-06-28 Thread Zach Daniel
I agree with Paul on the specific operator, however I feel like you've just done a great thing laying out most if not all of the considerations we've had on this conversation to date. I know that these conversations can get long and sometimes not produce fruit, but I feel like we should try to c

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

2023-06-28 Thread Zach Daniel
Perhaps removing the `:` is a bad idea actually? I see now it removes the consistency on values. Either way, let's not lose the momentum on this! I feel like we can get this over the line (or put the last nails in its coffin for good ) On Wed, Jun 28, 2023 at 8:45 PM, Zach D

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

2023-09-21 Thread Zach Daniel
Right now if you use access on a list, it expects it to be a keyword and requires the value to be an atom. I've tried to think of a reason why we couldn't support this in the language, but I haven't been able to. If the value being accessed is an `integer` it could get the item at that index, a

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

2023-09-21 Thread Zach Daniel
Languages that support it via square brackets: Rust, Ruby, Javascript, Python, C, Julia. I see your point, ultimately for me what is frustrating is when I have predefined data structures and we have a tool for "get the value at some point (i.e map keys)" so I can do `map[:key][:key]` but if I w

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

2023-09-21 Thread Zach Daniel
I mean ` Enum.at/2` ( http://enum.at/2` ) 😆 On Thu, Sep 21, 2023 at 1:14 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > Languages that support it via square brackets: Rust, Ruby, Javascript, > Python, C, Julia. > > > I see your point, ultimately for me wha

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

2023-09-21 Thread Zach Daniel
if we're doing it to help people write idiomatic code (which will probably be mostly beginners), we should point them more clearly to this then IMO. On Thu, Sep 21, 2023 at 1:25 PM, Zach Daniel < zachary.s.dan...@gmail.com > wrote: > > I mean ` Enum. at/ 2` ( http:

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

2023-09-21 Thread Zach Daniel
Yeah, I'm familiar with the differences on that front, but at the end of the day there are plenty of times where its perfectly normal to get a list/tuple element by index. It seems like a natural syntax extension to me (the syntax is basically already there, just intentionally blocked off in a w

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

2023-09-21 Thread Zach Daniel
Nice 😆. That is a definite improvement. Ultimately, I think it would be a nice improvement to the language, but I don't disagree with the idea that we need to take great care for the on ramp and to help people avoid footguns. I don't think its very likely that I'll convince the team to add it, a

[elixir-core:11641] Functionality that can only ever be used at compile time

2024-02-01 Thread Zach Daniel
Hey all! This isn't a fully fleshed out idea, but something that I've noticed especially with Ash Framework is how a *large* portion of our code should only ever be called when compiling. What brought this to my attention recently is that there are tons of places where we may do things like con

Re: [elixir-core:11653] Functionality that can only ever be used at compile time

2024-02-05 Thread Zach Daniel
e/achieve this is by having a separate package that you won't > include in releases. It will be available for compilation, but not > runtime. > > > On Thu, Feb 1, 2024 at 7:16 PM Zach Daniel < zachary. s. daniel@ gmail. com > ( zachary.s.dan...@gmail.com ) > wrote:

Re: [elixir-core:11654] Functionality that can only ever be used at compile time

2024-02-05 Thread Zach Daniel
That's aside from the "I don't want users to call this because it unsafely creates atoms", which isn't actually a problem I currently have now, as its usually pretty obvious what code is for compile time use and what isn't. On Mon, Feb 05, 2024 at 1:10 P

[elixir-core:11735] Better error message for unknown variables inside macros that haven't been required

2024-04-02 Thread Zach Daniel
Hey all! Something that happens very often to Ash users is forgetting to do something like `require Ash.Query`, and then doing something like this: ``` Ash.Query.filter(Resource, name == "fred") ``` Then, they get an error like `error: undefined variable "name"` What I'm wondering is if we can

Re: [elixir-core:11737] Better error message for unknown variables inside macros that haven't been required

2024-04-02 Thread Zach Daniel
his is a macro and warn, > but now we are allowing a program that we are certain to fail, to compile and > move forward. > > Maybe there are other solutions but I can't think of anything else :( > > On Tue, Apr 2, 2024 at 8:40 PM Zach Daniel <mailto:zachary.s.dan...@g

Re: [elixir-core:11739] Better error message for unknown variables inside macros that haven't been required

2024-04-02 Thread Zach Daniel
t. Please open up an issue so we don't forget about it. :) > > On Tue, Apr 2, 2024 at 11:36 PM Zach Daniel <mailto:zachary.s.dan...@gmail.com>> wrote: >> Could we potentially do something only in the case that we reach this error? >> Like if a module fails to com

[elixir-core:11836] Re: App recompilation at runtime within a Mix task

2024-07-29 Thread Zach Daniel
We've also had a fair amount of difficulty here, in a similar vein (but slightly different). Specifically, we need to modify the `mix.exs` file to include a new dependency and do a recompile. I can understand that `Mix.Task.run("compile")` should remain as it is, but it would be great if there

[elixir-core:11840] Mix task: patching `mix.exs` file and recompiling

2024-07-30 Thread Zach Daniel
Hey folks! In igniter, a core concept we have is `mix igniter.install dep`, which patches the `mix.exs` file, recompiles the app accordingly, and then looks for a mix task called `mix .install`, and invokes it. There are lots of other features, but this is the crux of it. In an ideal world, I

Re: [elixir-core:11841] Mix task: patching `mix.exs` file and recompiling

2024-07-30 Thread Zach Daniel
, it would be > fine. > > On Tue, Jul 30, 2024 at 21:05 Zach Daniel <mailto:zachary.s.dan...@gmail.com>> wrote: >> Hey folks! >> >> In igniter, a core concept we have is `mix igniter.install dep`, which >> patches the `mix.exs` file, recompiles the app

  1   2   >