add a notabs test
[gitmo/Class-MOP.git] / TODO
CommitLineData
682a6e93 1---------------------------------------------------------------------
2TODO
1396f86b 3---------------------------------------------------------------------
682a6e93 4
e060c80f 5[23:47] Theory stevan: What do you think of the use of key names as substitutes for class names that Class::Meta uses?
6[23:48] stevan Theory: key names?
7[23:48] Theory stevan: All Class::Meta classes have key names.
8[23:48] Theory They're short aliases, basically
9[23:48] stevan oh
10[23:48] Theory So Foo::Bar::App::Person might be "person".
11[23:48] Theory This is useful for a few things:
12[23:48] Theory 1. Database mapping (table/view names)
13[23:48] Theory 2. easy type specification
14[23:49] Theory 3. Use in other contexts (e.g., URLs)
15[23:49] Theory So in effect, class key names in Class::Meta are also types.
16[23:49] Theory So I can say
17[23:49] Theory has user => ( type => 'person');
18[23:49] Theory instead of
19[23:49] Theory has user => (type => "Foo::Bar::App::Person");
20[23:50] Theory Anyway, the key name stuff is essential for the ORM stuff I do.
21[23:50] Theory Which is why I'm asking you for your thoughts on it.
22[23:50] stevan where is the mapping stored?
23[23:50] stevan and how and when is it computed?
24[23:51] Theory It's just another attribute of the Meta::Class object,
25[23:51] Theory If it's not specified, it just grabs the last part of the package name.
26[23:51] Theory and lowercases it.
27[23:51] stevan but is there any global map anywhere?
28[23:51] Theory But it has to be unique.
29[23:52] Theory yes, Class::Meta stores a hash that maps key names to Meta::Class objects.
30[23:52] Theory So you can say
31[23:52] stevan k
32[23:52] stevan yeah Class::MOP has a similar thing
33[23:52] Theory my $meta = Class::Meta->for_key('person')
34[23:52] Theory Which is great for mapping URLs and database tables.
35[23:52] stevan Class::MOP::get_metaclass_by_name('Foo::Bar::App::Person')
36[23:52] Theory yes, but it's only package names, right?
37[23:52] stevan I could add Class::MOP::get_metaclass_by_key('person')
38[23:52] stevan yeah it is
39[23:53] Theory not a substitute key word.
40[23:53] Theory Yes, that's what I'm thinking, exactly.,
41[23:53] stevan yeah that would be fairly easy actually
42[23:54] stevan I have been pondering (for a very long time actually) a Smalltalk like class browser
43[23:54] stevan it would be very useful in that context
44[23:54] Theory Glad to hear it. :-)
45[23:54] * stevan jots another note onto the TODO list
c54756cd 46
682a6e93 47---------------------------------------------------------------------
48EXAMPLES TO WRITE
49---------------------------------------------------------------------
50
51- Prototype-style example
52
53Make a C::MOP::Class subclass which has an AUTOLOAD method, the
54method will DWIM depending up on the value it is passed.
55
56 Foo->prototype->say_hello(sub { print "Hello" });
57
58This will turn into this:
59
60 Foo->prototype->add_method('say_hello' => sub { print "Hello" });
61
62I am not sure how we should handle non-method arguments, mostly
63because those would be static prototype variables, which would
64translate to class package variables.
65
682a6e93 66
67
68
69
70
71
72