replikativ / hitchhiker-tree

Functional, persistent, off-heap, high performance data structure
Eclipse Public License 1.0
44 stars 19 forks source link

Addressed issue where class import does not conform to Clojure 1.10 ns spec #1

Closed simonbronner closed 5 years ago

simonbronner commented 5 years ago

To replicate the issue, switch to a 1.10 (rc-5 at this point) and use the hitchhiker.tree.core ns:

Clojure 1.10.0-RC5 user=> (use 'hitchhiker.tree.core) Syntax error macroexpanding clojure.core/ns at (core.cljc:1:1). () - failed: Insufficient input at: [:ns-clauses :import :classes :package-list :classes] spec: :clojure.core.specs.alpha/package-list [clojure.lang.PersistentTreeMap$BlackVal] - failed: simple-symbol? at: [:ns-clauses :import :classes :class] spec: :clojure.core.specs.alpha/import-list

Single class imports don't require vectors, although this used to work in 1.9 (obviously!)

mgerlach-klick commented 5 years ago

I just ran into this too!

whilo commented 5 years ago

Thanks! What are you doing with the hitchhiker tree if I may ask? :)

mgerlach-klick commented 5 years ago

This shows up as a dependency on datahike. I'm afraid I'm not using it directly.

whilo commented 5 years ago

Ah, I see. Unfortunately you normally only hear back from people when there are issues in your open-source code. I have been wondering whether too good code is bad for community building ;).

simonbronner commented 5 years ago

I'm also using it via datahike :) I'm largely using it as a way to conveniently distribute ~50 megabyte data sets around - with datahike providing a pleasant way of querying it - on fairly low spec'd nodes. Just getting my toes wet at present, nothing to write home about - but it's 'just worked' - so you might be right about the lack of feedback from others!

mgerlach-klick commented 5 years ago

I can see how that would be frustrating. I am using datahike as the database for a little link aggregator side project. I'll let you know once it's anything worth looking at :)

For what it's worth, while the code is probably great, it's likely the documentation that hinders adoption. I would have felt much more confident with going with datahike if there were:

There is also at least one big difference to datascript, and that's how to open a database/connection with a schema. I had to scour the issues to find that, and that made me worry about what else there might be that i'll run into. And the schema migration thing I mentioned in the other issue also worries me.

The datahike project is super cool and I'm very grateful for it, I'm just hoping to give an idea what goes through the mind of a newbie that is considering using it!

mgerlach-klick commented 5 years ago

Oh, also, would you mind cutting a datahike release with @sxb8au 's patch so I can use datahike on Clojure 1.10, please? :)

mgerlach-klick commented 5 years ago

I thought about this some more, a lot of these points could be addressed by a few paragraphs that say "use it for..." and "don't use it for...", like sqlite does here: https://www.sqlite.org/about.html and the executive summary on the same page

simonbronner commented 5 years ago

Oh, also, would you mind cutting a datahike release with @sxb8au 's patch so I can use datahike on Clojure 1.10, please? :)

If you're using deps.edn, you can temporarily point at the deps branch of my fork until a new datahike version is released:

  io.replikativ/datahike {:git/url "https://github.com/sxb8au/datahike.git"
                          :sha "7f0f50def8cb036308155c351b71e5e2cbdf257d"}
mgerlach-klick commented 5 years ago

Thank you @sxb8au . I'm using leiningen for this project, that's definitely one of the things I appreciate about deps.edn!

whilo commented 5 years ago

I thought about this some more, a lot of these points could be addressed by a few paragraphs that say "use it for..." and "don't use it for...", like sqlite does here: https://www.sqlite.org/about.html and the executive summary on the same page

What would you extend in this section: https://github.com/replikativ/datahike#when-should-i-pick-what ?

whilo commented 5 years ago

For what it's worth, while the code is probably great, it's likely the documentation that hinders adoption. I would have felt much more confident with going with datahike if there were:

* Some more and more complete examples of projects using datahike

Do you mind open-sourcing yours? ;) In general it is best if the community could provide those.

* Some documentation around the upgrade path to datomic

Right. I guess we need to upgrade that a bit further. I had hoped that somebody would help, because the project definitely got a lot of positive feedback. In general the datahike.api should be a subset of datomic, so as long as you are using it an upgrade path to datomic should mostly consist in converting your schema and importing your datoms into it. There might be edge cases of things that are not supported in datomic, e.g. nested values, that datahike might still accept at the moment. We probably should pin that down with spec and try to keep it compatible, but this is subject to discussion, I think.

* A bit more performance info. How does it scale and when do I need to worry?

It should scale fine, but we are still exploring it. Annoyingly we haven't had the time to work on https://github.com/replikativ/datahike/issues/7 yet though. But I have Christmas break next week. I also need to do some work on datopia though. I suspect it is either an issue with the hh-tree or the datascript query engine.

* Information about the requirements. Can I run it on an AWS nano instance?

I haven't tried. It should be possible though. Feel free to report back.

* An indication which datascript version this is based on, especially now that tonsky is actively working on it thanks to the clojurists-together grant

There is also at least one big difference to datascript, and that's how to open a database/connection with a schema. I had to scour the issues to find that, and that made me worry about what else there might be that i'll run into. And the schema migration thing I mentioned in the other issue also worries me.

Well, datahike is not a mainstream database, but it is exhaustively tested with the datascript tests. You should not lose data.

The datahike project is super cool and I'm very grateful for it, I'm just hoping to give an idea what goes through the mind of a newbie that is considering using it!

Thanks a lot for your feedback :+1:

mgerlach-klick commented 5 years ago

What would you extend in this section: https://github.com/replikativ/datahike#when-should-i-pick-what ?

Probably just some stronger wording on the limitations that one would run into (like the schema, or performance/memory constraints, etc). I'd also like some more concrete steps on the datomic upgrade path, but that's probably separate. I'll think some more about it.

Do you mind open-sourcing yours? ;) In general it is best if the community could provide those.

Probably not this one, but if datahike proves as useful as I hope it to be, I'll try to write something open-sourcable. Or at least a short example that would have helped me to get started :) And if it doesn't prove as useful I will let you know why. :)

Annoyingly we haven't had the time to work on replikativ/datahike#7 yet though. But I have Christmas break next week. I also need to do some work on datopia though

Merry christmas! (Frohe Weihnachten!?). What's datopia?

I haven't tried. It should be possible though. Feel free to report back. Will do!

Would you mind releasing a snapshot with the fix? 😬

mgerlach-klick commented 5 years ago

@whilo, as promised, here's a writeup on why Datahike isn't as useful to me as I was hoping it would be: http://gerlach.coffee/posts-output/2018-12-27-taking-datahike-for-a-spin/