You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig L Russell <Cr...@Sun.COM> on 2005/12/28 04:00:40 UTC

Issue 152: Redundant IMPORTS keyword

Javadogs,

The keyword IMPORTS seems to be redundant. It introduces a series of  
statements each of which begins “import ...;”. The keyword import  
could stand alone without the introductory IMPORTS.

I think it would be better if we omitted the IMPORTS keyword  
entirely, so e.g. instead of:
SELECT UNIQUE firstname, lastname
INTO FullName
FROM Employee
WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
VARIABLES Project p
IMPORTS import org.apache.jdo.tck.query.result.classes.FullName;
import org.apache.jdo.tck.pc.company.Person
import org.apache.jdo.tck.pc.company.Project;

we would have:
SELECT UNIQUE firstname, lastname
INTO FullName
FROM Employee
WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
VARIABLES Project p
import org.apache.jdo.tck.query.result.classes.FullName;
import org.apache.jdo.tck.pc.company.Person
import org.apache.jdo.tck.pc.company.Project;

Craig

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Issue 152: Redundant IMPORTS keyword

Posted by Michael Bouschen <mb...@spree.de>.
Hi Matthew,

>Provided that we could use "import" or "IMPORT", that would be fine.
>  
>
this would be the first case that we support a Java keyword in its upper 
case form. According to the spec keywords include Java keywords and 
JDOQL keywords. Only the JDOQL keywords have an all-lower-case and an 
all-upper-case form. So support for the upper case version IMPORT seems 
to be inconsistent with the above rule.

> 
>An alternative, although not so compatible between the API and string
>versions, is to support the keyword "import" followed by a comma-separated,
>semicolon-terminated list of imports:
>  
>
I don't have a strong opinion about the comma separation, but if we want 
to support this we need to do the same for the declaration of variables. 
What I really do not like is making a difference between the API version 
and the single-string representation of a JDOQL query. This is confusing 
for the user and requires two different implementations of the import 
handling.

I support the original proposal which just skips the keyword IMPORTS.

Regards Michael

> 
>SELECT UNIQUE firstname, lastname 
>INTO FullName 
>FROM Employee 
>WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
>VARIABLES Project p 
>IMPORT org.apache.jdo.tck.query.result.classes.FullName,
>org.apache.jdo.tck.pc.company.Person, org.apache.jdo.tck.pc.company.Project;
> 
>If we updated the spec (14.6.4) to allow this comma-separated,
>semicolon-terminated list in addition to the initial syntax, I think it
>would be intuitive:
> 
><proposal>
>14.6.4 Import statements
>The import statements follow the Java syntax for import statements. Import
>on demand is
>supported.
> 
>Additionally, import statements may be expressed as a comma-separated,
>semicolon-terminated list of elements.  For example, both
> 
>import org.example.Foo;
>import org.example.Bar;
>import org.example.util.*;
> 
>and
> 
>import org.example.Foo, org.example.Bar, org.example.util.*;
> 
>would be supported.
></proposal>
>
>-----Original Message-----
>From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
>Sent: Tuesday, December 27, 2005 7:01 PM
>To: JDO Expert Group; Apache JDO project
>Subject: Issue 152: Redundant IMPORTS keyword
>
>
>Javadogs, 
>
>
>The keyword IMPORTS seems to be redundant. It introduces a series of
>statements each of which begins "import ...;". The keyword import could
>stand alone without the introductory IMPORTS.
>
>
>I think it would be better if we omitted the IMPORTS keyword entirely, so
>e.g. instead of:
>SELECT UNIQUE firstname, lastname 
>INTO FullName 
>FROM Employee 
>WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
>VARIABLES Project p 
>IMPORTS import org.apache.jdo.tck.query.result.classes.FullName; 
>import org.apache.jdo.tck.pc.company.Person 
>import org.apache.jdo.tck.pc.company.Project; 
>
>
>we would have:
>SELECT UNIQUE firstname, lastname 
>INTO FullName 
>FROM Employee 
>WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
>VARIABLES Project p 
>import org.apache.jdo.tck.query.result.classes.FullName; 
>import org.apache.jdo.tck.pc.company.Person 
>import org.apache.jdo.tck.pc.company.Project; 
>
>Craig
>
>
>Craig Russell
>
>Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>
>408 276-5638 mailto:Craig.Russell@sun.com
>
>P.S. A good JDO? O, Gasp!
>
>
>
>  
>


-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			


RE: Issue 152: Redundant IMPORTS keyword

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
Provided that we could use "import" or "IMPORT", that would be fine.
 
An alternative, although not so compatible between the API and string
versions, is to support the keyword "import" followed by a comma-separated,
semicolon-terminated list of imports:
 
SELECT UNIQUE firstname, lastname 
INTO FullName 
FROM Employee 
WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
VARIABLES Project p 
IMPORT org.apache.jdo.tck.query.result.classes.FullName,
org.apache.jdo.tck.pc.company.Person, org.apache.jdo.tck.pc.company.Project;
 
If we updated the spec (14.6.4) to allow this comma-separated,
semicolon-terminated list in addition to the initial syntax, I think it
would be intuitive:
 
<proposal>
14.6.4 Import statements
The import statements follow the Java syntax for import statements. Import
on demand is
supported.
 
Additionally, import statements may be expressed as a comma-separated,
semicolon-terminated list of elements.  For example, both
 
import org.example.Foo;
import org.example.Bar;
import org.example.util.*;
 
and
 
import org.example.Foo, org.example.Bar, org.example.util.*;
 
would be supported.
</proposal>

-----Original Message-----
From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
Sent: Tuesday, December 27, 2005 7:01 PM
To: JDO Expert Group; Apache JDO project
Subject: Issue 152: Redundant IMPORTS keyword


Javadogs, 


The keyword IMPORTS seems to be redundant. It introduces a series of
statements each of which begins "import ...;". The keyword import could
stand alone without the introductory IMPORTS.


I think it would be better if we omitted the IMPORTS keyword entirely, so
e.g. instead of:
SELECT UNIQUE firstname, lastname 
INTO FullName 
FROM Employee 
WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
VARIABLES Project p 
IMPORTS import org.apache.jdo.tck.query.result.classes.FullName; 
import org.apache.jdo.tck.pc.company.Person 
import org.apache.jdo.tck.pc.company.Project; 


we would have:
SELECT UNIQUE firstname, lastname 
INTO FullName 
FROM Employee 
WHERE salary > 1000 && projects.contains(p) && p.budget > 30000
VARIABLES Project p 
import org.apache.jdo.tck.query.result.classes.FullName; 
import org.apache.jdo.tck.pc.company.Person 
import org.apache.jdo.tck.pc.company.Project; 

Craig


Craig Russell

Architect, Sun Java Enterprise System http://java.sun.com/products/jdo

408 276-5638 mailto:Craig.Russell@sun.com

P.S. A good JDO? O, Gasp!