use less in perl6?

2005-03-30 Thread Yuval Kogman
Perl 6 has some more interesting capabilities for lexical scoped hinting of tradeoff preferences. For example: use less precision; # the default nums created in this scope are # lower precision floats use less cpu; # many places this can have a desired effect use

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

2005-03-30 Thread Thomas Sandlaß
Luke Palmer wrote: Unless the caller can't see the signature, as is the case with methods. [..] Again, this can't be done unless you know the signature. And in fact, we can't do type inference on methods unless we do type inference everywhere, which we can't do if we want an autoloader. This

Re: use less in perl6?

2005-03-30 Thread Aaron Sherman
On Wed, 2005-03-30 at 10:20 +0200, Yuval Kogman wrote: Perl 6 has some more interesting capabilities for lexical scoped hinting of tradeoff preferences. For example: use less precision; # the default nums created in this scope are # lower precision floats use less cpu; #

Re: use less in perl6?

2005-03-30 Thread Matt Fowles
Aaaron~ On Wed, 30 Mar 2005 08:48:55 -0500, Aaron Sherman [EMAIL PROTECTED] wrote: On Wed, 2005-03-30 at 10:20 +0200, Yuval Kogman wrote: Perl 6 has some more interesting capabilities for lexical scoped hinting of tradeoff preferences. For example: use less precision; # the

Re: use less in perl6?

2005-03-30 Thread Herbert Snorrason
On Wed, 30 Mar 2005 08:56:58 -0500, Matt Fowles [EMAIL PROTECTED] wrote: On Wed, 30 Mar 2005 08:48:55 -0500, Aaron Sherman [EMAIL PROTECTED] wrote: use less syntax; Back out the entire p6 grammar and put in lisp's instead... Huh. I suppose that's the only difference these days... ;)

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

2005-03-30 Thread Aaron Sherman
On Tue, 2005-03-29 at 16:00 -0700, Luke Palmer wrote: Unless the caller can't see the signature, as is the case with methods. I need to understand this piece. In this code: class X { method meth() {...} } class Y is X { method meth() is

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

2005-03-30 Thread Luke Palmer
Aaron Sherman writes: On Tue, 2005-03-29 at 16:00 -0700, Luke Palmer wrote: Unless the caller can't see the signature, as is the case with methods. I need to understand this piece. In this code: class X { method meth() {...} } class Y is X {

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

2005-03-30 Thread Larry Wall
On Wed, Mar 30, 2005 at 09:40:26AM -0700, Luke Palmer wrote: : There _is_ a way to do it, actually, but we need to really screw around : with what kinds of things are inferred. In the case: : : my $a; : $a.m(1); : : We assign the type objects with an 'm' method that can take a single :

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

2005-03-30 Thread Thomas Sandlaß
HaloO Luke, you wrote: No, I think I agree with you here. But what happens if you change you're second-to-last line to: my $a = foo(); $a.meth() = 8; Perl 6 is both a statically typed language and a dynamically typed language, and the problems that I am addressing are mostly about the

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

2005-03-30 Thread Aaron Sherman
On Wed, 2005-03-30 at 11:40, Luke Palmer wrote: No, I think I agree with you here. But what happens if you change you're second-to-last line to: my $a = foo(); $a.meth() = 8; Perl 6 is both a statically typed language and a dynamically typed language, and the problems that I am

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

2005-03-30 Thread Luke Palmer
Thomas Sandla writes: And of course the builtin functionality and the packages available from CPAN save the typical small scale programmer from extensive declarations. But to use a complex module you have to read documentation to get the idea to call .meth() in the first place. And then I

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

2005-03-30 Thread Thomas Sandlaß
Larry Wall wrote: I think it's perfectly fine for the compiler to make use of whatever information it has. The trick is to never make any unwarranted assumptions, such as Nobody will ever add another class with an 'm' method. Er, isn't that not just the wrong way around? The point is to do the

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

2005-03-30 Thread Aaron Sherman
On Wed, 2005-03-30 at 13:53, Luke Palmer wrote: class CodeProxy { has Code $.code is rw; sub call ($a) { $.code($a); } } This is valid Perl 6, and anyone who says otherwise (because of type signatures) is changing the Perl philosophy too much

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

2005-03-30 Thread Larry Wall
On Wed, Mar 30, 2005 at 12:05:12PM +0200, Thomas Sandlaß wrote: : If I understand you correctly the use statement is more like a : linker/loader directive than a compile time interface include? That is up to the module being used. use is a linker, but it's only required to link enough

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

2005-03-30 Thread chromatic
On Wed, 2005-03-30 at 14:29 -0500, Aaron Sherman wrote: What I do not think should be allowed (and I may be contradicting Larry here, which I realize is taking my life in my hands ;) is violating the compile-time view of the static type tree. That is, you can load an object foo at run-time,

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

2005-03-30 Thread Aaron Sherman
On Wed, 2005-03-30 at 14:57, chromatic wrote: I certainly plan to continue to instrument code at runtime (and not just really slushy, partially slushy, and permafrost compile time). That's FINE, and no one should stop you! What I was referring to was only the items that an interface

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

2005-03-30 Thread chromatic
On Wed, 2005-03-30 at 15:27 -0500, Aaron Sherman wrote: Like I said, if you allow run-time munging of the type interfaces, then you can't tell if this is valid or invalid: my X $a; $a.m(1); you have to allow it always, regardless of the definition of X. In fact, you can

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

2005-03-30 Thread Thomas Sandlaß
Luke Palmer wrote: class CodeProxy { has Code $.code is rw; sub call ($a) { $.code($a); } } This is valid Perl 6, Hmm, a sub in a class? I guess that should be a method. OTOH a class is just a funny module, so might be OK. But that is the syntax realm.

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

2005-03-30 Thread Thomas Sandlaß
chromatic wrote: A compiler that assumes incorrectly and disallows programmers to do useful things because its holds those assumptions as precious is wrong -- especially in cases where even the programmer can't tell if code is valid or invalid until the program actually runs. Me neither. One

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

2005-03-30 Thread Thomas Sandlaß
Aaron Sherman wrote: No, that was most of the point. foo did not declare a return type, and while my code was simplistic, we obviously cannot be certain what foo might return in the general case. Sorry that I've spoiled that. But I wonder if it's just in the examples here on the list or a general

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

2005-03-30 Thread Luke Palmer
Thomas Sandla writes: Aaron Sherman wrote: No, that was most of the point. foo did not declare a return type, and while my code was simplistic, we obviously cannot be certain what foo might return in the general case. Sorry that I've spoiled that. But I wonder if it's just in the examples

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

2005-03-30 Thread Luke Palmer
Thomas Sandla writes: Luke Palmer wrote: class CodeProxy { has Code $.code is rw; sub call ($a) { $.code($a); } } This is valid Perl 6, Hmm, a sub in a class? I guess that should be a method. OTOH a class is just a funny module, so might be

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

2005-03-30 Thread Luke Palmer
Aaron Sherman writes: What I do not think should be allowed (and I may be contradicting Larry here, which I realize is taking my life in my hands ;) is violating the compile-time view of the static type tree. That sentence is getting pretty C++-derived-like, which Perl is hardly anymore. We

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

2005-03-30 Thread Luke Palmer
Aaron Sherman writes: On Wed, 2005-03-30 at 13:53, Luke Palmer wrote: class CodeProxy { has Code $.code is rw; sub call ($a) { $.code($a); } } This is valid Perl 6, and anyone who says otherwise (because of type signatures) is

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

2005-03-30 Thread Luke Palmer
Aaron Sherman writes: Please think carefully about how dynamic you want Perl 6 to be Dynamic is good, but there's such a thing as too much of a good thing. We'd like Perl 6 to be as dynamic as Perl 5. We'd think that is impossible. Perl 5 had full control of the run-time, Perl 6

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

2005-03-30 Thread Chip Salzenberg
According to Luke Palmer: [Perl 5] had to construct lvalues out of all arguments (for which that made sense) because the sub might modify them. No, actually, that wasn't the reason. Perl 5 passes all values by implicit mutable reference because it's faster, not because it's better. I suspect

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

2005-03-30 Thread Thomas Sandlaß
Luke Palmer wrote: Okay, now we're starting to talk past each other. I /think/ Thomas orignially suggested that we use type inference to determine whether to lvalue cast an argument or not, which is what I got all worked up about. Actually I was returning to the subject of co- or contravariance

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

2005-03-30 Thread Aaron Sherman
On Wed, 2005-03-30 at 17:09, Luke Palmer wrote: Aaron Sherman writes: What I do not think should be allowed (and I may be contradicting Larry here, which I realize is taking my life in my hands ;) is violating the compile-time view of the static type tree. That sentence is getting

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

2005-03-30 Thread chromatic
On Wed, 2005-03-30 at 18:35 -0500, Aaron Sherman wrote: When the Perl 6 compiler sees: my X $a; $a.m(1); What should it do? Options: * Accept the method call regardless of the definition of X * Accept the method call if it matches the signature from X