On 10/18/2016 04:53 PM, James E Keenan wrote:
> At this point I feel compelled to ask:
> Why?
> Why do you want to design a library with so many exportable subroutines
> and (worse!) constants?
> Now, I concede that the statements above are merely background for your
> questions about circular dependencies.  So my questions run the risk of
> sending discussion off in a different direction.  And we don't yet have
> your code to look at.
> But, on the basis of the experiences of the Perl 5 Porters in
> maintaining POSIX.pm -- which suffers from these problems, see
> http://search.cpan.org/~rjbs/perl-5.24.0/ext/POSIX/lib/POSIX.pod#CAVEATS
> -- I would be reluctant to use any library with a large number of
> exportable symbols and consequent risk of namespace pollution.

Thank you for your reply.

If you can recommend a module included in base Perl that includes the
ASCII character set in the following form, I would be happy to eliminate
128 of my constants:

    use constant NUL                        => chr   0;
    use constant SOH                        => chr   1;
    use constant STX                        => chr   2;
    use constant DEL                        => chr 127;

Same for these:

    use constant EMPTY_STRING               => '';
    use constant FALSE                      => '';
    use constant NAMESEP                    => '::';
    use constant TRUE                       => 1;
    use constant UNDEF                      => undef;

But you asked, "Why?":

    2016-10-18 18:20:59 dpchrist@t7400 ~/sandbox/perl
    $ cat constants-as-coderefs.pl
    use strict;
    use warnings;
    use constant FOO => 'foo';
    sub takes_coderef { print $_[0]->(), "\n" }
    my $rc = \&FOO;

    2016-10-18 18:21:02 dpchrist@t7400 ~/sandbox/perl
    $ perl constants-as-coderefs.pl

I'm experimenting with ideas from HOP [1], and coderefs are of primary


[1] http://hop.perl.plover.com/

Reply via email to