On 2013-11-13 16:46, David Mertens wrote:
Linda -
I think that you got feedback that you did not even ask for: a clear
response from the module-authors community to not name your module
Types. Might I suggest Types::LAW. Obviously, LAW are your initials,
but it also lets you brag about laying down the LAW for type
constraints. :-)
But that's not what the module does. It lets you use the Perl Types w/o
quotes
and lets you test for ref's being of a type, that replaces this widely
used, but
potentially buggy paradigm:
bless $this={}, $class unless ref $this;
or this:
$this={} unless ref $this;
bless $this [,$class];
then...
$this->{xxx} = blah;
---
bless $this={}, $class unless HASH $this;
a "ref" could be to any type... but how many people check for the correct
type.
Now if you can truthfully say that more than 50% of the modules on CPAN, do
this (and that less than 50% use 'ref' as a shortcut for meaning of some
type
(or package/classname):
$this={} unless ref $this eq 'HASH';
When I look on CPAN, I see...
elsif ($refx eq 'SCALAR' || $refx eq 'REF') {...}
elsif ($refx eq 'HASH') {..}
elsif ($refx eq 'CODE') {..}
elsif ($refx eq 'GLOB') {}
Which would at least have looked better as:
elseif(SCALAR $refx || REF $refx)...
elsif (HASH $refx)...
(but likely could have used a HASH)
Even Types.. pre-released version fell into mindlessness
(condensed a bit for brevity):
sub ARRAY (;$) {my $p = $_[0]; my $t='ARRAY';
return @_ ? ref $p eq $t : $t; }
sub HASH (;$) { my $p = $_[0]; my $t='HASH';
return @_ ? ref $p eq $t : $t; }
sub SCALAR (;$) {my $p = $_[0]; my $t='SCALAR';
return @_ ? ref $p eq $t : $t; }
But I'd try not to release such for CPAN -- only 1 sub
for defining them all.
BEGIN {
eval '# line ' . __LINE__ .' '. __FILE__ .'
sub ' . $_ . ' (;*) {
return @_ ? isatype($_[0], '.$_.') : '.$_.' } '
for @TYPES; }
---
People think that because have errors, my code sucks.
They haven't looked at my code.
I developed and used 'P' for 3 years before I felt it was
ready for CPAN. There errors I got on CPAN were ~60%
in using CPAN or it's test setup.
Compared to the code already in CPAN and in
the perl core?? Mine doesn't look so bad.
Not saying it's the best.. but that depends on
your criteria.
A bug in perlio I ran into and reported a
few months ago causes a ~50% increase
in execution time (when it is avoided).
Not avoiding it and it's an infinite increase.
Was told it wasn't worth fixing until
5.20.x...
So far the people who have not wanted it at the
top level said that before even knowing what
it did. I don't think they'll change their
minds, but who knows?
...