Skip to content

Commit

Permalink
Give Routine its own .gist
Browse files Browse the repository at this point in the history
So that "say sub foo { }" will be much closer to what Data::Pretty does
and thus make it obsolete and save masak some work.
  • Loading branch information
lizmat committed Aug 4, 2018
1 parent 546d08c commit 6ad50d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Routine.pm6
Expand Up @@ -48,6 +48,15 @@ my class Routine { # declared in BOOTSTRAP
self.dispatcher.defined
}

multi method gist(Routine:D:) {
if self.name -> $name {
"&$name"
}
else {
( self.^name ~~ m/^\w+/ ).lc ~ ' { }'
}
}

multi method perl(Routine:D:) {
my $perl = ( self.^name ~~ m/^\w+/ ).lc;
if self.is_dispatcher {
Expand Down

1 comment on commit 6ad50d7

@b2gills
Copy link
Contributor

@b2gills b2gills commented on 6ad50d7 Aug 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the match can be simplified to just /^\w/ (no +)

Please sign in to comment.