Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 23:43:43 -0500, Dave Rolsky wrote: > But I'd really like to get this stuff done at compile time wherever possible. > > If I write this: > >validate( credit_card_number: $number ); > > it should blow up at compile time, right? So should MMD: The type signatures are

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 01:04:56PM +0800, Autrijus Tang wrote: : On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote: : > And another question. How will I make Perl6 not do automatic coercion for : > me. If I have this sub: : > : > sub date (Int +$year is required, +$month, +$day) : :

Re: Time::Local

2005-08-17 Thread Sam Vilain
On Wed, 2005-08-17 at 01:28 -0500, Dave Rolsky wrote: > > Why on earth would you want to encourage such a short sighted > > programming practise? The earth wobbles like a spinning top. In fact > It's hardly short sighted to want leap seconds to be abandoned (not in > Perl but world wide). The f

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:45:52PM -0500, Dave Rolsky wrote: > And another question. How will I make Perl6 not do automatic coercion for > me. If I have this sub: > > sub date (Int +$year is required, +$month, +$day) BTW, Pugs supports the ++ syntax, which iirc is said to be back in favour du

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Wed, 17 Aug 2005, Dave Rolsky wrote: Type Validation, "isa", & "can" Params::Validate allows for several ways to check the _value_ of a parameter. One way is to specify a primitive type like "SCALAR" or "ARRAYREF". In P6 we have that with this: sub date (Scalar +$year is required, ...)

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Thu, 18 Aug 2005, Yuval Kogman wrote: You sortof can: sub validate (+$credit_card_number, +$credit_card_expiration, +$credit_card_holder_name) where { defined $credit_card_number xor defined $credit_card_expiration &&

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
On Wed, 17 Aug 2005, Luke Palmer wrote: Dependencies, Exclusions, and "Require one-of" With P::V I can do this: { credit_card_number => { optional => 1, depends => [ 'credit_card_expiration', 'credit_card_holder_name' ] }, credit_card_expiration => { optional => 1 },

Re: my $pi is constant = 3;

2005-08-17 Thread Larry Wall
On Wed, Aug 17, 2005 at 09:37:08PM +, Luke Palmer wrote: : On 8/17/05, Larry Wall <[EMAIL PROTECTED]> wrote: : > You could still reason about it if you can determine what the initial : > value is going to be. But certainly that's not a guarantee, which : > is one of the reasons we're now calli

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Larry Wall
On Wed, Aug 17, 2005 at 06:26:02PM -0400, Stevan Little wrote: : I am not sure if changing classes makes sense here so much as just : providing a means for submethod calls to be forced. Currently the : metamodels do this by allowing a special parameter in the first : argument which is a flag to

Serializing code

2005-08-17 Thread Yuval Kogman
In the last year AJAX has become a significant technology. Now with perl 6 compiling to javascript and perl 5 and what not, i think there is a big future when you merge the two and remove the details. The way HTML::Prototype works is: you get an OO interface, which is clean and simple

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 22:06:07 +, Luke Palmer wrote: > > > >{ credit_card_number => > > { optional => 1, > >depends => [ 'credit_card_expiration', 'credit_card_holder_name' ] }, > > > > credit_card_expiration => { optional => 1 }, > > > > credit_card_holder_name

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Stevan Little
Larry, On Aug 17, 2005, at 2:53 PM, Larry Wall wrote: : As for submethods, I see them like this: : : submethod foo () { ... } : : is really .. : : submethod foo () { : next METHOD unless $?SELF ~~ $?CLASS; : } : : At least that is how larry explained to me about a month ago. Can't use ~~

Rebinding binding

2005-08-17 Thread Luke Palmer
Two years ago or so, I became very happy to learn that the left side of binding works just like a routine signature. So what if binding *were* just a routine signature. That is, could we make this: sub foo () { say "hello"; my $x := bar(); say "goodbye $x"; } Equ

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Luke Palmer
On 8/17/05, Dave Rolsky <[EMAIL PROTECTED]> wrote: > I'm going to go over the various features in P::V and see if there are > equivalents in Perl6, and bring up any questions I have. I think this > will be interesting for folks still new to P6 (like myself) and existing > P::V users (I think there

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Uri Guttman
> "DR" == Dave Rolsky <[EMAIL PROTECTED]> writes: DR> Mandatory vs. Optional Parameters DR> This is a pretty straightforward one in P6, I think. Parameters can DR> be marked as required with "is required" like this: DR> sub date ($year, ?$month, ?$day) # positional DR> sub da

Re: my $pi is constant = 3;

2005-08-17 Thread Luke Palmer
On 8/17/05, Larry Wall <[EMAIL PROTECTED]> wrote: > You could still reason about it if you can determine what the initial > value is going to be. But certainly that's not a guarantee, which > is one of the reasons we're now calling this write/bind-once behavior > "readonly" and moving true constan

Re: my $pi is constant = 3;

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 12:02:53AM +0800, Autrijus Tang wrote: : On Wed, Aug 17, 2005 at 08:47:18AM -0700, Larry Wall wrote: : > : >That could be made to work by defining constant to mean you can assign : > : >to it if it's undefined. But then it gets a little harder to reason : > : >about it if $

Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Dave Rolsky
One of the things I'm looking forward to in Perl6 is greatly improved sub/method signatures. I'm hoping that this will eliminate the need for anything like Params::Validate, which IMO is a nasty hack to make up for a serious weakness in Perl5. I'm going to go over the various features in P::

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 02:40:12AM +0800, Autrijus Tang wrote: : On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote: : > On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: : > : 1.e5# all of these... : > : 1._e5 # : > : 1._0e5 # : > : 1.e_0_5_

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Larry Wall
On Wed, Aug 17, 2005 at 02:42:57PM -0400, Stevan Little wrote: : I think in a Role, $?SELF would still be the invocant in a method, and : $?CLASS would (eventually) bind to the class the role was composed : into. Yes, such things stay generic as long as they need to, and no longer. : As for sub

Re: What will happen if the attribute's names are the same but declared with different keyword?

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 03:33:35AM +0800, Yiyi Hu wrote: : class T : { : has $.a =1; : my $.a=2; : }; : my T $o .= new; : $o.a().say; : : What the result will be please? : 1 or 2? : Or an error? Definitely a compile-time error. You can't declare the same lexical name even if the declarator is di

What will happen if the attribute's names are the same but declared with different keyword?

2005-08-17 Thread Yiyi Hu
class T { has $.a =1; my $.a=2; }; my T $o .= new; $o.a().say; What the result will be please? 1 or 2? Or an error? Thanks, Xinming

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Larry Wall
On Wed, Aug 17, 2005 at 02:15:56PM -0400, Stevan Little wrote: : So, onto my question, I am wondering what are the valid scopes for : $?SELF and $?CLASS. : : Are these (magical) globals who only have bound values in certain : contexts? If that is so, what value do they have outside of a valid :

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Stevan Little
On Aug 17, 2005, at 2:28 PM, Ingo Blechschmidt wrote: Hi, Stevan Little wrote: So, onto my question, I am wondering what are the valid scopes for $?SELF and $?CLASS. Are these (magical) globals who only have bound values in certain contexts? If that is so, what value do they have outside of a

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote: > On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: > : 1.e5# all of these... > : 1._e5 # > : 1._0e5 # > : 1.e_0_5_# == 1 * 10^5? > > The last three are illegal because underline is allowed

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Larry Wall
On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: : 1.e5# all of these... : 1._e5 # : 1._0e5 # : 1.e_0_5_# == 1 * 10^5? The last three are illegal because underline is allowed only between digits. : The longest-possible-token metarule, common among

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Ingo Blechschmidt
Hi, Stevan Little wrote: > So, onto my question, I am wondering what are the valid scopes for > $?SELF and $?CLASS. > > Are these (magical) globals who only have bound values in certain > contexts? If that is so, what value do they have outside of a valid > context? undef? or is attempting to acc

scopes of $?SELF and $?CLASS

2005-08-17 Thread Stevan Little
Hello all, I tried to search for this answer in AES12, but I did not see anything, and a perl6.lang search just brought up the whole $_.method vs. ./method debate (which was too much to shlog through). So, onto my question, I am wondering what are the valid scopes for $?SELF and $?CLASS. A

Re: my $pi is constant = 3;

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 08:47:18AM -0700, Larry Wall wrote: > : >That could be made to work by defining constant to mean you can assign > : >to it if it's undefined. But then it gets a little harder to reason > : >about it if $pi can later become undefined. I suppose we could > : >disallow undefi

Re: my $pi is constant = 3;

2005-08-17 Thread Larry Wall
On Wed, Aug 17, 2005 at 01:56:35PM +1000, Adam Kennedy wrote: : : >: If not a special form, should this work? : >: : >: my $pi is constant; : >: $pi = 3; : > : >That could be made to work by defining constant to mean you can assign : >to it if it's undefined. But then it gets a little h

Re: DBI v2 - The Plan and How You Can Help

2005-08-17 Thread John Siracusa
On 8/17/05 5:39 AM, Tim Bunce wrote: > On Tue, Aug 16, 2005 at 03:58:54PM -0400, John Siracusa wrote: >> I think it'll take years, and much actual production experience building >> Perl 6 modules before the community learns what works and what doesn't for a >> Perl 6 API (let alone implementation).

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Yuval Kogman
On Tue, Aug 16, 2005 at 16:59:12 -0400, Mark Reed wrote: > On 2005-08-16 16:45, "Nicholas Clark" <[EMAIL PROTECTED]> wrote: > > I'd find it hard defending a language that treated 1.e5 as a method call. > > Guess we shouldn't sign you up for the Ruby Defense League, then? > > irb(main):001:0> 1.e

Re: GC API from discussion

2005-08-17 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 05:06:55 -, David Formosa (aka ? the Platypus) wrote: > This should be changed, timelyness will not prevent deadlock. However > it will prevent resource starvation aka livelock. What I meant is deadlock due to resource starvation: my $semaphore = Sempahore.n

Re: my $pi is constant = 3;

2005-08-17 Thread Adam Kennedy
: If not a special form, should this work? : : my $pi is constant; : $pi = 3; That could be made to work by defining constant to mean you can assign to it if it's undefined. But then it gets a little harder to reason about it if $pi can later become undefined. I suppose we could dis

Re: DBI v2 - The Plan and How You Can Help

2005-08-17 Thread Tim Bunce
On Tue, Aug 16, 2005 at 12:12:02PM -0700, Dean Arnold wrote: > Tim Bunce wrote: > > >And nobody mentioned JDBC as a potential model. Odd that. > > I was sorely tempted to do so (and did mention it a few times in > my posts, along w/ ODBC and ADO.NET), but there are some things about > JDBC which

Re: GC API from discussion

2005-08-17 Thread David Formosa \(aka ? the Platypus\)
On Tue, 16 Aug 2005 19:46:29 +0300, Yuval Kogman <[EMAIL PROTECTED]> wrote: [...] > On Tue, Aug 16, 2005 at 05:32:50 -, David Formosa (aka ? the Platypus) = > wrote: >> > This is getting me thinking though: >> >=20 >> >$*RUNTIME.Memory.GarbageCollector.dispose($object); # force it, >> >

Re: GC API from discussion

2005-08-17 Thread Yuval Kogman
On Wed, Aug 17, 2005 at 00:59:52 +0100, Adrian Howard wrote: > Sorry - I don't understand. If I do: > > call_to_external_c_library_foo( $foo ); > call_to_external_c_library_bar( $bar ); > > Then how does the compiler know that $foo is only used temporarily and can > be moved around, w

Re: DBI v2 - The Plan and How You Can Help

2005-08-17 Thread Tim Bunce
On Tue, Aug 16, 2005 at 01:16:19PM -0700, Darren Duncan wrote: > At 4:04 PM +0100 8/16/05, Tim Bunce wrote: > >I was a little dissapointed that there wasn't greater focus on using > >Perl6 features - especially as it would have helped kick-start my own > >understanding of Perl6 topics that I expect

Re: DBI v2 - The Plan and How You Can Help

2005-08-17 Thread Tim Bunce
On Tue, Aug 16, 2005 at 03:58:54PM -0400, John Siracusa wrote: > On 8/16/05, Tim Bunce <[EMAIL PROTECTED]> wrote: > > I was a little dissapointed that there wasn't greater focus on using > > Perl6 features - especially as it would have helped kick-start my own > > understanding of Perl6 topics that

Re: GC API from discussion

2005-08-17 Thread David Formosa \(aka ? the Platypus\)
On Tue, 16 Aug 2005 20:14:43 +0300, Yuval Kogman <[EMAIL PROTECTED]> wrote: [...] > Let's define some terms: These are all very good and I'm going to incorprate them in the API docs. > scope/origin - where objects are created I would refine this one. origin scope - The lexical scope

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Roger Hale
Luke Palmer wrote: On 8/16/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: Hi, 1_234; # surely 1234 1e23; # surely 1 * 10**23 1._5; # call of method "_5" on 1? 1._foo; # call of method "_foo" on 1? 1.e5; # 1.0 * 10**5? 1.efoo; # call of metho