Re: [css-values-4] String concatenation

On Tue, Jul 22, 2014 at 2:54 PM, Liam R E Quin <liam@w3.org> wrote:
> On Tue, 22 Jul 2014 14:14:51 -0700
> "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>> On Tue, Jul 22, 2014 at 9:47 AM, François REMY
>> > We can however do the exact same thing within "calc".
>> >
>> >    calc("a" + "b") // "ab"
>> >
>> > But it means that calc() may end up having different types depending on its
>> > content (albeit it is possible to know it at parse time)
>>
>> Already completely true - calc() can represent a <number>, an
>> <integer>, a <length>, etc depending on its contents.
>
> You also have to consider what calc(attr("data-quantity") + 1) should do,
> (1) if data-quantity has the value "hello"
> (2) if data-quantity has the value "6"
> and (3) if you our answers to 1 and 2 are different in nature, how do we guarantee string concatenation when the att value appears numeric, or, how do we get addition?
> (4) if the data-quantity has the value "14 cathedrals" should I get "15" back?

Already defined - without an explicit data-type specified in attr(),
it defaults to representing a string, so that calc() expression is a
syntax error.

~TJ

Received on Tuesday, 22 July 2014 21:59:47 UTC