W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > August 2002

Re: Java global implicit typing

From: Sergey Melnik <melnik@db.stanford.edu>
Date: Sun, 11 Aug 2002 14:46:16 +0200
Message-ID: <3D565C98.8010608@db.stanford.edu>
To: Mike Dean <mdean@bbn.com>
CC: RDF Core <w3c-rdfcore-wg@w3.org>

Mike Dean wrote:

> Sergey,
> 
> Below is my example of why I see Java (and C++) as employing
> global implicit typing.  I can use the same literal
> (constant) value with a variety of numeric types, and don't
> have to change it if the type changes among the numeric
> types.
> 
> 	Mike
> 
> lass globalimplicit
> {
>     public static void main(String args[])
>     {
>         short s;
>         int i;
>         float f;
>         double d;
> 
>         s = 5;
>         i = 5;
>         f = 5;
>         d = 5;
>     }
> }

Right; however,

String s;
char c;

c = 5;
s = 5;

won't work.

A general observation: Java syntax corresponds to RDF/XML, whereas Java 
bytecode can be viewed as a counterpart of RDF abstract model. In the 
bytecode, all of the above constants are "locally typed" 
(http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#20080). 
That is, the Java compiler simply provides a convenience mechanism to 
free you from explicit typing of (some!) literal constants. RDF parsers 
(e.g., NTriple parser) could do a similar job...

Sergey
Received on Sunday, 11 August 2002 08:46:25 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:50:25 EDT