--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/38581c82-efae-4775-a8f5-e01a89ec6290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Unfortunately we cannot check structs on guards. Fortunately we can pattern match on them:def my_function(%Time{}) do ...def my_function(%Date{}) do ...etc.
On Tue, Oct 25, 2016 at 9:29 PM, João Bernardo <jb.am...@gmail.com> wrote:
Hi !Why aren't there is_time, is_date and is_naive_datetime guards ?For sure I am not the first one to propose this, and baybe there is a reason for that.But I believe this would be really useful.Thanks.
--
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-co...@googlegroups.com.
From this page: http://erlang.org/doc/reference_manual/expressions.html#id2273702
"The reason for restricting the set of valid expressions is that evaluation of a guard expression must be guaranteed to be free of side effects."
If there is a way to guarantee that any given macro is certain to be free of side-effects then it could be supported although it'd require a change to the underlying BEAM itself.
--
Onorio