Ted Leung on the air
Ted Leung on the air: Open Source, Java, Python, and ...
Ted Leung on the air: Open Source, Java, Python, and ...
Fri, 09 May 2003
This is what counts as innovation for Java
Sun has a new article describing new language features in JDK 1.5.
I love this sidebar quote:
[11:52] |
[computers/programming/java] |
# |
TB |
F |
G |
2 Comments |
The new language features all have one thing in common: they take some common idiom and provide linguistic support for it. In other words, they shift the responsibility for writing the boilerplate code from the programmer to the compiler.In other words, we're modifying the language because we didn't have a macro system that we could do this with -- at least for generics, enhanced for, static import, and attributes. Getting rid of boilerplate code is what macros are all about. Also notice that 3 out of the 6 features in the article are being copied from C#.
In some cases modifying the language is better than using some "rewrite rules" that exist in macros to achieve a similar syntax. Among the advantages of this approach are better support from the development environment (debugger, etc.), possible compiler optimizations, transparency, and standardization.
BTW, the part about copying stuff from C# would have been the most funny thing to come out of Sun this year, if it were not for their rationale document explaining why suddenly it became better to move to 1:1 threading models, after insisting for 10 years that Windows' 1:1 model is inferior to Sun's M:N.
Posted by Ziv Caspi at Fri May 9 15:34:35 2003
BTW, the part about copying stuff from C# would have been the most funny thing to come out of Sun this year, if it were not for their rationale document explaining why suddenly it became better to move to 1:1 threading models, after insisting for 10 years that Windows' 1:1 model is inferior to Sun's M:N.
Posted by Ziv Caspi at Fri May 9 15:34:35 2003
Actually, I agree the for languages with non s-expression syntax (which I guess some people would call normal syntax ;-)) that macros have their limitations. As an example the XML literal syntax being adopted by E4X can't be done by a macro system.
As far environment support goes, we have debuggers for JSP's. I think that we can do debuggers for macros. There has been a bunch of work done in the compiler community on the use of inlining (methods and functions) for the purpose of enabling optimizations that would otherwise be prevented by the subroutine call / method lookup. So macros / inlining can actually expose opportunities for optimization.
Posted by Ted Leung at Fri May 9 22:32:03 2003
As far environment support goes, we have debuggers for JSP's. I think that we can do debuggers for macros. There has been a bunch of work done in the compiler community on the use of inlining (methods and functions) for the purpose of enabling optimizations that would otherwise be prevented by the subroutine call / method lookup. So macros / inlining can actually expose opportunities for optimization.
Posted by Ted Leung at Fri May 9 22:32:03 2003
You can subscribe to an RSS feed of the comments for this blog:
Add a comment here:
You can use some HTML tags in the comment text:
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk
To insert a URI, just type it -- no need to write an anchor tag.
Allowable html tags are:
<a href>
, <em>
, <i>
, <b>
, <blockquote>
, <br/>
, <p>
, <code>
, <pre>
, <cite>
, <sub>
and <sup>
.You can also use some Wiki style:
URI => [uri title]
<em> => _emphasized text_
<b> => *bold text*
Ordered list => consecutive lines starting spaces and an asterisk