Skip to content
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

Deprecate index()'s false return value #1127

Closed
nex3 opened this issue Feb 21, 2014 · 5 comments
Closed

Deprecate index()'s false return value #1127

nex3 opened this issue Feb 21, 2014 · 5 comments
Labels
infrastructure Non-spec task or chore requires deprecation Blocked on a deprecation cycle
Milestone

Comments

@nex3
Copy link
Contributor

nex3 commented Feb 21, 2014

79bad1f changed index() from returning false when not finding an element to returning null. As discussed in #832, we didn't think this necessitated a deprecation process since we expected users to be writing @if index(...). However, it seems that at least Foundation explicitly checks against false.

Rather than returning null immediately, we'll need to add a DeprecatedFalse value that complains if it's used in a way that is incompatible with the future null class.

@nex3 nex3 added this to the 3.3 milestone Feb 21, 2014
@nex3 nex3 closed this as completed Feb 21, 2014
@mikehdt
Copy link

mikehdt commented Mar 19, 2014

I've used a bit of "x == false" stuff in some cases where I care only about if something doesn't exist in a list.

Given we can't (or shouldn't) do x == false, and x == null also throws a warning, what should we do? I can only really think of checking for a "positive" value, and then immediately following it with an @else. But that seems kludgy.

@nex3
Copy link
Contributor Author

nex3 commented Mar 19, 2014

Why can't you write @if not x?

@mikehdt
Copy link

mikehdt commented Mar 19, 2014

You can - perfect! Thanks :) The warning from the compiler only suggested using @if x, hence why I was trying to figure a way around it.

Perhaps rather than throwing For example, instead of "@if index(...) == false", just write "@if index(...)". it could suggest @if not index(...) instead if that makes sense? (That message was from the Sass compiler in CodeKit 2).

@nex3
Copy link
Contributor Author

nex3 commented Mar 20, 2014

It's tough to get enough contextual information to figure out the perfect error message, unfortunately :-/.

@nex3
Copy link
Contributor Author

nex3 commented Mar 20, 2014

Actually, that error should just always say @if not index(...). I'll fix that.

jvah added a commit to jvah/viewports that referenced this issue Oct 7, 2014
On failure index returns now null instead of false, but viewports always
compares to false. This is easy to fix by taking a logical not of the resulting
value. For more information see sass/sass#1127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Non-spec task or chore requires deprecation Blocked on a deprecation cycle
2 participants