Jesse, thanks for the clear explanation.
On Friday, February 19, 2016 at 10:54:58 PM UTC-2, Jesse Gumm wrote: > > No, I definitely will not be killing the pmod syntax for simple_bridge. > > Even though simple_bridge doesn't use pmods any longer, it retains the > tuple-module syntax, and I did this specifically to avoid breaking > every app that depends on SB. > > That said, I added sbw because the pmod syntax is absolutely *loathed* > by many in the Erlang world, so giving a version that works without > pmods was the goal. Further, as I said, dialyzer can't analyze through > the pmod syntax, so if you want your apps dialyzable, the standard > Erlang syntax is the way to do it. > > But the pmod approach will not be dropped or abandoned unless Erlang > explicitly drops tuple-module syntax, in which case, even then a parse > transform will almost certainly be made available. > > For a bit of history and more explanation: > > sbw = "simple bridge wrapper" > > In SB 1.x, the request and response were separate objects, and were > handled using the explicit pmod syntax with the parse transform. At > that time, the modules that handled all calls were > simple_bridge_request_wrapper and simple_bridge_response_wrapper > ( > https://github.com/nitrogen/simple_bridge/blob/da17a0fe8da2a3d1d6e5feaf195d415d6504fdce/src/simple_bridge_request_wrapper.erl) > > > -- long names that no one ever would want to type in their code with > the frequency necessary when working with the modules. > > With 2.0, I unified the two into a single "Bridge" object (though CB's > code still refers to it as Req, and that's perfectly okay), and > introduced an internal record called #sbw > ( > https://github.com/nitrogen/simple_bridge/blob/master/include/simple_bridge.hrl#L14), > > > which wraps the information previously tracked using pmods. > Conveniently, if you have a record, and that record is used as the > last argument in a function call, you can also use the tuple-module > syntax in the same way. So even though simple_bridge doesn't > explicitly use pmods any longer, it does have both an #sbw record and > an sbw module. Which allows you to interchangeably use: > > Bridge:post_params("header") > or > sbw:post_params("header", Bridge) > > They are effectively the same call, though in the first case (the pmod > syntax), the `sbw` module is determined at runtime, rather than > compile time, which is why it can't dialyze. > > Anyway, that was a much longer explanation than necessary, but I guess > I'm feeling a little verbose this evening. > > Also, relevant to the conversation, the binary issue is documented > here: > https://github.com/nitrogen/simple_bridge#return-type-changes-to-look-out-for-in-20 > > .While most of it has already been mentioned, it's documented at that > part in the Readme. > > -Jesse > > On Fri, Feb 19, 2016 at 6:30 PM, [email protected] <javascript:> > <[email protected] <javascript:>> wrote: > > > > > > On Fri, Feb 19, 2016 at 10:02 PM, Jesse Gumm <[email protected] > <javascript:>> wrote: > >> > >> > >> > >> Or alternatively, sbw:post_param(redirect, Req). This method will help > >> with dialyzer checks. > > > > > > Going off on a tangent, sbw is new to me. Are you planning on killing > pmod > > support? Should I be using this in order to future-proof my apps? > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "ChicagoBoss" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > Visit this group at https://groups.google.com/group/chicagoboss. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/chicagoboss/CAF788usuZnjc2nmnTNvqam4oinTgfHbPfG97E0UvSLjjuJvUfw%40mail.gmail.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Jesse Gumm > Owner, Sigma Star Systems > 414.940.4866 || sigma-star.com || @jessegumm > -- You received this message because you are subscribed to the Google Groups "ChicagoBoss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/chicagoboss. To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/5f80b868-b79b-4d88-aa70-e30bda73fa5b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
