-
Notifications
You must be signed in to change notification settings - Fork 715
[css-functions-mixins] Handling superfluous arguments #11190
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
Comments
@JaneOri Can we use this issue to discuss (2) specifically? ("If my custom function only takes 1 param, is it okay to call it and still pass in 10 values where the last 9 are ignored?") If yes, we can we rename the issue to something like |
Yeah, (1) isn't an issue, just a question (and the answer is "yes"). I've renamed this issue. And as for "The current functions spec does not appear to mention this yet", it is called out in Example 3, but it's not in the grammar because it's not custom-functions specific; it's a new generic functionality defined in Values 5 for any function that takes an "arbitrary value" argument. For (2), I don't think that I have a strong opinion either way. I think I'm lightly inclined towards making it an error, as it is in most programming languages (and in CSS for built-ins). The use-case you mention (building arrays using custom functions) should be addressed more directly, I think. I've been sitting on an nth-item() suggestion for a long while which would do this, and actually passes the index as an argument so it's more dynamically usable. |
I agree with Tab here:
|
excellent, I appreciate the responses and appreciate your conclusions! apologies for the my delay in responding, I hadn't checked my GH notifications in over a week - been busy with fun stuff! |
The CSS Working Group just discussed
The full IRC log of that discussion<miriam> go for it<kbabbitt> TabAtkins: question raised, what to do if more arguments passed than defined <kbabbitt> ... is this invalid, are arguments ignored, or something else <kbabbitt> ... some discussion back and forth in issue, conclusion we're coming to is to make variable-arity part of validity of function call <kbabbitt> ... so invalid call if wrong number of arguments passed <kbabbitt> ... if we want to do variable-arity functions we can do that more explicitly <kbabbitt> ... unless anyone has a good argument for doing something else with too many arguments, we'll stick with plan in the issue <kbabbitt> ... which is to make it an invalid function call <kbabbitt> astearns: comments/questions? <kizu> +1 <kbabbitt> Proposed: If you have a function call with too many arguments, it's invalid <miriam> +1 <kbabbitt> RESOLVED: If you have a function call with too many arguments, it's invalid |
Copying from the main thread #9350 (comment)
.
@mirisuzanne replied:
.
@tabatkins replied
.
I LOVE the option to not expand the args using the curly braces. Awesome
The current functions spec does not appear to mention this yet
Splitting into separate args by default is an exciting possibility, I agree it's good (great!) so I really appreciate it! ty!
The 2nd question though appears to be the main discussion point for now!
Thank you!
The text was updated successfully, but these errors were encountered: