Hi ramon
this is really interesting.
Coming from CLOS I always thought and somehow would like to have
first class meta-objects for instance variable. In fact croquet needs
them (I do not like the xml used but
this is exactly that)
Object subclass: #Person
iv: (PersistentIV named: address; accessors)
or
Object subclass: #Person
requiredIV: 'name';
I have the impression that the way we describe instance variables in
Smalltalk is too monolithic. Strings are not
powerful enough.
A really interesting first steps that we were talking about with
lukas was to have
(Object subclass: #Person)
instVar: 'x y';
instVar: 'z' ;
classVar: 'ZORK'
Could be also a way. I'm not sure. In CLOS people are used to write
such a kind (not quite the same)
of class definition.
Now if the intuition that I get is that if you associate the pragmas
to method you get a
different kind of meta-description. This is true that lukas uses some
description once that
generate the first time their accessors so there is something missing
in Smalltalk from my point
of view (I was born with CLOS mop so this may explain that)
Obviously Pragmas are less flexible than class side
descriptions,
I'm not at
all suggesting there's anything wrong with Magritte, it's great,
but it
could be simpler to configure, just like Glorp vs. Rails.
Yes. I would really to see that.
Most of the time, when doing database bound web
applications, I
think one
really could use Pragmas like Rails uses macros to give hints to the
description builder to automate the construction of "MOST"
descriptions,
possibly all. It'd be really elegant if one made a field required
by simply
adding the <required> Pragma to the accessor itself, and then
having the
runtime generate both the Magritte and Glorp descriptions off the
class meta
data allowing Rails like behavior and no code required by the
developer.
For the more complex cases, you could always have the builder follow
<description: #authorDescription> to the manually configured class
side
descriptor, but seriously, most cases will be simple mappings of
Strings,
Numbers, Dates, and Memo fields directly to a matching field in the
database, and those, the most common cases, can be totally
automated and
work off Pragmas alone. Rails has proven the attraction of zero
configuration to the masses, and if Ruby can do it, Smalltalk can
do it
better.
I'm already building an ActiveRecord implementation that builds Glorp
descriptions from Magritte's meta data (working well so far), but
while
doing so, it just occurred to me that most of what I need for Glorp
could
come directly from Pragmas, and it'd be a shame to build the meta data
twice, so I just thought why not build Magritte descriptors from
Pragmas as
well. It's just an idea, but one I think I'm going to explore a
little to
see where it leads. Of course, I'll share anything worthy of
sharing if
anything pans out, if not, oh well, I'm sure I'll have fun in the
process.
Please let us know.