- attr do … end initialization
- [ ] cover all features
- reference doc
- [ ] tutorial
- more & better examples
- [ ] redo website as multiple pages
- [ ] move more things into __doodle__
- e.g. all methods which could be functions can be class methods
- ones which don’t rely on instance variables
- e.g. all methods which could be functions can be class methods
- [X] perhaps have a single doodle method e.g. doodle.validations, doodle.convert, etc.
- doodle, has, must, from, arg_order
- could use arg checking trick for doodle
- if no args, return DoodleInfo
- if block, enter doodle context
- [X] sorting
- [X] comparison
- [X] equality
See Facets compare_on
- [X] could compare attributes in arg_order by default
- [X] pp doesn’t seem to like Doodle anymore
- [X] Hash version has :list, :collect => Item, :key => :name
- [X] create spec for bug in validate! with loading YAML when default
defined
- see spec/bugs_spec.rb ‘loading bad data from yaml with default defined’
- [X] redefine has as a protocol so you can pass in other classes to
use other than Doodle::Attribute
has :thing, :using => MyClassAttribute
I could then use this to define other specialised directives which use subclasses of Doodle::Attribute, e.g. Doodle::CommandLineOption
- [X] refactor has to use specialized attribute classes for collections
- [ ] better examples (and better running example)
- [ ] more in tutorial fashion (cf. presentation) - from simple to more complex
- [X] separate page for each feature?
- [ ] tutorial?
- [ ] use capture/xmpfilter to run code
- [ ] and verify that output is correct
- [X] use webby rather than rote (not supported anymore it seems)
- [ ] document how to call factory functions defined in modules i.e. MyModule.Thing(:param => ‘abc’) rather than MyModule::Thing()
- [ ] provide full example of before vs after
- i.e. write out in full what you’d have to do to get same functionality
- perhaps also using traits and fattr
- [ ] example of using doodle to generate classes
- (e.g. write out optimised Ruby code rather than use framework) i.e. I could use the information gathered to generate a source file
- could also be in other language (e.g. Java, SQL DDL, etc.) (see SQL tables definition example)
- [ ] write spec for new #parents
- [ ] Want specs for both flavours of use (e.g. class C < Doodle
and include Doodle::Core)
- so I’ll probably need to generate the specs from templates
- [ ] reorganize specs around features
- [ ] make sure singleton inheritance working also, make sure I know exactly how I want this to work :)
- [ ] 1.9 review specs for 1.9 - seems like Object is getting updated somehow
- [ ] 1.9 also check discarding inherited method
- [X] parents
- [ ] collect_inherited
- this is pretty slow too
- [ ] embrace - maybe replace?
- perhaps use Ara Howard’s Mixin? Or similar
class Foo < Doodle end class Bar include Doodle::Core end
i.e. have a top-level class rather than
- [ ] document it (when working properly)
- the errors collection is for collecting all errors on an instance rather than raising an exception on the first error
- current way of collecting errors is not satisfactory
- need to get clearer idea of desired interaction
- errors need to be on the instance
- should clear errors before validation (or perhaps on accessing?)
- compare with AR
- errors on attributes should be collected at the instance level
- now not sure that Attributes should be Doodles - perhaps simpler
- [X] include attribute name
- [ ] do I want to save the call stack? probably
- compatibility with AR? do I need/want that?
- [X] make raise exception on invalid values optional
and compare with:
- [X] attr_accessor
- [X] attributes
- [X] traits
- [X] fattr
No surprise - doodle is much
slower
- only because this seems to be emerging standard (but
don't
use web page generation)
- may need to rename :attributes to :doodles or something similar to
avoid name clash
- changed #parent to #doodle_parent to avoid clash with ActiveSupport
- or to access through __doodle__ method
- also, validate! method, e
- doesn’t work with sequel_model at moment - conflict over initialization
- is this pointless? can I ever get full coverage?
- need to know instance variables in same way as yaml, etc.
- maybe could use yaml as intermediate representation?
or get rid of them
- [X] to_doodle - gone
- [X] don’t include @__doodle__ in inspect string
- [X] don’t break built-ins
- [X] loading from yaml should apply conversions 2008-03-24
- [X] sort out duplication of errors when calling validate! after setting incorrect value has already generated entry 2008-03-26
- [X] validate! sets instance variables with defaults
- why?
- to put errors on instance
- though this is somewhat tricky - can’t use simple reference to parent as neither would be garbage collected (bkz of cycle - better check this)
- 2008-04-06 22:12:22 use Doodle.parent (inside initialization only)
- 2008-04-17 15:57:15 use #parent instead of Doodle.parent (doesn’t seem to affect memory usage)
- I’m not happy using the class_init directive
- may be better to treat singleton attributes differently, e.g. to interpret the init at definition time rather than on object initialization
- the question then is how do you know you’re in a singleton? it seems to be one of those things that by checking to see if you are one, you become it
- solution: done on first access
- this isn’t perfect however
- [X] how should this be presented?
- class level directives (at attr_accessor level)
- [X] within block? to avoid too much namespace pollution
- e.g. doodle do … end
- see examples/datatypes.rb
- all those closures - are they leaking?
- and DOODLES hash (are objects being finalised?)
- check garbage collection of attributes
- 2008-04-06 22:12:18 - used ruby-bleak-house - doesn’t look good :(
- fixed - used @__doodle__ instead of DOODLES in DoodleInfo
- add :match from doodle/app to core
- apply before :from
- or include in :from, e.g
from String do |s| must “contain only digits” do |s| s =~ ^\d+$ end s.to_i end
from String, :match => ^\d+$ do |s| s.to_i end
- perhaps rename :pattern (after XMLSchema)
- converge on XMLSchema (e.g. PositiveInteger)
- ‘unions’ in collections, e.g. has :elements, :collect => [Element, Image, Text] has :elements, :collect => { :element => Element, :image => Image, :text => Text }
- merge doodle/datatypes and doodle/app - rationalize
- don’t make it awkward to use datatypes - if included, make available
- make it easier to define datatype helpers
- has_many instead of has :collect?
- list_of
- dict, map_of
- type-safe collections (check type when adding to list - trickier than it seems)