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

2024-04-02 Thread José Valim
I’ll open one now. I’m also happy to investigate adding this, > but will need a nudge as to where to start looking. Not high priority, but > I think will be a great quality of life improvement for users. > > On Apr 2, 2024, at 5:40 PM, José Valim wrote: > > We could try that. Please open up

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

2024-04-02 Thread José Valim
ant remote > calls at that point? > > On Apr 2, 2024, at 5:33 PM, José Valim wrote: > > Unfortunately this is hard. The simplest way to implement this would be by > checking on every remote call if the module is available and if the > function is macro, which would considerably slow down

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

2024-04-02 Thread José Valim
Unfortunately this is hard. The simplest way to implement this would be by checking on every remote call if the module is available and if the function is macro, which would considerably slow down the compiler. The reason why we have "require" is exactly so we don't need to pay this price. We

Re: [elixir-core:11726] [Proposal] introduce with_env in ExUnit

2024-03-27 Thread José Valim
I don't see a strong need to make this part of ExUnit, especially because: 1. We should avoid mutating the global state in tests 2. We should avoid reading system environment variables in code (use config/runtime.exs instead) Those can add to their own suites if necessary. :) On Wed, Mar 27,

Re: [elixir-core:11725] [Proposal] Translate error reports from gen_statem

2024-03-27 Thread José Valim
I would love to see a PR that implements translation for gen_statem, so we can evaluate if it makes sense to merge it into Elixir. On Wed, Mar 27, 2024 at 4:10 PM Cameron Duley wrote: > Several popular Elixir libraries use gen_statem internally, given it's > very useful for managing data over

Re: [elixir-core:11712] [Proposal] Adding Access.find/1

2024-03-20 Thread José Valim
best data structure for the actual use > case) > > That's all I found. > > Best regards, > Oliver > > On Wednesday, March 20, 2024 at 11:40:15 AM UTC+1 José Valim wrote: > >> Can you please provide a link to the previous discussions? I recall >> deal

Re: [elixir-core:11710] [Proposal] Adding Access.find/1

2024-03-20 Thread José Valim
Can you please provide a link to the previous discussions? I recall dealing with some complexities around finding and not finding elements as well. Thanks! On Wed, Mar 20, 2024 at 11:37 AM 'oliver@googlemail.com' via elixir-lang-core wrote: > Hello, okay I checked. > > Well, there was a

Re: [elixir-core:11704] Performance of regular expression matches

2024-03-15 Thread José Valim
improved the performance overall. > > I think I didn't then go, and profile specifically if removing the version > check alone will improve the performance by itself. So all I have to back > up that the version check is the root cause, is fprof. > > On Friday, March 15, 2024 at 8:2

Re: [elixir-core:11701] Performance of regular expression matches

2024-03-15 Thread José Valim
ns >> Regex.run/21.98 M 504.74 ns ±5851.21% 416 ns >> 542 ns >> >> Comparison: >> :re.run/3 2.88 M >> Regex.run/21.98 M - 1.46x slower +157.84 ns >> ``` >> On Friday 15 March 2024 at 07:20:11 UTC+1 jan.k...@gma

Re: [elixir-core:11697] Performance of regular expression matches

2024-03-14 Thread José Valim
>> I read the commit, and I don't it fixes what our actual problem was. See >>> my comment above. The problem is the actual call to :re.version, not the >>> recompilation of the regex >>> >>> On Thursday, March 14, 2024 at 4:37:43 PM UTC+1 José Valim wrote:

Re: [elixir-core:11694] Performance of regular expression matches

2024-03-14 Thread José Valim
l call to :re.version, not the > recompilation of the regex > > On Thursday, March 14, 2024 at 4:37:43 PM UTC+1 José Valim wrote: > >> I have pushed a fix to main. But also note we provide precompiled Elixir >> versions per OTP version. Using a matching version will alway

Re: [elixir-core:11691] Performance of regular expression matches

2024-03-14 Thread José Valim
I have pushed a fix to main. But also note we provide precompiled Elixir versions per OTP version. Using a matching version will always give you the best results and that's not only about regexes. :) On Thu, Mar 14, 2024 at 2:20 PM Jan Krüger wrote: > I've recently had to work on a code base

Re: [elixir-core:11688] [Proposal] Add `shift/2-3` to calendar types

2024-03-07 Thread José Valim
Elixir (also relevant for >> extending the use of Duration later on) >> - Reduced cognitive load as the time units are always spelled the same >> regardless of the context >> >> The reasons for singular do outweigh the reasons for plural, so unless >> we'r

Re: [elixir-core:11683] [Proposal] Add `shift/2-3` to calendar types

2024-03-06 Thread José Valim
keys exclusive to durations. Another reason > for going with plurals is that it _should_ make migrating from some > libraries to the standard library relatively straight forward (with the > exception of microseconds). > > On Wednesday, March 6, 2024 at 11:07:52 PM UTC+1 José Valim

Re: [elixir-core:11681] [Proposal] Add `shift/2-3` to calendar types

2024-03-06 Thread José Valim
After a quick glance on other programming languages, it seems Python, Java, Rust, and C# all have plural names. Erlang also uses plural in its helper functions in the timer module. So we might want to follow suit. On Wed, Mar 6, 2024 at 23:03 José Valim wrote: > We discussed plural vs singu

Re: [elixir-core:11679] [Proposal] Add `shift/2-3` to calendar types

2024-03-06 Thread José Valim
ficial for everybody. > > PS. I would expect plural in the duration fields. > > On Wed, Mar 6, 2024 at 8:23 PM José Valim wrote: > >> The main argument for having it in core is: >> >> * It integrates directly with the Calendar behaviour >> * We could pr

Re: [elixir-core:11677] [Proposal] Add `shift/2-3` to calendar types

2024-03-06 Thread José Valim
The main argument for having it in core is: * It integrates directly with the Calendar behaviour * We could provide built-in sigils in the future to create readable durations, such as ~P[3 hours and 10 minutes] * Postgrex, Explorer, CLDR, etc all implement their own version of durations

Re: [elixir-core:11672] [Proposal] OS specific interface modules; common system interface module

2024-03-02 Thread José Valim
The low-level integration bits are part of Erlang. If this functionality exists in Erlang today, we could surface it up, but I am afraid it doesn't right now. I believe there is a plan to provide more file system bindings there in the future, but there is no precise schedule. On Sat, Mar 2, 2024

Re: [elixir-core:11670] Introduce guards in MapSet

2024-03-02 Thread José Valim
the > size—so I'm proposing that addition. Just the single guard! > On Thursday, December 24, 2020 at 1:37:40 AM UTC-6 José Valim wrote: > >> Because if I have a MapSet, I would prefer to call MapSet API to make the >> intent clearer. >> >> On Thu, Dec 24, 202

Re: [elixir-core:11669] [Proposal] Sorted Map and Sorted Set

2024-03-02 Thread José Valim
as maps are missing one very important >>> function needed for implementing Lua and that is to be able to efficiently >>> step through a tree. I need a 'first' function which returns the first >>> key-value pair and then a 'next' which returns the next pair after a given >

Re: [elixir-core:11666] Change request: add triple target to default mix release output folder

2024-02-27 Thread José Valim
her >> in the docs. >> >> Thank you for your ongoing development of the language! >> >> On Tuesday, February 27, 2024 at 12:34:19 PM UTC+1 José Valim wrote: >> >>> Doing this now would certainly be a breaking change as it would break >>> all usages o

Re: [elixir-core:11663] Change request: add triple target to default mix release output folder

2024-02-27 Thread José Valim
Doing this now would certainly be a breaking change as it would break all usages of mix release today. The easiest way to go about this is to add a "path: " key to your release configuration in your mix.exs, in which you can employ any triple target that you want.

Re: [elixir-core:11660] Re: add Keyword.take!/2, Map.take!/2

2024-02-21 Thread José Valim
AJ >> >> Le mercredi 21 février 2024 à 20:21:56 UTC+9, José Valim a écrit : >> >>> +1 for the proposal, but it has to be implemented more efficiently than >>> what was described here and we also need to add drop!. PRs welcome. >>> >>> On Wed

Re: [elixir-core:11656] Re: add Keyword.take!/2, Map.take!/2

2024-02-21 Thread José Valim
+1 for the proposal, but it has to be implemented more efficiently than what was described here and we also need to add drop!. PRs welcome. On Wed, Feb 21, 2024 at 10:59 AM Artur Plysiuk wrote: > I just came here to add the same proposal. > > четвер, 28 грудня 2023 р. о 11:40:07 UTC+2 DaTrader

Re: [elixir-core:11645] [Proposal] Add Enum.select as alias for Enum.filter

2024-02-03 Thread José Valim
Correct, Elixir rarely adds aliases, because it adds to the learning curve (and Enum is already a large module) and it also eventually becomes a struggle for consistency (this code base must “only use select” or “only use filter”). Plus I personally dislike select because it partially conflicts

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

2024-02-01 Thread José Valim
My general gut feeling is: compared to the amount of code in Erlang/OTP, Elixir, dependencies, and the code that Ash generates, the amount of code in Ash used for code generation is going to be minimal. And all of that to save memory on a box that most likely still needs to load hundreds of rows

Re: [elixir-core:11637] Why no ternary expression?

2024-01-26 Thread José Valim
ped lambda calculus. Avoiding assignments feels like a highly arbitrary restriction to impose on your code. :) On Fri, Jan 26, 2024 at 23:28 José Valim wrote: > One of the goals behind Elixir is to provide a certain amount of syntax > that translates to a clear abstract syntax tree. T

Re: [elixir-core:11636] Why no ternary expression?

2024-01-26 Thread José Valim
One of the goals behind Elixir is to provide a certain amount of syntax that translates to a clear abstract syntax tree. The syntax available to create the language should also be available for others to extend language. Operators are generally tricky because they are hardcoded in the language.

Re: [elixir-core:11632] Enhance NaiveDateTime.truncate/2 to truncate to nearest :minute or :hour

2024-01-26 Thread José Valim
This is complicated because "truncate" is about removing the precision, and we cannot have a minute precision. The way to support it properly would be to allow seconds to be nil and then we would print it as "2022-12-31 13:45", without the seconds component, but I think this would be a large

Re: [elixir-core:11627] [Proposed warning for naming a variable the name of a type] What do you think?

2024-01-12 Thread José Valim
> 1. Do you think anyone would purposefully name a variable a type? (false positives.) Yes, we do it in Elixir all the time. Because if I am implementing String.downcase/1, the name `string` is a very good name for the argument: def downcase(string) And since we use names in the docs, calling

Re: [elixir-core:11625] Proposal: Support for opting out from specific warnings

2024-01-11 Thread José Valim
> you think would be the level of effort to have some rough take on it? If > it's a rather small change I would consider building my own fork just to > use personally. > > my three ideas. > 1) per warning type suppression > 2) warning suppression entirely > 3) separate war

[elixir-core:11625] Re: GPU accesss

2024-01-11 Thread José Valim
Please see: https://github.com/elixir-nx/nx The forum may be a better place to ask questions, as this mailing list is for language implementation discussion and features. On Tuesday, January 9, 2024 at 3:40:03 PM UTC+1 jonkl...@gmail.com wrote: > I was wondering if there was anyway to allow

Re: [elixir-core:11610] [Proposal] String.replace_invalid optionally tread <<0>> as invalid

2023-12-17 Thread José Valim
You can do a pass after the fact replacing <<0>> by the replacement character. On Sun, Dec 17, 2023 at 10:43 AM Daniel Kukula wrote: > Any chance to have an option to also escape null byte in > String.replace_invalid ?? > > In utf-8 <<0>> is a valid character but there are problems with it: > -

Re: [elixir-core:11608] Safe versions for `hd/1` & `tl/1`

2023-12-12 Thread José Valim
In addition to what Wojtek said and this being a breaking change, you can pattern match on the empty list vs [head | tail] directly, without the overhead of calling a function to just pattern match on ok/error. -- You received this message because you are subscribed to the Google Groups

Re: [elixir-core:11592] `Enum.join/2` behaviour in presence of non-UTF-8 binaries in enumerable

2023-11-10 Thread José Valim
Correct. When it comes to strings, Elixir generally assumes that the string has been validated before entering the system. If all functions were to validate they are indeed strings, it will become quite expensive. That said, I think your solution of changing the spec is the correct one,

Re: [elixir-core:11589] [Proposal] Add flag --changed-files to mix format

2023-11-07 Thread José Valim
This feature is now in main and it happens automatically. On Tue, Nov 7, 2023 at 12:36 Dario Heinisch wrote: > Hi, > > Running mix format on larger projects can be slow since it checks every > file. I don't think there is currently a way to run it on changed files > only. Users could run `mix

Re: [elixir-core:11586] [Proposal] Mix aliases docs

2023-11-02 Thread José Valim
We will inspect the function too. :) And we will see how it evolves. On Thu, Nov 2, 2023 at 1:01 PM Panagiotis Nezis wrote: > What if an alias is a function? > > On Thursday, November 2, 2023 at 1:49:43 PM UTC+2 José Valim wrote: > >> Before going down this road, I would firs

Re: [elixir-core:11584] [Proposal] Mix aliases docs

2023-11-02 Thread José Valim
Before going down this road, I would first like to add "mix help --aliases" and we could show the alias definition (i.e. what it invokes). I think it would already be a massive improvement to the UX. Would you like to give this a try? On Thu, Nov 2, 2023 at 12:45 PM Panagiotis Nezis wrote: >

Re: [elixir-core:11582] Re: [Proposal] U+FFFD Substitution of Maximal Subparts

2023-11-01 Thread José Valim
src/bytes/bytes_test.go;l=1157 > > On Tue, Oct 31, 2023 at 2:09 PM José Valim wrote: > >> Does the specification provide tests for us to include? Otherwise we can >> include enough tests for full line coverage and a “brute force”/property >> test commented out.

Re: [elixir-core:11579] Re: [Proposal] U+FFFD Substitution of Maximal Subparts

2023-10-31 Thread José Valim
ly uncertainty - How much is prudent and in what manner? > On Tuesday, October 31, 2023 at 12:35:48 PM UTC-4 José Valim wrote: > >> Folks, I am following up on this, where did we land? >> >> The new implementation is roughly ~70LOC for UTF-8, so at first I don't >> see an iss

Re: [elixir-core:11578] Re: [Proposal] U+FFFD Substitution of Maximal Subparts

2023-10-31 Thread José Valim
module makes good sense too as José says but > that's a longer "sales" and implementation cycle. > > On Saturday, October 7, 2023 at 7:40:50 PM UTC+11 José Valim wrote: > >> Hi Cameron, >> >> If the goal is to include this handling for UTF-16 and UTF-32, I

[elixir-core:11577] Re: [Proposal] import only: :guards

2023-10-31 Thread José Valim
Unfortunately we should not rely on the Docs chunk, because it is not expected to be available. We could add infrastructure to this but I would say only: :macros give a good enough approximation (and they'd cover patterns and guards). On Sunday, October 22, 2023 at 7:31:27 AM UTC+2

Re: [elixir-core:11575] [Proposal] support directories in `external_resource`

2023-10-23 Thread José Valim
It delegates to Phoenix.Template. On Mon, Oct 23, 2023 at 07:48 'Alexander Steppke' via elixir-lang-core < elixir-lang-core@googlegroups.com> wrote: > Thanks for the feedback, I've completely forgotten about > `__mix_recompile__?`! @Jose: I couldn't find anything implementing it in > LiveView or

Re: [elixir-core:11572] Date.shift implementation

2023-10-22 Thread José Valim
Timex.shift is probably the best reference: https://hexdocs.pm/timex/Timex.html#shift/2 Keep in mind it has many pitfalls, especially related to timezones and multiple calendars, so it is probably necessary to draft a proposal before. There is also a debate of which module it should be defined

Re: [elixir-core:11563] [Proposal] support directories in `external_resource`

2023-10-19 Thread José Valim
There is a callback that you implement for your modules called __mix_recompile__? Which you can implement with your own logic to detect how files and directories change. You can See how embed_templates does it for examples. :) On Thu, Oct 19, 2023 at 11:01 'Alexander Steppke' via elixir-lang-core

Re: [elixir-core:11561] Proposal: Struct field documentation

2023-10-19 Thread José Valim
Our goal is to revisit this relatively soon. If the type system work succeeds, we will introduce a new syntax for defining structs and we will make documentation a core part of field names. On Thu, Oct 19, 2023 at 07:59 Wojtek Mach wrote: > > PS. Having already typed this, it could be possible

Re: [elixir-core:11557] [Proposal] Fix Enum to return enumerables instead of lists

2023-10-16 Thread José Valim
Enum always returns lists by design, because it was designed to be a single abstraction that can: 1. enumerate elements while skipping 2. support both eager and lazy with the same protocol 3. support halting (such as take) 4. support zipping 5. does not cause dangling resources (so you can work

Re: [elixir-core:11550] Re: [Proposal] U+FFFD Substitution of Maximal Subparts

2023-10-07 Thread José Valim
Hi Cameron, If the goal is to include this handling for UTF-16 and UTF-32, I suggest proposing this to Erlang/OTP as new functions in the "unicode" module. Otherwise, Elixir only has facilities to deal with UTF-8. You could propose such a feature in their issues tracker. Also note that "rolling

Re: [elixir-core:11545] [proposal] Nested Map.from_struct/1

2023-09-27 Thread José Valim
This is a small function that can be part of your application or a package, we do not plan to add it to the standard library at the moment. Thank you. :) On Wed, Sep 27, 2023 at 10:40 PM Weslei Juan Novaes Pereira < weslei...@gmail.com> wrote: > The current Map.from_struct/1 works only in the

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

2023-09-21 Thread José Valim
For what is worth, the error message on main says: --- iex(1)> [1, 2, 3][0] ** (ArgumentError) the Access module does not support accessing lists by index, got: 0 Accessing a list by index is typically discouraged in Elixir, instead we prefer to use the Enum module to manipulate lists as a

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

2023-09-21 Thread José Valim
Index-based access on a list is very frequently an anti-pattern. Allowing list[i] means it will be easier to write non-efficient versions of algorithms without a second thought for those coming from imperative languages, instead of using the functions in Enum. It means someone can write this: for

Re: [elixir-core:11523] [Proposal] System.put_env/2 clears env on getting nil as value

2023-09-18 Thread José Valim
Sounds good to me. PR welcome! On Mon, Sep 18, 2023 at 6:41 PM Michal Śledź wrote: > System.put_env/1 erases given key when a value is nil. > > The proposal is to make System.put_env/2 symmetric with the > System.put_env/1 and also erase a key on the nil value. > > The spec would change from: >

Re: [elixir-core:11519] [Proposal] Trace functions when they are inlined

2023-09-12 Thread José Valim
This is a bug. We should emit the trace before they are inlined. Can you please do a bug report? On Mon, Sep 11, 2023 at 1:55 AM Mitchell Hanberg < the.mitch.hanb...@gmail.com> wrote: > Currently, by the time *_function and *_macro traces are emitted, I > believe that inlined functions have

Re: [elixir-core:11518] [proposal] Elixir For GSOC 2024

2023-09-12 Thread José Valim
The Elixir Team has no plans to participate but other projects in the community may be interested. I recommend starting a discussion on Elixir Forum. The Erlang Ecosystem Foundation was also used to participate in the past. On Tue, Sep 12, 2023 at 5:27 AM Apoorv Gupta wrote: > Will elixir be

Re: [elixir-core:11511] [Proposal] Allow ExUnit to run asynchronously by test cases (now it's by modules)

2023-09-04 Thread José Valim
If we want to add more parallelism later, then it is worth discussing future developments of the API now, so we don't put ourselves into a corner. If the answer is no, it is clear we are only parallelizing tests or parallelizing modules, but never both. And if we want to do both in the future, we

Re: [elixir-core:11509] [Proposal] Allow ExUnit to run asynchronously by test cases (now it's by modules)

2023-09-04 Thread José Valim
> 3. return both modules from ExUnit.Server.take_async_modules/1 > 3. running >1. spawn_tests/3 before spawn_modules/2 > 2. spawn_tests/3 inside spawn_modules/2 if it's a per_test async > module > > I'd prefer 1.2 + 2.2 + 3.1: > >- save asy

Re: [elixir-core:11507] [Proposal] Allow ExUnit to run asynchronously by test cases (now it's by modules)

2023-09-03 Thread José Valim
Yes, it is desirable and it has come up in the past: https://github.com/elixir-lang/elixir/pull/11949#issuecomment-1177262901 Although I think async: :per_module is what most people want, since the tests in the same module tend to access the same resource, opting-in for it to be per test will be

Re: [elixir-core:11506] [Proposal] Access.at/2

2023-09-03 Thread José Valim
A PR is welcome! On Mon, Aug 28, 2023 at 10:37 PM Anderson Cook wrote: > Under the hood `Access.at` calls `Enum.at` which takes an optional > default. I propose that it accept the same optional default, much like > `Access.key`. This should be a minimally-invasive addition. > > -- > You

Re: [elixir-core:11502] Determine why a package is being pulled

2023-08-18 Thread José Valim
mix deps.tree could help you here. My suspicion is either a path or a git dependency, as their deps are not in the lock file. A branch called "allow-poison-5" is highly suspicious. We could also introduce a mix deps.why or a mix deps.tree --filter option to help narrow down those cases. Proposals

Re: [elixir-core:11496] iex enhancement: make Home and End keys work

2023-07-17 Thread José Valim
If someone submits a PR for Erlang/OTP, they will automatically work for Elixir, so please go down that road. :) On Mon, Jul 17, 2023 at 03:58 Fernando Canizo wrote: > Request (TL;DR): > > Please add support for Home and End keys in `iex` shell. > > I know one can use CTRL-A and CTRL-E

Re: [elixir-core:11486] [Proposal] mix build task

2023-07-14 Thread José Valim
Phoenix standardized on setup, but it does not include the compile command. Not sure how useful build with compile is, if you run mix test instead of mix compile, build won’t help it. On Fri, Jul 14, 2023 at 09:11 Andrea Leopardi wrote: > I personally like the idea of a mix build alias defined

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

2023-06-29 Thread José Valim
: is not an operator at the user level for JS but it behaves like one syntactically. You can add or remove spaces on either side and it works. That’s not true for Ruby or Elixir as moving the spaces around is either invalid or has a different meaning. -- You received this message because you are

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

2023-06-29 Thread José Valim
n that some such >>> syntax should only work for structs: with Elixir LS today, starting to type >>> a `key:` in a struct/map literal does indeed suggest from the list of known >>> struct keys. I don't see this being impossible in LS tooling today, but >>> als

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

2023-06-29 Thread José Valim
ts: with Elixir LS today, starting to type > a `key:` in a struct/map literal does indeed suggest from the list of known > struct keys. I don't see this being impossible in LS tooling today, but > also don't know much about what is possible with the language server > protocol today. :) &g

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

2023-06-29 Thread José Valim
> waiting for Elixir 2.0 and/or atom garbage collection was the right play > here. > > On Thursday, June 29, 2023 at 2:33:22 AM UTC-5 José Valim wrote: > >> > I would argue that if we want to support only atoms, but make it clear >> that the syntax only appli

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

2023-06-29 Thread José Valim
s, and offers a syntax construct that can be used in more places > (as a specific example, error = "rate limit exceeded"; $:error # return > error tuple. Apologies if it feels like I am trying to torpedo other > solutions, that is not my intent at all. > On Thursday, June

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

2023-06-29 Thread José Valim
Hi Chris Keele, thank you for the excellent proposal. I just want to add that I agree with Paul that we don't need to support both strings and atoms, but it must be clear that it applies to either strings or atoms (if it supports only one of them) and the reason for that is because otherwise it

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

2023-06-26 Thread José Valim
There is a very extensive proposal and discussion here: https://elixirforum.com/t/proposal-add-field-puns-map-shorthand-to-elixir/15452 There is also very clear lines draw by myself on what this feature should look like: https://groups.google.com/g/elixir-lang-core/c/XxnrGgZsyVc/m/KgJwV8e-CgAJ

Re: [elixir-core:11420] Re: [Proposal] Pretty print diff when matching on context fails in ExUnit

2023-05-28 Thread José Valim
re sensitive to such things. > > And possibly a relevant question in both cases: How well does this work > with inspect limits that end up eliding parts of the data? > > On Sunday, May 28, 2023 at 12:35:40 PM UTC-4 José Valim wrote: > >> If we are going down this path, then my sugge

Re: [elixir-core:11417] Re: [Proposal] Pretty print diff when matching on context fails in ExUnit

2023-05-28 Thread José Valim
If we are going down this path, then my suggestion would be to add this to all of Elixir itself, starting with function clause errors. :) If someone wants to explore this path, please go ahead! On Sun, May 28, 2023 at 5:13 PM Ben Wilson wrote: > Agreed. Can the formatter get invoked on output

Re: [elixir-core:11406] [Proposal] Create Kernel.fst and Kernel.snd functions

2023-05-21 Thread José Valim
I am not sure we want to encourage those functions. The mentioned languages have a static type system, which means you know the shape upfront. In Elixir, we don’t, so we want to prefer pattern matching as much as possible, as it also helps assert on tuple size and help catch mistakes. On Mon,

Re: [elixir-core:11401] [Proposal] Change in Signature of Map and Keyword *_lazy functions to better facilitate piping

2023-05-20 Thread José Valim
I agree this is a good proposal but Wojtek unfortunately touched on a point that I don't know how to address. There are currently 4 *_lazy functions and, if we add this functionality to one of them, it would soon be expected that all of them support it. The problem is that the functions that

Re: [elixir-core:11396] Proposal: Add ~URI sigil

2023-05-18 Thread José Valim
Uppercase sigils do not supported interpolation, so that's a no-go. Note you can also get the compile time behaviour today by doing @uri URI.new!("..."). On Thu, May 18, 2023 at 4:25 PM Ben Wilson wrote: > Question: Would this sigil support interpolation? Is that too clever? > >

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

2023-05-16 Thread José Valim
We discussed it internally and the only concern at the moment is if it won't look inconsistent if we have ~UTC but still keep ~D / ~T / ~N. On Tue, May 16, 2023 at 9:59 AM Wojtek Mach wrote: > Hi, I'd like to propose deprecating ~U in favour of ~UTC. > > I don't think the change would

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

2023-05-14 Thread José Valim
ems etc. etc. >> >> But because of a lot of questions and doubts it's clear that's the >> requester responsibility to propose detailed description of the API, take >> into account all pros and cons, describe how they will affect the whole >> ecosystem and whether the requeste

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

2023-05-14 Thread José Valim
One addition: “features” makes sense for Rust because the contents of its “module body” cannot be dynamic as in Elixir. So if they want to provide this feature in the first place, it must be done as part of the compiler. Elixir can execute any Elixir code when defining modules, which is why it is

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

2023-05-14 Thread José Valim
> I get that. I am coming from a different perspective than yours that would help manage such dependencies based on how people deal with the dependencies today, such as using Code.ensure_loaded; and **try** to tackle the problem with a more "robust" idea. Here is the issue: the proposal has not

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

2023-05-13 Thread José Valim
ending on B and C, whereas B also >>>>> optionally depends on C. Then A might be included as `{:a, "~> …", config: >>>>> [b: true, sigils: false]}` and then A would know at the compilation stage >>>>> it should “flag C as used, and flag B as used

Re: [elixir-core:11366] Format inspect output as valid elixir

2023-05-09 Thread José Valim
mat` friendly because then its much > much easier to remove it > > On Tuesday, May 9, 2023 at 9:51:54 AM UTC-6 José Valim wrote: > >> There is a "structs: false" option but I am not sure if that is supported >> when diffing. >> >> But also keep in min

Re: [elixir-core:11364] Format inspect output as valid elixir

2023-05-09 Thread José Valim
There is a "structs: false" option but I am not sure if that is supported when diffing. But also keep in mind there are structures that represent memory data (such as PIDs and REFs) and those can never really be copy and pasted. And sometimes, like above, it shows in a special style because it is

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

2023-04-29 Thread José Valim
+1 for more tools for working with CLIs but that's definitely outside of the scope of the language itself. For more information, we have a document on the development guidelines and team: https://elixir-lang.org/development.html - Discussions about additional tooling to the ecosystem are probably

Re: [elixir-core:11355] Maps and merge behaviour in Config

2023-04-28 Thread José Valim
lists is realized. > > On Friday, April 28, 2023 at 9:19:35 AM UTC-5 José Valim wrote: > >> I am wondering if we should allow keyword lists in those cases instead >> but it can be confusing if folks then use the direct Erlang APIs. >> >> On Fri, Apr 28, 2023 at 3

Re: [elixir-core:11353] Maps and merge behaviour in Config

2023-04-28 Thread José Valim
l#module-boot-configuration > > Say I want to change the file path for different envs. > > > José Valim schrieb am Donnerstag, 30. März 2023 um 12:34:54 UTC+2: > >> Can you please provide examples of where this may happen? >> >> On Thu, Mar 30, 2023 at 12:08 

Re: [elixir-core:11350] [Proposal] Signing of precompiled artifacts

2023-04-25 Thread José Valim
Oh, nice! The builds are automated, so a PR that adds signatures would be welcome. Although, afaik, you should be safe with a SHA512 checksum. On Tue, Apr 25, 2023 at 08:19 Benedikt Reinartz wrote: > Hi, > > I have been working on making Elixir available to rebar3 users without the > need to

Re: [elixir-core:11345] Dynamic Supervisor doc change

2023-04-20 Thread José Valim
I would love to see a PR that tries approach 1. And we can expand from that. :) Thank you. On Wed, Apr 19, 2023 at 2:40 PM Bruce Tate wrote: > I have been going over my notes and noting the places my students have > trouble with standard Elixir documentation. One of them is this example > code

Re: [elixir-core:11341] Update Documentation for GenServer

2023-04-10 Thread José Valim
Agreed. I just wouldn't call it to_server but "state". Easier to bikeshed on code, so a PR is welcome. :) On Mon, Apr 10, 2023 at 4:14 PM Bruce Tate wrote: > I would like to propose that we change the base example for GenServer. For > those not familiar with it, here it is: > > defmodule

Re: [elixir-core:11338] [Proposal] Add Duration Module

2023-04-10 Thread José Valim
Hi Yordis, thank you for the proposal. I would like to see it expanded to say how such module you would look like and how it would interact with all the other Calendar modules. Kip also had a library where the dates and datetimes themselves could be duration and I would want to see them explored

Re: [elixir-core:11334] Re: Introduce Macro.Env.fetch_aliased_as/2 and improve Macro.Env.fetch_alias/2

2023-04-01 Thread José Valim
Hi Zach, thanks for the proposal! A PR for "fetch_alias_as" is welcome, we even use private APIs in Kino.VegaLite and friends which we could stop using if this function existed. :) On Sat, Apr 1, 2023 at 5:48 PM Zach Allaun wrote: > Upon reflection, the change that I'm proposing to

Re: [elixir-core:11330] Maps and merge behaviour in Config

2023-03-30 Thread José Valim
Can you please provide examples of where this may happen? On Thu, Mar 30, 2023 at 12:08 PM lostko...@gmail.com wrote: > We'll be seeing deeper integration with :logger in the upcoming elixir > version, but :logger is using maps for configuration, which don't merge in > config, but require

Re: [elixir-core:11328] Re: [Proposal] Create maybe(t) typespec

2023-03-29 Thread José Valim
The point of returning gap or ambiguous is exactly that they may or may not be errors and it is up to you to handle them. For example, some application may choose to surface those to the user and ask more information to resolve the ambiguity. In a statically typed language would have to handle

Re: [elixir-core:11327] [Proposal] Allow multiple clauses for a type

2023-03-29 Thread José Valim
Is this feature supported in Erlang? I am afraid it is not, which means we can’t support it. On Thu, Mar 30, 2023 at 06:03 Rafael Willians Moraes wrote: > Right now it's possible to declare multiple clauses for `@spec` as we can > see in Typespecs documentation >

Re: [elixir-core:11324] Re: mix deps.sync

2023-03-18 Thread José Valim
"mix deps.unlock --unused" is generally the way to go about it. You can also add "mix deps.unlock --check-unused" to CI. On Sat, Mar 18, 2023 at 2:13 PM Jonathan Arnett wrote: > I fully agree that this needs to be more discoverable. Every year or so, > I remove a dependency and then have to go

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

2023-03-18 Thread José Valim
Hi Austin and Zach, For the Bamboo Phoenix case, they should declare phoenix_view as an optional dependency. Then either conditionally compile code or use "@compile {:no_warn_undefined, Phoenix.View}" in the relevant module. Note Elixir v1.14 introduce a --no-optional-deps flag to help library

Re: [elixir-core:11321] elixirc_paths and deps including test libs separate from prod builds

2023-03-17 Thread José Valim
Yes, even another library. You can run it in test while you are in test. And the error message says it must be a relative path pointing inside the current directory, IIRC. On Fri, Mar 17, 2023 at 20:26 Brandon Gillespie wrote: > On 3/16/23 5:00 PM, José Valim wrote: > > > You sh

Re: [elixir-core:11318] elixirc_paths and deps including test libs separate from prod builds

2023-03-16 Thread José Valim
You shouldn't need to bundle test code into your production code. 1. Deps are compiled in prod but in_umbrella deps are compiled in the same environment as the current project. You can achieve this by specifying the env option to the dependency, such as "env: Mix.env()", and it works for any

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

2023-03-10 Thread José Valim
Can you please provide a small app that reproduces the issue? Even if the module comes from a transitive dependency, Elixir should be able to see it and avoid the warning. On Fri, Mar 10, 2023 at 5:00 PM Brandon Gillespie wrote: > I'm in the process of breaking our larger/monolithic app into

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

2023-03-07 Thread José Valim
re checks are only inclusive, it > should be fine. But you can also think if a library named A assumes that > dependency C is compiled without some flag, and library B assumes C is > compiled with said flag, you will end up with conflicting behaviour. > > I don't have answers to those questions but

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

2023-03-07 Thread José Valim
> needed to get the desired feature. What I would like to have is to focus on > the feature itself, leaving deps and their versions to library maintainers. > > > > > > wtorek, 7 marca 2023 o 14:45:03 UTC+1 José Valim napisał(a): > >> Hi Michał, >> >>

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

2023-03-07 Thread José Valim
Hi Michał, Thanks for the proposal. Your initial description makes me think there may exist bugs which we would need to investigate first. 2. Users of a library with optional dependencies have to include all optional dependencies in their mix.exs This should not be required. You only need to

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

2023-03-05 Thread José Valim
lation for > all sigils, single or multi letter? If so, what is the deprecation plan for > the current interpolation syntaxx? > > On Sunday, March 5, 2023 at 2:21:47 PM UTC-5 José Valim wrote: > >> This has been accepted and merged. Thanks everyone. >> >> On Sun, M

  1   2   3   4   5   6   7   8   9   10   >