Make SDL::Constants more polite? #34

Closed
kthakore opened this Issue Jul 26, 2011 · 8 comments

Projects

None yet

1 participant

@kthakore
Member

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 kthakore was assigned Jul 26, 2011
@kthakore
Member

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
Member

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
Member

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

@kthakore
Member

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

@kthakore
Member

Author: FROGGS
Time: 1269438543
Field: comment
Value:

@kthakore
Member

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

@kthakore
Member

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

@kthakore
Member

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

@kthakore kthakore closed this Jul 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment