Dan Sugalski wrote:
The expensive part is the shared data. All the structures in an
interpreter are too large to act on atomically without any sort of
synchronization, so everything shared between interpreters needs to have
a mutex associated with it. Mutex operations are generally cheap, but
Damian Conway [EMAIL PROTECTED] wrote my $file = open error.log
../some/other.log; # I hope this is legal
Under my junctive semantics it is. It simply calls Copen twice, with
the two states, and returns a conjunction of the resulting filehandles.
Though you probably really want a
Michael Lazzaro [EMAIL PROTECTED] wrote
Note that \b conflicts with backspace. I'd rather keep backspace than
binary, personally; I have yet to feel the need to call out a char in
binary. :-) Or we can make it dependent on the trailing digits, or
require the brackets, or require backspace
Larry Wall [EMAIL PROTECTED] wrote:
On Thu, Dec 05, 2002 at 10:09:08AM -0800, Michael Lazzaro wrote:
: What about divvy (or are we already using that for something else?)
:
: my(@a,@b) = divvy { ... } @c;
Any such solution must use := rather than =. I'd go as far as to say
that divvy
Miko O'Sullivan [EMAIL PROTECTED] wrote:
On Thu, 5 Dec 2002, Dave Whipp wrote:
Only if we apply a bit of magic (2 is a true value). The rule might be:
How about if we just have two different methods: one for boolean and one
for multiple divvies:
my(@true, @false) := @array.cull{/some
Michael G Schwern [EMAIL PROTECTED] wrote:
This is just your friendly neighborhood curmudgeon reminding you that in
Perl 6, everything is an object
...
Instead of introducing new built-in functions they can be done as methods.
The problem with this worldview is that you end up with horrible
Simon Cozens [EMAIL PROTECTED] wrote
Verbs are almost always associated with their subject in OO languages,
so I don't see where you're coming from.
Actually, the important part of it was the 3rd option (the multimethod):
sometimes the association is symmetrical. I was pointing out that the
Brent Dax [EMAIL PROTECTED] wrote in message
00f901c2a22a$50417b30$6501a8c0@deepblue">news:00f901c2a22a$50417b30$6501a8c0@deepblue...
Under all systems I can think of, the memory address of an object's
header is constant. The data may move, but the header stays constant.
This is to minimize
Dan Sugalski [EMAIL PROTECTED] wrote in message
news:a05200f00ba1ebb73c6d2@[63.120.19.221]...
There'll definitely be memory address reuse. If .id returns the
current object's memory address, it shouldn't be cached any place, as
otherwise you'll find things going bang with some regularity.
In a
Rich Morin wrote:
is not something I want to try in XSLT. I can do it in Perl, of course,
but I end up writing a lot of code. Am I missing something? And, to
bring the posting back on topic, will Perl6 bring anything new to the
campfire?
I think that one of the things that Perl6 will bring
Can the type of a variable vary independenty of its value?
Consider the following:
my @a = (1,2,3);
my $b := @a;
@a and $b both refer to the same object. $b's object has methods such as
PUSH, POP, etc, as does @a's.
So the type of the value (object) is the same in each case, but the
John Williams wrote:
Do they? One is obviously an array, and one is obviously a scalar.
You may get an error (cannot alias an array as a scalar) or $b get aliased
to the array-in-scalar-context (a reference).
This is one of those how we think about the fundamentals things. I am
taking the
--- Michael Lazzaro [EMAIL PROTECTED] wrote:
These lines all declare @a to be an array that stores ints. That
would imply that the is Array part is actually instantiating
(Cnewing) the array... you're not saying that @a can someday
hold an array obj, you're saying it already _is_ an array
Buddha Buck [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
and similarly,
$a ~ ...;
is equivalent to
$a = ...;
But with the different precedence. At last, I can assign from a list without
using parentheses:
@a = 1, 2, 3; # newbie error
@a ~ 1, 2, 3; #
Mr. Nobody [EMAIL PROTECTED] wrote :
I have to wonder how many people actually like this syntax, and how many
only
say they do because it's Damian Conway who proposed it. And map/grep
aren't
specialized syntax, you could do the same thing with a sub with a
prototype
of (block, *@list).
I 50%
Michael Lazzaro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
And note that as pretty as - is, we couldn't have - for piping
because it would conflict rather strongly things like
if ($a-5)# (negative five, or pipelike?)
Its resolved by the longest
In the L2R thread, I made a comment where I contrasted a for loop
with a junction. On reflection, I think we could go further.
If we defined
my $prev = 0;
sub mangle($value) { $value + $prev; $prev=$value }
and then used it as:
my $x = any(1,2,3);
$y = mangle($x);
then the
Damian Conway wrote:
Yes, but will it junctify them con-, dis-, ab-, or in-junctively???
Probably most similar to injunctively. But sequentially. I had been
thinking of something like this:
while (DATA)
{
print matched $_ if $_ == for(1,2,3,4,5);
}
__DATA__
1
2
9
3
4
5
Like the old
Joseph F. Ryan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Rafael Garcia-Suarez wrote:
The tokeniser could send two tokens else and if whenever it
recognizes the keyword elsif -- so this isn't a problem.
I think the point of having Cif as a sub rather
Michael Lazzaro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Of course, _I'd_ even prefer using - and - as the 'piping' operators,
and having ~ or | for pointy sub, because then $a-foo and $a.foo
really _could_ be the same thing, 'cept for precedence. But
David Storrs [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
And then we can replace the ~ with -:
for 1,2,3,4
- sub ($a, $b) { $a+$b }
- sub ($a) { $a**2 }
- { $^foo - 1 }
- print;
And this begs the question: what exactly does
Michael Lazzaro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
... if such capabilities exist, what are their real names? Can
anyone think of any that are absolute must-haves? Are any of the above
must-haves?
I think that the only must-have is the ability
Damian Conway [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Dave Whipp suggested:
The size constraints are probably Cbut properties, as is Clocked.
The
exception behavior probably deserves to remain an Cis property.
Nope. They're all Cis properti
Michael Lazzaro wrote:
2a) When a cell is explicitly re-undefined, does the default value take
effect?
my @a is Array( default = 'foo' ) = (1,2,3);
@a[1] = undef;
@a[1]; # undef, or 'foo'?
STRAWMAN ANSWER: 'foo'.
If Cundef is a valid value for a cell, then I should be
Aaron Sherman wrote:
auto-vivification will have to happen in some cases. e.g. if foo
requires a lvalue parameter. You can't know if an actual write will
happen, so you have to auto-vivify in order to pass a reference.
Or did I miss something there?
I think the idea is to use a special object
Jonathan Scott Duff [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Wed, Jan 29, 2003 at 11:32:53AM -0800, Michael Lazzaro wrote:
Agreed, it's not pretty. The fundamental problem is that a primitive
like an Cint simply cannot be undefined... there's no
Michael Lazzaro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Along those lines, the closest I've been able to come so far to a
usable two-sentence definition is:
-- A list is an ordered set of scalar values.
quibble: that's an ordered bag, isn't it? ;)
--
Michael Lazzaro [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
What is the utility of the perl5 behavior:
\($a,$b,$c)
meaning
(\$a, \$b, \$c)
Do people really do that? I must say, given that it looks *so
obviously* like it instead means
Sam Vilain wrote:
Associations *are* fundamental object things. Presenting them in terms of
attributes is the real hack.
I agree with this statement; and Brent previously asked what
associations *are*. The problem with describing them in terms of
attributes/properties not not so much that its
Larry Wall wrote:
I dunno. I can argue that it should coerce that. It'll certainly be
able to coerce a random scalar to int for you, so it's not a big stretch
to coerce conformant arrays of them. On the other hand, it's likely
to be expensive in some cases, which isn't so much of an issue for
The effect of a macro is lexical; but the name may be installed in
either a package or a lexical scope. If the name is installed in a
class, can it be invoked via a variable of that class?
Example (SQL query integrated via macro):
my Database $db = MySqlDatabase.connect(...);
$db.select *
Larry Wall replied:
: my Database $db = MySqlDatabase.connect(...);
: $db.select * FROM Foo WHERE Foo.bar LIKE a%b;
To answer your actual question, you either need to have some keyword out
front to start the alternate parsing, or you need to treat .select
as an infix macro that has an
Luke Palmer wrote:
I'm not quite sure I follow you (I'm not familiar with that pattern).
But the macromethod I imagine is the non-polymorphic one, and the one
it expands to is the polymorphic one, if I'm guessing correctly. And
you certianly could do that.
yes:
Brent Dax wrote:
Dave Whipp:
# But you're right, there are situations where the (base) type
# might not
# be knowable: and these could result in syntax errors.
Except they wouldn't, at least not always.
[snip]
The only part of that I'm not sure about is infix:LIKE, since such an
operator hasn't
Michael Lazzaro wrote:
Defining a Class for this is also overkill.
Ye.. well, no. Why?
class Foo is Bar; # normal inheritance
class Baz is Bar; # the thing that we are over-killing
Foo.isa(Baz) == FALSE;
A lightweight, typedef-like mechanism behaves differently:
class Foo is Bar;
Damian Conway wrote:
b) The argument passed here must be something that will definitely
not cause the program to crash and burn, and we'll verify
that at
compile-time.
I'm arguing that the former is well-nigh useless, and that the latter is
what large systems developers
Michael Lazzaro wrote:
3) If an untyped var is used for a typed parameter, a simple dataflow
analysis is used to determine whether the compiler can guarantee that,
at that point, an untyped var will _always_ contain values of a known,
specific type. If so, the type is inferred (silently or
Uri Guttman wrote:
talking about nested subs brought up another related idea, static (not
on the stack) lexicals inside subs.
Doesn't Cour give you this?
Dave.
--
http://dave.whipp.name
class Scalar isa intlike, numlike, ...; # and isa Object or whatever
Qoting A6: Perl makes a distinction between the type of the variable,
and the type of the value
If we view Scalar as the type of a variable, not value, then we could
cease to need all this cleverness with inheritance. People
Joe Gottman wrote:
Alternatively, there might be a new parameter type that indicates that the
parameter is not evaluated immediately:
sub infix:!! ($lsh, $rhs is deferred) {...}
A nice concept! So nice, in fact, that it would be a shame to limit it
to function args. I could see myself writing:
Reading A6, I was wondering if the following would work:
sub return_if_true ($value)
{
if ($value)
{
leave where=caller(1), value=$value
}
}
Joe Gottman wrote:
There are two reasonable semantics for deferred parameters:
1) lazy evaluation with caching, where the evaluation of the
actual expression in the call is deferred until the sub
actauly makes use of it and the result is then cached and
reused as necessary. Any side effects
A few more random thoughts:
Austin proposed
{
thread { print hello\n };
print world;
}
would spawn the first print into a separate thread, and then join before
executing the second print. I would like to see if this can be extended a
bit, using Luke's object Sigil proposal:
my $result =
John Macdonald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I would like to suggest a radically different
mechanism, that there be operators: fork, tfork, and
cfork to split off a process, thread, or coroutine
respectively. (The first might be called pfork
if we're willing to
Jonathan Scott Duff wrote:
I've read this post far more times than I care to admit and I still
see no merit to conflating threads and coroutines.
To me, the salient feature of coroutines is the ability to start from
the beginning or from where we left off, while the salient feature of
threads is
Jonathan Scott Duff [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
If we could think about threads not in terms of forkyness, but simply
in terms of coroutines that can be called in parallel, it should be
possible to create an implementation of threading that had to do a
whole
Austin Hastings [EMAIL PROTECTED] wrote:
1. Cyield always acts the same way -- stores args in CurThread.result
and gives up control to [?something?].
I think you want a fifo on the output there -- at least conceptually.
Stores args in .result might overly block the producer thread.
gives up
Austin Hastings [EMAIL PROTECTED] wrote
--- Dave Whipp [EMAIL PROTECTED] wrote:
Austin Hastings [EMAIL PROTECTED] wrote:
1. Cyield always acts the same way -- stores args in
CurThread.result
and gives up control to [?something?].
I think you want a fifo on the output
Michael Lazzaro [EMAIL PROTECTED] wrote in
for foo() {...}
It doesn't matter whether foo() is a closure or function returning a
list, lazy list, or iterator, or is a coroutine returning it's .next
value. Which is excellent, and, I'd argue, the whole point; I'm not
sure that we can have
OK, we've beaten the producer/consumer thread/coro model to death. Here's a
different use of threads: how simple can we make this in P6:
sub slow_func
{
my $percent_done = 0;
my $tid = thread { slow_func_imp( \$percent_done ) };
thread {
Michael Lazzaro [EMAIL PROTECTED] wrote in # But if you want
to get the thread object, so you can monitor it's
{
...
my $tid = thread slow_func_impl(...);
while $tid.active {
status_monitor($tid.progress);
sleep 60;
}
John Macdonald [EMAIL PROTECTED] wrote At first glance, this
doesn't need a thread - a
Instead of
sleep, though, I'd use a pipeline and read it with
a non-blocking read until there is no data. ...
++ For the lateral thinking. Definitely a valid solution to the problem, as
given. So I'll
Dulcimer wrote:
sub slow_fn {
my $tick = Timer.new(60, { print ... });
return slow_fn_imp @_;
}
Now if I could just get the compiler to not complain about that
unused variable...
Maybe I'm being dense
Why not just
sub slow_fn {
Timer.new(1, { print . });
return slow_fn_imp @_;
}
Dulcimer [EMAIL PROTECTED] wrote so that the timer goes off after a
second, prints a dot, and resets
itself to go off again after another second? And I still like the idea
of an expanding temporal window between dots:
sub slow_fn {
my $pause = 1;
my $timer is last { .stop } = new
Dulcimer [EMAIL PROTECTED] wrote
But exposing the object like that still bothers be: I shouldn't need
the $tmp, nor the .new.
I'm not so sure I agree with losing the new(). I kinda like that just
for readability. Less isn't always more. :)
Ok, how about this:
sub slow_fn {
temp
Dulcimer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I find Ctimeout(60) { ... } too terse, and would
rather see a more verbose version
I'm obviously more lazy than you ;-).
Ah. Ok, but if that's the case, you could as easily write it
timeout(5) { coro { ... } };
and
Luke Palmer wrote:
I think it would fall trivially out of the events mechanism, which is
planned for Parrot.
I have heard rumours of such a thing, but no details of how it will be
exposed in the language...
Dave.
Piers Cawley [EMAIL PROTECTED] wrote
Threads and Progress Monitors
Dave Whipp had some more thread questions, and wondered what would be
a
good Perl 6ish way of implementing a threaded progress monitor. Whilst
the discussion of all this was interesting, I'm not sure that it's
Luke Palmer wrote:
So, maybe what's needed is a Cwarn catcher (CWARNCATCH... eew),
where Cwarn would throw an exception object with an attached
continuation. And of course, if a warning reached the top of the
stack without being caught, it would print itself and invoke its
continuation.
I
I've been re-reading A5 (regexen), and I was trying to work out how to
incorporate a preprocessor into regex, without a separate lexer. I came
to the conclusion that preprocessor commands are part of the whitespace
in the higher layer of the grammer. So we just need to define the ws
rule
Luke Palmer [EMAIL PROTECTED] wrote:
Benjamin Goldberg wrote:
David Storrs wrote:
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3? Would it do the same
thing?
Of course.
I tend to agree, I think. But see
Piers Cawley [EMAIL PROTECTED] wrote
Parsers with Pre-processors
I didn't quite understand what Dave Whipp was driving at when he
talked
about overloading the ws pattern as a way of doing preprocessing
of
Perl 6 patterns. I didn't understand Luke Palmer's answer either.
Help
Austin Hastings [EMAIL PROTECTED] wrote:
What you really want is to be able to chain grammars:
my $fh = open hello.c;
$fh =~ /Grammars::Languages::C/;
grammar Grammars::Languages::C {
method init {
SUPER::init;
$.source = (new
Austin Hastings [EMAIL PROTECTED]
I.e. is it just an input stream filter?
Doubtful.
Do you want to do this at the grammar level, or the file level?
If you want it at the file level, you Ctie a translator (ooh! my
first p6 idiom!) to the file handle.
If you want it at the grammar level
Mark J. Reed [EMAIL PROTECTED]
Quick, dumb question: what is an abjunction? How does it differ
from a junction?
An abjuction requires that none of its members match. For example,
($a == none(1,2,3)) is true for any value of $a except 1, 2 or 3.
Dave.
Are parameter names part of the function signature? A6 defines siglets,
which don't appear to include parameter names.
If I write:
sub foo( Int $a, Int $b ) {...}
sub foo( Int $a, Int $c ) { print $a+$c }
Are these now equivalent:
foo( a = 1, b = 2 )
foo( a = 1, c = 3 )
What if I
Austin Hastings [EMAIL PROTECTED] wrote
if (Dough eqn(4) Douglas) ...
I wonder if the . operator is available here:
if Dough eq.n(4) Douglas { ... }
that makes it intuitive how to define new equality methods. One thing of
concern is that we'd need whitespace rules to disambiguate things. I
Larry Wall [EMAIL PROTECTED] wrote:
Also, since multi is orthogonal to naming ...
So I'm wondering what the correct syntax is to grab a reference to a group
of multi-somethings. Example:
multi sub foo(Int $a:) {...};
multi sub foo(String $a:) {...};
my $ref = multi foo;
$ref(hello); # calls
When I see these long squiggles of line noise, I can't help thinking that
English might be a better alternative. Using Larry's terminology from a few
posts ago, we might think of:
@a \C[leach] + \C[reach] @b
Not mnemonic in a visual sense, but extendable to all sorts of trigraph
contexts.
Larry Wall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
That is, suppose you have:
macro leach () { return » }
macro reach () { return « }
You could unambiguosly write
leach+reach
but (assuming spaces not allowed within distributed operators) you can't
write
Perhaps something like:
@sorted = sort { infix:= map { scalar $_.foo('bar').compute } @^_ } }
@data
I'm not entirely sure it's readability is better than yours, though.
Dave.
Luke Palmer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I've been thinking about this problem which
Damian Conway [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
type KeyExtractor ::= Code(Any) returns Any;
# Modtimewise numerically ascending...
@sorted = sort {-M} @unsorted;
One thing I've been trying to figure out reading this: what is the signature
of prefix:-M
Larry Wall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Unfortunately we can't just use topicalization to say
my Cat $tom = .new()
because most people won't expect simple assignment to break their
current topic.
So another option is to replace = with something that
Jonathan Scott Duff [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Wed, Apr 14, 2004 at 10:31:23PM -0400, Joe Gottman wrote:
And Perl 6 isn't? I use backticks quite a bit in Perl, and I don't
see
that changing if I upgrade to Perl 6.
Me too, but I write my backticks like
Trey Harris [EMAIL PROTECTED] wrote i
It's easy to just say don't nest placeholder-using closures, but that
doesn't seem workable in practice since every block is a closure, unless
placeholders are forbidden from all but the most trivial cases. Absurdly
trivial, it seems. How about
$sub
Larry Wall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Fri, Apr 23, 2004 at 02:50:42PM -0400, Austin Hastings wrote:
: Sure, but You haven't provided a value yet. doesn't seem very ...
: exceptional.
The important thing will be You didn't provide a value at line 42, though
Abhijit A. Mahabal [EMAIL PROTECTED] wrote:
Symbol tables and typeglobs and such belong to A10... and the * has been
stolen... so I'll just speculate in pseudocode.
Blocks-are-subroutines makes life easier, and in pseudocode that can be
just:
*{Foo::name1} = - $a { $a-{name1} };
If I read
Luke Palmer [EMAIL PROTECTED] wrote
Well, the IO-objects are iterators, and you use $iter to iterate. It
makes sense that would iterate over $*ARGV by default.
When I read this, I instinctively thought to myself: why does this need to
be global?. And that thought progressed to: what is the
Abhijit A. Mahabal wrote:
*{Foo::name1} = - $a { $a-{name1} };
If I read A12 correctly, this could be written as:
Foo::$name1 := - $a {$a.name1};
Could be; that sounds somewhat right, but could you point out where in A12
because a search for := revelaed nothing relevant to me.
Sorry, the
Is it possible to hyper a hyper operator?
For example, given:
my @m = ( [1,2], [3,4], [5,6] );
my $a = @m + 1;
my $b = @m +« 1;
my $c = @m +«« 1;
is it true that:
ok($a == 4);
ok($b »==« [ 3, 3, 3 ];
ok($c »»==«« [ [2,3], [4,5], [6,7] ];
Is there an infinite depth hyper
It probably depends on what nationality that keyboard is for. If its
Japanese, you probably won't have a problem ;-).
But for the rest of us, use Vi and ctrl-KYe (or spacezipspace).
Dave.
Gabriel Ebner [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,
Joe Gottman wrote:
Larry Wall [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
This is Perl 6. Everything is an object, or at least pretends to be one.
Everything has a .boolean method that returns 0 or 1. All conditionals
call the .boolean method, at least in the abstract.
My reading of A12 leads me
Jonadab The Unsightly One [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
It would be possible to have right-associative operators (that bind at
least more tightly than comma and possibly very tightly) and convert a
number to one of these objects, so that we can do stuff like this:
Ph. Marek [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Thursday 08 July 2004 05:25, Larry Wall wrote:
: say @x[rand]; # how about now?
Well, that's always going to ask for @x[0], which isn't a problem.
However, if you say rand(@x), it has to calculate the number of
I was thinking about the discussions about the open function, and of the
capabilities of strings.
Given that we'll have things like $str.bytes, etc. It doesn't seem a stretch
to suggest that we could also have $str.lines. Once we have that, and also a
level of pervasive laziness (lazy
Andrew Shitov [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
DW my $text is TextFile(/tmp/bar);
DW $text = hello; # writes, truncates
DW $text ~= , world\n; # appends
DW $text.print again\n; # for old-times sake
Anyhow we still need $text.flush() or $text.close() methods.
Rod Adams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Case 1:
So I wanted to do a read/write scan, so I create my TextFile, start
reading in data, so the file is opened for reading. Then, I come to the
part where I want to update something, so I do a write command. Suddenly
the
Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Amen. Please don't steal unnecessary metacharacters in qq()
strings--although I still think we should keep it, @ causes a lot of
problems.
I seem to recall an issue, last week, of whether adverbs can be
Chromatic [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Shh, no one's let slip the idea of curried roles yet! I'm not even
certain A12 mentioned parametric roles, let alone first-class roles.
And with parametric roles, perhaps we also get Cmulti roles?
Dave.
David Storrs [EMAIL PROTECTED] wrote (apparently may days ago):
Race condition: what if something deletes the file between the moment
that perl closes the file and the moment that it re-opens it? Is
there a cross-platform way to do an atomic reopen?
I'm not sure if you need to close it before
David Storrs [EMAIL PROTECTED] wrote
# Print file, inefficiently
print $default.readline for 1..$default.lines;
print it efficiently:
print $default;
# Append a line
$rw .= an additional line\n;
$rw ~= \n unless $rw.chars[-1] eq \n;
$rw ~= an additional line\n;
#
Parameters are by default constant within the block. You can
declare a parameter read/write by including the Cis rw trait.
If you rely on C$_ as the implicit parameter to a block, then
then C$_ is considered read/write by default. That is,
the construct:
for @foo {...}
is actually
Sean O'Rourke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
my $x = (use Some::Module::That::Defines::A::Class).new(blah);
how about some variation on
my $x = Some::Module::That::Defines::A::Class.AUTOLOAD.new(blah);
Dave.
Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Aaron Sherman [EMAIL PROTECTED] wrote:
I've always thought that particular bit of sugar was rather dangerous.
I'd even prefer a longhand:
$foo either 0 or split();
The overloading of 'or' there is
I was rereading S5, and the example of grammatical inheritance caught my
eye:
grammar Letter {
rule greet :w { [Hi|Hey|Yo] $to:=(\S+?) , $$}
...
}
grammar FormalLetter is Letter {
rule greet :w { Dear $to:=(\S+?) , $$}
...
}
My first reaction was that we need a bit more
I was wondering just how much once can do with gather/take: is it possible
to have multiple bins?
@words = abc def ade afe ade agc ;
gather @bin1, @bin2 - $bin1, $bin2{
for @words {
$bin1.take if /^^a/;
$bin2.take if /e$$/;
}
}
?
gather @bin1, @bin2 - $bin1, $bin2{
for @words {
$bin1.take if /^^a/;
$bin2.take if /e$$/;
}
}
Juerd point out (private email) that my example doesn't really make any
sense in that it doesn't do anything over and above s/take/push.
However, I think the concept of multiple bins
Attributes are declared with Chas, but also have a unique signil
C$.. So is it strictly necessary to declare them? Or rather, is it
Cno strictly necessary -- i.e. is the following legal?
no strict;
class Foo {
method bar {
say $.a++
}
}
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
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;
1 - 100 of 238 matches
Mail list logo