473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ST Blocks vs Java anonymous classes ?

I just browsed the book on "Apache Jakarta Commons".
Seems like Jakarta 'closures' are much like Smalltalk
blocks, yet not quite.

Any thoughts on whether Java's anon classes will
match up with ST blocks eventually?

I see the Java anon-class syntax as impractically
verbose. But otherwise it would almost seem able
to simulate ifTrue:ifFalse: [] etc.

Feels like all Java needs is a good "block-oriented"
class-library, just like Smalltalk's. A streamlined
syntax for inner classes perhaps. Static typing,
already optional in ShellBeans & Groovy.

Will Java become Smalltalk in disguise?
When will Java have full closures?
Thanks
- Panu Viljamaa

Sep 30 '05 #1
1 3260
Chris Uppal wrote:
[BTW, comp.lang.java has been defunct for about 10 years --
comp.lang.java.programmer would be the correct group to xpost to on this
subject]

panu wrote:

Any thoughts on whether Java's anon classes will
match up with ST blocks eventually?

There's no direct equivalent of the ^ construct. I.e. translating:

aCollection do: [:each | each somecondition ifTrue: [^ each]].

into the "obvious" Java equivalent (and leaving the #ifTrue as a Java
conditional statement) would not "return" out of the loop's caller.

You could fake it with exceptions, but it'd be unbearably messy (not to mention
slow). The only way to fix it would be to change the JVM spec, and that's not
going to happen.

-- chris

Oct 7 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
20
by: Doug Holton | last post by:
Is there any metaclass trick or something similar to allow anonymous code blocks? I'd like to be able to let users do something like this fictitious example: b = Button() b.OnClick =: print...
4
by: Demo | last post by:
What computer science concepts can I learn from Java and not from Python?
24
by: cs_hart | last post by:
I have an application in Java that I would like to port to c++ to integrate with existing c++ app. Is anyone aware of any tools to help? I found microsft has a java->c# convert, but the java app...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
26
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of...
318
by: King Raz | last post by:
The shootout site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmark on the site ... ...
5
by: Daniel | last post by:
Hi all, I have some questions regarding C#. I come from a Java background. I am using .NET 1.1. Please limit your answers to v 1.1, otherwise please state the version to which it applies to. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.