You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would probably prefer the code above over struct!/2, because some external data is bound to have various other bits of data not to be used by the struct - data that hopefully can be harmlessly ignored. struct!/2 would fail with KeyError if passed a map/kwlist of keys not belonging to the struct.
I still would like @enforce_keys to actually do something though. If devs dont want the check to enforce keys they can just not put @enforce_keys in.
Kernel.struct!/2 is stricter (see docs), which will prevent the ignorance of @enforce_keys and prevent invalid struct keys being passed.
If you want some code to do the two checks independently, you could add something like this:
The text was updated successfully, but these errors were encountered: