The book of inspiration

July 13, 2009

Nobody likes the records that I play

Filed under: jsc — Tags: , , — zproxy @ 7:02 am

It is time to make yet another release of my jsc compiler. This time around you can finally use anonymous non generic delegates with java. Coolness! Subscribing to events and threading is now much easier. For applets you’d need to write a delegate to interface wrapper tho…

In the release you have a project template at C:\util\jsc\templates\OrcasJavaConsoleApplication.zip

At this time I modified it to show off the anonymous delegate support. In debug build mode this project can be debugged using F5 in Visual Studio on .net. If release build was selected the jsc compiler will be invoked as a post build event to generate java source code then javac and jar will be invoked. To run the new java package you need to start the tools/run.jar.bat.

javaevents by you.

How will that delegate keyword work out in java source code you ask? Here is the Program.java for you to inspect.

javaevents2 by you.

As you can see there is some magic involved, where magic is the compile time code generation. While jsc has been around for years – it took just that long to actually implement the delegate support. It is running via reflection and as such not really that performant, but at this time we cannot take a function pointer in java can we.

PS. It seems sourceforge is not showing statistics for me anymore – whats up with that?

About these ads

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 81 other followers

%d bloggers like this: