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
>
https://groups.google.com/d/msgid/chicagoboss/CAF788usuZnjc2nmnTNvqam4oinTgfHbPfG97E0UvSLjjuJvUfw%40mail.gmail.com.