On 5/19/05, Martin Kuehl <[EMAIL PROTECTED]> wrote:
> I have tried, but I can't make myself like it.
I'm afraid I have to agree.
When I saw it used in code after this discussion (I think it must have
been somewhere in pugs t/ or ext/) my reaction was "yuck".
(for what it's worth)
Carl
> eval_is('undef + 1', undef, 'undef + 1', :todo); # dies
> eval_is('1 + undef', undef, '1 + undef', :todo); # gives 1
I would expect these to both equal 1,
see perl5
>perl5 -le "undef $_; ++$_; print"
1
Is [EMAIL PROTECTED] the correct way to get a hash slice using elements of an
array?
(it's giving me a compilation error with pugs)
Cheers,
Carl
On 5/25/05, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
> Works just fine for me. What version of pugs are you using? Perhaps
> you need to upgrade.
Ok, I've just realised I had missed a '->' to '.' in my perl5 to perl6
conversion,
I was trying to do
[EMAIL PROTECTED] = $obj->list;
I wasn't
I have a class that normally takes a list of named arguments.
I also want to be able to handle a single argument.
class Foo {
multi method new (Class $class: Str $date) {
return $class.bless(date => $date);
}
submethod BUILD ($.date, $.time, $.offset) {
# some error checking here
On 5/31/05, david d zuhn <[EMAIL PROTECTED]> wrote:
> Running pugs r4158, I find that (some, at least) subroutine calls
> only work with no whitespace between the sub name and the arguments.
>
> $v = numcmp (1,2); # fails with
>
> I don't see anywhere in the canon that no whitespace is allowed
Here's a demo script:
#!/usr/bin/pugs
use v6;
class Foo {
multi method new (Class $class: Str $date) {
say "ok";
return $class.new(date => $date);
}
submethod BUILD (+$date) {
say "date: '$date'";
}
}
my $foo = Foo.new(date => 'blah');
=cut
>pugs test.pl
ok
date: ''
Proble
Running `make clean` on WindowsXP is dying with an "expanded command
line too long" error.
Output as follows:
>make clean
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cd ext\Algorithm-TokenBucket && C:\Perl\bin\perl.
On 5/31/05, david d zuhn <[EMAIL PROTECTED]> wrote:
> this is a pretty fundamental change in
> perl that ought to be made a bit clearer (it's not in the p5->p6 porting
> guide, for example).
Agreed.
I remembered this being discussed by Abigail. Found it here:
http://www.perlmonks.org/?node_id=346
On 5/31/05, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote:
> I didn't really realize that there was a p5->p6 porting guide until I
> saw this. I'll add something to the guide as above (plus subs).
I've already added a bit about method calls, but I'll leave it alone
for you to do arrays/hashes.
C
ok, that was quick :)
Shall I remove what I'd already added to the bottom of the file?
Carl
On 5/31/05, Aankhen <[EMAIL PROTECTED]> wrote:
> You need to get a later version of nmake. The latest is 7.10, I believe.
1.50 -> 7.10
That's quite a version number jump!
I've updated it, and it works now, thanks.
Carl
> It's *a* correct way. But redundant in this particular case.
> The universal new() would handle the one-argument call exactly the same
> as your overloaded new() does. Presumably, however, the one-argument variant
> would do something else as well.
Some people will need to call the constructor w
> The universal new() would handle the one-argument call exactly the
> same as your overloaded new() does.
Is that correct? S12 says...
All classes inherit a default new constructor from Object.
It expects all arguments to be named parameters initializing
attributes of the same name.
... whi
> : alias newlines, newline;
Isn't it possible to add a Role to the relevant Class, which specifies
that is 'handles' the method name you want as an alias?
Carl
> sub factorial (Int $n is topic) {
> return 1 when 0;
> return $n * factorial $n;
> }
hmm, could we write...
sub foo (Class $self is topic: +$foo, +$bar) {
.method;
}
to avoid having to use ./
?
Cheers,
Carl
> why do we have to give up a space when calling functions under Pugs?
>
> A need to type open('file.txt') instead of open ('file.txt') makes
> me perplexing (not perl-flexing ;-) Our recent discussions in 'zip with()'
> gave no answer.
Not sure whether it's enough of an answer, but see:
http://d
> > why do we have to give up a space when calling functions under Pugs?
>
> >> Not sure whether it's enough of an answer, but see:
> >> http://dev.perl.org/perl6/doc/design/syn/S04.html#Statement_parsing
>
> it says:
>
> if $term ($x) # syntax error (two terms in a row)
>
> if this ca
I've just realised I quoted the wrong doc earlier, I meant to link to:
http://dev.perl.org/perl6/doc/design/syn/S12.html#Methods
.doit ()# ILLEGAL (two terms in a row)
.doit .() # okay, no arguments, same as .doit()
I had wrongly thought this also applied to subroutine calls, and th
On 29/09/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> * "try { foo() } err next" will next even if foo() did not throw
> an exception, but returned undef. But I don't think that's a problem
> in most cases. One can always do:
> try { foo(); 1 }
I think that's a flag that it's not
Brent,
Why not post the original query to p6compiler for their take on it?
Carl
Where did you get ALT-155 from?
I've just checked the windows Character Map, and ¢ (cent) is ALT-0162
( If it's not in your startmenu, do start -> run -> charmap )
It displays in Eclipse (3.1.1) whether the Text File Encoding is set to
Cp1252 (default) or UTF-8 or ISO-8859-1
Cheers,
Carl
On 21/10/05, Steve Peters <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 21, 2005 at 09:42:00AM +0100, Carl Franks wrote:
> > Where did you get ALT-155 from?
> >
> > I've just checked the windows Character Map, and ¢ (cent) is ALT-0162
> > ( If it's not in
Are default values supported for attributive parameters in an argument list?
I wish to convert these 2 subroutines to perl6:
sub foo {
my $self = shift;
$self->{foo} = defined $_[0] ? shift : undef;
}
sub bar {
my $self = shift;
$self->{bar} = defined $_[0] ? shift : $DEFAULT;
}
Is th
signatures and have to 'go back' to the
perl5-ish
sub do_this (*%args) { }
Carl Franks
That puts my mind at ease!
Many thanks,
Carl
On 4/25/05, Luke Palmer <[EMAIL PROTECTED]> wrote:
> Carl Franks writes:
> > Will it be valid to pass a hash to a subroutine expecting named
> > params, if the hash keys match the names?
> >
> > sub do_this
t\header.t t\params.t t\r
emote.t t\server.t
t\basicok 3/21Terminating on signal SIGINT(2)
-
Carl Franks
p, postfix iteration, ";" or end of input
at test.pugs at line 4, column 40
Alternately, if I remove the semicolon after the closing curly of the
"multi method new" declaration, I get this error:
d:\Documents and Settings\Carl Franks\My Documents\checkout\perl6>pugs -c
Sorry, I think I had been prematurely excited by all the "make test"
OK's I had seen while installing...
I'm now going through the test suite and seeing all the ":todo(1)"s !
I'll check the test suite first next time, before I ask a question
about unimplemented features.
Carl
Are you subscribed to perl6-compiler?
Yesterday Patrick Michaud posted "PGE features update (corrections)"
which describes the results you've got:
* Match objects for nested captures are nested into the surrounding
capture object. Thus, given
rulesub = p6rule(":w (let) ( (\w+) \:= (\S+) )"
Greetings,
S32/Temporal says a DateTime object can be maniplated like so:
$dt.delta(44, minutes);
Rakudo's core/Temporal.pm contains this:
my enum TimeUnit (
:second(1), :seconds(2),
:minute(3), :minutes(4),
[snip]
);
which is used in the signature of both Da
31 matches
Mail list logo