X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=TODO;h=545760039601e94409bd6a32b07aa0bc0d4289d7;hb=83dcb8665835751e1c79b6e44df247d25cd256fd;hp=242c278eda5d4a7e224721974e35f14f8b36969e;hpb=17265e0312d2a6d73d81e310f99cd7889f94b21b;p=gitmo%2FMoose.git diff --git a/TODO b/TODO index 242c278..5457600 100644 --- a/TODO +++ b/TODO @@ -105,6 +105,80 @@ over there.. in that other object [13:32] mst etc. [13:53] stevan hmm +----------------------------------------------------------- +-- Type Constraints refactor +----------------------------------------------------------- + +- add support for locally scoped TC + +This would borrow from MooseX::TypeLibrary to prefix the TC with the name +of the package. It would then be accesible from the outside as the fully +scoped name, but the local attributes would use it first. (this would need support +in the registry for this). + +- look into sugar extensions + +Use roles as sugar layer function providers (ala MooseX::AttributeHelpers). This +would allow custom metaclasses to provide roles to extend the sugar syntax with. + +(NOTE: Talk to phaylon a bit more on this) + +- allow a switch of some kind to optionally turn TC checking off at runtime + +The type checks can get expensive and some people have suggested that allowing +the checks to be turned off would be helpful for deploying into performance +intensive systems. Perhaps this can actually be done as an option to make_immutable? + +- misc. minor bits + +* make the errors for TCs use ->message +* look into localizing the messages too +* make ANON TCs be lazy, so they can possibly be subsituted for the real thing later +* make ANON TCs more introspectable +* add this ... + +# +# Type Definition +# +subtype 'Username', + from 'Str', + where { (/[a-z][a-z0-9]+/i or fail('Invalid character(s)')) + and (length($_) >= 5 or fail('Too short (less than 5 chars)')) + } +on_fail { MyException->throw(value => $_[0], message => $_[1]) }; + +# fail() will just return false unless the call is made via +$tc->check_or_fail($value); + +* and then something like this: + +subtype Foo => as Bar => where { ... } => scoped => -global; +subtype Foo => as Bar => where { ... } => scoped => -local; + +# or + +subtype Foo => as Bar => where { ... } => in __PACKAGE__ ; + +# or (not sure if it would be possible) + +my $Foo = subtype Bar => where { ... }; + +# ---------- + +[17:10] stevan: it should do it if I pass coerce => 1 as part of the attribute definition +[17:12] autarch: what I am not 100% sure of is how to tell it to deep coerce and when to not +[17:13] cause a basic coerce is from A to B +[17:13] hmm +[17:13] which is valid for collection types too +[17:13] deep coercion is what you are asking for +[17:13] yeah +[17:13] so perhaps we add deep_coerce => 1 +[17:13] which will do it +[17:13] that's fine for me +[17:13] k + +coerce_deeply => 1 # reads better + ------------------------------------------------------------------------------- INTERNALS -------------------------------------------------------------------------------