Skip Menu |
Report information
Id: 126135
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at] fysh.org
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [LTA] definedness constraint ignored on native type
From: Zefram <zefram [...] fysh.org>
Date: Mon, 21 Sep 2015 19:22:03 +0100
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 455b
$ ./perl6 -e 'sub aa(int:U $i) { say $i; }; aa(3); aa(int)' 3 Cannot unbox a type object in sub aa at -e:1 in block <unit> at -e:1 The definedness constraint qualifiers :D and :U are ignored for the int type, even though in this context of a parameter declaration they work for most types. This is misleading. The qualifiers should signal an error in this situation, unless and until they are implemented so as to have the obvious effect. -zefram
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 710b
On Mon Sep 21 11:22:24 2015, zefram@fysh.org wrote: Show quoted text
> $ ./perl6 -e 'sub aa(int:U $i) { say $i; }; aa(3); aa(int)' > 3 > Cannot unbox a type object > in sub aa at -e:1 > in block <unit> at -e:1 > > The definedness constraint qualifiers :D and :U are ignored for the int > type, even though in this context of a parameter declaration they work > for most types. This is misleading. The qualifiers should signal an > error in this situation, unless and until they are implemented so as to > have the obvious effect. >
A native type cannot hold an undefined value, so writing :U should be a compile time error (it could never match, so probably indicates confusion). May as well do similar for :D. /jnthn
Subject: Re: [perl #126135] [LTA] definedness constraint ignored on native type
Date: Wed, 23 Sep 2015 21:09:26 +0100
To: "jnthn [...] jnthn.net via RT" <perl6-bugs-followup [...] perl.org>
From: Zefram <zefram [...] fysh.org>
Download (untitled) / with headers
text/plain 546b
jnthn@jnthn.net via RT wrote: Show quoted text
>A native type cannot hold an undefined value, so writing :U should >be a compile time error (it could never match
I would expect the type object (int) to match the notional int:U constraint. Rakudo is quite clear that (int) isa int, and obviously it's not defined in the relevant sense. $ ./perl6 -e 'say int ~~ int; say int.defined' True False This side of native types runs into [perl #126116], regarding inconsistent behaviour about whether the type object is allowed into a native-typed variable. -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org