Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Fri, 12 Mar 2004 12:01:10 -0800
Local: Fri, Mar 12 2004 3:01 pm
Subject: Re: Mutating methods
On Fri, Mar 12, 2004 at 09:19:46AM -0800, Dave Whipp wrote: : Why are we mixing the concepts of assignment and topicalization -- : especially in a way that doesn't generalize. Why can't we invent a : "topicalization" operator, analogous to the old binding operator, that : simply sets its LHS as the topic of its RHS: and then have an assigning : version of that operator. Hmm, yes, other than the usual arguments against inventing *any* new : For example, lets use the "section" Unicode symbol: "§" to locally set the I expect the first thing a Nihongo-jin would do is to change it from $x = ( $foo は .a + .b + .c ) So maybe the ASCII workaround is just "wa". :-) * .5 $x = ( $foo wa .a + .b + .c ) (Yes, Simon, I know that that Japanese only allows wa in the top-level Some will argue that since English doesn't have a grammatical $x = (.a + .b + .c given $foo) But that doesn't give us the corresponding assignment op. Interestingly, Or we could use a syntax that is already allowed: $x = {.a + .b + .c}($foo) But that doesn't give us a simple topic-in-front form either... : The assigning version of the operator could be Though I confess I find it hard to imagine persuading people to write: my Dog $dog wa= .new; Now, if we had a unary = that assigned to the current topic, we could do given my Dog $dog { = .new } But I'm not recommending that approach, because I dislike unary =, and For the sake of argument, let's call our theoretical new operator "wa". Neko wa. which means something like "consider the cat". On the other hand, my Dog $dog wa= .new; is really an assignment operator, or whether it actually (my Dog $dog).wa = .new; In the latter case, you could use the wa postposition anywhere you $modthingie wa %= .modulus; or tell a subscript to default to the array as its topic: @array wa .[.min .. .max] That would of course read better with a single character postfix: @array§[.min .. .max] It's really a pity that question mark is already so overloaded with $dog? .bark would really be the best postfix operator in ASCII for this. my Dog $spot ?= .new; as an idiom. And @array?[.min .. .max] would be the way to get a topicalized subscript. If "wa" were a binary @array ? $_[.min .. .max] or @array ? .[.min .. .max] since it's setting up expectation for a term rather than an operator. On the other hand, if it's a binary operator of a particular precedence, $foo? ( when they should probably be saying given $foo { But maybe the rule is that it governs the rest of the surrounding Not sure I want to explain that though...I certainly haven't explained But this is gonna be a weird binary operator, if operator it is. Arguably, we already have exactly this operator. It's called "dot". Ignore for the moment that we've said that .() calls a sub. What $topic . (.a + .b + .c) Then we're back to my dog $spot .= .new; and then the dotted subscript form: @array .[.min .. .max] would automatically topicalize the subscript. Except that people would @array . [.min .. .max] which would presumably just produce an anonymous list of subscripts without Hmm. The basic problem is that we're using the same notation to both Despite the severe overloading problems, it's really gonna be hard $topic ? (.a + .b + .c) And I do think people would rebel at using Latin-1 for that one. Larry You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||