-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type errors for operators? #26
Comments
I understand that it's annoying to not get type errors and we do have a plan for improving the situation, but let me first explain the reasons for why we can't just naively add type errors:
We do agree that it's annoying during development so the plan is to introduce a warning concept (see #16). This would be a flag you can pass to the backend ( Does this sound good? |
Thanks, that's a helpful explanation. I confess that I find the two given reasons to be a little odd, but my questions would probably prove your overall point: that adding type errors to an existing system turns up all kinds of ugly edge case questions. The warning idea sounds like the best in the circumstances, as long as GROQ queries are read only (and it looks like there's no plan to change that). The nice side effect of providing multiple warnings from a query is that it shows the user all the distinct problems with the query, not just the first one. (I would consider the example you give in reason 2 to be a single problem, not a separate problem for each document with numeric IDs.) |
I understand that some of these issues are bit vague when you're not aware of the processing we do internally to optimize it. Here's maybe a better example if you're interested: Look at the query Internally we have an index on the |
At present, operators just return
null
on type failure (e.g.:3 + "str"
). I'd much rather have this blow up with a useful error than have to check all query results for buriednull
s.The text was updated successfully, but these errors were encountered: