fixed build console
[groovy.git] / TODO.txt
blob027ef1330390534c925ff814f07faa8a2a548985
1 !!!!!! Obsolete file!! Don't add anything here, use Jira instead.
3 TODO: remove irrelevant entries, add others to Jira.
5 Things to Test
6 ==============
8 * test synchronized statement
10 Core Groovy Tasks
11 =================
13 * new GroovyMethods     to be added
14         - File.grep(pattern) -> List
15         - File.grep(pattern) { closure } 
16                 allow iteration through a file for each line matching a regex pattern
17                 
18         - List.first(), List.last(), pop()
19         - Collection.removeIf { x | x > 0 }
20         - Collection.count(foo) -> returns number of objects that equal foo
22         - Map.get(key, defaultValue)
23         - Map.setDefault(key, defaultValue) for things like
24                  map.setDefault(key, []).add(newValue)
25         
26         - Object.eachProperty
27         - Object.eachPropertyName { object.getProperty(it) }
28         - Object.setProperties(foo:'abc', x:123)
29         
30         - some kind of Regexp iterator of strings like Ruby's scan
31         - maybe support Pythons' zip and reduce functions?
32         
33                 maybe add the various readonly List APIs to Object[] and *[] types
34                 if we ever support the DTD / Xed style type*, type+ then we can do the same
35                 there too
37 * SQL builder
39 sql.table("users") {
40 ÊÊÊ column('user-id') { autoinc(), primaryKey(), references('foo'), initialValue(1234) }
41 ÊÊÊ column('nickname') { varchar(200) }
42         column(name:'foo', type:'varchar(200)', references:['a', 'b'], initialValue:1234)
43   }
46 * using mixin for adding using style behaviour to any object??
48         mixin Using {
49         
50                 static using(yield) {
51                         object = this.newInstance()
52                         try {
53                                 yield(object)
54                                 object.close()
55                         }
56                         catch (Exception e) {
57                                 try {
58                                         object.close()
59                                 }
60                                 catch (Exception e2)
61                                         // ignore e2
62                                         throw e
63                                 }
64                         }
65                 }
66                 
67                 or
68                 
69                 using(yield) {
70                         try {
71                                 yield(this)
72                                 close()
73                         }
74                         catch (Exception e) {
75                                 try {
76                                         close()
77                                 }
78                                 catch (Exception e2)
79                                         // ignore e2
80                                         throw e
81                                 }
82                         }
83                 }
84         }
85         
86         then use it as 
87         
88                 new FileInputStream().using { in |
89                         ...
90                 }
92 * looks like a bug on generated methods, should use param name over any field name
93         - also it looks like there's various unnecessary stuff (creation of tuples) when invoking
94         methods
95         
96 * test identity -> hashCode + equals methods
98 * support for property converters, based on type
100 * to support dynamic mixins we should use dynamic proxies to allow
101         a groovy object to change metaclass at runtime
103 * groovy dynamic proxy of any Java object in Java-land?
104         NullObject pattern
105         
106 * immutable bean
108 * support static newInstance() method for constructors
110 * maybe split up ClassGenerator - do code gen & class gen separately
112 * mixin support...
114         SomeClass.addMixin(Foo);
115         
116         MetaClass.addInterceptor( new Interceptor() {
117                 filter(method) {
118                         return method.isPublic();
119                 }
120                 invoke(method, args) {
121                         // do something
122                         method.invoke(args);
123                 }
124         });
126         * allow meta classes to be added dynamically using closure syntax?
127         e.g. Map?
128         
130 STUFF TO PONDER
131 ===============
133 * Support multiple return values...
135         String, Number cheese() {
136                 "hello", 7
137         }
138         
139         a, b = cheese()
140         
141         also if we do this we should do assignment / swapping
142         
143                 a, b = 1, 2
144                 a, b = b, a
146 * using macros to avoid dependencies on logging stuff (say)
148         class GroovyLog {
149                 switch (System.getProperty('groovy.log.impl', 'useCommonsLogging')) {
150                         case 'useCommonsLogging': {
151                                 // lets define the new instance method
152                                 newInstance() {
153                                         return new CommonsLoggingThingy()
154                                 }
155                         }
156                         default {
157                                 newInstance() {
158                                         return new SimpleGroovyLog()
159                                 }
160                         }
161                 }
162         }
163         
164         doing things like this at compile time means no runtime dependencies. Ditto to do JDK based compiles
165         
166 UI WORK
167 =======
169 * tree demo...
171 * when named method calls are supported with default values, refactor SwingBuilder
172         so that all the creations of widgets occur with SwingFactory which would be 
173         useful in and of itself
174         - plus we should be using normal method call mechanism & for groovy to do the rest to avoid
175         the long laborious Map coding
176         
177 * FormModel.addPropertyModel(property)
178         FormModel.addClosureModel(readClosure, writeClosure)
180 * ListModel is-a List but delegates to an underlying list and has events
182 * rename tableLayout -> table and table -> grid
184 * add sortableGrid
186 * create a GroovyUI
187         -> interactive script + allows scripts to be run & objects explored
190 JUNIT WORK
191 ==========
193 * patch GroovyTestCase so that methods which return Object are included in the test. This avoids us having to
194 specify void for method return types.This requires a clever static method when we generate the
195         bytecode which can instantiate a special kind of TestSuite
196         unless there's another way?
199 OPTIMISATIONS
200 =============
201 * method invocations - if foo instanceof GroovyObject
202 then generate bytecode
204 foo.invokeMethod(method, args);
206 * could code generate the MetaClass with very efficient dynamic dispatch
207         e.g. could switch() on the method name & then use real method invocation
208         on the method instance