pmods usage
rambocoder opened this issue · 3 comments
What do you think about me refactoring SB to not use Erlang's parametrized modules functionality and instead change the API to be:
RequestBridge = simple_bridge:make_request(mochiweb_response_bridge, [{Req, Docroot}]),
Method = simple_bridge_request:request_method(RequestBridge),
PeerIP = simple_bridge_request:peer_ip(RequestBridge).
Since pmods have been nuked from R15B02... Not sure if they are coming back in R16
The initial solution will be to be backwards compatible using a parse_transform per the recommendations of the OTP team, however I did have plans on refactoring simple_bridge so that it does not reply on pmods.
I haven't tested it, but @uwiger has a parse_transform he made up to provide parameter module functionality even post R16. I'm unsure if this is the same parse_transform that will be provided by the OTP team for providing pmod backwards compatibility.
That can be found here: https://github.com/uwiger/parse_trans/blob/master/examples/pmod.erl
pmods, however, were not removed in R15B02, but will be removed in R16. I'm having no issues running Simple Bridge with R15B02. Up until then, Simple Bridge with pmods should be working just fine.
All that said, I'm open to pull requests with the refactored simple bridge for non-pmod usage. For now, all that would be pulled into a dev branch, but overall, is a good idea for the future with pmods officially dropped. So if you want to do it, be my guest, and shoot me the pull request when things look stable. I'm glad to pull them in.
Thank you for the link to pmod.erl, that's a good example of what might be forthcoming from the OTP team.
As far as refactoring goes, for example in the cowboy adapter, you use the process dictionary to cache data, I'm thinking of picking up where you started, by implementing a gen_server for the request object, this way the state is stored in the gen_server state. I will see what I can hack up.
I will close this issue for now.
Please do. I'm not exactly proud of the process dictionary usage for the
cowboy adapter. Replacing it with a gen_server would be ideal.
On Dec 27, 2012 9:22 PM, "rambocoder" notifications@github.com wrote:
Thank you for the link to pmod.erl, that's a good example of what might
be forthcoming from the OTP team.As far as refactoring goes, for example in the cowboy adapter, you use
the process dictionary to cache data, I'm thinking of picking up where you
started, by implementing a gen_server for the request object, this way the
state is stored in the gen_server state. I will see what I can hack up.I will close this issue for now.
—
Reply to this email directly or view it on GitHub.