canjs / can-connect

Model layer utilities for every JavaScript framework! Assemble real-time, high performance, restful data connections.
https://canjs.com/doc/can-connect.html
MIT License
29 stars 16 forks source link

remove dependency on can-set #411

Closed justinbmeyer closed 6 years ago

justinbmeyer commented 6 years ago

For CanJS 5.0, can-query will be the default instead of can-set. This issue discusses how to remove can-set as a dependency and replace it with can-query. There's a few options, but first the problem:

Problem

A bunch ofcan-connect code assumes the existence of a can-set algebra or creates one if one doesn't exist. For example, in real-time:

canSet.has(set, props, self.algebra)

This makes it so we must have some form of algebra available by default. This means importing an algebra.

Dangerous, but possible

can-query has a compatibility mode that passes all can-set tests. We could simply import that, and use that as the default algebra.

It's likely this will cause bugs during an upgrade, but we can fix these. Eventually, can-query can be fully backwards compat.

Safe, but slow to discover compat bugs

Alternatively, I can start working on can-connect@3.X right now. Have it use can-query everywhere, and if people want to upgrade, they change:

var canSet = require("can-set")

To

var canSet = require("can-query/compat/compat");

Everything else should be the same.

My Preference

I think I like the Safe option because it will mean less over-all work for me. But it will force a CanJS 5.0.

BigAB commented 6 years ago

The Safe way seems like the "right" way, where we won't be causing a mess for ourselves to untangle down the road.

But it will force a CanJS 5.0.

We're not really running out of integers

My vote: logo-safeway-d

matthewp commented 6 years ago

A bunch of CanJS code assumes the existence

Where? I'm surprised that any canjs code cares about this other than can-connect...

BigAB commented 6 years ago

I'm surprised that any canjs code cares about this other than can-connect..

@matthewp is right, actually, that is probably the problem we should "solve", making sure a bunch of code doesn't assume there is a can-set/can-query

justinbmeyer commented 6 years ago

I meant a bunch of can-connect code. And it doesn't just assume an algebra is passed to it .... it assume the presence of a "default" algebra.

justinbmeyer commented 6 years ago

completed for CanJS 5.0