Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl6 changes breaking code #5882

Open
p6rt opened this issue Dec 13, 2016 · 5 comments
Open

perl6 changes breaking code #5882

p6rt opened this issue Dec 13, 2016 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Dec 13, 2016

Migrated from rt.perl.org#130338 (status was 'open')

Searchable as RT130338$

@p6rt
Copy link
Author

p6rt commented Dec 13, 2016

From @MARTIMM

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

@p6rt
Copy link
Author

p6rt commented Dec 13, 2016

From @zoffixznet

On Tue, 13 Dec 2016 02​:11​:12 -0800, mt1957@​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.

@p6rt
Copy link
Author

p6rt commented Dec 13, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 14, 2016

From @MARTIMM

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.
Hi,
Well, it is one of those undocumented features of perl 6 :-) About the
lottery​: 42 42 42 42 42 42 42 ...

What I do is pulling rakudo directly from the repo like I did this
morning(11​:05 CET);

git pull
remote​: Counting objects​: 159, done.
remote​: Compressing objects​: 100% (21/21), done.
remote​: Total 159 (delta 110), reused 102 (delta 102), pack-reused 35
Receiving objects​: 100% (159/159), 47.58 KiB | 0 bytes/s, done.
Resolving deltas​: 100% (113/113), completed with 32 local objects.
From git​://github.com/rakudo/rakudo
  5d6a8e9..7b09bee nom -> origin/nom
...

Then

perl Configure.pl --gen-moar --backends=moar
make test
make install

After the installation

perl6 -v
This is Rakudo version 2016.11-271-g416e83b built on MoarVM version
2016.11-41-gd2139b5

What about this version? is it better? 40 commits further than 238.
(maybe its a pull count instead of commit count ;-)

Thanks for all of your work everyone (I must say it somewhere someplace)
Marcel

@p6rt
Copy link
Author

p6rt commented Dec 14, 2016

From @MARTIMM

Hi,

I've rebuild rakudo from the ground up. Version I get now is
2016.11-236-g7b09bee built on MoarVM version 2016.11-41-gd2139b5 which
looks better now. However, problem still exist. Can do for now with the
unit package line before all use statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant