Re: A12: default accessors and encapsulation

2004-04-20 Thread Damian Conway
John Siracusa wrote: I'd either like a way to more cleanly extend the default accessor's assignment behavior down the road (i.e. by just writing a new name() method, not by hacking away at STORE traits and adding private worker subs) or a way to auto-generate the slightly more boring default

Re: backticks (or slash, maybe)

2004-04-20 Thread Damian Conway
Sean O'Rourke wrote: I'm saying division is now defined such that when the numerator is a hash(-ref), the result is the set of values associated with the denominator. I've never tried to divide a hash or hashref by something without it being a bug. Right...in Perl 5. In Perl 6, a hash in a

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Larry Wall
On Mon, Apr 19, 2004 at 01:44:53PM -0400, John Siracusa wrote: : On 4/19/04 1:30 PM, Larry Wall wrote: : On Mon, Apr 19, 2004 at 01:14:57PM -0400, John Siracusa wrote: : : I know we are running out of special characters, but I really, really think : : that required named parameters are a

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Damian Conway
John Siracusa asked: Well, actually, we saved you last summer when we decided to make + mean that the parameter must be named. ...named and required, or named and optional? Named and optional, by default. IOW, is this all true? sub foo(+$a, +$b) { ... } foo(); # compile-time

Re: A12: default accessors and encapsulation

2004-04-20 Thread Larry Wall
On Mon, Apr 19, 2004 at 06:53:29PM -0400, John Siracusa wrote: : Yeah, that's exactly what I don't want to type over and over :) I really don't understand what you're getting at here. First you complain that you'd rather write an ordinary method, and then you complain that you have to. Have I

A12 - Protected Attributes and Methods

2004-04-20 Thread Joe Gottman
Apocalypse 12 was very clear about the difference between private and public class members, but it didn't say anything about protected ones? How can you define a protected member? Do you have to do the following? has $.foo is protected; method bar() is protected; Maybe we could

community involvement - Was: Re: backticks

2004-04-20 Thread Scott Walters
Since this horse came back to life, I'm going to give it a good thrashing, and I've got goons to help me. I've asked the Phoenix Perl Mongers for their take on the situation. I've posted a _completely_ unbiased synopsis of the situation. Here are excerpts from the replies: Tony's take: Rename

Re: A12 - Protected Attributes and Methods

2004-04-20 Thread Larry Wall
On Mon, Apr 19, 2004 at 08:21:58PM -0400, Joe Gottman wrote: :Apocalypse 12 was very clear about the difference between private and : public class members, but it didn't say anything about protected ones? How : can you define a protected member? You can't. The concept of protected does not

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/19/04 7:20 PM, Larry Wall wrote: On Mon, Apr 19, 2004 at 06:53:29PM -0400, John Siracusa wrote: : Yeah, that's exactly what I don't want to type over and over :) I really don't understand what you're getting at here. First you complain that you'd rather write an ordinary method, and

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread John Siracusa
On 4/19/04 9:05 PM, Damian Conway wrote: You want: sub foo(+$a is required, +$b is required) { ... } Yes, that would be just fine :) -John

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/19/04 10:04 PM, Damian Conway wrote: John Siracusa wrote: I'd either like a way to more cleanly extend the default accessor's assignment behavior down the road (i.e. by just writing a new name() method, not by hacking away at STORE traits and adding private worker subs) or a way to

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/20/04 1:25 AM, Luke Palmer wrote: John Siracusa writes: The will STORE stuff covers the easy cases, but can I extend it all the way up to a name() that's a multimethod with a ton of optional args? I supposed you can (technically) do all of that with will STORE, but it seems an odd place

Re: backticks

2004-04-20 Thread Peter Haworth
On Fri, 16 Apr 2004 23:45:48 +0200, Juerd wrote: Jonathan Scott Duff skribis 2004-04-16 15:51 (-0500): Except that you've put things in this explanation that shouldn't be there IMHO. The %varnamekey is a special case, but not of getting a single item from a hash, rather it's a special case

Re: A12: default accessors and encapsulation

2004-04-20 Thread Mark J. Reed
Let me just chime in with my support for John's basic idea. I would definitely prefer that it be easy to arrange things such that $obj.foo = 'bar' winds up invoking a method on $obj with 'bar' as an argument, rather than invoking a method on $obj that returns an lvalue to which 'bar' is

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Dan Sugalski
At 9:50 AM -0400 4/20/04, John Siracusa wrote: On 4/19/04 7:16 PM, Larry Wall wrote: Well, no, we're still stuck at run-time validation of that. In the case of methods you can't really do anything else anyway, generally speaking. Why is that? Because at compile time all you have is a generic

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread John Siracusa
On 4/20/04 10:42 AM, Dan Sugalski wrote: At 9:50 AM -0400 4/20/04, John Siracusa wrote: On 4/19/04 7:16 PM, Larry Wall wrote: Well, no, we're still stuck at run-time validation of that. In the case of methods you can't really do anything else anyway, generally speaking. Why is that?

Re: A12: Required Named Parameters Strike Back!

2004-04-20 Thread Dan Sugalski
At 10:51 AM -0400 4/20/04, John Siracusa wrote: On 4/20/04 10:42 AM, Dan Sugalski wrote: At 9:50 AM -0400 4/20/04, John Siracusa wrote: On 4/19/04 7:16 PM, Larry Wall wrote: Well, no, we're still stuck at run-time validation of that. In the case of methods you can't really do anything else

Re: backticks

2004-04-20 Thread Juerd
Peter Haworth skribis 2004-04-20 14:56 (+0100): I think %hashkey key key is best explained as %hash{ key key key } with implicit curlies, not as an alternative to curlies. In that case, why aren't you suggesting something more in line with that? Here's what I'd like to see instead of your

Re: A12: default accessors and encapsulation

2004-04-20 Thread Matthew Walton
Mark J. Reed wrote: Let me just chime in with my support for John's basic idea. I would definitely prefer that it be easy to arrange things such that $obj.foo = 'bar' winds up invoking a method on $obj with 'bar' as an argument, rather than invoking a method on $obj that returns an lvalue to

RE: A12: default accessors and encapsulation

2004-04-20 Thread Austin Hastings
-Original Message- From: Mark J. Reed [mailto:[EMAIL PROTECTED] Let me just chime in with my support for John's basic idea. I would definitely prefer that it be easy to arrange things such that $obj.foo = 'bar' winds up invoking a method on $obj with 'bar' as an argument,

A12: Storage class/class traits

2004-04-20 Thread Austin Hastings
One of the things that got a little less clear with A12 was the idea of multiple Cis clauses. Once upon a time, we talked about: my $spot is Dog is const is persistent is ...; Obviously some of those are traits, now. However, I'm wondering how to handle things like my recent suggestion of a

Re: A12: default accessors and encapsulation

2004-04-20 Thread Luke Palmer
Mark J. Reed writes: Let me just chime in with my support for John's basic idea. I would definitely prefer that it be easy to arrange things such that $obj.foo = 'bar' winds up invoking a method on $obj with 'bar' as an argument, rather than invoking a method on $obj that returns

Re: A12: Storage class/class traits

2004-04-20 Thread Luke Palmer
Austin Hastings writes: One of the things that got a little less clear with A12 was the idea of multiple Cis clauses. Once upon a time, we talked about: my $spot is Dog is const is persistent is ...; Obviously some of those are traits, now. However, I'm wondering how to handle things

Re: backticks

2004-04-20 Thread Luke Palmer
Juerd writes: Peter Haworth skribis 2004-04-20 14:56 (+0100): I think %hashkey key key is best explained as %hash{ key key key } with implicit curlies, not as an alternative to curlies. In that case, why aren't you suggesting something more in line with that? Here's what I'd like to

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Williams
On Tue, 20 Apr 2004, Luke Palmer wrote: There. Now here's the important part: in order to *use* all this, you import whatever module defines it, and then say: class Dog { method foo (?$arg) is accessor { # accessor code here } } If that's not easy

Re: A12: default accessors and encapsulation

2004-04-20 Thread Luke Palmer
John Williams writes: On Tue, 20 Apr 2004, Luke Palmer wrote: There. Now here's the important part: in order to *use* all this, you import whatever module defines it, and then say: class Dog { method foo (?$arg) is accessor { # accessor code here }

Re: A12: default accessors and encapsulation

2004-04-20 Thread Mark J. Reed
On 2004-04-20 at 10:51:47, Luke Palmer wrote: I guess I bogged down that message with the implementation, so the result may have been easy to miss. That is what happened in my case. Apologies; it looks like your original solution would do the job nicely. As long as the requisite module comes

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/20/04 12:14 PM, Luke Palmer wrote: Okay, well, I thought that my example did that, but apparently using Cwill get and Cwill set is a little too complex... (my sentiments are beginning to follow Larry's, in that I'm not sure you know what you want -- perhaps you could give a hypotheical

Final Answer [Was: backticks]

2004-04-20 Thread Larry Wall
Okay, let's put this one to rest. I've suspended judgement long enough. Let me first say that I have my own personal biases, and they are towards keeping things visually and psychologically distinctive, rather than towards reducing keystrokes. (Though I have enough arthritis in my hands to at

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Williams
On Tue, 20 Apr 2004, Luke Palmer wrote: John Williams writes: On Tue, 20 Apr 2004, Luke Palmer wrote: There. Now here's the important part: in order to *use* all this, you import whatever module defines it, and then say: class Dog { method foo (?$arg) is accessor {

A12: Strings

2004-04-20 Thread Aaron Sherman
Well, I have a lot to digest, but off the top of my head (and having nothing to do with objects, but rather the string discussion at the end), it would be very useful if I could assert: no string complex; or something like that. That is to say, I would love to have a way to say that my

Re: A12: default accessors and encapsulation

2004-04-20 Thread Larry Wall
On Tue, Apr 20, 2004 at 01:15:24PM -0400, John Siracusa wrote: : With that has line alone, you auto-magically get an accessor that works : like this: : : $obj.foo# get value of $.foo : $obj.foo(5) # set $.foo = 5 I don't care what syntactic sugar you put underneath, but if you expose

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/20/04 2:37 PM, Larry Wall wrote: On Tue, Apr 20, 2004 at 01:15:24PM -0400, John Siracusa wrote: : With that has line alone, you auto-magically get an accessor that works : like this: : : $obj.foo# get value of $.foo : $obj.foo(5) # set $.foo = 5 I don't care what

Re: A12: default accessors and encapsulation

2004-04-20 Thread Mark J. Reed
On 2004-04-20 at 11:37:18, Larry Wall wrote: So do whatever you like to the declarations, but make sure you preserve the symmetry and extensibility of $obj.foo([EMAIL PROTECTED], *%NONSENSE) # get value of $.foo $obj.foo([EMAIL PROTECTED], *%NONSENSE) = 5 # set $.foo

Re: A12: default accessors and encapsulation

2004-04-20 Thread Aaron Sherman
On Tue, 2004-04-20 at 15:40, John Siracusa wrote: On 4/20/04 2:37 PM, Larry Wall wrote: It's wrong to introduce a fundamental asymmetry that breaks the contract that an accessor can be used as a variable. Er, I think we have different definitions of accessor. I'm perfectly happy to never

Re: A12: default accessors and encapsulation

2004-04-20 Thread Brent 'Dax' Royal-Gordon
John Williams wrote: class Dog { has $.foo will FETCH { ... } will STORE { ... } ; } I'm not saying there is anything wrong with that, but John Siracusa is asking for something different, I think. A simple accessor which looks like a method without

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Siracusa
On 4/20/04 4:08 PM, Aaron Sherman wrote: On Tue, 2004-04-20 at 15:40, John Siracusa wrote: On 4/20/04 2:37 PM, Larry Wall wrote: It's wrong to introduce a fundamental asymmetry that breaks the contract that an accessor can be used as a variable. Er, I think we have different definitions of

Re: A12: default accessors and encapsulation

2004-04-20 Thread Juerd
Brent 'Dax' Royal-Gordon skribis 2004-04-20 12:58 (-0700): method buffersize() will store { my $sqrt=$^v.sqrt; die $^v is not a power of two unless int($sqrt) == $sqrt; $.buffer = \x[0] x $^v; } { +$.buffer.bytes } Could this be

minimal accessor declaration

2004-04-20 Thread John Williams
On Tue, 20 Apr 2004, Brent 'Dax' Royal-Gordon wrote: John Williams wrote: I'm not saying there is anything wrong with that, but John Siracusa is asking for something different, I think. A simple accessor which looks like a method without having to play with Proxy, FETCH, STORE, etc. If

run / qx/ etc.

2004-04-20 Thread Aaron Sherman
On Tue, 2004-04-20 at 13:55, Larry Wall wrote: Okay, let's put this one to rest. Good, and I'll not try to speak ill of the dead thread, so ignoring hash and/or array access, let me respond to the end of your message. As for Cqx//, it probably needs to be completely rethought anyway, along

Re: A12: default accessors and encapsulation

2004-04-20 Thread John Williams
On Tue, 20 Apr 2004, Juerd wrote: Brent 'Dax' Royal-Gordon skribis 2004-04-20 12:58 (-0700): method buffersize() will store { my $sqrt=$^v.sqrt; die $^v is not a power of two unless int($sqrt) == $sqrt; $.buffer = \x[0] x $^v; }

Re: A12: default accessors and encapsulation

2004-04-20 Thread Jonathan Scott Duff
On Tue, Apr 20, 2004 at 10:25:04PM +0200, Juerd wrote: Brent 'Dax' Royal-Gordon skribis 2004-04-20 12:58 (-0700): method buffersize() will store { my $sqrt=$^v.sqrt; die $^v is not a power of two unless int($sqrt) == $sqrt; $.buffer =

Re: A12: Strings

2004-04-20 Thread Larry Wall
On Tue, Apr 20, 2004 at 02:16:01PM -0400, Aaron Sherman wrote: : Well, I have a lot to digest, but off the top of my head (and having : nothing to do with objects, but rather the string discussion at the : end), it would be very useful if I could assert: : : no string complex; : : or