[erlang-questions] Any Erlang Devs Contemplating Elixir?

Andrew Berman rexxe98@REDACTED
Sat Apr 23 00:56:11 CEST 2016

No, I wasn't saying that is_uri should throw an error, it most certainly
shouldn't.  Anytime I see is_foo, I expect some sort of boolean to answer
the question of is it a foo.  In Elixir when I do URI.parse(""), I get no
error and everything returned is nil.  Why?  It's clearly not a valid URI,
and the parse function is happy consuming it.  Just seems like an odd
choice to me.  At least the docs for parse do say it expects a valid URI
and doesn't validate.

On Fri, Apr 22, 2016 at 3:27 PM Kenneth Lakin <kennethlakin@REDACTED>

> On 04/22/2016 02:31 PM, Andrew Berman wrote:
> > Also, the Erlang motto of just letting it
> > fail seems to have gotten lost somewhere.
> In regards to is_url, Erlang's is_integer doesn't throw when passed a
> non-integer. It would be kind of disastrous if it did. If you want
> is_url to throw when passed something that's not a URL, then I expect
> that you can do
> true=IsUrl.validate(url);
> > ... it doesn't look like Elixir's URI.parse
> > actually throws any error when it cannot parse a valid URI.
> Elixir's URI.parse _appears_ to behave in exactly the same way that
> Python3's urllib.parse.urlparse does. The problem here (if there is one)
> is that it kind of seems like both libs use RFC1808's grammar for
> parsing URLs rather than one of the more strict (and non-obsolete!) RFCs.
> Note that section 2.2 of RFC 1808 defines a URL as "( absoluteURL |
> relativeURL ) [ "#" fragment ]", so the only possible *failure*
> condition that I see is passing a thing that's not a string. URI.parse
> throws when passed something that's not a string, so that seems to be in
> order.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160422/03e5fe14/attachment.htm>

More information about the erlang-questions mailing list