In the name of the bum (and c++-used eyes), i have some small criticism
about the "type and property" syntax. "Exegesis 2 - Any variables to
declare?" suggests:
my int ($pre, $in, $post) is constant = (0..2);
Two things "type and property" that belong so together are visually so
disrupted, which hurts. Additionally it is so confusing for a mainly
c++/java/c# that he would mixup "perl property" with his "c++ object
declaration" (resulting in a hard learning curve during p6 basics).
While the type "int" is more the "object" he would have expected. My
suggestion for alternativ syntax:
my constant int ($pre, $in, $post) = (0..2);
my int is constant ($pre, $in, $post) = (0..2);
This also protects from overlooking somewhere trailing properties in
growing variable lists, like in:
my int ($one, $two, $three, $four, $five, $six, $seven, $eight, $nine,
$ten) is constant = (0..9);
or complex property collections
my int ($one, $two, $three, $four, $five, $six, $seven ) is Prop(
'camel', 'perl', 'camel', 'perl' ) = (0..X);
In "alternativ syntax":
my constant int ($one, $two, $three, $four, $five, $six, $seven,
$eight, $nine, $ten) = (0..X);
here i had just looked in the head and see whats it.
my int Prop( 'camel', 'perl', 'camel', 'perl' ) ($one, $two, $three,
$four, $five, $six, $seven ) = (0..6);
here i had just looked at the tail and can count how many vars to
initialize (more like perl5, nothing disturbing inbetween).
Addition: I have an idea ;) Also i think one could recycle decleration
"is" for testing values in non-declerational-context. What if i have a
"propertyless" variable and want to test whether its would suffice a
property's spirit. When "is" would result in a boolean value i could
write my unloading perl6 like:
my ($var, $a);
print "this is a month day" if $var is Any(1..31);
print "this is a valid email" if $var is Email( 'mxcheck' );
print "debug: var was constant" if $var is constant;
print 'MasterCard' if $a is CreditCard( 'MASTER' );
print 'VISA' if $a is CreditCard( 'VISA' );
print 'i am confused' if $a is SocialNumber( 'US' );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
boolean expr
Greetings,
Murat
PS: Sorry for opening a new thread, but after rereading my last stupid
question i realized that i wasn't using perl6-talk. So i reread apo/exe
and reconfigured my whole intention ;)