Skip to content

Instantly share code, notes, and snippets.

Created September 6, 2014 03:19
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 anonymous/7b86c66589fd5b67feab to your computer and use it in GitHub Desktop.
Save anonymous/7b86c66589fd5b67feab to your computer and use it in GitHub Desktop.
# Perl 6
class Point {
has $.x;
has $.y = 2 * $!x;
}
my $p = Point.new( x => 1, y => 2);
# ^^^ inherited from class Mu
say "x: ", $p.x;
say "y: ", $p.y;
# CafeScript
class Point
@x
@y = 2 * @x
class main
p = Point x: 1, y: 2
say "x: " @p.x
say "y: " @p.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment