On Mon, Mar 07, 2005 at 03:03:08AM +0200, Yuval Kogman wrote:
: On Sun, Mar 06, 2005 at 02:13:09 -0700, Luke Palmer wrote:
: What is output:
:
: sub foo($x, ?$y, [EMAIL PROTECTED]) {
: say x = $x; y = $y; z = @z[];
: }
:
: my @a = (1,2,3);
: foo($x, @a);
:
: And
Hello all,
while writing some experimental code with Pugs, I realised that it is a
bit hard for me to parse the following type of declaration:
sub greeting (Str $person) returns Str is export {
Hello, $person
}
Specifically, the 'is export' trait is too buried. Reformatting it
Leo, you (or someone) might want to:
s/Poicephalus/Phoenix/
on parrotcode.org etc.
When you get a spare minute ;-)
--
Ciao
Richard Foley
Ciao - shorter than aufwiedersehen
http://www.oreilly.com/catalog/perldebugpr/
-Original Message-
Date: Sun, 6 Mar 2005 16:57:38 +0100
wolverian wrote:
There are other ways to format the declaration, like indenting the
traits line:
Yes, I like:
sub greeting( Str $person )
returns Str
is export
{
Hello, $person
}
With the sub-line as some kind of intro and the block as the terminator.
A
wolverian wrote:
Hello all,
while writing some experimental code with Pugs, I realised that it is a
bit hard for me to parse the following type of declaration:
sub greeting (Str $person) returns Str is export {
Hello, $person
}
don't know if it helps, but I guess that you can also
On Sun, Mar 06, 2005 at 11:58:43PM -0800, Larry Wall wrote:
On Sun, Mar 06, 2005 at 02:13:09AM -0700, Luke Palmer wrote:
: What is output:
:
: sub foo($x, ?$y, [EMAIL PROTECTED]) {
: say x = $x; y = $y; z = @z[];
: }
:
: my @a = (1,2,3);
: foo($x, @a);
I think
On Sun, Mar 06, 2005 at 04:57:38PM +0100, Leopold Toetsch wrote:
On behalf of the Parrot team I'm proud to announce the release of
Parrot 0.1.2.
First: Congratulations to everyone for this release!
Second: What will it take before Parrot moves to a 0.2 (0.3, 0.4...)
release?
--Dks
On Mon, Mar 07, 2005 at 03:43:19PM +0100, Aldo Calpini wrote:
don't know if it helps, but I guess that you can also write it like
this, if you prefer:
sub greeting(Str $person) {
returns Str;
is export;
Hello, $person;
}
(this guess is based on
David Storrs wrote:
Urk. I, for one, will definitely find this surprising. I would have
expected:
x = whatever; $y = 1; z = 2 3
to obtain what you have expected, you need to explicitly treat the array
as a list of values with the unary splat:
foo($x, [EMAIL PROTECTED]);
But I suppose it's
On Mon, Mar 07, 2005 at 12:55:49PM +0200, wolverian wrote:
: Hello all,
:
: while writing some experimental code with Pugs, I realised that it is a
: bit hard for me to parse the following type of declaration:
:
: sub greeting (Str $person) returns Str is export {
: Hello, $person
:
On Mon, Mar 07, 2005 at 08:27:10AM -0800, David Storrs wrote:
: On Mon, Mar 07, 2005 at 03:43:19PM +0100, Aldo Calpini wrote:
:
: don't know if it helps, but I guess that you can also write it like
: this, if you prefer:
:
: sub greeting(Str $person) {
: returns Str;
:
Larry Wall wrote:
Yes, and it wouldn't work at all if you ever wanted to autoload anything.
If we ever get to where we're autoloading class bodies, they'd have the
same problem with embedded declarations. The compiler can't work with
information that isn't there.
This is something that is blurry
On Mon, Mar 07, 2005 at 05:36:08PM +0100, Aldo Calpini wrote:
: but then, you could define:
:
: multi sub bar($x, $y, $z) { ... }
: multi sub bar(@coords is shape(3)) {
: my($x, $y, $z) = @coords;
: return bar($x, $y, $z);
: }
:
: bar(@coords); # ok now
Or,
HaloO,
another self-reply :)
I've added a little hack that classifies strings
into these areas 0 to 3 to illustrate my idea of
a type lattice on which composes the background
of the Perl 6 Type System. Pattern matching and
type systems are related but the question for
Perl 6 is: how exactly?
The
Larry Wall skribis 2005-03-07 8:40 (-0800):
method foo ($self: $odd returns Int where { $_ % 1 }, $even
return Int where { not $_ % 1 }, Block ?permutator, [EMAIL PROTECTED])
returns Footype is good is bad is ugly { ... }
That someone took the time to bring this up pleases me. I'm
On Mon, Mar 07, 2005 at 05:53:23PM +0100, Thomas Sandlaß wrote:
: Larry Wall wrote:
: Yes, and it wouldn't work at all if you ever wanted to autoload anything.
: If we ever get to where we're autoloading class bodies, they'd have the
: same problem with embedded declarations. The compiler can't
I was trying to work out how to get non-integer indexes working for an
array -- initially using linear interpolation, though perhaps later it
would be generalized. Can anyone comment on whether this simple role
would work as I expect. Does defining the invocant as Num @self is
constant
Larry Wall wrote:
Or, assuming you might want to generalize to N dimensions someday, just
sub bar ([EMAIL PROTECTED]) {...}
and deal with it as in Perl 5 as a variadic list. I suppose one could say
sub bar ([EMAIL PROTECTED] is shape(3)) {...}
and get checking on the argument count.
if I
Dave Whipp wrote:
Does defining the invocant as Num @self is constant constrain the application
of the role to read-only uses of indices?
I don't think you need is constant. arguments are readonly by default,
unless you give them the is rw trait. I guess that is constant means
that you can
Aldo Calpini wrote:
I don't think you need is constant. arguments are readonly by default,
unless you give them the is rw trait. I guess that is constant means
that you can specify the index only using a literal, not a variable, eg:
@test[1]; # ok, 1 is a costant
my $idx = 1;
On Mon, Mar 07, 2005 at 05:36:08PM +0100, Aldo Calpini wrote:
David Storrs wrote:
Urk. I, for one, will definitely find this surprising. I would have
expected:
x = whatever; $y = 1; z = 2 3
to obtain what you have expected, you need to explicitly treat the array
as a list of values
On Mon, Mar 07, 2005 at 10:29:58PM +0100, Aldo Calpini wrote:
: Larry Wall wrote:
: Or, assuming you might want to generalize to N dimensions someday, just
:
: sub bar ([EMAIL PROTECTED]) {...}
:
: and deal with it as in Perl 5 as a variadic list. I suppose one could say
:
: sub bar
On Mon, Mar 07, 2005 at 02:20:47PM -0800, David Storrs wrote:
: Yes, I know. That's what I meant by ...arrays are objects...(sort
: of). They are objects in the sense that they are sort of references
: and sort of not and that they have behavior built into them
: (e.g. C.length). They won't
On Mon, Mar 07, 2005 at 04:58:29PM -0800, Larry Wall wrote:
In fact, we really haven't specified what happens when you say
my Int @a is shape(3) := [1,2];
my Int @b is shape(3) := [1,2,3,4];
[...]
But I also have this nagging feeling that the user wouldn't have
specified
On Mon, Mar 07, 2005 at 05:15:14PM -0800, Larry Wall wrote:
On Mon, Mar 07, 2005 at 02:20:47PM -0800, David Storrs wrote:
: Yes, I know. That's what I meant by ...arrays are objects...(sort
No, they're real objects. (Though it's .elems rather than .length, since
we've banished the l word
On Mon, Mar 07, 2005 at 05:56:12PM -0800, David Storrs wrote:
: On Mon, Mar 07, 2005 at 05:15:14PM -0800, Larry Wall wrote:
: On Mon, Mar 07, 2005 at 02:20:47PM -0800, David Storrs wrote:
: : Yes, I know. That's what I meant by ...arrays are objects...(sort
:
: No, they're real objects.
Perl 6 Summary for 2005-02-22 though 2005-03-07
All~
Welcome to yet another fortnight summary. Once again brought to you by
chocolate chips. This does have the distinction of being the first
summary written on a mac. So if I break into random swear words, just
bear with me.
On Mon, Mar 07, 2005 at 05:37:53PM -0800, David Storrs wrote:
: On Mon, Mar 07, 2005 at 04:58:29PM -0800, Larry Wall wrote:
:
: In fact, we really haven't specified what happens when you say
:
: my Int @a is shape(3) := [1,2];
: my Int @b is shape(3) := [1,2,3,4];
:
: [...]
: But
On Mon, Mar 07, 2005 at 07:50:47PM -0800, Larry Wall wrote:
On Mon, Mar 07, 2005 at 05:37:53PM -0800, David Storrs wrote:
: On Mon, Mar 07, 2005 at 04:58:29PM -0800, Larry Wall wrote:
: Is
: there is then any way to explicitly leave off an element. Can I do
: this:
:
: sub foo( Int @a
Is there a way to find the name of ?SUB ? It would be useful for
error-logging and -reporting.
--Dks
On Mon, Mar 07, 2005 at 09:49:04PM -0800, David Storrs wrote:
: Is there a way to find the name of ?SUB ? It would be useful for
: error-logging and -reporting.
$?SUBNAME, I think, unless ?SUB just stringifies to that. I guess
it's a good question whether foo should stringify to foo or
foo or
LW == Larry Wall [EMAIL PROTECTED] writes:
LW On Mon, Mar 07, 2005 at 09:49:04PM -0800, David Storrs wrote:
LW : Is there a way to find the name of ?SUB ? It would be useful for
LW : error-logging and -reporting.
LW $?SUBNAME, I think, unless ?SUB just stringifies to that. I guess
On Tue, Mar 08, 2005 at 01:55:07AM -0500, Uri Guttman wrote:
: why not leave it as $?SUB but it is an object and you use the .name
: method?
Uh, yeah. Obviously, 11 pm is still to early in the day for me...
: this way you won't clutter the namespace and you can add more
: methods like
On Mon, Mar 07, 2005 at 08:58:44PM -0800, David Storrs wrote:
: Ok, rewrite; is THIS legal?:
:
: sub foo( Int [EMAIL PROTECTED] is shape(3) ) { ... }
: foo(1, 2, undef);
Yes, since Int can represent undef.
: The sense I'm trying to convey is:
:
: Here is my sub. It takes three
LW == Larry Wall [EMAIL PROTECTED] writes:
LW On Tue, Mar 08, 2005 at 01:55:07AM -0500, Uri Guttman wrote:
LW : why not leave it as $?SUB but it is an object and you use the .name
LW : method?
LW Uh, yeah. Obviously, 11 pm is still to early in the day for me...
35 matches
Mail list logo