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

promote 'use' to happen at compile time #321

Closed
p6rt opened this issue Sep 16, 2008 · 4 comments
Closed

promote 'use' to happen at compile time #321

p6rt opened this issue Sep 16, 2008 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 16, 2008

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

Searchable as RT58936$

@p6rt
Copy link
Author

p6rt commented Sep 16, 2008

From @mberends

With Rakudo 0.7.0-devel r31065 inheritance works as in this
single file​:

  class Dog {
  has $.name is rw;
  method bark() {
  say "$.name says Woof!";
  }
  }

  class Pug is Dog {
  method set_name( $n ) {
  $.name = $n;
  }
  }

  my $pot = Pug.new();
  $pot.set_name( 'Spot' );
  $pot.bark();

But move class Dog { ... } into Dog.pm and import it with
'use Dog;' and Rakudo is like 'Attempt to inherit from
non-existent parent class'.

On 2008-09-16 in #perl6 moritz explains that 'use' happens
(erroneously) at run time whereas it should happen at
compile time, and gives a
workaround 'BEGIN { use Dog; };' that works.

Synopsis 11 topic "Runtime Importation" contrasts 'use' and
'require' in terms of time. This request is to obviate the
workaround.

@p6rt
Copy link
Author

p6rt commented Sep 16, 2008

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

@p6rt
Copy link
Author

p6rt commented Sep 18, 2008

From @jnthn

On Tue Sep 16 13​:04​:11 2008, mberends@​flashmail.com wrote​:

...
But move class Dog { ... } into Dog.pm and import it with
'use Dog;' and Rakudo is like 'Attempt to inherit from
non-existent parent class'.

This bug is like fixed.

Well, kinda. Your example now runs. However, modules using modules then
causes some fun (though I'm not convinced this change has made the
situation worse), and this won't play so nicely with pre-compiled
modules. Those'll want tickets of their own, though, so resolving this
ticket since use has been promoted to happen at runtime now.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Sep 18, 2008

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

@p6rt p6rt closed this as completed Sep 18, 2008
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant