-
Notifications
You must be signed in to change notification settings - Fork 464
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
Relax compact error to warning #1055
Conversation
My preference is we simply just drop this error/warning completely. Mentioning it as a breaking change should be enough IMO. I don't see the benefit in keeping this code debt around. |
How about relaxing the error in 3.2.1 to a warning and removing it completely in 3.3.0 (3.2.2)? |
Sure thing! |
Thinking about this does it makes sense to go form error -> warning -> gone? Ship this in 3.2.0 instead? |
When did we introduce that error message (was a version already released with that message included)? IMO it does make sense to make people aware that the behavior has changed! But personally I don't really have a preference here ... |
I believe it was introduced in 3.2.0. IMO error -> warning -> gone make no sense. Either
|
So we haven't even released the "deprecated" error yet. Problem is that the error will disallow the use of custom functions named "compact". But we IMHO still want to inform the user that his code will no longer work the way it did. The errors seems to be a bit too much, but warnings might get overlooked by users. So IMHO it makes sense to first use an error (failing hard), then emit a soft warning and finally ignore it altogether. This should make a nice transition for users that use this function, but an error also disallows any "polyfill" implementation, so maybe going with a warning is the best option? Actually I don't see why "warn > error > gone" would make any sense at all? |
Correct.
I expect they'll notice when their code doesn't work :)
warn > error > gone and error -> gone are patterns used by the Ruby Sass team.
This makes erroring a non-starter for me. I had assumed native (libsass) functions would have the lowest priority in the function resolution process.
I think warning -> gone is the best option here unless we change the resolution order of function calls. |
@@ -1608,6 +1608,10 @@ namespace Sass { | |||
{ | |||
lex< identifier >(); | |||
string name(lexed); | |||
if (name == "compact") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would not incorrectly warn users even if they have defined their own compact
function? Could we move the warning into the functions.cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also saw that, but wasn't sure how to better address it. But we surely can move that to some more appropriate place. IMO we might be able to add a specific if clause just before internal functions are resolved, and if the name is compact
emit this warning!?
@mgreter I think I have misunderstood the issue here.
I thought you meant the current master made it impossible for users to define their own @function compact() {
@return foo; }
foo {
bar: compact(); }
The specs you've mentioned are invalid and should be deleted as I think we should leave the current behaviour and remove the error completely 3.2.1/3.3. Thoughts? |
3f1c048
to
58ffae1
Compare
This relaxes the error to a warning. Otherwise the function cannot be used by user-code. It will now just spit out a warning, but behavior in output matches ruby sass. Makes a few spec tests to pass now: