Re: Mutating methods

2004-03-11 Thread Andy Wardley
Larry Wall wrote: multi sub *scramble (String $s) returns String {...} [...] Or you can just call it directly as a function: scramble(hello) Can you also call scramble as a class method? class String is extended { method scramble { ..etc... } } String.scramble(hello) A

Re: Mutating methods

2004-03-11 Thread Andy Wardley
Larry Wall wrote: Yet another approach is to *replace* dot with something that mutates: @array!sort @array?sort Either of those would work syntactically in that case, since neither ! nor ? is expected as a binary operator. What about ? is as a ternary operator: @foo?bar:baz;

Re: Mutating methods

2004-03-11 Thread Uri Guttman
AW == Andy Wardley [EMAIL PROTECTED] writes: AW What about ? is as a ternary operator: AW @foo?bar:baz; IIRC, that was changed to ?? :: because larry wanted the single ? for more important uses. also doubling the ? made it more like , || which are related logical ops. and ?? as the

Re: Mutating methods

2004-03-11 Thread Gregor N. Purdy
Larry -- So, will mutatingness be a context we'll be able to inquire on in the implementation of a called routine? Or, could we provide a specialized distinct implementation for mutating that would get called if .=X() is used? If we are performing some operation on large data, and we know the end

Re: Mutating methods

2004-03-11 Thread Larry Wall
On Thu, Mar 11, 2004 at 11:38:11AM +, Andy Wardley wrote: : Larry Wall wrote: : multi sub *scramble (String $s) returns String {...} : [...] : Or you can just call it directly as a function: : scramble(hello) : : Can you also call scramble as a class method? : : class String is

Re: Mutating methods

2004-03-11 Thread Larry Wall
On Thu, Mar 11, 2004 at 06:49:44AM -0800, Gregor N. Purdy wrote: : So, will mutatingness be a context we'll be able to inquire on : in the implementation of a called routine? Probably not, but it's vaguely possible you could somehow get a reference to what is being assigned to, if available, and

Re: Mutating methods

2004-03-11 Thread Larry Wall
On Thu, Mar 11, 2004 at 02:05:55PM -0600, Jonathan Scott Duff wrote: : On Thu, Mar 11, 2004 at 11:11:54AM -0800, Larry Wall wrote: : On the final hand, if people fall in love with both self:sort and =sort, we : could have =sort be a shorthand for self:sort where it's unambiguous. : : Wouldn't

Re: Mutating methods

2004-03-11 Thread Larry Wall
On Thu, Mar 11, 2004 at 12:43:22PM -0800, Larry Wall wrote: : Which is precisely the problem with something like : : $a cmp= $b : : insofar as $a is being treated as a string at one moment and as a boolean : at the next. Well, okay, not a boolean. More like a troolean. Larry

Re: Mutating methods

2004-03-11 Thread John Siracusa
On 3/11/04 4:04 PM, Larry Wall wrote: On Thu, Mar 11, 2004 at 12:43:22PM -0800, Larry Wall wrote: : Which is precisely the problem with something like : : $a cmp= $b : : insofar as $a is being treated as a string at one moment and as a boolean : at the next. Well, okay, not a

Re: Mutating methods

2004-03-11 Thread chromatic
On Thu, 2004-03-11 at 13:04, Larry Wall wrote: Well, okay, not a boolean. More like a troolean. Unless it's a falselean. -- c

Re: Mutating methods

2004-03-11 Thread Larry Wall
On Thu, Mar 11, 2004 at 01:18:52PM -0800, chromatic wrote: : On Thu, 2004-03-11 at 13:04, Larry Wall wrote: : : Well, okay, not a boolean. More like a troolean. : : Unless it's a falselean. It's more truelean than falselean by a 2/3rds majority. And it's much more if you include 2, -2, 3,

Re: Mutating methods

2004-03-11 Thread Matthew Walton
Larry Wall wrote: On Thu, Mar 11, 2004 at 01:18:52PM -0800, chromatic wrote: : On Thu, 2004-03-11 at 13:04, Larry Wall wrote: : : Well, okay, not a boolean. More like a troolean. : : Unless it's a falselean. It's more truelean than falselean by a 2/3rds majority. And it's much more if you

Re: Mutating methods

2004-03-11 Thread Damian Conway
Larry wrote: On the other hand, I suspect most people will end up declaring it int method self:rotate (int $a is rw) {...} in any event, and reserve the =rotate for .=rotate, which can never put the = on the left margin, even if we let ourselves have whitespace before POD directives.