On Tue, 13 Dec 2016 02:11:12 -0800, mt1...@gmail.com wrote: > Hi, > > Recently after pulling the newest rakudo/moarvm (2016.11-238-g2f502b4 > built on MoarVM version 2016.11-41-gd2139b5 implementing Perl 6.c) I > saw > errors in my code which compiled ok before. This is difficult to golf > down because it disappears when used in another context. So better > explain my way of coding. > > The error I get now is > > /home/marcel/Languages/Perl6/Projects/mongo-perl6- > driver/xt/Sxml/driver-authentication.t > .. > ===SORRY!=== > Type 'MongoDB::Server' is not declared > at > /home/marcel/Languages/Perl6/Projects/mongo-perl6- > driver/lib/MongoDB/Client.pm6 > (MongoDB::Client):152 > ------> my MongoDB::Server⏏ $server .= new( > Malformed my > at > /home/marcel/Languages/Perl6/Projects/mongo-perl6- > driver/lib/MongoDB/Client.pm6 > (MongoDB::Client):152 > ------> my MongoDB::⏏Server $server .= new( > > > The module in question has the following at the top > > use v6.c; > > use MongoDB::Server; > use MongoDB::Database; > use MongoDB::Collection; > use MongoDB::Uri; > use MongoDB::Wire; > use MongoDB::Authenticate::Credential; > use MongoDB; > > use BSON::Document; > use Semaphore::ReadersWriters; > > #------------------------------------------------------------------------------- > unit package MongoDB:auth<https://github.com/MARTIMM>; > > #------------------------------------------------------------------------------- > class Client { > ... > my MongoDB::Server $server .= new( > :client(self), :$server-name, :$loop-time > ); > .... > } > > > The server class is defined likewise as > > use v6.c; > > use MongoDB; > use MongoDB::Server::Monitor; > use MongoDB::Server::Socket; > use MongoDB::Authenticate::Credential; > use MongoDB::Authenticate::Scram; > > use BSON::Document; > use Semaphore::ReadersWriters; > use Auth::SCRAM; > > #------------------------------------------------------------------------------- > unit package MongoDB:auth<https://github.com/MARTIMM>; > > #------------------------------------------------------------------------------- > class Server { ... } > > > When e.g. the line 'use MongoDB::Uri' is moved above that of > MongoDB::Server (in the Client module) another error is returned; > > Type 'MongoDB::Uri' is not declared > at > /home/marcel/Languages/Perl6/Projects/mongo-perl6- > driver/lib/MongoDB/Client.pm6 > (MongoDB::Client):99 > ------> my MongoDB::Uri⏏ $uri-obj .= new(:$!uri); > Malformed my > at > /home/marcel/Languages/Perl6/Projects/mongo-perl6- > driver/lib/MongoDB/Client.pm6 > (MongoDB::Client):99 > ------> my MongoDB::⏏Uri $uri-obj .= new(:$!uri); > > > Now I found out that when the 'unit package' line is moved above the > use > statements, the error disappears. Can anyone shed some light over > this? > I know that use statements can be used within package, module and > class > to narrow the scope of definitions but I can't remember anything which > could explain this behavior. > > Thanks, > Marcel
Hi, How did you build your Perl 6? That version number looks suspicious. You say you're on 2016.11-238-g2f502b4, but the current HEAD/nom is 2016.11-226-g1d46004, 12 commits fewer than yours. The most obvious answer is you're in possession of a time machine and are reporting bugs from the future. In which case, would you mind including this week's lottery numbers in your reply? Let us know, Thank you.