chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
mauricio.szabo 2020-04-21T01:11:06.281700Z

I also tested edamame, parsing core.cljs to benchmark comparing with the current implementation. It's almost the same speed, so I think I'll keep the current approach

2020-04-21T04:49:06.282200Z

out of curiosity, did you happen to try on clojure.core or clojurescript.core?

2020-04-21T22:12:11.303700Z

thanks!

2020-04-21T04:51:26.284200Z

i recently looked at file sizes of real-world clojure code and found something like the following:

1k:  73042
  2k:  22604
  4k:  16474
  8k:   7887
 16k:   3027
 32k:   1014
 64k:    331
128k:    108
256k:     21
512k:      6
  1M:      2
  4M:      3
for the left column, 16k means roughly, not larger than 16k, but greater than 8k. for the right column, that's the total number of files that were in a range.

seancorfield 2020-04-21T04:52:23.284900Z

@sogaiu What are those stats from? I'm curious what "real-world clojure code" is public...?

2020-04-21T04:52:33.285200Z

yes, i fetched releases from clojars

seancorfield 2020-04-21T04:52:51.285500Z

Ah, so this is libraries?

2020-04-21T04:53:03.285800Z

whatever is on clojars

seancorfield 2020-04-21T04:53:28.286200Z

That would not include applications, just open source libraries.

2020-04-21T04:53:43.286600Z

i think there are some apps there too, but i didn't try to count

2020-04-21T04:53:57.286900Z

i suspect they are mostly libraries though

seancorfield 2020-04-21T04:56:03.288500Z

Just curious, since "most" real world Clojure is proprietary / behind closed doors, as far as I know...

1βž•
2020-04-21T04:56:06.288600Z

i do have a collection of things fetched from github as well loosely based on andy.fingerhut's haironfire work, but i haven't tried to count against those

2020-04-21T04:56:22.288900Z

lol

2020-04-21T04:56:31.289200Z

so libraries don't count as real world?

2020-04-21T04:56:36.289400Z

just playing with you πŸ™‚

2020-04-21T04:56:42.289600Z

poor phrasing on my part

2020-04-21T04:56:50.289900Z

i should have said clojars to begin with

seancorfield 2020-04-21T04:57:18.290400Z

NP. I was just wondering where the stats came from and what you were implying by that...

seancorfield 2020-04-21T04:57:45.291Z

If it's "can we parse all this public code with tools.reader", yeah, that's a very real concern.

2020-04-21T04:58:10.291400Z

i collected the code for testing of a tree-sitter grammar for clojure -- there is some weird stuff out there

1
borkdude 2020-04-21T06:42:08.292500Z

Yes, you can pass exactly this option to edamame, it’s in the README

2020-04-21T07:34:26.294500Z

Apropos namespaces, I have been wondering for awhile how when I execute something via Chlorine it knows the correct namespace.

2020-04-21T07:35:35.296400Z

Also curious if you can have multiple namespace declarations in a file, and how that works out (I’m assuming the Java rules of files/packages prevent that...).

mauricio.szabo 2020-04-21T14:30:41.297100Z

@mattias504 It uses the current cursor position, and searches backwards. The first ns form it finds, is the one it uses πŸ™‚

mauricio.szabo 2020-04-21T14:31:18.298100Z

sql-korma uses multiple namespaces per file, that's why I implemented support for multiple ns forms per file πŸ™‚

borkdude 2020-04-21T15:07:38.298600Z

Is that from JS?

mauricio.szabo 2020-04-21T15:08:39.299500Z

Yes, I'm running both from ClojureScript, parsing the cljs.core namespace source file

1πŸ‘
mauricio.szabo 2020-04-21T15:14:12.299800Z

@borkdude by the way... I wasn't able to use a default tag reader. The code below doesn't work:

(eda/parse-string "#some [:name]" {:reader {:default tagged-literal}})

borkdude 2020-04-21T15:19:05.300Z

@mauricio.szabo try:

user=> (eda/parse-string "#some [:name]" {:tools.reader/opts {:default tagged-literal}})
#some [:name]

borkdude 2020-04-21T15:19:39.300300Z

:readers (plural) is recognized as a convenience, but other options for tools reader you can pass like this

mauricio.szabo 2020-04-21T15:20:08.300600Z

Yes, that solved it πŸ™‚ Also, how do I use :auto-resolve?

mauricio.szabo 2020-04-21T15:20:40.300800Z

When I tried to parse clojurescript core, I ended up replacing all :: to a single :

borkdude 2020-04-21T15:21:07.301Z

auto-resolve is for resolving namespaced keywords: https://github.com/borkdude/edamame/blob/3fa04b714f55a4f1435ad045fb618b959d5a55bb/test/edamame/core_test.cljc#L192

borkdude 2020-04-21T15:21:32.301400Z

you can pass that a map of aliases to namespaces

borkdude 2020-04-21T15:21:39.301600Z

or :current for the current namespace

mauricio.szabo 2020-04-21T16:13:48.302200Z

Great, it works, thanks! πŸ˜„

mauricio.szabo 2020-04-21T16:17:15.302400Z

Yes, probably... to be honest I never tested too much evaluating code before a ns form πŸ™‚

seancorfield 2020-04-21T16:50:35.302600Z

I mostly notice it when trying to run tests or my inspect namespace command.

2020-04-21T18:50:24.303100Z

Interesting, thanks!

mauricio.szabo 2020-04-21T19:28:35.303300Z

Well, running tests on current namespace can be something I should look at... it's not rare to Clojure sources to have comments before the namespace.

seancorfield 2020-04-21T19:45:14.303500Z

Yeah, I'd say that if you hit the start of the file with only comments/whitespace without finding a ns then you could look forward for one.

2020-04-21T22:12:11.303700Z

thanks!