- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Wed, 27 Feb 2019 18:34:57 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `String Concatenation`, and agreed to the following: * `RESOLVED: work on astring-coercion-and-concatenation function` <details><summary>The full IRC log of that discussion</summary> <fantasai> Topic: String Concatenation<br> <astearns> github: https://github.com/w3c/csswg-drafts/issues/542<br> <fantasai> leaverou: There's a bunch of string value accepting proeprties in CSS, and can't use variables in there<br> <fantasai> leaverou: paths<br> <fantasai> leaverou: Lots of places where concatenation would be useful<br> <fantasai> leaverou: and don't have a way to do it<br> <fantasai> leaverou: Didn't recall any objections to the propsoal, just questions about what it's called<br> <fantasai> leaverou: I don't care, we just need a way to do it<br> <AmeliaBR> q+<br> <fantasai> chris: ppl using preprocessors take string concatenation for granted, it's simple there<br> <fantasai> chris: they're astounded when they find it's not available in raw CSS<br> <fantasai> leaverou: Primarily useful in URLs, but also useful in other places like paths<br> <fantasai> TabAtkins: I agree with the need for a function here, prefer concat() but fine with anything else<br> <chris> q?<br> <fantasai> leaverou: We've also had suggestions for a function that converts things to strings,<br> <xfq> ack AmeliaBR<br> <fantasai> leaverou: text() is generic enough to do both<br> <fantasai> string() sgtm<br> <fantasai> AmeliaBR: Problem with that is that for string coercion you often also want number formatting<br> <fantasai> AmeliaBR: so that might need to be a separate function<br> <fantasai> AmeliaBR: butwould need to be partof the system if you are going to make useful path dat from numeric variables<br> <fantasai> AmeliaBR: need to concatenate not just letters but numbers from variables<br> <fantasai> AmeliaBR: calc expressions<br> <dbaron> q+ to ask what the inputs to this function can be, and where it can be used<br> <fantasai> AmeliaBR: etc.<br> <fantasai> TabAtkins: What are the use cases for coercion? Debugging ovviousl, anything else?<br> <fantasai> leaverou: ...<br> <fantasai> Am Big in dataviz<br> <leaverou> s/.../generated content to display a variable value in the UI/<br> <leaverou> q+<br> <fantasai_> AmeliaBR: e.g. bar graphs, want to use value in drawing but also labelling<br> <fantasai_> AmeliaBR: don't want to duplicate content<br> <fantasai_> TabAtkins: I really don't want to get into string formatting<br> <fantasai_> TabAtkins: otherwise do see the value in do see value in displaying 50% on bar chart while 50% also used to size the bar chart<br> <fantasai_> AmeliaBR: So if we want to leave the generic number formatting issue for later, that's fine<br> <fantasai_> AmeliaBR: So long as we still have idea that basic concat function can take non-string values and simply print them out<br> <fantasai_> AmeliaBR: so you can use them for path data<br> <fantasai_> AmeliaBR: In path data you generally want to preserve maximum precision anyway<br> <fantasai_> leaverou: example ... interpolation<br> <fantasai_> leaverou: Don't want to define how concat() interpolates with each other<br> <xfq> ack db<br> <Zakim> dbaron, you wanted to ask what the inputs to this function can be, and where it can be used<br> <fantasai> dbaron: Reading the proposal wasn't clear to me what the inputs of this function is and what the output is in terms of types<br> <fantasai> dbaron: What CSS value types can be used in here?<br> <fantasai> TabAtkins: output tpe is tring<br> <fantasai> TabAtkins: input type is any thing, standard serialization of the token<br> <fantasai> dbaron: There will be a spec defining standard serialization of a token?<br> <leaverou> s/example ... interpolation/yes, that simplifies interpolation as well, if types of arguments were not coerced we'd need to define interpolation between two concat() calls<br> <fantasai> TabAtkins: Need that for variables anyway<br> <fantasai> TabAtkins: If it doesn't exist yet, some othe rspec is implicitly relying on it and it needs to be defined<br> <fantasai> astearns: Wrt used, it's anywhere with a string?<br> <fantasai> fremy: Exception for url?<br> <fantasai> TabAtkins: No, works in url()<br> <xfq> ack lea<br> <fantasai> TabAtkins: url() can take a string<br> <TabAtkins> s/take a string/take only a literal string, there's another issue for generic <string> input/<br> <fantasai> astearns: I'm hearing lots of nods on having this thing. Any implementer interest?<br> <fremy> (to clarify what tab said, url() can take a string but not a <string>)<br> <fantasai> astearns: From silence sounds like, yes this would be a good thing, no it's not a priority<br> <fantasai> emilio: Expectation is that you can do like sth(var(--whatev))?<br> <fantasai> emilio: Then how can you define it to be any token?<br> <fantasai> TabAtkins: var() is processed at a higher level than any value<br> <fantasai> fremy: If you want a string, you do text("string")<br> <TabAtkins> (It's specific as taking a <string> in the syntax, but in Syntax we handle url() in special ways that prevent it from taking string-producing functions.)<br> <fantasai> emilio: If it takes any token<br> <fantasai> fremy: If it's not a string, then you convert<br> <fantasai> TabAtkins: I think Emilio got it<br> <fantasai> astearns: OK, naming. What do we call the thing?<br> <fantasai> AmeliaBR: Lea suggested text(), but there's already a text() function in paged content<br> <fantasai> fantasai: How about string? was in Lea's original proposal<br> <fantasai> leaverou: sounds fine<br> <fantasai> chris: sounds fine<br> <bkardell_> lol<br> <fantasai> AmeliaBR: Sorry, confused things. It's the string() function that exists, text() does not<br> <fantasai> AmeliaBR: and already implemented<br> <chris> I care more that it exists, than what precisely it is called<br> <xfq> https://drafts.csswg.org/css-gcpm-3/#using-named-strings<br> <tantek> I for one an all for the cat() function, I bet it would poll well on Twitter 😺<br> <bkardell_> lol<br> <fantasai> astearns: Any objections to text()?<br> <chris> Lets go with text<br> <fantasai> dydz: Prefer concat(), but ...<br> <Rossen> combine()<br> <fantasai> AmeliaBR: Want names that are understandable by non-programmers in CSS<br> <fantasai> AmeliaBR: Also, we tend not to truncate identifiers in CSS<br> <chris> concat is not immediately obvious to non programmers either. both cat and concat are abbreviations<br> <fantasai> TabAtkins: We are not using cat(), tantek!<br> <tantek> 😿<br> <fantasai> bkardell_: I don't have a better suggestion, but text() is not very clear to me<br> <TabAtkins> text(50%)<br> <Rossen> +1 to bkardell_<br> <fantasai> bkardell_: There are so many ways that I coudl interpret "text"<br> <tantek> +1 to bkardell_<br> <fantasai> flatten() :P<br> <fantasai> chris: I think it's pretty clear<br> <fantasai> myles__: We should think about whether concatenation or coercion is more common use case<br> <TabAtkins> url(text("http://example.com", var(--foo)))<br> <florian> echo() ?<br> <tantek> printf()<br> <florian> printf()<br> <fantasai> AmeliaBR: text() is clear for coercion, maybe less clear for concatenation<br> <TabAtkins> No unixisms!<br> <TabAtkins> y'all weirdos!<br> <chris> and text(var(--foo)) with one param is clearer than concat(var(--foo))<br> <Rossen> stringify()<br> <Rossen> toString()<br> <TabAtkins> to-string()<br> <chris> DOTtoString<br> <dbaron> hopefully everybody has forgotten XPath by now?<br> <tantek> Time for a Twiter survey!<br> <fantasai> iank_: Spreadsheets use concatenate and concat<br> <fantasai> TabAtkins: It's terrible and hard to spell<br> <fantasai> TabAtkins: These are all great names, except for all the ones that are bad.<br> <chris> https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/concat<br> <fantasai> TabAtkins: Let's table this and put together a non-binding Twitter poll<br> <fantasai> florian: Make sure you include an international audience<br> <fantasai> bkardell_: That works best if we all promote it so let us know<br> <fantasai> leaverou: Twitter doesn't have enough space for examples, and based on what examples you use can get different reactions<br> <fantasai> TabAtkins: I'll put together coercion example and concat example, and you can review them<br> <chris> https://stackoverflow.com/questions/9493732/difference-between-text-and-string<br> <fantasai> astearns: Sounds like we'll do this and decide the name later, would be interested in implementer interest<br> <fantasai> astearns: Any objections?<br> <fantasai> RESOLVED: work on astring-coercion-and-concatenation function<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/542#issuecomment-467978463 using your GitHub account
Received on Wednesday, 27 February 2019 18:34:59 UTC