[erlang-questions] maps or records?

Santiago Fernández santif@REDACTED
Mon Feb 29 15:51:00 CET 2016


On Mon, Feb 29, 2016 at 9:21 AM, Benoit Chesneau <bchesneau@REDACTED>
wrote:

> I have a function hackney_url:parse_url() returning a record
> #hackney_url{} . This record can be used internally but also externally by
> the applications that need it. Which requires for now to include
> "hackney_lib.hrl" . The record will likely change. On the other hands I am
> not sure I like to have to import the include file to get its definition
> (or copy this definition in another file, or just use the tuple) .


You can provide functions to access data in #hackney_url{}, like this:

hackney:get_host(Url)

and it isn't required to include hackney_lib.hrl in client code.


--
Santiago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160229/864ad647/attachment.htm>


More information about the erlang-questions mailing list