http://qs1969.pair.com?node_id=234125


in reply to Re: "Perl Idioms for Java" Underway at Sourceforge.net
in thread "Perl Idioms for Java" Underway at Sourceforge.net

I haven't looked at the upcoming generics framework, so I have no idea about it's usefulness here. That said, I'll be the first to admit that several of the methods are of dubious value, particularly pop, push, et al which are essentially just wrappers around equivalent Java methods. The Collections framework is really very good once you get past its sheer verbosity.

The idea behind the Block is that you create an anonymous inner subclass that contains the code you want to execute. To be honest I'm not completely sure what it would look like with a delegate class in there, but my goals were: 1) to mimic the Perl functions not just in behavior but in user interface, and this was the only way I could think to duplicate a bare block; 2) keep the interface simple otherwise the point would be lost, hence a single Block class; 3) give the feel of a builtin function.

With respect to threading, I take it you're referring to the use of static instances of Context? I will probably end up synchonizing the relevant methods to deal with that, which isn't a perfect solution but I really don't want to require the programmer to create an instance of the class just to encapsulate that one thing.


"The dead do not recognize context" -- Kai, Lexx