David Storrs wrote:
On Jul 8, 2005, at 4:25 PM, Dave Whipp wrote:
Rod Adams wrote:
multi method foo#bar (Num x) {...}
multi method foo#fiz (String x) {...}
$y = 42;
$obj.foo#fiz($y); # even though $y looks like a Num
$obj.foo($z); # let MMD sort it out.
Instead of
multi method foo#fiz (String x) {...}
$y = 42;
$obj.foo#fiz($y); # even though $y looks like a Num
$obj.foo($z); # let MMD sort it out.
It's unclear if
$obj.foo($y);
even works, or should work, even if it does.
It be no means solves all of Yuval's problems, but it would be a handy
workaround to un-multi your calls.
-- Rod Adams
Larry Wall wrote:
On Mon, Jun 20, 2005 at 07:09:42PM -0500, Rod Adams wrote:
: S10 talks about how it is AUTOSUB vs AUTOMETH (and others), but AUTOLOAD
: is still around. S10 doesn't mention it, but I think it's been said that
: AUTOLOAD only gets called as a last resort.
Really
think. Also makes the info
available for more than just AUTO.* methods, which opens the door up for
all kinds of useful perversions, especially in the age of bindings and such.
I leave the definition of "something useful" to others.
-- Rod Adams
o mentions that the 'goto' is implicit. I think I like the return
of a ref better, since you're not always going to want to build the
function out and store it. But the call can be hijacked, so I guess
that's okay.
-- Rod Adams
that counterintuitive. A more consistent
approach might produce
13
14
14
Don't you mean:
13
4
4
?
-- Rod Adams
1"}/;
s:g/multi (sub|method) / $1 /;
And then have a "single" still be multi, just with a MMD distance of
-Inf to everything.
-- Rod Adams
Juerd wrote:
Still, argumentless split probably defaults to something. And ' ' is a
good thing to default to, IMO.
I like /\s+/ as a default for split better.
-- Rod Adams
x" is spelled for certain. One could probably even
write a macro that auto-binds all the lexicals in the outer scope to the
current scope.
-- Rod Adams
eing moderately useful, I still find that only reliable way to
do automated multi-processing is to whip out Win32::Process and start a
new interpreter with special "I'm a child process" arguments.
-- Rod Adams
, and dispatching accordingly.
3) a dispatch table of all the foo's currently in scope at the time the
reference is made.
Personally, I think #3 would be the most useful.
-- Rod Adams
Sam Vilain wrote:
Rod Adams wrote:
How do I specify the signature of a context-sensitive function?
sub foo() returns (what?) {
return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep;
}
I suspect a typed junction would look like : "Junction of Int|Str".
to me that C should have an implied C on it's lhs.
Unless we spell that C.
-- Rod Adams
typed junction would look like : "Junction of Int|Str".
-- Rod Adams
Nathan Gray wrote:
possibly as an strftime() pattern.
Can we please make sure that strftime() is _not_ OS dependent like the
POSIX version is now?
-- Rod Adams
y be a split between bytecode/doc
distros, and full source distros.
I have no thoughts on how to handle the (un)installation of collections.
-- Rod Adams
wever, as I pointed out before, since in p5
there is no notion of an author URI, haveing that become the string
'perl5' makes sense, and could be matched against, both positively and
negatively.
-- Rod Adams
Juerd wrote:
Rod Adams skribis 2005-05-26 4:15 (-0500):
From S02: "Array and hash variable names in scalar context
automatically produce references."
Since [...] produces a scalar arrayref, we end up with an arrayref one
both sides of the =.
No.
There is no scalar cont
r die.
In p5, your only options were to 1) not install the new version 2)
install it, and globally update your code to match, 3) give each script
it's own libpath.
I still think auto fallback makes sense. If you don't like it, always
fully specify your "use" statements. See S11 for details.
-- Rod Adams
Markus Laire wrote:
Rod Adams wrote:
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not sure if this
automatically
makes the array
ize 3 in Perl6?
@a = 1,2,3;
You could, if you changed the precedence of , to be tighter than =.
However, by default, = has higher precedence than ,, so that you need
parens to override this decision: @a = (1,2,3);
Or use
@a <== 1,2,3;
-- Rod Adams
Austin Hastings wrote:
--- Rod Adams <[EMAIL PROTECTED]> wrote:
TSa (Thomas Sandlaß) wrote:
You mean @a = [[1,2,3]]? Which is quite what you need for multi
dimensional arrays anyway @m = [[1,2],[3,4]] and here you use
of course @m[0][1] to pull out the 2. I'm not s
n an arrayref to an array element.
-- Rod Adams
, assuming the module author was kind enough to up the
version number.
Glancing at S11, I see where you're coming from. There is some logic in
giving all the p5 modules an author of "perl5", since they will not have
one on their own. However, I think the calling syntax would have to be
"use Digest-(Any)-perl5;" to force the usage of a perl5 version.
-- Rod Adams
g someone has to ask for, and that it
likely shouldn't carry the name 'uniq'.
-- Rod Adams
#x27;d have to stop and wonder if wrapping
it inside a map would be more natural. If it does happen, it'd likely
need to copy the key generation style of the new sort.
-- Rod Adams
hat way, doesn't mean it is that way.
But the "eval join" way of looking at it does seem to be consistent with
what I've seen discussed previously, and would provide a useful way to
remember the effects of edge cases.
-- Rod Adams
My general thoughts has been that:
[op] @list
behaves something like:
eval join(op, @list)
so feeding it an empty list would return undef, regardless of op.
Similarly, if @list is just one element, it returns that element.
-- Rod Adams
the CALLER is. Therefore, when log10() is called, the CALLER for
log() is the same as the CALLER for log10.
IMO, if this is not the case, it severely limits the utility of curried
functions. Comments from @Larry requested.
-- Rod Adams
easy
optimization of including unboxed equivalents and letting MMD sort it out.
-- Rod Adams
Juerd wrote:
Rod Adams skribis 2005-05-14 19:21 (-0500):
o.
O.
this.
self.
me.
Not special syntax, meaning you can no longer use these identifiers for
your own class. Bad style to use single-letter identifiers, but we know
what trouble $a and $b in Perl 5 cause, and the B:: namespace.
I
eople on this list actually stand on the issue.
Here's the list as I've heard them:
$?SELF, and nothing else by default.
$_ bound to $?SELF at start of method.
o.
O.
this.
self.
me.
^
->
_
° (an idea I just had. would likely need a 7-bit option as well)
..
As for myself, I'm unfavorable to the first option, favorable to ->, °,
and me., neutral to the rest.
-- Rod Adams
e it's not
at all obvious that $x{2} is calling an array.
-- Rod Adams
Larry Wall wrote:
On Sat, May 14, 2005 at 12:51:32PM -0500, Rod Adams wrote:
: Unless, of course, there is some subtle difference between a 3-d hash
: and a hash of hashes of hashes that invalidates this.
No difference, I hope. The multidimensional notation is meant
to extend to HoH and AoA
er we have
to make != and !~ and ne transform themselves via "not raising", or
we have to disallow negative comparisons on junctions entirely.
Opinions?
I go with option 2b: leave the syntax the way it is, but fire off a
warning, not an error when someone does this.
-- Rod Adams
taken from what Larry was talking about when he first brought
up the [] metaop.
Unless, of course, there is some subtle difference between a 3-d hash
and a hash of hashes of hashes that invalidates this.
-- Rod Adams
at does nothing:
sub Foo { }
Is it illegal to say this?
sub Foo returns Void { }
Can't we just say :
Void =:= none(Any)
and get Void for near free?
-- Rod Adams
ns justice. Looking ahead, I do not see this state changing for
the better in the foreseeable future.
It's my hope that someone none(@Larry) can and will pick this effort up.
I will give whatever assistance I can to anyone choosing to do so. Drop
me a line.
-- Rod Adams
John Macdonald wrote:
On Wed, May 04, 2005 at 03:02:41PM -0500, Rod Adams wrote:
If there are good uses for coroutines that given/take does not address,
I'll gladly change my opinion. But I'd like to see some examples.
FWIW, I believe that Patrick's example of the PGE returning
t I'd like to see some examples.
FWIW, I believe that Patrick's example of the PGE returning matches
could be written with given/take (if it was being written in P6).
-- Rod Adams
single interpreter should be more than
sufficient.
-- Rod Adams
Luke Palmer wrote:
Rod Adams writes:
Perhaps the easiest way to explain the difficulty here is to note that
executing a relational op (i.e. returning a boolean) value on a junction
argument returns a junction of boolean values.
Is that so? Does Perl6 have some fundamental law of
it.
It's been established before that getting at _which_ values in a
junctions made the evaluation turn one way or the other is _not_
something that will be readily supported.
-- Rod Adams
al $WARNING = 0;
print "Windoze\n" or die "Can't print: $OS_ERROR";
}
Not exactly a fair comparison, since it's common to not "use English"
due to the $& issue.
I suspect that if that was not the case, it would be used more.
-- Rod Adams
list, but "return" is a strong contender.
Additionally, any predicate form cannot be a "normal function". You
might be able to define an &infix:, but getting to where you don't
need the {}'s on the LHS block, and getting a proper list on the RHS
gets rather abnormal.
Something that crossed my mind while writing this: Does
for { say } <== @a;
Work?
-- Rod Adams
rforming magical disappearing
acts all over the place, and the ^ ties in with the $^x of parameters.
As for shortcuts to $OUTER::_, perhaps $-, if it's not put to some
better usage, but anything beyond that is getting too obscure for common
usage.
-- Rod Adams
$j];# \(b..d)
$ju = juncture @ar[$j]; # 'b'|'c'|'d'
@v = %hash{$k}; # (1,7)
%v = %hash{$k}.kv; # (a=>1,c=>7)
$v = %hash{$k}; # \(1,7)
$jv = juncture %hash{$k}; # 1|7
Am I way off base here?
What would you propose
@v[all(any(4,5),one(1,2,3),none(7,8,9))]
return?
-- Rod Adams
n core.
Didn't S09 take care of that w/ the [ ; ; ] syntax?
-- Rod Adams
or the block,
but that starts getting to look a lot like
{my $sql = '...'} CATCH {default};
Except that one is run-time, the other compile-time.
So one could interpret this thread as a cry for a compile-time exception
handler. I see some interesting uses for this in conjunction with
C, but I doubt I'm seeing the whole story.
-- Rod Adams
David Wheeler wrote:
But the first person to write <[a...]> gets what's comin' to 'em.
Is that nothing (since '.' lt 'a'), or everything after 'a'?
-- Rod Adams
's a possibility and no one seems to be disputing those, so
I apologize if I just need to be pointed to where methods v functions
is clarified.
Many of them will happen in S29, since there's an odd duality that class
based multi subs exist in. I don't pretend to fully understand
;, and
that was on Feb 22, one can be left to assume that Damian is suffering
from a very long week. Poor Damian. Sadly, my recent weeks have felt as
if they were 2 months long. Here's to a return of the 7 day
week!
-- Rod Adams
I see them as solving all kinds of corner cases.
Unfortunately, I don't have a solid proposal handy, which has kept me
from posting it. But since there is some interest in this, I'll throw
the concept out there, and see if anyone else has a good idea what they
should look like, and exactly how they should work.
-- Rod Adams
e individual chars. Consider:
$a = $b = "All good boys go to heaven.";
substr($a,9,3) = "girl";
$b[9..11] = "girl"[];
say "A: $a";
say "B: $b";
A: All good girls go to heaven.
B: All good girs go to heaven.
-- Rod Adams
list of lists is still just a list. An array
of arrays is a different story.
So this behavior is what I meant to say in S29. If it's unclear, I'm
open to suggestions.
-- Rod Adams
(who still needs more time to work on S29. Looks like I'll have some in
a few weeks. In the meant
pair is more useful.)
Most likely a pair.
Now if I could only find some more time to work on S29. I've been making
progress (slowly) on getting the string functions written up, but life
seems to be conspiring against rapid progress.
-- Rod Adams
lay problem. I seriously doubt the someone working with a rtl
language would ever wish to count the characters ltr. And note that we
are calling the positions "start" and "end", not "left" and "right".
If I'm missing something basic here, let me know.
-- Rod Adams
Larry Wall wrote:
On Sat, Mar 26, 2005 at 02:37:24PM -0600, Rod Adams wrote:
: Please convince me your view works in practice. I'm not seeing it work
: well when I attempt to define the relevent parts of S29. But I might
: just be dense on this.
Well, let's work through an example
ust a "toy" for solving a few minor problems like
specifying characters.
- It's fairly comprehensive in that it should be easy to write
functions which mutate the units intelligently, and know when to flag a
type mismatch.
- It all goes away by default for the user who doesn't want to bother
with it.
-- Rod Adams
t I might
just be dense on this.
-- Rod Adams
allowing the user to add more as they
see fit (EBCDIC, etc).
Level and Encoding can be mixed and matched independently, except for
the combos that don't make any sense.
-- Rod Adams
of those creates an Array of
Arrays, and the other just an Array. In other words, using @ instead of
$ puts a "Array of" in front of the supplied type.
This makes sense when one considers orthogonality with C and
C. But it's easy to get tripped up it.
-- Rod Adams
(Who needs m
o.
But you can't solve
nothing while something();
with a comment. Well, not gracefully. Not without inline comments, at least.
There seems to be some support for just saying:
{} while something();
I would also hope the compiler could optimize away something like:
sub nothing () {};
-- Rod Adams
Larry Wall wrote:
On Sun, Mar 20, 2005 at 09:08:08PM -0600, Rod Adams wrote:
: I propose creating a no-op function "nothing" that can be used
: here or anywhere else you specifically wish to do nothing at all.
:
: given $this {
:when Even { nothing };
:when Prime { ... };
:
Luke Palmer wrote:
Rod Adams writes:
C is an odd sort of function. AFAIK, it's the only optimization
hint that we have.
Will the P6RE even use this information, and is it worth keeping?
My gut feeling tells me that it will be useful again around 6.2, and we
should keep it around until
s
not something you can do with slices, unless you start stiching the
prefix, replacement, and suffix slices on your own, which requires a lot
of copying that could be skipped.
-- Rod Adams
C is an odd sort of function. AFAIK, it's the only optimization
hint that we have.
Will the P6RE even use this information, and is it worth keeping?
My gut feeling tells me that it will be useful again around 6.2, and we
should keep it around until then as a potential no-op.
Comments?
-
I'm thinking C and C should be strictly Code Point level
activities, but I'm not sure.
They likely need to be renamed, in any event, to better reflect the fact
that everything is Unicode these days.
-- Rod Adams
hogonality strikes again.
I've renamed C to C in S29. (new post soon)
-- Rod Adams
$this {
when Even { nothing };
when Prime { ... };
default{ ... };
}
As a side question, I assume that there's a predicate form of "when",
but it's not mentioned.
given $this {
nothing when Even;
when Prime { ... };
default{ ... };
}
-- Rod Adams
e `if $x == 1 | 2`, this
is one of those things that a newbie to programming would ask "why can't
I do that?"
For the record, this is the currently what I plan on doing in S29 unless
I hear a strong objection or something better.
-- Rod Adams
Larry Wall wrote:
On Wed, Mar 16, 2005 at 11:49:12PM -0600, Rod Adams wrote:
: I haven't gotten a solid answer on when and how Perl will autogenerate
: methods from subs.
In general I don't think of it as autogeneration at all, but as
failover to a different dispatcher. I can't
h positions within those
strings, and what a given integer position means can vary greatly with
level. But even there I suppose that we could force the target's level
onto the term, and make all positions relative to the target, and it's
level.
As for the exact syntax of the coercion, I'm open to suggestions.
-- Rod Adams
urns an lvalue or not, which my
C<.as> does.
There's likely room for unification of the two ideas.
-- Rod Adams
it did in Perl 5.
Some side points:
It is an error to do things like C with strings of different
levels, but not different encodings.
level and encoding should default to whatever the source code was
written in, if known.
C and C should be able to be replaced with C views of
compact structs (see S09).
C kills C. Or at least buries it very deeply, without oxygen.
Comments?
-- Rod Adams
view" type casting
Larry was rumbling about. Simply re-view your string as an "Array of
Chars", (bytes/codepoints/graphemes) and then pop or shift.
Let's see where that thread ends up first.
-- Rod Adams
Larry Wall wrote:
On Thu, Mar 17, 2005 at 10:31:07PM -0600, Rod Adams wrote:
: Aaron Sherman wrote:
: >>Methods on numeric values (should be defined as pseudo-methods on
: >>unboxed numbers):
: >>
: >> chr
: >> hex
: >>oct
: >>
: >>
other languages That's evil. I like it :-)
btw, has some syntax been created for "punt this over to Parrot, in
language X"?
eval q:to:0 /EOB/ :lang('PIR');
...
EOB
eval $=DATA :lang('python');
eval loadfile 'foo.pl' :lang('ponie')
Aaron Sherman wrote:
On Thu, 2005-03-17 at 20:47 -0500, Aaron Sherman wrote:
Methods on numeric values (should be defined as pseudo-methods on
unboxed numbers):
chr
hex
oct
Sigh... well, now I know what Ctrl-Return does in Evolution :-/
Ok, so what I was getting at was that th
Aaron Sherman wrote:
On Wed, 2005-03-16 at 02:18 -0600, Rod Adams wrote:
I just posted a fresh copy of S29 to:
http://www.rodadams.net/Perl/S29.pod
http://www.rodadams.net/Perl/S29.html
Couple more points from the docs (mostly to the list, but some to you,
Rod):
multi sub grep (Any
Aaron Sherman wrote:
On Thu, 2005-03-17 at 18:06 -0600, Rod Adams wrote:
This is a SEPARATE need from the need for a repeatable, standard PRNG,
and should always operate off of the best source of entropy available to
the program. Right now, that's /dev/urandom (for non-blocking hybri
Aaron Sherman wrote:
On Wed, 2005-03-16 at 03:18, Rod Adams wrote:
I just posted a fresh copy of S29 to:
http://www.rodadams.net/Perl/S29.pod
http://www.rodadams.net/Perl/S29.html
From there:
=head2 Obsolete
=item chop
Chop removes the last character from a string. Is that
C, and leave it up to you to
determine what the operator form of it should be, if any.
for zip :shortest 1...; @foos; @bars {...}
-- Rod Adams
Larry Wall wrote:
On Wed, Mar 16, 2005 at 01:22:06PM -0600, Rod Adams wrote:
: Larry Wall wrote:
:
: >On Tue, Mar 15, 2005 at 12:28:15PM -0700, Marcus Adair wrote:
: >: Isn't saying "false doesn't exist" like saying, "dark doesn't exist"?
: >: Why
Luke Palmer wrote:
Rod Adams writes:
In S29, I currently have C as:
multi sub grep (Any|Junction $test : [EMAIL PROTECTED]) returns List {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}
That's the listop form. I was referring to the method form:
multi
bit
more flexible.
Thanks to Joe for pointing out the missing functions. They've been added
locally and will be posted shortly. (Any others?)
-- Rod Adams
yms in all other ways but "autoflatten".
As far as linguistics go, "for" makes a suitable replacement for "given"
in my head. It's just a very heavily loaded term when you leave English
and enter CS-speak.
-- Rod Adams
ar2 -> $_ is rw {
s/.../.../;
s/.../.../;
}
though
given $var1 {
s/.../.../;
s/.../.../;
}
is nice.
)
But if you don't see the need for lvalueing the elements coming out of
C, that certainly makes things easier. :-)
-- Rod Adams
ke $expression
.( splice(@values, 0, $expression.arity) );
}
}
}
-- Rod Adams
) > take care of those cases?
Sure, it's line noise, but do we really need a new keyword for something
that's "relatively rare"?
Especially when that keyword is likely to confuse people a lot more than
the application of two unary operators?
-- Rod Adams
.
:'s have been added into signatures where they belong.
various other clean ups.
Comments welcome.
-- Rod Adams
I vote for axing C in favor of C and C.
-- Rod Adams
Larry Wall wrote:
On Tue, Mar 15, 2005 at 02:25:01PM -0600, Rod Adams wrote:
: In Perl 6, all builtin functions belong to a named package. Not all
: functions are guaranteed to be imported into the global package
: C<::*>. In addition, the list of functions imported into C<::*> will
ness and deprcate it completely?
I hadn't thought about it yet. I almost definitely would have come to
that conclusion.
Yes, please.
Done.
-- Rod Adams
a named package. Not all
functions are guaranteed to be imported into the global package
C<::*>. In addition, the list of functions imported into C<::*> will be
subject to change with each release of Perl. Authors wishing to
"Future Proof" their code should either specifically import the
functions they will be using, or always refer to the functions by their
full name.
-- Rod Adams
Thomas Sandlaß wrote:
Rod Adams wrote:
How am I supposed to define a signature that says "A scalar that
refers to a hash or array element, but do not evaluate or autovivify
the element"?
I'll make a guess: Ref of Int of Array.
This assumes Int has a polymorphic subtype that allow
hout actually making it one, but maybe we should make
a separate precedence level for it to keep list op precedence "pure".
I don't see the point of making them list ops. Leaving them at that
precedence level makes sense, but leave them unary. For a list version,
you can write C or C to do the same thing.
-- Rod Adams
ing that I can define just the base multi sub, without
all the associated multi methods
-- Rod Adams
I'm trying to define zip(), but can't come up with a signature for a
function that returns a lazy list of lvalues, but the list itself is not
lazy?
As a second matter, can you declare a type for the elements of a slurpy
array?
So far I have:
multi sub zip (Array [EMAIL PROTECTED]) returns List
the same thing, as do
@a[3;4]
@a[3][4]
And then operate the Perl 5 way, where C would return an array ref.
#2 seems like the way to go, but I'm open to other suggestions.
I'm especially interested in hearing people's view on how C
should work with multi-dim arrays.
-- Rod Adams
1 - 100 of 239 matches
Mail list logo