- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Wed, 24 Nov 2010 20:57:30 +0000
- To: Steve Harris <steve.harris@garlik.com>
- CC: Gregory Williams <greg@evilfunhouse.com>, SPARQL Working Group <public-rdf-dawg@w3.org>
> Even some strongly typed languages have this sort of oddity, e.g. Java's StringBuffer.append() appears to take a bunch of types as an argument, but + only works on pairs of numeric types, or strings, as far as I can tell. Not being a java user, I don't know how this pans out in practice.
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html
+ works on strings if the LHS is a string.
It is exactly StringBuffer.append.
Oddly, it makes that use of "+" non-commutative.
The RHS is converted to a string by (1) whatever the base type
conversion is (int, long, etc) or (2) Object.toString().
String x = ""+1+2 ;
==>
the string "12"
That's not a good for SPARQL IMO, where just string+string -> string is
convenient.
Andy
Received on Wednesday, 24 November 2010 20:58:10 UTC