Add a TODO item for error
[gitmo/Moose.git] / TODO
1 -------------------------------------------------------------------------------
2 BUGS
3 -------------------------------------------------------------------------------
4
5 -------------------------------------------------------------------------------
6 FEATURES
7 -------------------------------------------------------------------------------
8
9 - DDuncan's Str types
10
11 subtype 'Str'
12     => as 'Value'
13     => where { Encode::is_utf8( $_[0] ) or $_[0] !~ m/[^0x00-0x7F]/x }
14     => optimize_as { defined($_[0]) && !ref($_[0]) };
15
16 subtype 'Blob'
17     => as 'Value'
18     => where { !Encode::is_utf8( $_[0] ) }
19     => optimize_as { defined($_[0]) && !ref($_[0]) };
20
21 - type unions
22
23 Add support for doing it with Classes which do not have
24 a type constraint yet created
25
26 - type intersections
27
28 Mostly just for Roles
29
30 - inherited slot specs
31
32 'does' can be added to,.. but not changed
33 (need type unions for this)
34
35 - proxy attributes
36
37 a proxied attribute is an attribute
38 which looks like an attribute,
39 talks like an attribute, smells
40 like an attribute,.. but if you
41 look behind the curtain,.. its
42 over there.. in that other object
43
44 (... probably be a custom metaclass)
45
46 - local coerce
47
48 [13:16]         mst     stevan: slight problem with coerce
49 [13:16]         mst     I only get to declare it once
50 [13:17]         mst     so if I'm trying to declare it cast-style per-source-class rather than per-target-class
51 [13:17]         mst     I am extremely screwed
52 [13:17]         stevan  yes
53 [13:17]         stevan  they are not class specific
54 [13:18]         stevan  they are attached to the type constraint itself
55 [13:18]         *       stevan ponders anon-coercion-metaobjects
56 [13:18]         mst     yes, that's fine
57 [13:19]         mst     but when I declare a class
58 [13:19]         mst     I want to be able to say "this class coerces to X type via <this>"
59 [13:19]         stevan  yeah something like that
60 [13:19]         stevan  oh,.. hmm
61 [13:20]         stevan  sort of like inflate/deflate?
62 [13:20]         stevan  around the accessors?
63 [13:25]         *       bluefeet has quit (Remote host closed the connection)
64 [13:27]         mst     no
65 [13:27]         mst     nothing like that
66 [13:27]         mst     like a cast
67 [13:31]         mst     stevan: $obj->foo($bar); where 'foo' expects a 'Foo' object
68 [13:31]         mst     stevan: is effectively <Foo>$bar, right?
69 [13:32]         mst     stevan: I want to be able to say in package Bar
70 [13:32]         mst     stevan: coerce_to 'Foo' via { ... };
71 [13:32]         mst     etc.
72 [13:53]         stevan  hmm
73
74 -------------------------------------------------------------------------------
75 INTERNALS
76 -------------------------------------------------------------------------------
77
78 - rationalize all the get_X methods for classes (and roles)
79
80 We have get_attribute, get_attributes_list, get_all_attributes,
81 etc. First, we need to make the method names consistent. If something
82 returns an attribute vs a name, that needs to be clear from the method
83 name. We also need to make sure that local vs. "entire inheritance
84 chain" is clear from the name.
85
86 Finally, kill all the public get_X_map methods. The hashref it returns
87 is the internal reference, and the fact that it _is_ a hashref is just
88 an implementation detail.
89
90 This is mostly a CMOP change.
91
92 - Metaclass constructors
93
94 There's a _lot_ of different conventions in here. Some things to consider:
95
96 * new vs _new
97 * allowing new( 'name', %args ) vs ( name => 'name', %args )
98 * Method->wrap vs Method->new
99
100 - Role & Class
101
102 These two share a _lot_ of logic, but it's not via shared code. Maybe
103 implement some sort of role-lit internal thing so we can have a
104 "HasAttributes" and "HasMethods" role for classes and roles.
105
106 - Moose::Meta::TypeConstraint::Parameter{izable,ized}
107
108 The relationship between these two classes is very odd. In particular,
109 this line in Parameterized is insane:
110
111     foreach my $type (Moose::Util::TypeConstraints::get_all_parameterizable_types()) {
112
113 Why does it need to loop through all parameterizable types? Shouldn't
114 it know which parameterizable type it "came from"?
115
116 - Moose::Util::TypeConstraints vs Moose::Meta::Type{Coercion,Constraint}
117
118 The Util module has _way_ too much functionality. It needs to be
119 refactored so it's a thin sugar layer on top of the meta API. As it
120 stands now, it does things like parse type names (and determine if
121 they're valid), manage the registry, and much more.
122
123 - Moose::Meta::Role::Application::*
124
125 These class names are hardcoded throughout Moose, making replacing
126 them very difficult.
127
128 - Moose::Meta::Role & attributes
129
130 The way a role stores attributes is nasty and not very
131 introspectable. It should store some sort of object, possibly one that
132 knows how to turn itself into a "real" attribute.
133
134 - Anything with a _(meta)?class method
135
136 Every method that returns a class name needs to become a rw attribute
137 that can be set via the constructor.
138
139 - The Moose::Error stuff
140
141 This is sort of half-implemented. We still use Carp directly, and the
142 internals can't decide how to throw an error (is it
143 Moose->throw_error, __PACKAGE__->throw_error, what?).
144
145 The internals need to be made consistent before we expose this to the
146 rest of the world.
147
148 -------------------------------------------------------------------------------
149 TO PONDER
150 -------------------------------------------------------------------------------
151
152 - Moose "strict" mode
153
154 use Moose 'strict'; This would allow us to have all sort of expensive tests
155 which can be turned off in prod.
156
157 - Moose::Philosophy.pod
158
159 To explain Moose from a very high level
160
161 - moosedoc
162
163 We certainly have enough meta-information to make pretty complete POD docs.
164
165
166