Git Product home page Git Product logo

backtick's Introduction

Hi there ๐Ÿ‘‹

backtick's People

Contributors

bmillare avatar brandonbloom avatar deraen avatar devn avatar noahtheduke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backtick's Issues

Avoiding resolving symbols within a local scope?

Hi -- backtick is really awesome! We're using it to provide inline Clojure code for Alda. It mostly works great, but there is still one wrinkle that we haven't quite been able to solve -- symbols within a let binding are resolved just like any other symbol. This may or may not be a solvable problem, but at any rate, I wanted to see if you have any ideas.

Our use case: We want to read Clojure code from strings and evaluate it within the context of the alda.lisp namespace, which has a bunch of useful things defined for the user's convenience.

(defquote alda-lisp-quote
  #(if-let [{:keys [ns name]} (meta (ns-resolve 'alda.lisp %))]
     (symbol (str ns "/" name))
     %))

(defn read-to-alda-lisp
  [code]
  (load-string (format "(alda.parser/alda-lisp-quote %s)" code)))

The idea is that each symbol attempts to be resolved in alda.lisp (if this succeeds, we get something like alda.lisp/tempo or clojure.core/println), and if this fails, then the symbol stays as-is (e.g. x), so that when the code is eval'd, the Clojure reader will attempt to read it as a locally scoped symbol or within the current namespace, depending on the context.

This appears to work in every case except for the one where you create a local binding that happens to have the same name as something defined in alda.lisp -- it will resolve to alda.lisp/that-thing instead of that-thing.

Do you know if there is a way, using backtick, to only attempt to resolve a symbol if it is not supposed to be in some scope? The Clojure reader apparently does this somehow, but I'm not familiar enough with Clojure's internals to know how exactly.

template compatibility with clj-kondo

I am heavily using the backtick/template macro in my application. The macro is unfortunately not compatible with recent changes in clj-kondo. However, I have created a compatibility layer for cli-kondo. This basically means a proxy macro expander must be provided for cli-kondo to use rather than really expanding the macro.

I am happy to provide this compatibility layer as a contribution to the backtick project, but I'm not sure the best way of doing that.

If you are interested in discussing this, let me know.
It would amount to me submitting a PR which would add a kondo.exports at the top level of the library. That directory would provide an alternate macro expansion which clj-kondo's limited clojure interpreter would use rather than loading the real one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.