On 14/09/2011 00:30, John Imrie wrote: > > Would one of the following pragma work > > use latest; > use version::latest; > use latest::version; > > Then we have > > use 5.x where x <16 := use at least version 5.x > > use 5.x where x >= 16 := use exactly version 5.x, with all the > semantics of that version except I'd like to propose it really means > use the max known version of the interpreter of version 5.x.00 to 5.x.99 > > use latest := Use the semantics of the interpreters version; > > This gives us the opportunity to do something like > > use latest; > my @features = latest::features; > die "no given/when" unless grep {$_ eq 'switch'} @features > > John I had another thought having sent the above. I'd like to see a class method 'feature::where()' With no parameters it returns a hash keyed on feature name. Each value in the hash is a hash ref keyed on the function name/keyword the feature provides and the value is the fully qualified function name. With a parameter it returns a hash ref keyed on the function names/keywords that that feature provides. eg for 5.10 %features = frature::where() %features containes ( say => {say => 'CORE::say'}, state => { state => 'CORE::state'}, switch => { given => 'CORE::given', when => 'CORE::when' } ) Some future version of Perl may return ( say => {say => 'Implement:::Say::say'}, state => { state => 'Clasic::Perl::state'}, switch => { given => 'CORE::given', when => 'CORE::when' } ) The inner most hash should be magical so you can do $features{say}{say}->('This is from feature say, no matter where it's implemented'); or feature::where(say)->{say}->('This is from feature say, no matter where it's implemented'); This could be used internally to move existing keywords out of the core without unduly effecting existing code. e.g. A new feature called 'sysV' could be introduced to handle all the system V keywords and this mechanism could then be used to move them selectively out of the core in future versions without having to modify the existing scripts moe than ensuring that the sysV feature is activated. JohnThread Previous | Thread Next