develooper Front page | perl.perl6.compiler | Postings from May 2018

[perl #122815] [BUG] nativecall sub declaration complains about'returns' type when type has been predeclared using yadda-yadda on RakudoMoar

From:
Brian S. Julin via RT
Date:
May 8, 2018 22:26
Subject:
[perl #122815] [BUG] nativecall sub declaration complains about'returns' type when type has been predeclared using yadda-yadda on RakudoMoar
Message ID:
rt-4.0.24-29149-1525818394-38.122815-80-0@perl.org

Golf and change of behavior:

$ perl6 -e 'use NativeCall; class T is repr<CPointer> is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new();'
$ perl6 -e 'use NativeCall; class T {...}; class T is repr<CPointer> is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new();'
===SORRY!=== Error while compiling -e
Cannot change REPR of T now (must be set at initial declaration)
at -e:1

Workaround:

$ perl6 -e 'use NativeCall; class T is repr<CPointer> {...}; class T is export { sub new(size_t $n) returns T is symbol<malloc> is native { * }; }; T.new(); say T.REPR;'
CPointer




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About