Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 85895
Status: resolved
Priority: 0/
Queue: Type-Tiny

People
Owner: Nobody in particular
Requestors: me [...] berekuk.ru
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.004
  • 0.006
  • 0.007_02
Fixed in: (no value)



Subject: Type comparison not working on 5.8
See: mmcleric@dhcp173-77-red:~$ perlbrew exec perl -MTypes::Standard=-types -e 'Bool eq Bool; print "ok\n"' perl-5.16.1 ========== ok perl-5.8.8 ========== Operation "eq": no method found, left argument in overloaded package Type::Tiny, right argument in overloaded package Type::Tiny at -e line 1. PS: One case where this is an issue is when I use Type::Tiny with Moose and diamond role application, and Moose compares attribute definitions to see if there's a conflict (see is_same_as() method in Moose::Meta::Role::Attribute).
I'd recommend using "==" to compare types, or the "equals"/"is_subtype_of"/etc methods. The reason being that two type libraries could define different type constraints called "Bool" (for example an XML type constraint library might expect bools to be strings matching /^(true|false|1|0)$/), and "eq" will just compare the type constraint names as strings, which isn't a good indication that they're the same type. I will try to fix overloading for eq soon, simply because I dislike the "no overloaded magic" error message. But I don't recommend eq to check types.
Subject: Re: [rt.cpan.org #85895] Type comparison not working on 5.8
Date: Fri, 07 Jun 2013 00:52:05 +0400
To: "bug-Type-Tiny [...] rt.cpan.org" <bug-type-tiny [...] rt.cpan.org>
From: Vyacheslav Matyukhin <me [...] berekuk.ru>
So you're saying that Moose should be patched? 06.06.2013, 23:33, "Toby Inkster via RT" <bug-Type-Tiny@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=85895 > > > I'd recommend using "==" to compare types, or the "equals"/"is_subtype_of"/etc methods. > > The reason being that two type libraries could define different type constraints called "Bool" (for example an XML type constraint library might expect bools to be strings matching /^(true|false|1|0)$/), and "eq" will just compare the type constraint names as strings, which isn't a good indication that they're the same type. > > I will try to fix overloading for eq soon, simply because I dislike the "no overloaded magic" error message. But I don't recommend eq to check types.
I missed the part where you said that Moose does this. Moose possibly should be patched; but I think Type::Tiny will need to workaround it.
Fixed in repo
0.007_04 fixes this issue. Not sure when the next stable release will be yet. Soonish.
Fixed in 0.008.