On Wednesday, October 28, 2015 at 11:49:39 AM UTC-4, Nathan Davis wrote:
>
> On the Clojure 1.80-beta2 release thread 
> <https://groups.google.com/forum/#!topic/clojure/_AGdLHSg41Q>, Ambrose 
> Bonnaire-Sergeant mentioned that he is monkey-patching clojure.core/load to 
> provide "an extension pointfor alternative compilers".  I can see several 
> possibilities for such an extension:
>
>    - Alternative readers / sources
>    - Parse another language (e.g. Python) into Clojure forms
>       - Non-file sources (e.g., load code from database)
>    - Use a custom compiler
>    - Apply a transform (e.g., transform to continuation passing style)
>
> Much of this suggests a pipeline, to which a middleware pattern might be 
applied. In particular, we seem to have these steps:

1. Load source from somewhere.
2. Read.
3. Compile.
4. Evaluate the top-level forms.

And there might be useful transformations that could be inserted between 
any two of these as well, e.g.

1. Load source from somewhere. - various places, files, DB, network
- Transform source in some way, e.g. tangle/weave literate programming 
separation, or apply custom reader macros ahead of main read, or infix 
math, or etc.
2. Read. - custom readers?
- Other xforms, e.g. a sandboxing loader might forbid certain forms or only 
allow a whitelisted subset; transform e.g. to CPS; instrument, e.g. a 
debugging tool with watches and breakpoints.
3. Compile. - add special forms; target different JVM versions
- Bytecode xforms, e.g. instrumenting for speed profiling purposes or other 
sorts of debug instruments.
4. Evaluate the top-level forms.


A middleware stack/pipeline architecture should be considered in light of 
these.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to