kthakore / MTFT

migrationtestfromtrac
1 stars 0 forks source link

Make SDL::Constants more polite? #20

Closed kthakore closed 13 years ago

kthakore commented 13 years ago

Current code exports everything, which pollutes the namespace of the module user. Maybe we should change it to export only what is requested, be it a single constant or a set of them (via @EXPORT_OK and %EXPORT_TAGS, respectively - See Exporter.pm for more information). This way we could have constants grouped by functionallity, like (for example):

use SDL::Constants ':events'; use SDL::Constants qw(:keys :mouse); use SDL::Constants 'CD_PAUSED';

etc.

Whoever tackles this, please look into ticket 18 first.

Also, please append to this ticket any discussion on whether to do this or not (because if we do, people will have to change their legacy code to grab the appropriate constant group, or at least do SDL::Constant ':all'.

kthakore commented 13 years ago

Author: j_king Time: 1262095798 Field: comment Value: I think it's a good idea.

It might come as a surprise to legacy code however. Is there any way we can implement both and simply emit a deprecation warning on a blank import?

kthakore commented 13 years ago

Author: j_king Time: 1262123556 Field: comment Value: http://irclog.perlgeek.de/sdl/2009-12-25

I like the %EXPORT_TAGS method myself. Would be rather easy to modify scripts/auto_constants.pl to set it up.

kthakore commented 13 years ago

Author: FROGGS Time: 1269438543 Field: status Value: accepted

kthakore commented 13 years ago

Author: FROGGS Time: 1269438543 Field: owner Value: FROGGS

kthakore commented 13 years ago

Author: FROGGS Time: 1269438543 Field: comment Value:

kthakore commented 13 years ago

Author: FROGGS Time: 1269561312 Field: status Value: closed

kthakore commented 13 years ago

Author: FROGGS Time: 1269561312 Field: resolution Value: fixed

kthakore commented 13 years ago

Author: FROGGS Time: 1269561312 Field: comment Value: Done. All constants are in their modules. They are documented and are exported by default.