I find that importing Access makes the *_in and friends much nicer:

   update_in(foo.bar[id], &(...))
   # vs
   update_in(foo, [key!(:bar), key(id)], &(…))


> On Dec 8, 2016, at 9:49 AM, José Valim <[email protected]> 
> wrote:
> 
> The above wouldn't be desired because you lose the important property of 
> asserting the field is there. Plus, implementing behaviour means defining 
> three functions, and I don't believe defstruct should pollute the user module 
> with functions more than necessary.
> 
> One of the reasons Access was moved to a Behaviour from a Protocol was 
> exactly to promote proper usage with structs.
> 
> 
> 
> José Valim
> www.plataformatec.com.br <http://www.plataformatec.com.br/>
> Skype: jv.ptec
> Founder and Director of R&D
> 
> On Thu, Dec 8, 2016 at 3:08 PM, Allen Madsen <[email protected] 
> <mailto:[email protected]>> wrote:
> Would it be acceptable and sufficient, when using the defstruct macro, to 
> define default implementations of the methods required for the Access 
> behaviour?
> 
> Allen Madsen
> http://www.allenmadsen.com <http://www.allenmadsen.com/>
> On Thu, Dec 8, 2016 at 5:20 AM, Ólafur Arason <[email protected] 
> <mailto:[email protected]>> wrote:
> What is the exact problem I don't get it from the description is it that 
> struts don't have Access built in, because that is solveable, or that because 
> you have default value like nil set in a struct you can't create a nested 
> structure on the fly?
> 
> Regards,
> Olaf
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:elixir-lang-core%[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/1f0a4e4c-83a6-4329-9e02-771369f2793a%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/1f0a4e4c-83a6-4329-9e02-771369f2793a%40googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3Cs_oUXWvKp2_3cHEw2ErYUOJg65RsFt8yYg%3DVp%2BEqCNpg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3Cs_oUXWvKp2_3cHEw2ErYUOJg65RsFt8yYg%3DVp%2BEqCNpg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JsQ_2vMC5tvKJR6K8iePUJB2tPX_7OvxHEQ6TT7hp%2B-g%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JsQ_2vMC5tvKJR6K8iePUJB2tPX_7OvxHEQ6TT7hp%2B-g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/038E1729-B44B-40D2-A143-75602605F76A%40chrismccord.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to