On Sun, Apr 13, 2008 at 12:09 AM, Trans <transfire / gmail.com> wrote:
>  Hi Sean,
>
>  Doodle looks very promising. I especially like the use on annotation-
>  style attribute options.
>
>  Couple of questions:
>
>   1. None of the examples define regular methods. Is Doodle just for
>  data classes?

Not at all. The examples focus on data definition because that's what
Doodle is for. However, I am finding that I'm defining fewer methods
on classes simpy because Doodle handles a lot of what those methods
would be doing. One of the nice things about Doodle is that it makes
it much clearer what are the properties of an object (attributes +
constraints) and what are its behaviours (methods). But if it's
methods you're after, the latest version has a mail.rb example
(translated from an example in Florian Frank's dslkit) which defines a
#send method :)

>   2. Are you currently using this in any of your other apps?

Yes. At work, we're using it in the development branch of what will
shortly be a production application. It handles validation of yaml
configuration files. While this is only using a subset of Doodle, it
greatly simplifies the task.

I have also been using it for my own experimental projects. For
example, I've been toying with an interactive fiction DSL, a
Ruby-centric ORM, code generation and a command-line option handler.
They're all kind of related and Doodle is making it much easier to see
and share the similarities. One of the most promising directions of
this experimentation is shared 'rich datatypes'. For example, doing
this:

class Mail < Doodle::Base
  doodle do
    email :to
    email :from
  end
  ...
end

defines attributes that accept only RFC822-compliant email addresses.
Look at examples/datatypes.rb for some sample datatype definitions and
examples/mail-datatypes.rb to see how they're used. (Note that this is
enabled in the examples, not in the lib). These are in svn on
rubyforge, not in the gem.

Having said that, Doodle is very much a work-in-progress (as will be
evident to anyone reading the code!). There's a fair bit of behaviour
that's not covered by specs and a few tortuous workarounds. In
particular, I'm finding I keep getting tied up in knots trying to
handle singleton classes consistently. I've had to use some dubious
hacks in places - the most egregious being reading an object's inspect
string to determine if it's a singleton class. (BTW, If anyone knows a
better way to discover whether self is a singleton class without
creating a singleton class in the process, I'd be grateful to learn
it.)

While I sometimes get the feeling that I shouldn't be trying to do
this in Ruby (and I'm sure you appreciate what I mean :), I am
committed to seeing this through - I'm finding it too useful and fun
to stop now :)

>  Thanks,
>  T.

Best regards,
Sean