datajoint/datajoint-matlab

Replace the `|` operator with `dj.OrList`

Opened this issue · 5 comments

The | operator is currently used to construct or-lists for restrictions but it is limited to restrictions by relations. In datajoint-python, we implement the explicit dj.OrList object. I propose to match the matlab implementation and deprecate the | operator.

What would be a reason not to support either syntax? Use of | sounds intuitive compared to having to use dj.OrList.

The | operator only works for objects of classes that we define and is therefore limited. dj.OrList works for any types of restrictors. If dj.OrList works, then i would rather have one correct way of doing something.

Do we support something like restricting by a cell array?

Yes, an OrList is any list. So what we really need is an AndList so that

r & a & b & c

can be expressed as

r & dj.AndList({a b c})
ixcat commented

should be implemented with #96