
Abusing Proxies for DSLs - fagnerbrack
https://mcluck90.github.io/abusing-proxies-for-dsls/
======
userbinator
I thought it would be about network proxies and Digital Subscriber Lines...

 _Why would you want to use this? I 'm not sure._

Unfortunately one of the applications that immediately comes to mind is
obfuscation.

I did a bit of JS work many years ago, before the whole "framework craze" and
massive amount of churn started, and looking at the code written in it now, it
almost feels like they're trying to compete on complexity with languages like
C++.

~~~
noiv
It's a trade. For example, you can split the whole program (think execution of
hundreds of business rules) into an interpreter - maintained by developers -
and the pure rules in an easy to understand text file - maintained by business
people.

~~~
taeric
Has that happened, pretty much ever? It is a great aspirational goal. I've
never seen it pan out, though.

Not that there isn't a benefit from reducing things to the language you use to
reason about the overall problem, and the language used to implement it. In
large, whether you create a "DSL" or not, you almost always move to doing
things in terms of the API you are using. Effectively making it a language.
Taking a little more deliberate control does seem nice.

That said, I have found benefit in keeping fewer abstractions around. This is
especially true as I am supporting an API. Don't hide that API from anything
you do. Too easy to hide warts in it that you might otherwise fix.

~~~
userbinator
_Has that happened, pretty much ever? It is a great aspirational goal. I 've
never seen it pan out, though._

That's pretty much the definition of [https://en.wikipedia.org/wiki/Inner-
platform_effect](https://en.wikipedia.org/wiki/Inner-platform_effect)

Almost every story about a "business rules engine" I've heard was that it
eventually turned into an odd Turing-complete programming language, and it'd
be simpler to just write the same code in the original language.

~~~
noiv
Well, it depends, if you can keep the rules structured as data and not as code
you're fine.

------
empyrical
I think with proxies, you might be able to recreate the magical "sh" library
[1] from Python for node.js (wouldn't be surprised if someone already managed
this!)

[1] [https://amoffat.github.io/sh/](https://amoffat.github.io/sh/)

------
mysterypie
DSL: A domain-specific language is a computer language specialized to a
particular application domain. This is in contrast to a general-purpose
language (GPL), which is broadly applicable across domains. (from Wikipedia)

The author does eventually define DSL, but it's pretty confusing until then.

------
jarym
Fun article but you and I just know someone is gonna ignore the warnings at
the top and put this into production on some site.

~~~
mjburgess
"No, no, it's exactly what the _JVM_ needs!"

\-- Martin Odersky

