[erlang-questions] maps or records?

Benoit Chesneau bchesneau@REDACTED
Mon Feb 29 15:54:48 CET 2016


On Mon, Feb 29, 2016 at 3:51 PM, Santiago Fernández <santif@REDACTED>
wrote:

>
> 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.
>
>
>
Yeah but like i said my initial mail, i think it's quite embarrassing when
you could just pass a maps that already have this get function. On first
thought thought :)

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


More information about the erlang-questions mailing list