relevance / diametric

Diametric is a library for building schemas, queries, and transactions for Datomic from Ruby objects.
MIT License
169 stars 28 forks source link

Requesting review of cardinality/many support #18

Closed avescodes closed 11 years ago

avescodes commented 11 years ago

I'd like to get a second set of eyes on cardinality/many support.

Note: I'm fixing the travis-ci failures in jruby now.

avescodes commented 11 years ago

(Wrong thread)

yokolet commented 11 years ago

I think cardinality/many feature is working as we expected. So, the branch should be merged to master.

One thing I'm concerned about is a type of returned class. Diametric returns Set type for values of cardinality/many, while people set Array for creation. This inconsistency might cause users' confusion.

avescodes commented 11 years ago

@yokolet The passed and returned types are definitely a concern of mine as well. I don't have a particularly strong opinion, my motivation for allowing array assignment was to make a frequent operation such as assignment to be less trouble that it would if Set was required.

So:

person.likes = Set.new("chocolate", "vanilla")

vs.

person.likes = %w|chocolate vanilla|

It's a tough call. If you think it is too confusing to the user then maybe it is best to raise a meaningful error message about type when anything other than a Set-like object is passed.

yokolet commented 11 years ago

I've thought which is better. I'd rather leave current inconsistency because Set is not an Array. To reveal the fact that Datomic returns Set has a good side effect. In any case, Datomic never returns Array. Users should aware that though they might shout "Datomic is different!"