Java and Closures

Posted on August 26, 2006

Gilad Bracha, Neal Gafter, James Gosling and Peter von der Ahé wrote a proposal on closures for Java language.

some code that is quite awkward to express in Java (particulary when it comes to GUI programming):

public interface Runnable {
   void run();
}

public interface API {
   void doRun(Runnable runnable);
}

public class Client {
   void doit(API api) {
      api.doRun(new Runnable(){
                    public void run() {
                         snippetOfCode();
                    }
      });
   }
}

Can be expressed quite terse and elegantly using closures:

public interface API {
   void doRun(void() func);
}

And the client like this:

public class Client {
   void doit(API api) {
      api.doRun( () {
         snippetOfCode();
      });
}

and as side benefit closures can access all class variables. The only negative aspect that authors mention is the fact that Java API was designed around interfaces and anonymous classes and can’t be changed to make full use of closures.

There are other ways to solve this problem. For example there exist an RFE for shorter syntax for common operations.

Filed Under Uncategorized | 1 Comment

ACM Concordia Exec Knowledge Base

Posted on August 15, 2006

ACM Concordia Exec Knowledge Base

Filed Under Uncategorized | 2 Comments

Concordia Professors

Posted on August 14, 2006

Some professors at Concordia should stop reading from slides, stop reusing sample assignments that come with textbook for years, give back corrected assignments before the final exam and take ESL classes between lectures.

Filed Under Uncategorized | Leave a Comment

News

Posted on August 11, 2006

Bill Gates, the world’s richest man, yesterday pledged $500m (€390m, £260m) to the UN-backed Global Fund to fight Aids, TB and malaria, further reinforcing his role as the single largest philanthropist supporting global health.

He may be a father of evil empire, but he is a good man.

A Vancouver man convicted of beating a sex-trade worker over a drug debt has been sentenced to four years in prison less time served.

Sex-trade worker, I like the way they call them, no sexims and pollitically correct, after all it’s just another trade ;-)

Filed Under Uncategorized | Leave a Comment

VMs

Posted on August 10, 2006

Somebody found that due to the bug in the URL rewrite code in Ruby on rails, it is possible to evaluate 3rd party code on server. So soon script-kiddies will start erasing hard-drives and installing root-kits. But there is nothing special about Ruby-on-rails, many popular applications written in different languages had similar problems. It is more a deficiency of a programming language itself.

I think, it is important to learn from more secure languages that do not allows such things to happen. And develop new programming languages with that in mind. It just does not make sense to allow such accidents.

But it takes a long time to develop and promote a programming language. So in the near future, when new processors will have a virtualization technology built-in (basically this will allow to run several operating systems concurently with very small overhead), I think, it would be wise to run a dedicated OS per network application.

Filed Under Uncategorized | Leave a Comment

VMs

Posted on August 10, 2006

Somebody found that due to the bug in the URL rewrite code in Ruby on rails, it is possible to evaluate 3rd party code on server. So soon script-kiddies will start erasing hard-drives and installing root-kits. But there is nothing special about Ruby-on-rails, many popular applications written in different languages had similar problems. It is more a deficiency of a programming language itself.

I think, it is important to learn from more secure languages that do not allows such things to happen. And develop new programming languages with that in mind. It just does not make sense to allow such accidents.

But it takes a long time to develop and promote a programming language. So in the near future, when new processors will have a virtualization technology built-in (basically this will allow to run several operating systems concurently with very small overhead), I think, it would be wise to run a dedicated OS per network application.

Filed Under Uncategorized | Leave a Comment

COMP445 Midterm

Posted on August 9, 2006

Oh, that’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.

Filed Under Uncategorized | Leave a Comment

COMP445 Midterm

Posted on August 9, 2006

Oh, that’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.
That’s the way, uh-huh uh-huh,
I like it, uh-huh, uh-huh.

Filed Under Uncategorized | Leave a Comment

Mr. Spook

Posted on August 6, 2006

Filed Under Uncategorized | Leave a Comment

Mr. Spook

Posted on August 6, 2006

Filed Under Uncategorized | Leave a Comment

Next Page »

© Copyright 0xDEADBEEFCAFE • Powered by Wordpress • Design by Sebastin.

free web hit counter