a
Size: a a a
a
AB
AB
We have also used records for doing the protocols dispatch but it had a big limitation. For example, every time you called any protocol, whenever we saw a tuple where the first element was an atom, like {Student, "josé", "valim"}, we would try to invoke the Student implementation for that protocol. The issue with this approach is that tuples where the first element is an atom are very, very, very common, so we ended-up trying to call protocol implementations for a bunch of different tuples only to find out there was no implementation, that it was a false positive, and it made the whole thing slow. With structs, because the struct tag is in __struct__, it is very unlikely to have conflicts.
DR
We have also used records for doing the protocols dispatch but it had a big limitation. For example, every time you called any protocol, whenever we saw a tuple where the first element was an atom, like {Student, "josé", "valim"}, we would try to invoke the Student implementation for that protocol. The issue with this approach is that tuples where the first element is an atom are very, very, very common, so we ended-up trying to call protocol implementations for a bunch of different tuples only to find out there was no implementation, that it was a false positive, and it made the whole thing slow. With structs, because the struct tag is in __struct__, it is very unlikely to have conflicts.
AB
__struct__
в protocol dispatch module - нормально, а посмотреть на elem(1) + tuple_size() в нем же - нельзяAB
AB
AB
ŹR
DR
a
YZ
ka
DR
ŹR
a