Skip to main content

In the middle

Posted by editor on December 3, 2004 at 9:28 AM EST

Is "would be nice" a compelling reason for a new language feature?

The Java Mustang forum continues to be a great source of new ideas and debate over enhancements to the next version of Java. One recent topic that's attracting a lot of attention is called Between operator. The idea advocated by original poster yishai is that Java should have a tertiary operator that returns true if an argument is between two values, as in:


 if (1 < var < 10) {
      System.out.println("var is greater than one and less than ten.");
   }

This has spun off a lot of responses. monika_krug notes that it's little more than syntactic sugar for 1 < x && x < 10, and tsinger observes that it could be implemented as an isInOpenInterval method. But regexguy supports the idea, saying "This is such an intuitively obvious thing to read, and I have many times, over the years, wished I could write this very thing whether I was programming java, C++, f77, ..." And then patrikbeno makes three counter-arguments:

1) i think this would break the way expressions are evaluated, operator associativeness etc
2) it is not worth introducing new keyword even if this would be a solution
3) it would be first operator that takes three arguments (var, min, max) which introduces complexity to current expression evaluation scheme

The discussion continues on this topic — several replies have been posted since I started writing today's blog, so why not head over and join in?

Also in today's Forums, walter_bruce tries to clear up misconceptions about "extended primitives": [Extended primitives are] a solution for entities [that] perhaps should have been included in Java's set of primitive types but were not. Usually because they are only needed in particular application subdomains (eg, complex numbers or 3D points). Because Java provides no way to extend its set of primitives, programmers resort to encoding these as small objects currently. However the memory (and performance) overhead for small objects can be quite high and they could be more cleanly and efficiently represented as extended primitives if Java allowed them.

The discussion about making switch() and case work with objects as well as primitives has brought up issues about languages that mix primitives and objects, like Java, and those that are objects-only, like Smalltalk. Some find Java's approach to make things harder than necessary — kcpeppe writes "Yes but even within this discussion topic (Mustang), there have been others who have spoken out against the over complication of the languge. I also know many others that are also not for the the feature but you won't most likely hear from them in this forum which is unfortunate."


In today's Weblogs, Eduardo Pelegri-Llopart calls attention to the filing of JSR-261: Java API for XML-based Web Services Addressing. "The JCP EC will be voting on this proposal in the next couple of weeks. If the proposal is approved, we expect a few additional members to have an EG that represents the interests of platform vendors, tool vendors and other types of users of the technology"

John O'Connor says You don't know beans about the next version of NetBeans: "unless you've checked out the latest NetBeans 4.0 RC1 release, you really don't know beans about NetBeans. If you've been using the 3.x line of NetBeans for a while, this new version may be somewhat challenging at first."


In Also in Java Today , Terrie Miller blogs about a classic aptitude test, asking Can You Handle the Robot Test?. "'The Robot Clerk Test' was administered by the US Census Bureau to interested Civil Service employees who had scored high on the Federal Service Entrance Exam. Those who scored high on the robot test were eligible to receive computer training and go on to better jobs in the Bureau as programmers, doing the work to process the data from the 1960 census."

Apsect-Oriented Programming can turn traditional programming models on their head, and that, in turn, can be challenging for tools like IDE's. Fortunately, IDE's and AOP are coming together. In Compiling an AspectJ Project Using Eclipse, an excerpt from the new ApectJ Cookbook, Russell Miles shows you how to download, install, and use the AspectJ Development Tools for Eclipse, which provide a graphic view of where AOP advice will be inserted into your code.


In Projects and Communities, the NetBeans community that Release Candidate 1 of the NetBeans IDE 4.0 is now available. The release plan highlights 4.0's major features: ant-based build system, J2SE 5.0 support, refactoring, mobility, web app development improvements, debugger improvements, and more.

The Jini Community's Harvester application container allows you to develop and deploy Jini applications by building "services using a servlet-like API, and the container handles some of the sticky issues in Jini - in particular it manages your codebase and provides an http server for codebase downloads.


In today's java.net News Headlines:

Registered users can submit news items for the java.net News Page using our news submission form. All submissions go through an editorial review before being posted to the site. You can also subscribe to thejava.net News RSS feed.


Current and upcoming Java Events :

Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.


Note: today's daily blog was written by Chris Adamson (invalidname), Associate Online Editor for java.net

Is "would be nice" a compelling reason for a new language feature?