W3C home > Mailing lists > Public > www-style@w3.org > May 2012

Re: [css-variables] $ for declaration? (not a variable on the left)

From: Liam R E Quin <liam@w3.org>
Date: Sat, 26 May 2012 21:47:56 -0400
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-ID: <1338083276.27247.68.camel@localhost.localdomain>
On Fri, 2012-05-25 at 14:46 -0700, Tab Atkins Jr. wrote:
> Because then it's nice and easy to see the relationship, and because,
> in general, languages use the same syntax for setting and using
> variables.

There are plenty of examples both ways.

Unix shell...
b="hello world"
echo $a $b "${a}${b}"

my ($a, $b) = (3, "hello world");
print $a, $b, "${a}${b}\n";

<xsl:variable name="a" select="3" />
<xsl:variable name="b" select=" 'hello world' "/>
<xsl:value-of select="concat($a, $b)" />

XQuery and XPath / XSLT these days:
let $a := 3, $b := "hello world"
return concat($a, $b, $a, $b)

$a = 3;
$b = "hello world";
echo $a, $b, "${a}${b}\n";

JavaScript, ruby, C, C++, Java and Python don't use $ signs for
variables of course...

So I don't think it's a strong argument either way.

What matters is that the assignment/creation is obviously different from
using the value and obviously different from anything else, so people
understand what's going on.


Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Received on Sunday, 27 May 2012 01:48:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:16 UTC