[erlang-questions] Best Practice in Map keys: Atoms or Binaries (or Strings)?
Kenneth Lakin
kennethlakin@REDACTED
Sun Oct 2 00:22:34 CEST 2016
On 10/01/2016 06:39 PM, Vans S wrote:
> Turns out by simply replacing text in 20 modules something was missed
> that is producing undefined behavior now.
One of the things that records get you -that maps do not- is a compiler
error when you try to use a field that is not defined in the record.
I'm not sure what sort of error you had in mind when you were creating
your scenario, but you're free to remove and add fields from a record.
Were I working on the project in your story, I would remove the
email_verification_token field from the 'User' record before going ahead
and creating the 'Validation' record. The compiler errors would make it
difficult to miss code that was using the old field.
Maps are nice, but records have their place, too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161001/dfa88b29/attachment.bin>
More information about the erlang-questions
mailing list