Skip Menu |

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

Report information
The Basics
Id: 128039
Status: rejected
Priority: 0/
Queue: Type-Tiny

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.004002
Fixed in: (no value)



Subject: allow IntRange and NumRange to only have upper bounds
For *Range types, it's currently possible to specify either 1. lower and upper bounds 2. lower bound only fI've of course come across a case where I'd like to have 3. upper bound only The obvious(?) way of signalling this would be to allow "undef" for the lower bound, e.g. IntRange[undef,20] to indicate there is no lower bound. Any thoughts? Patch welcomed? Thanks, Diab
This might want changes to Type::Parser too. Type::Parser is the module that allows you to parse a string like "IntRange[10]" into a type constraint object. I don't think it currently handles undef. Note though: IntRange[undef, 10] Int->where('$_<10') The second one is pretty much as readable as the first one. Anyway, I'll think about it.
I can't really see a use case for ranges like negative infinity to positive ten. And in the rare cases where they're wanted, they're easy to achieve using things like: Num->where('$_ < 10')
On Thu Nov 14 17:19:58 2019, TOBYINK wrote: Show quoted text
> I can't really see a use case for ranges like negative infinity to > positive ten. > > And in the rare cases where they're wanted, they're easy to achieve > using things like: > > Num->where('$_ < 10')
I was ignorant of the where method on types. That leads to a very clear expression of intent. No need to spend any more cycles on this. Thanks.