News for hackers. Stuff that matters.
Re:Lisp in Your Language by SEMW on Wednesday September 09, 2015 @05:13PM (#10194658)
I discovered recently that one part of the Pusher javascript library does basically this (using arrays of javascript strings, just as in the article). And this isn't test code, it's the actual code they use for connection fallback logic. Utterly bizarre.

https://github.com/pusher/pusher-js/blob/2.2/src/defaults.js...

parser in https://github.com/pusher/pusher-js/blob/2.2/src/strategies/...

Re:Lisp in Your Language by ludvik on Thursday September 10, 2015 @04:14AM (#10196733)
I wrote that code, there were some reasons why we did it that way. First, before the 2.0 release, we ran several experiments with the connection strategy to figure out the fastest way for the clients to connect to Pusher. We haven't had much experience with HTTP fallbacks, so it was important for us to make the learning process easier. This DSL helped a little bit.

The main reason was that we were thinking about helping clients with server-supplied connection strategies. We could gather some metrics and tell the client in advance that, for example, WebSockets won't work due to some network issues. We also thought it could be useful for orchestrating migrations and working around potential load balancing issues. Injecting JavaScript was out of question, so I wrote this JSON DSL for connection strategies.

We haven't done that and it's probably never going to happen. The Internet has moved on, we dropped support for some ancient browsers, connectivity has improved and we haven't really felt a need for that feature, to be honest.

I agree that at the moment it's unnecessary.

Re:Lisp in Your Language by SEMW on Thursday September 10, 2015 @05:18PM (#10200622)
Thanks for the explanation. Interesting to hear the reasoning behind it.