Re: [elixir-core:6213] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread Paul Schoenfelder
Ah sure enough :), figured there was something I was missing, thanks for the examples! Paul On Fri, Aug 12, 2016 at 4:28 PM, José Valim wrote: > "is_positive_integer IO.inspect(1)" in the macro you have posted will > inspect the value twice when used in the function body. > "is_positive_integer

Re: [elixir-core:6212] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread José Valim
"is_positive_integer IO.inspect(1)" in the macro you have posted will inspect the value twice when used in the function body. "is_positive_integer send(self(), 1)" would send the message to self twice and so on. *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D O

Re: [elixir-core:6211] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread Paul Schoenfelder
Hey José, could you give an example of what you mean? At least with those guards, using them in function bodies appears to work just fine, is it because they are working on simple types (i.e. integer, tuple)? If it does fall down in the general case, I can definitely see where that would make it a

Re: [elixir-core:6210] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread eksperimental
the Comparison group of kinds was the last group and I just included just to see how much i could push guard, But the rest of the groups are less controversial. - Basic and built-in types - Additional: Derived from is_* functions - Additional: Literal numbers and maybe it is arguable if we need

Re: [elixir-core:6209] Re: Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread José Valim
Paul, the main problem is that if you want to use that macro outside of a guard, n will be unquoted twice which could have side-effects. *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Fri, Aug 12, 2016 at 9:02 PM, Paul Schoenfelder < paulschoenfel...@gmail.c

Re: [elixir-core:6208] Re: Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread Paul Schoenfelder
Just to throw in my two cents, here's how I define my own custom guards in Timex: https://github.com/bitwalker/timex/blob/master/lib/timex/macros.ex#L96 I'm not sure that this proposal simplifies anything for me really, but maybe I'm misunderstanding the benefit. Paul On Fri, Aug 12, 2016 at 2:2

Re: [elixir-core:6207] Re: Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread eksperimental
Thank you Wiebe-Marten for your input, i would like to mention that "is, is_not, is_any, are, are_not, are_any" are all operators. So functions are written in a more idiomatic way. def something_magical(x) when x is_any [:integer, :float, :list, :map]) do ... end regarding kinds that u

Re: [elixir-core:6206] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread José Valim
> > thank you for your answer José, > > I can look into how we can add new kinds (I will need help with > defining how to deal with conflicting kinds). > I think the defguard approach is reasonable, but I thought it was > ditched for some reason. > > What we could do is create a defkind macro that

Re: [elixir-core:6205] Introducing is_kind/2 and guard-safe operators: is, is_not, is_any, are, are_not, are_any

2016-08-12 Thread eksperimental
thank you for your answer José, I can look into how we can add new kinds (I will need help with defining how to deal with conflicting kinds). I think the defguard approach is reasonable, but I thought it was ditched for some reason. What we could do is create a defkind macro that uses defguard, b

Re: [elixir-core:6204] [Proposal] mix run --recursive

2016-08-12 Thread Michał Muskała
> On 12 Aug 2016, at 10:26, José Valim wrote: > > I am -1 because you can solve it with aliases OR by using "mix cmd mix run > priv/repo/seeds.ex" (which runs a command on all children apps). > I cannot solve this with an alias - I can't create a recursive alias in the root of umbrella. I d

Re: [elixir-core:6203] [Proposal] mix run --recursive

2016-08-12 Thread José Valim
I am -1 because you can solve it with aliases OR by using "mix cmd mix run priv/repo/seeds.ex" (which runs a command on all children apps). *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Fri, Aug 12, 2016 at 10:00 AM, Michał Muskała wrote: > Hello everybod

Re: [elixir-core:6202] Proposing backticks infix syntax for arity-2 functions

2016-08-12 Thread José Valim
> > It is true that when compiled, `a foo b` and ` a |> foo(b)`, both become > `foo(a, b)`. The argument that you gave against adding `` could just as > well be applied against the pipeline operator itself > As you said though, "aesthetics do matter" and |> provides a huge gain in readability we a

[elixir-core:6201] [Proposal] mix run --recursive

2016-08-12 Thread Michał Muskała
Hello everybody, Today I encountered an interesting problem. We're doing seeding for our applications with a custom mix alias: "run priv/repo/seeds/**/*", which works great. The problem is we're using umbrella applications with multiple ecto repos, so each application has it's own seeds. You ca