<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="135827" data-post-id="135827">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bglusman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/120/9459_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bglusman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks!  And just to see what it looked like/for anyone following along at home and still interested despite all the consensus against this, I went and added (in PR) a struct with access behavior not relying on the atom lookup hack…  <a href="https://github.com/bglusman/indifferent_access/pull/2" class="inline-onebox" rel="noopener nofollow ugc">First pass at a struct with Access behavior by bglusman · Pull Request #2 · bglusman/indifferent_access · GitHub</a> (EDIT - and then for the hell of it, more config, merged, and new published version, because, I dunno, it took 5 mins and let’s people play with it all… Occurs to me the approaches are hard to compare because the struct approach at least currently only changes top level hash in params, but I suppose when getting a value that’s a map it could wrap it in a new param struct making it sort of lazily recursive/allowing get_in to work at &gt; 1 depth… Maybe I’ll do that or make that another config just for fun! <img src="https://forum.elixirforum.com/images/emoji/apple/upside_down_face.png?v=15" title=":upside_down_face:" class="emoji" alt=":upside_down_face:" loading="lazy" width="20" height="20">)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135827" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-135827" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135827"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #41"></div>
  </section>
</div>
    <div class="postbit" id="135841" data-post-id="135841">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="NobbZ" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/NobbZ/120/27235_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  NobbZ
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dimitarvp" data-post="39" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>I can’t talk for him but I believe he meant that “normalised data” is what I called above “data with a well-known and mandatory shape, like pagination and ordering clauses”.</p>
</blockquote>
</aside>
<p>Exactly.</p>
<p>When I get input from the user, its usually that I validate it and typeconvert to elixir types as necessary. Then its either used for funcalls directly as bare value, or to create some other data. For what I have done so far, this other data is about 90% some struct that existed already before I decided to get some user input.</p>
<p>And in case of projects using ecto, well, at least 50% of them have a schema and a changeset function which makes validation/normalization very easy and straightforward.</p>
<p>Of course, sometimes other data structures make sense, then use it. And of course, if there are user provided relationships, just don’t use atom keys. But either way, deeper in your codebase nothing should access a map by a literal string, as either you know upfront what you expect or you don’t. And if you use a literal string, it feels as if you knew what you should get, but forgot to normalize. (And as always, there are exceptions to this “rule”, case by case)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135841" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/43">Post #42</a>
	                </div>
	            </div>
              <div id="likers-container-135841" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135841"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #42"></div>
  </section>
</div>
    <div class="postbit" id="135891" data-post-id="135891">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bglusman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/120/9459_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bglusman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji only-emoji" alt=":+1:" loading="lazy" width="20" height="20"></p>
<p>Also released iteration this morning (only took another 10-20 mins so why not) to add option/default for the recursive wrap support to the Params struct… Haven’t tried in my project yet but welcome feedback!  This may be more what you had in mind <a class="mention" href="/u/mhanberg" rel="nofollow">@mhanberg</a> and I think I agree this is a better direction but the old options are still there also.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135891" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/44">Post #43</a>
	                </div>
	            </div>
              <div id="likers-container-135891" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135891"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #43"></div>
  </section>
</div>
    <div class="postbit" id="135945" data-post-id="135945">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bglusman" data-post="15" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>I’ve meant to play around with defprotocolex, maybe this’ll give me an excuse at some point <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>Heh, it’s like Protocols in elixir, but instead of working on a few limited set of types it works on matchers instead, so it can be exceedingly complex.  It supports <code>@priority</code> definitions for matching order, testing callbacks (so you can enforce that things that implement a behaviour follow your contracts at compile-time), etc… etc…  Lot of useful features that I’ve kept adding for my own use and a couple by request of others.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="bglusman" data-post="16" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>(Edited: literally took about 30 seconds so that’s up as a PR <a href="https://github.com/bglusman/indifferent_access/pull/1" rel="noopener nofollow ugc">https://github.com/bglusman/indifferent_access/pull/1 </a> though really I’d probably pull the behavior out into configuration with a couple options like those two if were doing this for real)</p>
</blockquote>
</aside>
<p>If anything you’d want to keep the strings, not the atoms.  Converting strings to atoms can be quite costly since they are never GC’d.</p>
<aside class="quote no-group" data-username="Schultzer" data-post="17" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/schultzer/48/4339_2.png" class="avatar"> Schultzer:</div>
<blockquote>
<p>Maybe a better thing is to take a few steps back and, look at why a developer would end up in this situation, in the first place; I feel like all of this can be solve by good design, but that is sometime harder than said.</p>
</blockquote>
</aside>
<p>&lt;soapbox&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;PROPER STATIC TYPE SYSTEMS!<br>
&lt;/soapbox&gt;<br>
<em>/me coughs</em></p>
<p>^.^</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="19" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>It seems you are dead-set on actually going forward with this though, so maybe all of us here trying to convince you to give it up are barking up the wrong tree. <img src="https://forum.elixirforum.com/uploads/default/original/2X/6/6c3193d1dd46244da3c8c6f719c9f5e2abdd5ae8.gif?v=15" title=":003:" class="emoji emoji-custom" alt=":003:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>I think its mostly a ‘can it be done’ kind of thing, not a ‘should’, a lot of my play projects are just ‘seeing if I can’ too after all.  ^.^</p>
<p>ProtocolEx started out as that, just a ‘see if I can’ replacement of Protocol fixing all the faults that I saw in Protocol, it is one of the things that ended up being rather generically useful that I actually do use.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="dimitarvp" data-post="22" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<ul>
<li>Structs are mostly enforced at compile time. They save you from a part of errors you’d otherwise get at runtime.</li>
<li>Structs blow up at runtime if you touch them the wrong way (as your colleague did). And they give you a very clear error message.</li>
<li>Structs convey the message that you <em>really</em> want a certain piece of data to be shaped this way or that way. A good programmer will stop and think “why do they disallow removing of keys from this thing?” and maybe go and ask their colleague in charge of that code – this fosters communication in the team which is always a good thing.</li>
<li>Structs will slap you on the wrists if you introduce a new field and make it mandatory (the <code>@enforce_keys [:field_a, :field_b, ...]</code> annotation just above the <code>defstruct</code> expression) and you’ll have an exact list of compile errors to work through, which accelerates your work (as opposed to getting paranoid and adding more and more tests which might not even catch the problems that can come into existence by introducing the new field).</li>
</ul>
</blockquote>
</aside>
<p>This this, structs are as close as we get to static typing in Elixir.</p>
<aside class="quote no-group" data-username="bglusman" data-post="27" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>I’m not against structs, but some of the recommended usage of them feels to me like people who want to make Elixir into a statically typed language, or make it seem closer to one… which isn’t a <em>bad</em> thing or something I’m against, but it’s not fundamentally “correct” either… it probably can/does lead to lower defect rates,</p>
</blockquote>
</aside>
<p>+1</p>
<aside class="quote no-group" data-username="bglusman" data-post="27" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>but it also can make some refactoring and/or features take longer to develop,</p>
</blockquote>
</aside>
<p>I still say this is significantly false, at least for me it makes refactoring and feature development easier and faster as it is much easier to catch the places where things need to be updated.</p>
<aside class="quote no-group" data-username="bglusman" data-post="27" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>and part of what I value in Elixir is how flexible and fast to iterate/change it is… and it’s a big part of what my employers seem to value in it too. In many parts of the application there’s tolerance for bugs if we get substantial velocity out of it while we’re under time pressure and/or experimenting with new features that are not yet fully baked in scope or shape. I value the ability to start off more flexible and gradually harden the system over time and as needed.</p>
</blockquote>
</aside>
<p>Same thing in OCaml, it’s considered as being super fast and flexible to iterate/change while being safe about it.  Rust is pretty easy to do this in as well though its syntax slows that down a good bit in ways that OCaml doesn’t (but once you ‘get’ Rust it is near as fast, though ‘getting’ rust can be a large hurdle for a lot of people due to how different it is from other things).</p>
<aside class="quote no-group" data-username="bglusman" data-post="30" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>Hmm… so here’s an interesting question… why doesn’t Phoenix and/or Plug use a struct instead of a bare map for its params objects coming through plug?</p>
</blockquote>
</aside>
<p>I really wish it did.  I wish it was a struct of GET params, POST/field params, and arguments from the path, in addition to perhaps another field for plugs to inject things in to.</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="31" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>Care to elaborate? Static typing has a number of advantages. Any error you can push to compile time as opposed to runtime is one less sleepless night for you fixing bugs at 2:30 AM.</p>
</blockquote>
</aside>
<p>Soooo much this.  Easily 95%+ of my errors in my Elixir apps are things that would have been caught by a static typing system before a compilation ever completed successfully and I wish it did.  Sure tests catch things but you have to know ‘what’ to catch, and there is so much a typing system will catch just automatically, definitely not everything but easily that 95% of ‘stuff’ (at least my stuff).</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="31" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>It very definitely does, not “probably”, at least in my and many others’ experience.</p>
</blockquote>
</aside>
<p>Definitely for me.  In C++, OCaml, Rust, etc… the number of times a compile failed and it’s something that Elixir or Python or so would have just let go through to crash at runtime is astounding.  I <em>don’t</em> feel reliable coding with Elixir.  I feel reliable on the BEAM in the ways its designed, but Erlang/Elixir-the-language I feel like I fight with way too much.</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="31" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>That’s nothing that much older languages like PHP cannot give you as well. You clearly see the writing on the wall that Elixir’s creators and/or community would like more compile time enforcement, I see no point in you contesting this or arguing against it. Ruby is also extremely dynamic.</p>
</blockquote>
</aside>
<p>Uh, PHP has a static type system for a while now too.  It can give quite a performance boost in addition to the compile-time safety it adds.  ^.^</p>
<p><em>/me still has to deal with PHP for people at times, it’s not near as bad as it used to be…</em></p>
<aside class="quote no-group" data-username="dimitarvp" data-post="31" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>This is a very telling sign that I’d never work with your employers. <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>Yeah I would not be happy with that either.  In OCaml to just ‘Get a feature in <em>now</em>’ kind of thing I can scatter <code>failwith "blah"</code> all over the place, that will make the type system happy (it returns ‘anything’, since it crashes instead of returning) and it is <em>super</em> easy to grep for (make the CI not allow it in production builds for example).  Scala has the <code>???</code> operator for that, C++ has all kinds of ways to die, Rust has <code>panic!(...)</code>, etc…  There are ways to ‘make the type system happy’ but in a safe way that you can force not to be allowed in prod builds in every strongly typed language that I know that makes iterative development <em>really</em> fast and yet still significantly safer.</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="32" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>Isn’t it obvious? <code>Plug.Conn</code> <em>is</em> a struct and parameters have to be a bare map because every app has their own set of parameters incoming to their controllers.</p>
</blockquote>
</aside>
<p>Eh, except right now phoenix is kind of ‘munging’ multiple parameter types together.  Like just from mind if a field named <code>id</code> is passed in via a GET, a POST, <em>and</em> a router argument (and who knows from what else) or in any combination thereof, then what gets priority, which gets set in this mapping?  This is why they should be distinct, they should not be ‘combined’ into one map, that was <em>such</em> a huge PHP error and vulnerability for such a long time that they finally got rid of in like PHP5 or so (though thankfully the routes themselves help ‘clean’ it a bit compared to the PHP horrors, lol).</p>
<aside class="quote no-group" data-username="bglusman" data-post="33" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>but playing devil’s advocate is part of how I figure out what I really think, so thank you for indulging me/apologies if the writing has come across the wrong way</p>
</blockquote>
</aside>
<p>Likewise, it’s best to think through ideas by debating for each side of the debate.  ^.^</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="35" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>but have in mind that languages like OCaml and Rust make an entire class of bugs <em>impossible</em> by the mere virtue of your program compiling</p>
</blockquote>
</aside>
<p>I entirely agree with this, at least for my most common class of bugs by far static typing makes impossible just by virtue of how they work (assuming you don’t start stringly-typing everything or so ^.^;).</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="37" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>You can do that. I can bet $20 that you’ll spend more time developing it now compared to the time you’ll save down the line by using it, though.</p>
</blockquote>
</aside>
<p>Eh, it’s still fun to make things just to make them though.  ^.^</p>
<aside class="quote no-group" data-username="benwilson512" data-post="41" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/48/1457_2.png" class="avatar"> benwilson512:</div>
<blockquote>
<p>Oh the things people have to deal with when not using GraphQL APIs… <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji only-emoji" alt=":laughing:" loading="lazy" width="20" height="20"></p>
<p>GraphQL and Absinthe are awesome.  ^.^</p>
<aside class="quote no-group" data-username="bglusman" data-post="42" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>but I suppose when getting a value that’s a map it could wrap it in a new param struct making it sort of lazily recursive/allowing get_in to work at &gt; 1 depth</p>
</blockquote>
</aside>
<p>You can make a new Access function that can be used in things like <code>get_in</code> and so forth to do indifferent access, I think one of the other libraries has one.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="bglusman" data-post="44" data-topic="23853" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>Also released iteration this morning (only took another 10-20 mins so why not) to add option/default for the recursive wrap support to the Params struct… Haven’t tried in my project yet but welcome feedback! This may be more what you had in mind <a class="mention" href="/u/mhanberg" rel="nofollow">@mhanberg</a> and I think I agree this is a better direction but the old options are still there also.</p>
</blockquote>
</aside>
<p>“option/default”?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135945" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/45">Post #44</a>
	                </div>
	            </div>
              <div id="likers-container-135945" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135945"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #44"></div>
  </section>
</div>
    <div class="postbit" id="135962" data-post-id="135962">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bglusman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/120/9459_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bglusman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="45" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Heh, it’s like Protocols in elixir</p>
</blockquote>
</aside>
<p>Yup!  I’ve looked at a few times when browsing your github, just never found/remembered a good excuse to play with yet.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="45" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>If anything you’d want to keep the strings, not the atoms. Converting strings to atoms can be quite costly since they are never GC’d.</p>
</blockquote>
</aside>
<p>Well, no, I <em>never</em> create atoms dynamically, as much as this may be for fun I wouldn’t want to create something that added actual attack vulnerability.  I guess you didn’t look at the code, but it gets initialized with a map of all atoms in system keyed by string so it only ever replaces strings that already have a corresponding atom.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="45" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>You can make a new Access function that can be used in things like <code>get_in</code> and so forth to do indifferent access, I think one of the other libraries has one. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>That’s the default behavior of the new version of the library, it converts params to an IndifferentAccess.Params struct with either recursive or static/flat behavior for maps pulled out as values. It also still supports two variants of the old behavior using the atoms_map. I doubt I’ll ever actually use it myself but I think the result is fun and maybe reasonable for some people to use!  Maybe we can extend it with your idea for seperate area for different actions or something, I can’t quite visualize that but it sounds interesting, but might not belong in the same library.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135962" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/46">Post #45</a>
	                </div>
	            </div>
              <div id="likers-container-135962" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135962"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #45"></div>
  </section>
</div>
    <div class="postbit" id="135975" data-post-id="135975">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bglusman" data-post="46" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>but it gets initialized with a map of all atoms in system keyed by string so it only ever replaces strings that already have a corresponding atom.</p>
</blockquote>
</aside>
<p>Don’t actually need to do that, <code>String.to_existing_atom</code> already handles that.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135975" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/47">Post #46</a>
	                </div>
	            </div>
              <div id="likers-container-135975" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135975"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #46"></div>
  </section>
</div>
    <div class="postbit" id="135978" data-post-id="135978">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bglusman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/120/9459_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bglusman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="47" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Don’t actually need to do that, <code>String.to_existing_atom</code> already handles that.</p>
</blockquote>
</aside>
<p>Well, yes but it <em>errors</em> if it doesn’t exist, I don’t want to rescue, I just leave the string in place in that case.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135978" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/48">Post #47</a>
	                </div>
	            </div>
              <div id="likers-container-135978" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135978"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #47"></div>
  </section>
</div>
    <div class="postbit" id="135979" data-post-id="135979">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bglusman" data-post="48" data-topic="23853">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/48/9459_2.png" class="avatar"> bglusman:</div>
<blockquote>
<p>Well, yes but it <em>errors</em> if it doesn’t exist, I don’t want to rescue, I just leave the string in place in that case.</p>
</blockquote>
</aside>
<p>Heh, well it will use a lot less memory, plus it’s missing something <em>big</em>:</p>
<p>Atoms can be dynamically added, which is very common as modules are loaded into the running system, so when the atom list is captured may be very incomplete until ‘later’.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>So rescue’ing is better, just wrap it in a wrapper function.  ^.^</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135979" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/49">Post #48</a>
	                </div>
	            </div>
              <div id="likers-container-135979" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135979"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #48"></div>
  </section>
</div>
    <div class="postbit" id="135981" data-post-id="135981">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bglusman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bglusman/120/9459_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bglusman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>True, but thats an acknowledged limitation… though I suppose that might be a good additional option that wouldn’t require the option_map, but different time/space complexity tradeoffs, the overhead of rescuing when wrong is a lot higher than nil map lookup but agree its more reliable and less memory intensive… <img src="https://forum.elixirforum.com/images/emoji/apple/man_shrugging.png?v=15" title=":man_shrugging:" class="emoji" alt=":man_shrugging:" loading="lazy" width="20" height="20"> nothing wrong with either but there’s some overhead for using this and didn’t want ti to be too terrible but maybe that’s the new third config option!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135981" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/50">Post #49</a>
	                </div>
	            </div>
              <div id="likers-container-135981" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135981"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #49"></div>
  </section>
</div>
    <div class="postbit" id="135982" data-post-id="135982">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benwilson512" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benwilson512/120/1457_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benwilson512
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Craft GraphQL APIs in Elixir with Absinthe</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Sounds like it’s time to break out <code>benchee</code></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="135982" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/indiffererentaccess-adaptation-of-hashwithindifferentaccess-to-elixir-maps-plug/23853/51">Post #50</a>
	                </div>
	            </div>
              <div id="likers-container-135982" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="135982"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #50"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/23853/load_more?page=6">Load more posts (4 remaining)</a>
</div></template></turbo-stream>