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
Warnings on use of undefined routine? #191
Comments
From @masak$ svn info | grep Revi There's no problem matching against an extant class: $ ./perl6 -e 'class A {}; say "mm, pie" ~~ A' But matching against an undefined class doesn't work: $ ./perl6 -e 'say "mm, pie" ~~ A' Now, it shouldn't work (because A hasn't been defined), but * The error is all wrong. The class 'Failure' has got nothing to do with it. |
From @pmichaudOn Sun, Jul 27, 2008 at 07:27:50AM -0700, Carl Mäsak wrote:
You're correct, Rakudo doesn't maintain a compile-time symbol table This is a _little_ bit trickier than it might seem at first, since Currently most refactors having to do with BEGIN/INIT/END/etc. are Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @chrisdolanIf you accidentally try to instantiate a class that has not been % perl6 -e 'class Foo::Bar::Baz { }; Foo::Bar.new;' With the attached patch, Rakudo instead dies with a more informative % perl6 -e 'class Foo::Bar::Baz { }; Foo::Bar.new;' The patch is a bit of a hack. It introduces a new() method to Module.pir | 19 +++++++++++++++++++ |
From @chrisdolanundefined_class.patchIndex: languages/perl6/src/classes/Module.pir
===================================================================
--- languages/perl6/src/classes/Module.pir (revision 32970)
+++ languages/perl6/src/classes/Module.pir (working copy)
@@ -19,6 +19,25 @@
p6meta.'register'('NameSpace', 'parent'=>moduleproto, 'protoobject'=>moduleproto)
.end
+.sub 'new' :method
+ .local pmc name, iter
+ name = self.'get_name'()
+ iter = new 'Iterator', name
+ # Drop parrot::
+ $S0 = shift iter
+ # always have at least one part
+ $S0 = shift iter
+ name_loop:
+ unless iter goto name_end
+ $S1 = shift iter
+ $S0 = concat $S0, '::'
+ $S0 = concat $S0, $S1
+ goto name_loop
+ name_end:
+ $S0 = concat 'Cannot instantiate Module. Perhaps you have not defined a class named ', $S0
+ $S0 = concat $S0, '?'
+ 'die'($S0)
+.end
=head1 METHODS
|
From @chrisdolanThere is at least one problem with the approach in this patch. I now get: % perl6 -e 'my %h = :a(1); %h.pairs' |
From @jnthnOn Thu Nov 20 20:46:18 2008, chris@chrisdolan.net wrote:
We should actually detect this at compile time, not runtime. That I will leave the ticket open, however, as something that needs to happen Thanks! Jonathan |
The RT System itself - Status changed from 'new' to 'open' |
From @chrisdolanOn Wed Nov 26 12:38:19 2008, jnthn@jnthn.net wrote:
Yes, I agree the patch is a terrible approach. I'll change the subject |
From @masakThis now works in r35994: $ perl6 -e 'say "mm, pie" ~~ A' Not sure if I can resolve the ticket though, since things are still not $ perl6 -e 'say "OH HAI"; say "mm, pie" ~~ A' |
From @jnthnOn Mon Jan 26 02:42:39 2009, masak wrote:
Since A could well be a post-declared listop, maybe we can warn about A Jonathan |
From @jnthnMerged a couple of tickets together that basically boil down to the same |
From @jnthnOn Wed Jan 28 08:02:22 2009, jnthn@jnthn.net wrote:
Or at least, we want it to at least warn, maybe...comments welcome. |
From @moritzNow dies at CHECK time: ./perl6 -e 'say "mm, pie" ~~ A' I think that's good enough to close this ticket (tested in |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#57332 (status was 'resolved')
Searchable as RT57332$
The text was updated successfully, but these errors were encountered: