Fork me on GitHub
#unrepl
<
2017-11-16
>
cgrand11:11:27

I’m happy to announce that sideloading support in unravel is complete.

cgrand11:11:59

Start a plain old repl:

Clojure 1.8.0
user=> (require ’[net.cgrand.xforms :as x])
FileNotFoundException Could not locate net/cgrand/xforms__init.class or net/cgrand/xforms.clj on classpath.  clojure.lang.RT.load (RT.java:456)

cgrand11:11:14

Now connect unravel to it with additional entries on the classpath:

$ scripts/run -cp .:$HOME/.m2/repository/net/cgrand/xforms/0.9.5/xforms-0.9.5.jar:$HOME/.m2/repository/net/cgrand/macrovich/0.2.0/macrovich-0.2.0.jar 5555
Unravel 0.2.2 connected to localhost:5555

Type ^O for full docs of symbol under cursor, ^D to quit
Enter #__help for help

user=> (require '[net.cgrand.xforms :as x])
nil
user=> (x/into {} (x/by-key odd? x/count) (range 10))
{false 5, true 5}
EDIT: It’s worth noting that xforms requires macrovich. So recursive requires are supported “for free” (without any support at the sideloader level)

dominicm11:11:07

oh, wow, it works with jars too. That's basically what would be needed by CIDER. That's amazing. I'm sure @benedek and @bozhidar would be excited by this.

cgrand11:11:20

Btw nothing prevents a client from extending a classpath dynamically

dominicm11:11:57

yeah, for sure.

dominicm11:11:22

I mean, in theory you could say "I will handle any require of replant.XXXXXX" and load it with x, y and z functions.

cgrand11:11:04

yes on missed require you could ask the user if they want to perform a repo lookup and add the dep etc.

cgrand11:11:32

I’ve been rambling with the sideloader idea for so long (and having struggled to communicate it), that I’m happy to see it works

cgrand11:11:06

> I (@dominicm) just didn’t understand the gap between jar and base64 encoded class. you are asked for a resource, you open the zip (jar), check if the resource is in it, if found you extract it, base64 it and send it

dominicm11:11:24

I might attempt something like this for juxt/edge's training mode. It's quite nice to not have to worry people with require's whilst we're getting them to grips with the foundations of the language.

cgrand12:11:49

@pesterhazy @volrath @dominicm Does anyone remember what I proposed for autocomple: prefix, suffix returns a list of maps? I think there was a third argument

cgrand12:11:23

namespace! that was the 3rd one, right?

dominicm12:11:08

if it wasn't, it probably should be

dominicm12:11:47

although, doesn't unrepl know the current ns?

cgrand12:11:36

if you complete for a file that you are editing out of the repl buffer, no

cgrand12:11:10

Logbot is on vacation since Oct 20th so...

dominicm12:11:26

slack is increasingly not the best place for this I suppose.

cgrand12:11:51

this being the whole clojurians thingy?

dominicm12:11:34

Slack, yes. Not to repeat discussions elsewhere, with much heat, but Slack's business model doesn't align with community's much. I'm not advocating for a move, I think the sheer # of people far surpasses many of the costs.

pesterhazy15:11:49

@cgrand, yes, namespace I think

cgrand16:11:00

thanks for the confirmation

cgrand21:11:31
replied to a thread:

Ah! I forgot package.json

dominicm22:11:06

If I haven't aot'd my clojure code, I suppose I can't do a base64 of the class. Is that reconcilable?

cgrand22:11:11

Base64 of the ns should be enough. Except if you try something fancy.

cgrand22:11:35

@dominicm despite the name classloaders load more than classes

dominicm22:11:17

Awesome. I thought it was very jvm centric, cool to hear that it isn't.