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

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...
a=3
b="hello world"
echo $a $b "${a}${b}"

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

XSLT 1
<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)

PHP
$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

-- 
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