Looking at why the Perl was even shorter than the Lisp: not needing delimiters does not change the number of function points or size of the parse tree, just makes it easier to type. And still declaring parameters but not having to list them all at the top as well saves effort but does not eliminate the information from the source code.
In Perl 6, there are indeed more meanings, but the symbols are used more consistently and uniformly. In my article, you saw how ^$n was clearly related to 0..^$n so it registers mentally as an abbreviation, even though it concerns different operators. And the use of the caret there is obliquely related to the anchor in a regex, conceptually. Backwards, but it makes me think "relates to the endpoint", or in a character range it means "exclude". The colon character does have a few totally different uses, but they are familiar and unconfusing: statement labels, package namespace, etc. The new use of :( ) as the delimiter for a signature is kind of arbitrary, but it makes qualified (overloaded) function names read well, and still using parens rather than some new bracket makes parameter list declarations familiar, with the : optional where a signature but not an expression is expected. A lot of milage comes from its use in "pair" syntax, but that is one use. It is pairs that have many uses, in hash items, named parameter passing, flags, etc. So, I think that learning the meanings systemattically rather than just picking them up one at a time would enable you to better see the organization behind it. ? means boolean/bistate/optional, + means numeric, ~ means string. So $x? is an optional parameter, just as it means 0-or-1 occurances in a regex, and ?| is a boolean "or" as distinguished from +| which is a bitwise "or", and ? as a prefix converts to Bool and imposes boolean context. So, you can guess what infix ?& means, right? You might not guess what $obj.?foo() does, but the use of the symbolism is clear once you are told, and you won't forget. It optionally calls the method, if it exists on the object, but is not an error if it doesn't exist. —JohnIn reply to Re^4: A Romp Around addn
by John M. Dlugosz
in thread A Romp Around addn
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |