Skip to content

Instantly share code, notes, and snippets.

@Ovid
Created January 9, 2015 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ovid/a935ab3b93300d75d501 to your computer and use it in GitHub Desktop.
Save Ovid/a935ab3b93300d75d501 to your computer and use it in GitHub Desktop.
String Overloading in Perl 6
class Point {
has $.x = 0;
has $.y = 0;
method Str {
say "[{$.x},{$.y}]";
}
}
my $point = Point.new;
say $point;
# Point.new(x => 0, y => 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment