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
"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
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
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
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
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
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
>
> 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
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
> 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
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
>
> 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
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
13 matches
Mail list logo