# HG changeset patch
# User sourcer
# Date 1318367053 -10800
# Node ID df71a307ef9b269a32dff81e6dc1af63b71d2aea
# Parent 74c27daf2e7ba91c8cb5a43446b6835fcac68cf3
new constructor syntax
diff -r 74c27daf2e7b -r df71a307ef9b .includepath
--- a/.includepath Wed Oct 05 16:23:45 2011 +0400
+++ b/.includepath Wed Oct 12 00:04:13 2011 +0300
@@ -1,5 +1,5 @@
-
-
-
-
-
+
+
+
+
+
diff -r 74c27daf2e7b -r df71a307ef9b Lib/IMPL/lang.pm
--- a/Lib/IMPL/lang.pm Wed Oct 05 16:23:45 2011 +0400
+++ b/Lib/IMPL/lang.pm Wed Oct 12 00:04:13 2011 +0300
@@ -38,6 +38,8 @@
&property
&static
&property
+ &ctor
+ &base
)
],
compare => [
@@ -117,6 +119,24 @@
$class->static_accessor( $name, $value );
}
+sub ctor(&;$) {
+ my ( $code, $base ) = @_;
+ no strict 'refs';
+ my $class = caller;
+
+ if ($code) {
+ *{"${class}::CTOR"} = $code;
+ }
+
+ if (ref $base eq 'HASH') {
+ %{"${class}::CTOR"} = %$base;
+ }
+}
+
+sub base($) {
+ return shift;
+}
+
sub equals {
if (defined $_[0]) {
return 0 if (not defined $_[1]);