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

Problem when instantiating a class which has an argument typed as a class which loads a grammar in Rakudo #600

Closed
p6rt opened this issue Jan 10, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jan 10, 2009

Migrated from rt.perl.org#62162 (status was 'resolved')

Searchable as RT62162$

@p6rt
Copy link
Author

p6rt commented Jan 10, 2009

From @masak

The following three correct Perl 6 modules give a runtime error in
Rakudo r35336.

$ cat CGI.pm
use v6;
use URI;

class CGI {
  has URI $.uri;
}

$ cat URI.pm
use v6;

class URI;

use URI​::Grammar;

$ cat URI/Grammar.pm
use v6;
grammar URI​::Grammar {
}

$ perl6 -e 'use CGI; CGI.new'
Method 'item' not found for invocant of class 'FixedPMCArray'
[...]

The fact that the last file contains 'grammar' is irrelevant; 'class'
gives the same error. The relative order of 'class URI' and 'use
URI​::Grammar' is also irrelevant.

These things make the problem go away​:

* Removing the 'URI' typing of the $.uri attribute in CGI.pm.
* Making 'class URI' use braces instead of a semicolon in URI.pm.
* Removing the dependency on URI​::Grammar in URI.pm.

@p6rt
Copy link
Author

p6rt commented Jan 10, 2009

From @pmichaud

On Sat Jan 10 07​:06​:01 2009, masak wrote​:

The following three correct Perl 6 modules give a runtime error in
Rakudo r35336.

[...]
$ cat URI.pm
use v6;

class URI;

I'm not sure this is legal Perl 6. S11 says that the "class Foo;" form
is only allowed as the first statement in the file. I recommend using
the braces form for now -- later today Rakudo will throw an exception if
the semicolon form isn't the first statement.

One could also eliminate the "use v6;", but I suspect that doesn't work
in Rakudo yet. It shouldn't be hard to fix, so I'm leaving this ticket
open until that happens.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Jan 10, 2009

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

@p6rt
Copy link
Author

p6rt commented Jan 11, 2009

From @pmichaud

On Sat Jan 10 07​:23​:00 2009, pmichaud wrote​:

On Sat Jan 10 07​:06​:01 2009, masak wrote​:

The following three correct Perl 6 modules give a runtime error in
Rakudo r35336.

[...]
$ cat URI.pm
use v6;

class URI;

I'm not sure this is legal Perl 6. S11 says that the "class Foo;" form
is only allowed as the first statement in the file. I recommend using
the braces form for now -- later today Rakudo will throw an exception if
the semicolon form isn't the first statement.

One could also eliminate the "use v6;", but I suspect that doesn't work
in Rakudo yet. It shouldn't be hard to fix, so I'm leaving this ticket
open until that happens.

Thanks!

Pm

It should now be working. Assigning ticket to moritz for appropriate
tests to be created.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Apr 24, 2009

From @moritz

After lying in my queue for a quarter year I've finally written the
test, in t/spec/S11-modules/nested.t.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Apr 24, 2009

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Apr 24, 2009
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