[erlang-questions] Any Erlang Devs Contemplating Elixir?
Sat Apr 23 00:27:11 CEST 2016
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
> ... 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
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the erlang-questions