Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-29 Thread Luke Palmer
Thomas Sandlaà writes: > Luke Palmer wrote: > >So if you want things modified, you'd have to pass in a reference. > >Arrays and hashes would not generally have this restriction, since we > >pass references of those guys anyway. > > But I would really like to see a declaration of any possible modif

RE: Unknown level of hash

2005-03-29 Thread Zhuang Li
> -Original Message- > From: Luke Palmer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 29, 2005 5:43 AM > To: Zhuang Li > Cc: Jeff Yoak; fwp@perl.org; perl6-language@perl.org > Subject: Re: Unknown level of hash > > Zhuang Li writes: > > Yes. I think it's both useful and fun. I was th

Re: .method == $self.method or $_.method?

2005-03-29 Thread Thomas Sandlaß
Paul Seamons wrote: To sum up... If you are in a method then you get .method and it always works even if $_ is rebound to something else. I also have problems to perceive .method beeing bound to $_ from a typing point of view: $_ is a dynamic variable in the runtime environment, while the method i

Re: .method == $self.method or $_.method?

2005-03-29 Thread Juerd
Larry Wall skribis 2005-03-29 9:27 (-0800): > and write _.method, which is of dubious merit. Or we could use `<>, > `[], `(), and `method if we don't use ` for qx. I daresay `method > would probably be used more than qx for many styles of programming. Hey, look at that, backticks again :) If t

Re: .method == $self.method or $_.method?

2005-03-29 Thread Aaron Sherman
On Tue, 2005-03-29 at 11:38, Juerd wrote: > Luke Palmer skribis 2005-03-29 6:14 (-0700): > > method iterate () { > > for (@.objs) { > > .process($_); # oops > > } > > } [...] > $_ is the topic, and I think that if we have two topics, Perl gets as > convoluted

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

2005-03-29 Thread Thomas Sandlaß
Luke Palmer wrote: So if you want things modified, you'd have to pass in a reference. Arrays and hashes would not generally have this restriction, since we pass references of those guys anyway. But I would really like to see a declaration of any possible modification in the interface of a sub. Othe

Re: .method == $self.method or $_.method?

2005-03-29 Thread Larry Wall
On Tue, Mar 29, 2005 at 06:38:31PM +0200, Juerd wrote: (B: Luke Palmer skribis 2005-03-29 6:14 (-0700): (B: > method iterate () { (B: > for (@.objs) { (B: > .process($_); # oops (B: > } (B: > } (B: (B: There is an alarming similarity with (B: (B:

Re: .method == $self.method or $_.method?

2005-03-29 Thread Juerd
Luke Palmer skribis 2005-03-29 6:14 (-0700): > method iterate () { > for (@.objs) { > .process($_); # oops > } > } There is an alarming similarity with for (@hashes) { .($_) } Which doesn't quite use $self! .<>, .[], .{} are method calls, vi

Re: Units on numbers [was Re: S28ish]

2005-03-29 Thread osfameron
Craig DeForest wrote: Yow -- units would be extra cool for perl6: I know of no other language that has units support built in. It would go a long way toward making perl6 the language of choice for students in the physical sciences... Frink is built around this idea: http://c2.com/cgi/wiki?FrinkL

Re: Units on numbers [was Re: S28ish]

2005-03-29 Thread Thomas Sandlaß
Craig DeForest wrote: Yow -- units would be extra cool for perl6: I know of no other language that has units support built in. It would go a long way toward making perl6 the language of choice for students in the physical sciences... Well, my HP48 pocket calculator used to have it :) -- TSa (Tho

Re: Currying positionals

2005-03-29 Thread Thomas Sandlaß
Larry Wall wrote: Yeah, I agree. How 'bout we go with something like you have to * the actual hash (if it's the first thing) to make it look like a list of pairs to the parser, and we can just get rid of 3 there. I'm not sure if 3) was superflous depending on the definition of "non-pair". Did you

Re: string/list division

2005-03-29 Thread Luke Palmer
Aaron Sherman writes: > On Mon, 2005-03-28 at 13:38, Luke Palmer wrote: > > > Your "list mod" idea is interesting, though. I fear that adding too > > many list operators will start to make us look like Haskell, where we > > have *extremely* expressive single lines that take an hour to write and >

Re: Unknown level of hash

2005-03-29 Thread Luke Palmer
Zhuang Li writes: > Yes. I think it's both useful and fun. I was thinking something similar > to > @[EMAIL PROTECTED] = map{1} @a; > > But getting "$hash->{E1}->{E2}->...->{En} = 1;" instead of "$hash{E1} = > 1; ... $hash{En} =1;". Yeah, like this: %hash{dims @a} = (1) xx Inf; > What I'd r

Re: Unknown level of hash

2005-03-29 Thread Markus Laire
Zhuang Li wrote: Yes. I think it's both useful and fun. I was thinking something similar to @[EMAIL PROTECTED] = map{1} @a; But getting "$hash->{E1}->{E2}->...->{En} = 1;" instead of "$hash{E1} = 1; ... $hash{En} =1;". What I'd really like to do is: Given @a = ('E1', 'E2', ..., 'En'); @b

Re: .method == $self.method or $_.method?

2005-03-29 Thread Luke Palmer
Piers Cawley writes: > Larry Wall <[EMAIL PROTECTED]> writes: > > > I've been thinking about this in my sleep, and at the moment I think > > I'd rather keep .foo meaning $_.foo, but break the automatic binding > > of the invocant to $_. Instead of that, I'd like to see a really, > > really short

Re: Units on numbers [was Re: S28ish]

2005-03-29 Thread James Mastros
Craig DeForest wrote: Yet another point: there are plenty of non-obvious reductions that people worry about, such as "N m" -> "J" (energy) but "m N" -> "m N" (torque); but it's probably not worth worrying about such things: if the coder knows that s/he wants a torque, s/he should be able to ask f

Re: return of copies vs references

2005-03-29 Thread Piers Cawley
Darren Duncan <[EMAIL PROTECTED]> writes: > At 7:10 AM +0100 3/29/05, Piers Cawley wrote: >>Doesn't that rather depend on the type of the attribute? Personally, if I get >>an object back from accessor method then I expect that any modifications of >>that object's state will be seen the next time I