Giter Club home page Giter Club logo

Comments (6)

Olical avatar Olical commented on May 14, 2024

Ohhh that could be neat, I'd probably print them under some other "type" of message in the log so that users could blacklist it separately to stop it opening the log window.

I'd say it can't hurt, the only problems could be if the client connecting expected the prepl to behave exactly like a normal prepl, people need to build their clients to log or ignore unknown messages.

Mine is built on assumptions that I'll only see one :ret and only after I've evaluated a single form, for example. But I could see out, tap or err at any time.

I'd say go ahead, can't hurt! I think!

from conjure.

thheller avatar thheller commented on May 14, 2024

Good to know.

It might make sense to accept multiple :ret values in case it is possible for the user to send 1 2 3 directly to the REPL socket. Not sure how much parsing you do on your end.

I'll try to make a wiki page of all the possible "extra" prepl messages you might receive.

from conjure.

Olical avatar Olical commented on May 14, 2024

So if you send multiple forms you will get multiple :ret values, Conjure however wraps all evaluations to ensure multiple forms (such as an entire buffer contents or visual range eval) will always return one thing.

In Clojure it does this by passing the raw string wrapped in some code to evaluate it with the correct source file / line / column set. This means the code sent to the prepl is actually one form, no matter what, that contains the code to evaluate your code. If that makes sense?

In CLJS I try to work out if you have a single form or many, if I am sure you're sending one form it's sent as is, no modifications are made other than switching to the correct namespace for the eval. If you send multiple forms they'll be automatically wrapped in a do which could cause issues in some rare cases, but the only one I know of is some specific namespace form evals.

If I started using self hosted CLJS (which I think would bring a whole host of complications) then I could do the wrapped eval just like I do in Clojure, which would be nice. I don't think I can do self hosted CLJS and have all the require loading etc just work out of the box... I think you know more than me about that though, maybe self hosting would be a good route for CLJS evals.

Then I think I could set the file / line / col for different evals which would be 👌

Super excited to see prepl getting "native" support in shadow though!

from conjure.

thheller avatar thheller commented on May 14, 2024

Even self-hosted can't get past the limitations of the CLJS REPL. You can find the REPL specials here and those wouldn't work when wrapped in a do.

Most of those can't work like Clojure because almost all IO is async in JS so a require that needs to load namespaces from somewhere first would need to take a callback before proceeding. In Clojure require is blocking and you can immediately use the new ns.

I believe the default CLJS repl impls (eg. browser) are still buggy and evaluating (require 'some.ns) (some.ns/foo) too quickly would fail if there isn't an accidental "wait" time after the require.

from conjure.

Olical avatar Olical commented on May 14, 2024

Yep, of course. So if you eval the file or you eval that single form it'll be fine. If a user tries to eval multiple forms from a range or block it'll cause issues but I think that's okay. There's some... interesting... workarounds I could do for evaluating the whole buffer from memory (not from disk) for example, but for the most part it all works fine.

Generally when I'm editing CLJS I use <localleader>ef a lot which translates to a load-file call, that produces nice results with the "go to definition" information intact.

I don't require any sync require as part of Conjure, so I'm okay on that front 🙂

from conjure.

Olical avatar Olical commented on May 14, 2024

Going to close this issue for now since I don't think there's much else to say. If you want to send some extra values I'd be happy to render them 😄 I'll make sure there's a catch all for non-standard prepl messages.

from conjure.

Related Issues (20)

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.