not tied to unrepl but to tooling in general: scavenging the Eclipse incremental Java Compiler and repurposing as either a standalone agent or a plain lib started in a repl session would be useful. clj
and such a lib/agent would be enough to do mixed projects
https://github.com/eclipse/eclipse.jdt.core/blob/master/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java and https://github.com/eclipse/eclipse.jdt.core/blob/master/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java looks like interesting starting points
I wonder if anyone’s using Eclipse these days, apart from people in IBM and SAP. 🙂 When I started doing Java long time ago I was an Eclipse user myself, but when I swithed to IDEA I felt enlightened. Eclipse innovated very slowly and couldn’t get even basic things like git and maven integration, right, IDEA on the other hand felt like a speedtrain and always delivered tools to alleviate known pain points and leverage new trends in development.
But I guess you want to use the compiler only, not build something for Eclipse itself.
That’s it, feasting on the carcass.
Back to unrepl. I have in mind of adding a very small unrepl.core
namespace which would not be shaded in blobs.
Why? as one can do (clojure.main/repl ...)
or even better (->> (read) eval prn (while true))
to upgrade their repl session I’d like to expose equivalent facilities.
as .cljc
or just .clj
? either way I like the idea
the question is not really about the source file extension but, I guess, about cross-platform availability
because of the async env of JS the API may have to diverge
is it problematic to have one ns to host different definitions depending on the env?
(as long as we don’t reuse names with different semantics)
The magic tagging is a pain.
?
Vim cannot have compound map keys. The you got a map with symbol keys? Then I get a magically tagged alist having very fun accessing the innards......
Vim has no symbols. And no vectors/list duality. So I get "foo" vs. {"edn/symbol": "foo"}. And ["foo"] vs. {"edn/list": ["foo"]}
I think that vimpire needs to modify the write part of unrepl.
I thought about a helper for one way simplification where needed.
what would be easy for vimscript to read? (“nothing” chants the crowd)
Only the actions are problem. For consumption there can be ambiguety.
I see
so removing ambiguity everywhere would increase complexity, right?
One issue is that embedded actions are contextual: they are not tagged you have to understand the structure of the message to know what is an action and what is “just data”
well actions are not sprinkled everywhere (except elisions which are tagged) so it may be doable to have a post-processing of the edn to transform actions into something more palatable for vim
The actions are not really a problem in handling. They are from known sources. And are traversed for params. Not really a problem. The payload of events is the issue. Case: : prompt. But these are not sent back. So I can munge them.
Do you have a concrete example?
The example from the SPEC for prompt is parsed as follows:
[':prompt', {'edn/map': [[':file', 'unrepl-session'], [':line', 1], [':column', 1 ], [':offset', 0], [{'edn/symbol': 'clojure.core/warn-on-reflection'}, v:null], [{'edn/symbol': 'clojure.core/ns'}, {'edn/tag': 'unrepl/ns', 'edn/value': {'edn/ symbol': 'user'}}]]}]
The interesting part is the very last 'user'.
So this is the code I need to get there:
for [ k, v ] in a:response[1]["edn/map"] if type(k) == v:t_dict \ && has_key(k, "edn/symbol") \ && k["edn/symbol"] == "clojure.core/ns" let a:this.namespace = v["edn/value"]["edn/symbol"] break endif endfor
Where I'd like to do: let a:this.namespace = a:response[1]["clojure.core/ns"]
I'll write a simplifier to apply in such cases, which translates for example list or symbols to vim lists and strings. The means, I cannot distinguish lists and vectors anymore. As well as symbols and strings.
But in this side, I don't have to anyway.
Elisions can be special cased to be left alone. But I don't need their contents, since they act as a template only.
Why not use a serialized representation for keys?
Aka don’t parse strings or symbols or keywords.
Serialized represantation?
From what I get keywords are represented as “:kw” then keep on with this trend: “sym” and "\”str\”” etc
Hrm. That would be a possibility.
But maybe the :kw is already a bad idea and should be an edn/keyword map.
Actually I think latent parsing (no it’s not a thing I just made the term up) is a good idea.
latent parsing?
Parsing where some nodes in the resulting tree are just spans of the actual input.
Hmm... I'm not completely convinced. It may work with keywords, symbols and strings, because you can use the first character to discriminate the type.
But it breaks down with tagged values.
There you can still use # for the dispatch in the string, but you cannot access to payload easily.
Then you need again to fire up the parser.
Are there tagged values used as keys?
Dunno hopefully not. This maybe a question, how general purpose the parser should be. Also keeping strings as double quoted puts the escape burden on the user. Not nice.
Fluffing around with strings.... Don't want that. This should be handled by the system.
Treat strings as opaque and provide fns to check the actual type etc
General purpose parser is somehow a sub project of its own. Parsley Clojure parser has been detrimental to CCW imo. However it has somehow succeeded on its own (because of an empty ecosystem niche)
It's also the other way: I can't just stick a string in. And that's almost always what I want to do. But then it would be considered a symbol. So I must wrap it in ". But now I also have to take care that things are escaped correctly. Bleh. :-(
But that might be an encoding issue. Maybe a prefix is better: :: keyword, ': symbol, s: string. And hope that there are no tagged literal as key. (#inst anyone?)
In the end it boils down to intended usage: Do I want a full blown parser/generator for EDN? Or is the need for vimpire more important/sufficient. Actually I need both. The first for the actions which have to be traversed for parameter replacement (so no opaque tagged literals!) and have to produce exact EDN. Then the latter for the tooling interaction, where ease of accessibility is key. But there I don't need sets or symbols. There I can live a simplified translation.
yeah you could also introduce you own serialization to encode as strings all kind of keys. However if you really want to be generic then: what when you get maps as keys? You would need to write a canonicalization algorithm for maps to be independent of the key order...
I disagree that you need a full blown parser to perform substitutions. It can be done at the string level (extra points for taking care to figure out that you are not in an escaped context (eg string))
String level? With escaped context? And who got that ever right?
framed like that it feels preposterous to say “me” but.. in the blob generation code, the regex-from-hell-that-blows-stupid-Java-regex-matching or the hand crafted state-machine that replaces it.
This state machine knows if you are in normal code or in some escaped context.
So now one can use unrepl.core/write
and unrepl.core/non-eliding-write
(total-write. full-write, write++?)
@igor.i.ges hi!
https://github.com/cgrand/seqexp/blob/master/README.md you and rich have a shared way of thinking @cgrand
(Or you're good at understanding him!)
Wow that is handy!
Before that there was @chouser’s seqex iirc.
I still has plan to make seqexp and xforms to meet.