Chip Salzenberg wrote:
Link link.
http://www.cs.washington.edu/research/projects/cecil/www/Papers/gud.html
In case it matters, we're trying to support the Perl 6 semantics of
both ($a:$b:) and ($a,$b:). The former looks like something that
could be implemented with something called "predicat
Chip Salzenberg wrote:
This:
multi sub is_equal(Integer $a, Integer where { $_ == $a } $b: ) { 1 }
hurts. At least as I've been given to understand it[*], is impossible
to implement, because the second parameter's type can't be precalculated
in order to prepare for MMD dispatching.
Quite
HaloO Larry,
you wrote:
: Might I add that it should read
:
: $var = (&op.does(identval) ??
: &op.identval($value) :: undef) op $value;
:
: The rational is, that &op is subject to MMD, so the .identval method
: should be dispatched as well. Actually &op.identity($value) r
Piers Cawley wrote:
[..] then I think it means we can write:
sub call-with-current-continuation(Code $code) {
my $cc = -> $retval { return $retval }
For the records: the return here is the essential ingredient, right?
Without it the block would be evaluated or optimized away to an
Piers Cawley wrote:
"TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> writes:
Piers Cawley wrote:
My preference is for:
Boo
Boo
Can't dereferene literal numeric literal 42 as a coderef.
How do you reach the second 'Boo'? Iff -> does not create a Sub
but a Block instance then Luke's code
Piers Cawley wrote:
My preference is for:
Boo
Boo
Can't dereferene literal numeric literal 42 as a coderef.
How do you reach the second 'Boo'? Iff -> does not create a Sub
but a Block instance then Luke's code can be interpreted as a
much smarter version of
sub foo()
{
Well,
does using -> as blockref creator also give anonymous scalars?
$y = -> $x { $x = 3; $x }; # $y:(Ref of Block of Int)
BTW, is -> on the 'symbolic unary' precedence level
as its read-only companion \ ?. Are they pure macros?
--
TSa (Thomas Sandlaß)
Damian Conway wrote:
So, to clarify again, if $var is undefined, then the assignment:
$var op= $value;
is equivalent to:
$var = (&op.does(identval) ?? &op.identval() :: undef) op $value;
Correct?
Might I add that it should read
$var = (&op.does(identval) ??
&op.
Luke Palmer wrote:
Says not:
Boo
Boo
Boo
...
This is clear, but I would expect the output
Boo
42
because the return value of foo is a ref to a block that
makes the caller return 42. This is written in my current
Perl6 as
&foo:( : --> Block --> 42)
The question is when exa
Juerd wrote:
$y() = 7;
No, sorry, that looks to me as if $y is a reference to an lvalue sub,
not like any form of referencing of scalars.
I think it will come naturally to the C++ and Java folks. There the
accessor kind of functions is either mapped into the name get_y()
and set_y(value), or
HaloO Roger,
I'm answering here to your other mail as well. In my example
I was intensionally changing from last to first and positive
and negative numbers! This is a sublety of distance preserving,
direction aware counting in multiples of arbitrary
unity---or some such ;)
you wrote:
This is why
Rod Adams wrote:
It used to be
&foo
&foo
And has become
&foo:(Array,Int)
&foo:(Hash,Int)
The return type arrow --> inside the :() type spec is not
yet approved by @Larry.
In my mind, the more interesting question is what does &foo without the
<> specifiers return when foo is mul
HaloO Juerd,
you wrote:
Except that () doesn't return a reference to an anonymous scalar of the
list it surrounds.
Of course not. The inside of the .() call operator has type
Signature and the dispatch goes to the implementation that has
the closest type distance to the types of the actual arg
Juerd wrote:
$y() = 7;
No, sorry, that looks to me as if $y is a reference to an lvalue sub,
not like any form of referencing of scalars.
Well, it is a reference to an lvalue sub if it is just that :)
As unspecificly typed as it stands there it could be anything
that reacts to &postfix:<()>
Patrick R. Michaud wrote:
Alas, it doesn't seem to be quite that straightforward. Or maybe
it is, and I'm just not seeing it yet. So, I'll just "think out
loud" here for a bit...
I like it if that is happening on the list instead of off-list.
Thanks.
I think the state object ought to have
Luke Palmer wrote:
When we heard that Larry didn't acutally want $$foo to infinitely
dereference, some of us were overjoyed, and others severely
disappointed. Both transparent dereferencing (infinite $$foo) and
opaque dereferencing (one-level $$foo) have their uses, but they are
definitely disti
Luke Palmer wrote:
Should {} be an empty hash rather than an empty code?
Does it matter? More interesting is the question what it returns
or evaluates to if it's a block. Actually with my idea of List
beeing a subtype of Code the parse time recognition of blocks
as List of Pair has no implicati
Patrick R. Michaud wrote:
Of course, there are other "implicit" parameters that are given
to a rule -- the target string to be matched and an initial
starting position. But I think some of those details are still
being worked out.
Wasn't it said that rules have the current match object/stat
Juerd wrote:
Thomas Sandlass skribis 2005-05-28 17:34 (+0200):
I propose %hash = { key => :\$variable, foo => 'bar' };
:\$variable looks like many things to me, but not an alias.
Let's forget that idea, because I have a bunch of better ones!
$hash = { key => \ $variable but rw , foo =
Larry Wall wrote:
: my $b <== foo();
:
: declares $b to be an iterator rather than an array ref.
Though that would seem to imply that *$x slurpy parameters should
work that way too, and that's not how they work right now...
This is very in line with my current conclusion that List is
a s
Gaal Yahas 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;
}
If it were two subs, one would "is returns" Int and the other List of
Sheep. The draft S29 uses thin
Sam Vilain wrote:
I also don't like implicit normalisation to seconds
underneath the hood when I'm doing basic date calculations, and
the way that the "DateTime" base class is inherantly based on the
Gregorian calendar.
I concur in this view. From a typing point of view there should
be some com
Mark Reed wrote:
At least, not in cases where the intended result is consistent across 0.
Lots of date arithmetic falls into this category, and works beautifully with
the definitions above.
Does it? If you have a year 0, what is the number corresponding
to the middle of that year? Is it 0.5? Is
Yuval Kogman wrote:
my Set of Int $s = Set.new; # is this how you call it?
This whole thing depends on how hard-wired the first level
container implementation is. There is either a loose or
very strict mapping from sigils to container types:
$ --> Scalar/Item
@ --> Array
% --> Hash
& -
Mark Reed wrote:
I would really like to see ($x div $y) be (floor($x/$y))
That is: floor( 8 / (-3) ) == floor( -2. ) == -3
Or do you want -2?
and ($x mod $y) be ($x - $x div $y).
Hmm, since 8 - (-3) == 11 this definition hardly works.
But even with $q = floor( $x / $y ) and $r = $x
[This is a repost, somehow it didn't get through before, sorry.]
Luke wrote:
> Both transparent dereferencing (infinite $$foo) and
> opaque dereferencing (one-level $$foo) have their uses, but they are
> definitely distinct.
Well, they are more like variations on a theme.
> Instead of adding d
Luke Palmer wrote:
So I suppose that's my proposal. Allow, even encourage, overloading
of =:=, but only for value types. I've been thinking that we ought to
provide a standard role for making something a value type. Maybe it
would require definition of =:=.
I would like to propose something
HaloO Juerd,
you wrote:
Because the alternative is to drop context.
...
Then we lose the point for having different sigils, and everything gets
a dollar sign.
Isn't the strong type system adequate compensation?
Especially when the sigils denote the level below
which you can't go in untypedness
Ingo Blechschmidt wrote:
# Please add more ways :)
enum ;
my &MEANING_OF_LIVE = 42; # But might be considered evil sigilless mode
--
TSa (Thomas Sandlaß)
Juerd wrote:
And, assigning to a reference is impossible, as a reference is a VALUE,
not a VARIABLE (container).
What should hinder &infix:{'='}:(Ref, Int: --> Int) to exist and be
usefull at least if the Ref is known to something that derefs it
and then finds the new referee? On the Perl6 lang
Juerd wrote:
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 context on the LHS of the assignment operator.
And, assigning to a re
Markus Laire wrote:
@m[0;1] is a multidim deref, referencing the 4.
Referencing the 2, I hope?
Doh!
Yes, the 2.
Really?
I consider this puzzling indicative that the (,) vs. [,] distinction
in Perl6 falls into the same category as e.g. starting the capture
variables at $1.
@m here has _sin
Juerd wrote:
If assigning a ref to a hash uses the hashref's elements, then the same
is to be expected for an array.
Same feeling here. But I would let the array concede.
Because this behaviour is unwanted for
arrays (because you then can't assign a single arrayref anymore without
doubling t
Juerd wrote:
If you STILL don't understand that it has nothing to do with
inconsistency or asymmetry, then please allow me to at this point give
up and stop trying to explain.
I would bewail that, because your explainations are very clear.
And it might appear different but I'm just trying to un
Juerd wrote:
An array in scalar context evaluates to a reference to itself.
A hash in scalar context evaluates to a reference to itself.
An array in list context evaluates to a list of its elements.
A hash in list context evaluates to a list of its elements (as pairs).
Array context is a scal
Sorry, that I excavate that thread, but it just fits my question.
Rod Adams wrote:
Well, "and" and "or" serve the purpose of being at a much lower
precedence level than "&&" and "||".
I would see the value in alphabetic "not" as serving the same relation
to "!". But I would still see it retur
[EMAIL PROTECTED] wrote:
There are actuall two usefull definition for %. The first which Ada calls 'mod'
always returns a value 0<=XSigned integer division and remainder are defined by the relation:
A = (A/B)*B + (A rem B)
where (A rem B) has the sign of A and an absolute value less than
Ingo Blechschmidt wrote:
am I correct in the assumption that the following is an error?
# Not in a BEGIN block
my $::(calc_varname()) = 42;
The more interesting question is: how do you expect to
adress the var in the code that follows? I guess the compiler
won't have a problem with taking
Yuval Kogman wrote:
The only "builtin" feature that needs to be added is that coroutines
can masquerade as their return value, and not a code reference, but
AFAIK proxy objects will give us that anyway, right?
Hmm, isn't the same achieved by considering Eager and Lazy as
subtypes of Code? E.g.
HaloO Mark,
please don't regard the following as obtrusive.
you wrote:
If as usual the definition of a right identity value e is that a op e = a for
all a,
then only +inf works. Besdies you example should have been;
Or actually $n % any( abs($n)+1 .. Inf ) to really exclude 0
from the junct
C. Scott Ananian wrote:
I think Ingo was trying to explicitly specify the normally-implicit
invocant; ie, invoke the method via the reference *without* using a '.'.
If this is possible (and I think it is), it's not (yet) clear what the
syntax would be. Maybe
$ref(Foo.new():)
I think for MMD c
Mark A. Biggar wrote:
Well the identity of % is +inf (also right side only).
I read $n % any( $n..Inf ) == $n. The point is there's no
unique right identity and thus (Num,%) disqualifies for a
Monoid. BTW, the above is a nice example where a junction
needn't be preserved :)
E.g. if XSorry, is it t
John Macdonald wrote:
... (and there may be additional
operator attributes that make sense there too, although none
come immediately to mind).
Well, I wonder why people neglect the fact that the neutral/identity
element is not a property of the operator alone?! Besides the
associativity and commuta
HaloO Luke,
you wrote:
I wonder how we specify meta
operators that only work on comparators, or only on assignment forms,
or etc. etc. etc.
Well, Perl6 has got first class Code types, hasn't it?
So it's a matter of defining a type hierarchy among the
operators and then you can dispatch on them with
Juerd wrote:
Parens and square brackets are very different things.
I know. The parens relevant here are the ones for precedence overrides.
And Comma is pretty low, so it almost always needs parens around it to
form lists. In particular it is below = and friends.
The above is more commonly written
Damian Conway wrote:
Now, personally, I would like to see a short-cut for *both* types of
method call,...
Looks like this syntax is now .method and ./method plus the private
counterpart .:method.
If I have .foo() as $_.foo(), then I can get unary method call on
invocant very easily, even if method
Autrijus Tang wrote:
I think the former is simpler ("always use coercion"), but the latter
makes it possible to define various other things that, although not
isomorphic with builtin numbers, can still use arithmetic operators.
I haven't understood what Larry meant with hard constraint but I would
Juerd wrote:
my @b = [1,2,[3,4]];
is([EMAIL PROTECTED], 1, 'Array length, nested [], outer []s');
Isn't that a bit inconvenient? To get e.g. 2 out of @b
one has to write @b[0][1] while for $b a $b[1] suffices.
And @x = @b maintains this superficial level of indirection?
Does @x = @b
HaloO Juerd,
you wrote:
(This illustrates my feeling about @foo[] being the same as @foo. It
feels inconsistent with &foo() not being &foo.)
I have the same feeling. But I would like @foo[] to mean something else
than plain @foo which should be---hmm, how shall I put that---a
underefenced referenc
Aaron Sherman wrote:
Ok, so log and log10:
multi sub Math::Basic::log (: Num ?$x = $CALLER::_, Num +$base);
&log10<> := &log<>.assuming:base(10);
Sorry, I don't want to interfere but two nit-pickings from me:
1) It's &log10:() and &log:(: Num ?$, Num +$) these days, isn't it?
A
HaloO Autrijus,
you wrote:
On Fri, May 13, 2005 at 07:13:53PM +0200, "TSa (Thomas Sandlaß)" wrote:
Larry Wall wrote:
: Void context still exists and is not a form of singular or plural
: context. Perhaps this should be called nullar context, although void
: context works equally well for me and is
Autrijus Tang wrote:
I don't know, I didn't invent that! :-)
$ perl -le 'print join ",", split /(..)/, 123'
,12,3
Hmm,
perl -le 'print join ",", split /(..)/, 112233445566'
,11,,22,,33,,44,,55,,66
For longer strings it makes every other match an empt string.
With the "Positions between char
Damian Conway wrote:
I think this error--unintentional, I swear!--argues strongly that
internal consistency within Perl 6 is more important than historical
consistency with Perl 5's $1, $2, $3...
But that's only the opinion of one(@Larry), not of $Larry.
My opinion as none(@Larry), too. And corr
Juerd wrote:
No, again, please do not make the mistake of thinking VALUES have
identity. VARIABLES (containers) do. A reference points to a container,
never to a value directly.
I don't consider it a mistake. So, you dany identity to "fat" values
like database connections or GUI objects?
This is s
Aaron Sherman wrote:
Squint harder ;-)
I'm trying!
If we agree that the first say should print 7, then we must conclude
that either we've changed the value of undef to 7, or we've created a
circular reference.
In my view of refs 7 is printed, indeed. But I've difficulty to understand
what you mean
Autrijus Tang wrote:
If the reference semantics changed drastically, please
reflect it prominiently in the relevant Synopsis. :)
Unfortunately I don't feel entitled to do so. I'm
just an interessted bystander, not a member of the
design team.
Sorry.
--
TSa (Thomas Sandlaß)
Autrijus Tang wrote:
What should this do, if not infinite loop?
my ($x, $y); $x = \$y; $y = \$x; $x[0] = 1;
Hmm, after the my both $x and $y store an undef.
Then $x stores a ref to undef. Then $y stores
a ref to ref of undef. I see no circle.
Now let's look at $x = 1. I think it goes down
to th
Abhijit Mahabal wrote:
When you dispatch, what happens would depend upon WALKMETH (according to
the pseudocode for CALLONE in A12). Usually the first inherited method
would get called.
Ohh, yes, that thing. I forget about it. And actually I hope that
there's a version among the standard pragmas t
Autrijus Tang wrote:
On Tue, May 03, 2005 at 05:32:44AM -0700, Larry Wall wrote:
: # Type Instantiation?
: sub apply (&fun<::a> returns ::b, ::a $arg) returns ::b {
: &fun($arg);
: }
The first parameter would be &fun:(::a) these days, but yes.
(Stylistically, I'd leave the & off t
Juerd wrote:
I personally would not mind requiring whitespace around & in those
cases.
Same here. Actually the whitespace after & makes the destinction, or not?
If parens are used for the grouping, then why is the colon required?
Because it escapes into type-space like ::() escapes into name-space
Larry Wall wrote:
On Mon, May 02, 2005 at 05:42:47PM -0700, Larry Wall wrote:
: We're still discussing it on @Larry, but I think we can make that work.
Sorry if I don't know, but where or what is @Larry?
I guess some IRC?
Well, now I think &.foo() won't work, since &.foo should be reserved
for a s
David Storrs wrote:
Let's move this away from simple types like Str and Int for a moment.
If you consider them simple...
Tell me what this does:
class Tree {
method bark() { die "Cannot instantiate a Tree--it is abstract!" }
}
class Birch {
method bark() { return "White, papery" }
}
HaloO,
I don't know if this is usefull and if it is were this information
should be put. I've reworked the Code class chart from A06 to look
as follows:
invocant(s) : Code
_ :__ ___|___
| |: | |
SubMethod Method : SubBlock
Autrijus Tang wrote:
1. Type variables as role parameters
> [..]
Curiously, A12 and S12 already allows something like that:
role List[Type $t] {
method first() returns ::($t);
method rest() returns List[::($t)];
method cons(::($t) $x) returns List[::($t)];
method
Juerd wrote:
Ingo Blechschmidt skribis 2005-04-28 14:30 (+0200):
does the following work as expected?
for %hash.pairs -> $pair { # Note: No "is rw"!
$pair.value = ...; # Modifies %hash
}
Yes, because a pair is an object (reference), and it's not the .value
that you're passing ro.
I come
Joshua Gatcomb wrote:
... FAQs such as union, difference, intersection of lists are
FAQs for a reason.
... it would be nice to have a real simple easy answer for p6.
And indeed it could be:
use Sets;
my @a is Set = (1,2,3);
my @b is Set = (2,3,4);
say @a + @b; # (1,2,3,4)
say @a / @b; # (2,3)
e
I wrote:
permute( @x_chars ) »{ $^a eq $^b ?? $^a :: ''}« permute( @y_chars )
Permutation is the wrong thing here, sorry. It's just:
( @x_chars »xx« @y_chars.elems ) # or was that .size?
»{ $^a eq $^b ?? $^a :: ''}«
( @y_chars xx @x_chars.elems ) # note: no hypering
e.g. and give »{...}«
Aaron Sherman wrote:
Now, I'm not saying that that's the way it MUST be, just that that seems
to be the way that junctions would work in that situation.
I know, and I'm very confused about all these pseudo procedural uses
of junctions. And others seem to share my state of affairs.
If we decide
tha
Jonathan Lang wrote:
When you take the square root of a number, you actually get one of two
possible answers (for instance, sqrt(1) actually gives either a 1 or a
-1).
sqrt() is a function that maps its input domain into its output range.
As such multiple return values are at least not part of the
Patrick R. Michaud wrote:
On Wed, Apr 27, 2005 at 08:46:53AM -0400, Joshua Gatcomb wrote:
The problem is that in the regex version I use capturing parens to
identify the character matched. For the purposes of the problem I
don't need to rely on the first character matched I just need to know
1.
Wi
Autrijus Tang wrote:
map { $_ => $_; } @foo;
This works too:
map { ;$_ => $_ } @foo;
But () is still only a grouper, so this won't do:
map { ($_ => $_) } @foo;
Does this make sense?
A lot! BTW, is it possible to distinguish methods and subs
from the toplevel, too? That little inference
Brad Bowman wrote:
my $a = rand(); # runtime variable
my $result = one(any( sub { $a+1}, sub { $a-1} ),sub { $a+3 }).();
say $result.perl;
If $a was 0.5 I'd guess
$result = one(any(1.5, 0.5), 3.5)
is this the case?
IIRC the .perl method produces a string from which an equal value
can be re
Larry Wall wrote:
I should point out that we're still contemplating breaking .foo() so it
no longer means $_.foo(). I wish there were more keys on my keyboard...
What is the status of my proposal to reserve the indirect object syntax
for calls on $_ and the .method form for the invocant in (single
eThing be a package? Ans if yes, what does it mean?
--
TSa (Thomas SandlaÃ)
read!
So a third case of uncomparable types is needed as well, or it is the default
if nothing else is specified.
That's not true. I don't believe it would be an error to specify
all nine combinations.
Ohh, sorry. Of course implementing all is fine as well. But a bit
tedious for larger collections of classes.
MfG
--
TSa (Thomas SandlaÃ)
();
foo( $obj );
I think stuffing a method into a multi sub should be just fine.
Me too. The above is irrelevant for the call site.
MfG
--
TSa (Thomas SandlaÃ)
and using them to constrain e.g. params of subs
is fine, too. But defining a multi branch on a very common operator
like +, * or grep for a predicate---i.e. using where---subtype
is penalized. Sounds reasonable to me.
MfG
--
TSa (Thomas SandlaÃ)
types like Int, Str or even Any can seriously harm performance
because than the dispatcher has to check it always and everywhere!
So the Perl 6 type system let's you have your rope and tie yourself.
Well, that is late binding :)
--
TSa (Thomas SandlaÃ)
tural subtyping as opposed to name based subtyping with roles,
classes and signatures or contraint based subtyping with where clauses.
Quite interesting that Perl 6 does all three of them where other languages
are content with one :)
--
TSa (Thomas SandlaÃ)
smart matches in the 'where' of multi
method parameter types!
Sorry, if this is the wrong list for discussing these Parrot details.
--
TSa (Thomas SandlaÃ)
neral MMD mechanism?
Will the Perl 6 MMD be directly implemented in Parrot or on top of it?
I guess Parrot needs to do it for language interoperability, right?
Regards,
--
TSa (Thomas SandlaÃ)
ys have to pull in
opposite directions.
Well, quoting Einstein: "Nothing is more practical than a sound theory!"
:))
--
TSa (Thomas SandlaÃ)
ding about A. J. H. Simons's "Theory of Classification" has made
me a true admirer of the design of Perl6 as it is right now.
(See http://www.dcs.shef.ac.uk/~ajhs/classify/index.html). I would
really like to hear how this works out on Perl6! Perhaps we could
interesst some students or researcher of theoretical computer science
to write a paper or so?
Regards,
--
TSa (Thomas SandlaÃ)
(male|female)] $partner )
returns Mammal[male^female];
Am I making sense?
--
TSa (Thomas SandlaÃ)
airs are nice lunguistic
concessions of Perl. On the other hand, as a programmer it's not so far
out. Definitly not more than xor---but I repeat myself.
Good night!
--
TSa (Thomas SandlaÃ)
junction | num str bit
lhs is | low | high | | + ~?
---+-+--+--+
true | and | && | & all | +&~& ?&
always | xor | ^^ | ^ one | +^~^ ?^
false | or | || | | any | +|~| ?|
false | nor | \\ | \ none | +\~\ ?\
undef | err | // |
Regards,
--
TSa (Thomas SandlaÃ)
86 matches
Mail list logo