blob: 027ef1330390534c925ff814f07faa8a2a548985 [file] [log] [blame]
!!!!!! Obsolete file!! Don't add anything here, use Jira instead.
TODO: remove irrelevant entries, add others to Jira.
Things to Test
==============
* test synchronized statement
Core Groovy Tasks
=================
* new GroovyMethods to be added
- File.grep(pattern) -> List
- File.grep(pattern) { closure }
allow iteration through a file for each line matching a regex pattern
- List.first(), List.last(), pop()
- Collection.removeIf { x | x > 0 }
- Collection.count(foo) -> returns number of objects that equal foo
- Map.get(key, defaultValue)
- Map.setDefault(key, defaultValue) for things like
map.setDefault(key, []).add(newValue)
- Object.eachProperty
- Object.eachPropertyName { object.getProperty(it) }
- Object.setProperties(foo:'abc', x:123)
- some kind of Regexp iterator of strings like Ruby's scan
- maybe support Pythons' zip and reduce functions?
maybe add the various readonly List APIs to Object[] and *[] types
if we ever support the DTD / Xed style type*, type+ then we can do the same
there too
* SQL builder
sql.table("users") {
ÊÊÊ column('user-id') { autoinc(), primaryKey(), references('foo'), initialValue(1234) }
ÊÊÊ column('nickname') { varchar(200) }
column(name:'foo', type:'varchar(200)', references:['a', 'b'], initialValue:1234)
}
}
* using mixin for adding using style behaviour to any object??
mixin Using {
static using(yield) {
object = this.newInstance()
try {
yield(object)
object.close()
}
catch (Exception e) {
try {
object.close()
}
catch (Exception e2)
// ignore e2
throw e
}
}
}
or
using(yield) {
try {
yield(this)
close()
}
catch (Exception e) {
try {
close()
}
catch (Exception e2)
// ignore e2
throw e
}
}
}
}
then use it as
new FileInputStream().using { in |
...
}
* looks like a bug on generated methods, should use param name over any field name
- also it looks like there's various unnecessary stuff (creation of tuples) when invoking
methods
* test identity -> hashCode + equals methods
* support for property converters, based on type
* to support dynamic mixins we should use dynamic proxies to allow
a groovy object to change metaclass at runtime
* groovy dynamic proxy of any Java object in Java-land?
NullObject pattern
* immutable bean
* support static newInstance() method for constructors
* maybe split up ClassGenerator - do code gen & class gen separately
* mixin support...
SomeClass.addMixin(Foo);
MetaClass.addInterceptor( new Interceptor() {
filter(method) {
return method.isPublic();
}
invoke(method, args) {
// do something
method.invoke(args);
}
});
* allow meta classes to be added dynamically using closure syntax?
e.g. Map?
STUFF TO PONDER
===============
* Support multiple return values...
String, Number cheese() {
"hello", 7
}
a, b = cheese()
also if we do this we should do assignment / swapping
a, b = 1, 2
a, b = b, a
* using macros to avoid dependencies on logging stuff (say)
class GroovyLog {
switch (System.getProperty('groovy.log.impl', 'useCommonsLogging')) {
case 'useCommonsLogging': {
// lets define the new instance method
newInstance() {
return new CommonsLoggingThingy()
}
}
default {
newInstance() {
return new SimpleGroovyLog()
}
}
}
}
doing things like this at compile time means no runtime dependencies. Ditto to do JDK based compiles
UI WORK
=======
* tree demo...
* when named method calls are supported with default values, refactor SwingBuilder
so that all the creations of widgets occur with SwingFactory which would be
useful in and of itself
- plus we should be using normal method call mechanism & for groovy to do the rest to avoid
the long laborious Map coding
* FormModel.addPropertyModel(property)
FormModel.addClosureModel(readClosure, writeClosure)
* ListModel is-a List but delegates to an underlying list and has events
* rename tableLayout -> table and table -> grid
* add sortableGrid
* create a GroovyUI
-> interactive script + allows scripts to be run & objects explored
JUNIT WORK
==========
* patch GroovyTestCase so that methods which return Object are included in the test. This avoids us having to
specify void for method return types.This requires a clever static method when we generate the
bytecode which can instantiate a special kind of TestSuite
unless there's another way?
OPTIMISATIONS
=============
* method invocations - if foo instanceof GroovyObject
then generate bytecode
foo.invokeMethod(method, args);
* could code generate the MetaClass with very efficient dynamic dispatch
e.g. could switch() on the method name & then use real method invocation
on the method instance