Re: Multiple colons

2005-05-17 Thread Luke Palmer
On 5/17/05, Larry Wall [EMAIL PROTECTED] wrote: On Tue, May 17, 2005 at 10:10:22PM +0800, Autrijus Tang wrote: : Is the final level ($z and $w) participating in the MMD at all : as tiebreakers? Luke mentioned that in all levels but the final : one, Manhattan distance (sum of inheritance

Re: multi sub and invocants (related to colon question from earlier)

2005-05-17 Thread Luke Palmer
On 5/17/05, Aaron Sherman [EMAIL PROTECTED] wrote: Let's say that that's true. You can certainly still end up in conflict: class A {...} my A $a = A.new() but role { method x() {...} } eval 'multi sub x(A $i:) {...}'; Now, the eval should work because A has no x

Re: Virtual methods

2005-05-18 Thread Luke Palmer
On 5/18/05, Aaron Sherman [EMAIL PROTECTED] wrote: In Perl 6, I don't think we need to tag methods as virtual like C++ does, since we have the handy yadda, yadda to do that for us. However, there is a variant of C++'s virtual that I'd love to see. By default a role cannot override the

Re: Default precedence level of user defined infix ops

2005-05-18 Thread Luke Palmer
On 5/18/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: (B Hi, (B (B now that the following works in Pugs :)... (B (B sub infix:. (Code x, Code y) { sub ($z) { x(y($z)) } } (B (say . int)(10/3);# 3 (B (B use Set; (B sub infix:$B":(B ($item, @set) { (B

Re: Complex Arithmetic

2005-05-19 Thread Luke Palmer
On 5/19/05, Edward Cherlin [EMAIL PROTECTED] wrote: It turns out that the domain and range and the location of the cut lines have to be worked out separately for different functions. Mathematical practice is not entirely consistent in making these decisions, but in programming, there seems to

Re: hyperoperators and multi-dimensional datastructures

2005-05-19 Thread Luke Palmer
On 5/18/05, Anthony Heading [EMAIL PROTECTED] wrote: Is there a way to target hyperoperators at different axes of a multi-dimensional array? This is an attractive feature of various APL-like languages, viz. e.g. in J: a =. 2 5 $ i. 7 - a simple 2-by-5 array a 0 1 2 3 4

Re: [S29] uniq

2005-05-19 Thread Luke Palmer
On 5/19/05, Damian Conway [EMAIL PROTECTED] wrote: Ingo Blechschmidt wrote: I wondered what uniq's default comparator should be, =:=? infix:~~ Woah there. ~~ is a good comparator and all, but it's not the right one here. ~~ compares an object and a pattern to see if they match. That

Re: How do I... create a new meta operator?

2005-05-19 Thread Luke Palmer
On 5/19/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, quoting A12: infix_postfix_meta_operator:= $x += 2; postfix_prefix_meta_operator:{'»'} @array »++ prefix_postfix_meta_operator:{'«'} -« @magnitudes infix_circumfix_meta_operator:{'»','«'} @a »+« @b

Re: Argument Type Checking

2005-05-19 Thread Luke Palmer
On 5/19/05, Joshua Gatcomb [EMAIL PROTECTED] wrote: All: I was hoping the following would give me an outright error sub foo (Int $bar) { say $bar; } foo('hello'); Fortunately you are right. I seem to recall, probably incorrectly, that one of the differences with int, Int, and no

Re: foo(1: 2: 3: 4:) ?

2005-05-22 Thread Luke Palmer
On 5/20/05, Autrijus Tang [EMAIL PROTECTED] wrote: So I'm finally starting to implement multi-level invocants in MMDs. I'd like to sanity check some cases first, though. Dewarnocking time. Are these two assumed to be identical? multi sub foo ($x, $y) multi sub foo ($x, $y : )

Re: Intervals

2005-05-23 Thread Luke Palmer
On 5/23/05, Edward Peschko [EMAIL PROTECTED] wrote: They have the intent (Alan Eliasen has the intent) of implementing 'intervals' which match fuzzy values where you know an approximate extent of the value, but not the value itself. E.g (.5 ... .75) * (.5 ... .8) == (.25 ... .6)

Re: Perl6 and support for Refactoring IDE's

2005-05-25 Thread Luke Palmer
On 5/25/05, Deborah Pickett [EMAIL PROTECTED] wrote: I'm afraid that because of the dynamic parse/execute nature of Perl, it may be a theoretically intractable problem to parse Perl safely. Yep. It's not really possible for the parser to distinguish between: BEGIN {

Transparent / Opaque references

2005-05-27 Thread Luke Palmer
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 distinct. Instead of

Re: Fully introspectable Code objects?

2005-05-29 Thread Luke Palmer
On 5/29/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, while responding to nothingmuch++'s post function signatures?, I thought that it'll be great if Code objects were fully introspectable. I.e.: foo.statements; # List of statements foo.statements[0] #

Sub call resolution

2005-05-30 Thread Luke Palmer
Okay, I'd like to set myself straight. Sanity check: bar($foo, $baz); # looks for subs (lexical then package), and falls back to MMD $foo.bar($baz);# looks in ref($foo), then falls back to MMD If this is correct, can we simplify the latter to mean MMD only ? Would there be a more

Re: loop/do {...} while EXPR;

2005-05-30 Thread Luke Palmer
On 5/30/05, Gerd Pokorra [EMAIL PROTECTED] wrote: Hello! Why is the do {...} literal added in Pugs 6.2.5? Because do {...} is a part of the language, while or no while. Perl 6 is supposed to die if you say do {...} while, which isn't implemented in pugs yet. But the special delayed

Re: loop/do {...} while EXPR;

2005-05-30 Thread Luke Palmer
On 5/30/05, Luke Palmer [EMAIL PROTECTED] wrote: I expect it should be pretty simple to implement: loop {...} while EXPR; loop {...} until EXPR; Yep. It was. Done as of r4171. Luke

Empty hash

2005-06-01 Thread Luke Palmer
Two questions: Should {} be an empty hash rather than an empty code? Why did we change { %hash } from making a shallow copy of a hash to the code that returns %hash? Luke

Re: reduce metaoperator on an empty list

2005-06-01 Thread Luke Palmer
On 6/1/05, Deborah Pickett [EMAIL PROTECTED] wrote: I'm still in the camp of those wanting each operator to know its own identity value (perhaps in terms of a trait). The identity of multiplication (say) is always 1, after all, and it doesn't change depending on when you do multiplication in

Re: reduce metaoperator on an empty list

2005-06-01 Thread Luke Palmer
On 6/1/05, Michele Dondi [EMAIL PROTECTED] wrote: On Wed, 1 Jun 2005, Luke Palmer wrote: $ordered = [] @array; If @array is empty, is $ordered supposed to be true or false? It certainly shouldn't be anything but those two, because is a boolean operator. I read

Re: Idea for making @, %, $ optional

2005-06-03 Thread Luke Palmer
On 6/3/05, Millsa Erlas [EMAIL PROTECTED] wrote: Does this allow the grammer rules of the language to be changed so that this could be implemented? How does this work? Yes. In fact, one of the big goals of perl 6 is to allow people to mutate the grammar of the language. If you just want

Re: return() in pointy blocks

2005-06-07 Thread Luke Palmer
On 6/7/05, Matt Fowles [EMAIL PROTECTED] wrote: On 6/7/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, sub foo (Code $code) { my $return_to_caller = - $ret { return $ret }; $code($return_to_caller); return 23; } sub bar (Code $return) { $return(42) }

Re: return() in pointy blocks

2005-06-07 Thread Luke Palmer
On 6/7/05, Luke Palmer [EMAIL PROTECTED] wrote: Then let's put it this way: sub foo () { for 0..10 { when 6 { return 42 } } return 26; } And if that didn't do it, then let's write it equivalently as: sub foo () { map(- $_ { return 42

Re: reduce metaoperator on an empty list

2005-06-07 Thread Luke Palmer
On 6/7/05, Larry Wall [EMAIL PROTECTED] wrote: Okay, I've made up my mind. The err option is not tenable because it can cloak real exceptions, and having multiple versions of reduce is simply multiplying entities without adding much power. So let's allow an optional identvalue trait on

Re: reduce metaoperator on an empty list

2005-06-07 Thread Luke Palmer
On 6/7/05, Larry Wall [EMAIL PROTECTED] wrote: On Tue, Jun 07, 2005 at 09:41:49PM +, Luke Palmer wrote: : and still don't make sense as reduce operators. Yeah, I keep confusing them with min and max. : That reminds me, how are , , etc. defined anyway? How can we tell : them

Re: return() in pointy blocks

2005-06-08 Thread Luke Palmer
On 6/8/05, Piers Cawley [EMAIL PROTECTED] wrote: In other words, it outputs: Foo Foo # dies Yep. My mistake. If that works, then I think it means we can write: sub call-with-current-continuation(Code $code) { my $cc = - $retval { return $retval }

Re: How much do we close over?

2005-06-13 Thread Luke Palmer
On 6/12/05, Piers Cawley [EMAIL PROTECTED] wrote: Chip and I have been having a discussion. I want to write: sub foo { my $x = 1; return sub { eval $^codestring } } say foo()($x); I claim that that should print 1. Chip claims it should throw a warning about because of timely

Re: Optimisations (was Re: How much do we close over?)

2005-06-13 Thread Luke Palmer
On 6/13/05, Paul Johnson [EMAIL PROTECTED] wrote: On Mon, Jun 13, 2005 at 11:24:07AM +, Luke Palmer wrote: Back when I wrote an back-chaining system in perl, I used tied variables in order to determine when I needed to solve for something

Re: %hash1 ... %hash2

2005-06-14 Thread Luke Palmer
On 14 Jun 2005 06:07:10 -, David Formosa (aka ? the Platypus) [EMAIL PROTECTED] wrote: multi sub infix_circumfix_meta_operator:{'',''} (Hash %a,Hash %b,Code $op) { my Hash %return; for intersection(keys %a,keys %b) - $key { %return{$key} =

Re: Ignoring parameters

2005-06-16 Thread Luke Palmer
On 6/16/05, Gaal Yahas [EMAIL PROTECTED] wrote: Say I have a class method in FooClass, callable as FooClass.greet(): method greet(Class $class: ) { say Hello, FooClass!; } Aside from the fact that I don't think this is the right way to specify class methods... AFAIK,

Re: nested subs

2005-06-16 Thread Luke Palmer
On 6/16/05, Piers Cawley [EMAIL PROTECTED] wrote: So, I was about to write the following test for Pugs: sub factorial (Int $n) { my sub factn (Int $acc, $i) { return $acc if $i $n; factn( $acc * $i, $i+1); } factn(1, 1); } When I thought to check the

Re: sub my_zip (...?) {}

2005-06-16 Thread Luke Palmer
On 6/16/05, Larry Wall [EMAIL PROTECTED] wrote: Or maybe a splat @foo[*] Or go with the parens with something in them to indicate the positive absence of something. @foo[(*)] Anyone else want to have a go at this bikeshed? You know, before I read this part of the message, I

Re: AUTLOAD and $_

2005-06-20 Thread Luke Palmer
On 6/20/05, chromatic [EMAIL PROTECTED] wrote: On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote: I think there exists an even simpler way to avoid any mess involved. Instead of letting AUTOLOAD receive and pass on arguments, and instead of letting AUTOLOAD call the loaded sub, why not have

Re: AUTLOAD and $_

2005-06-21 Thread Luke Palmer
On 6/21/05, Adam Kennedy [EMAIL PROTECTED] wrote: You are of course assuming that every use of AUTOLOAD, for all time, will result in a) Calling another function b) An error Wouldn't this lead to hacks where people do things like this just to prevent perl thinking it's a failure? sub

Re: ./method defunct

2005-06-21 Thread Luke Palmer
On 6/21/05, Matthew Zimmerman [EMAIL PROTECTED] wrote: Could we revisit the idea of using a shorter keyword for $?SELF, like 'o'? I know that $Larry said the idea was probably not going to work: http://tinyurl.com/7baz6 but I'm curious if the reasoning that killed it then still holds

Re: Magic mutators and my $var is Proxy( ... );

2005-06-26 Thread Luke Palmer
On 6/26/05, Sam Vilain [EMAIL PROTECTED] wrote: So, we've got this my $var is Proxy( ... ) construct in A06. Say you've got this class: class MagicVal { has Int $.varies is rw; method varies returns Int is rw { return my $var is Proxy ( :for($.varies),

Re: [perl #36437] [BUG] PGE recursion, bus error

2005-07-01 Thread Luke Palmer
Attempting to come up with a simplistic math grammar that has one possible operand (A) and one possible operator (*) - so that things like A, A*A, and A*A*A*A*A are all parsed. This simplistic example (thanks to spinclad on #perl6) cause PGE to explode. $ cat ta.p6r grammar f; rule atom

Re: File.seek() interface

2005-07-07 Thread Luke Palmer
On 7/7/05, wolverian [EMAIL PROTECTED] wrote: On Thu, Jul 07, 2005 at 08:18:40PM +0300, wolverian wrote: I'm a pretty high level guy, so I don't know about the performance implications of that. Maybe we want to keep seek() low level, anyway. Sorry about replying to myself, but I want to

Re: Hackathon notes

2005-07-08 Thread Luke Palmer
On 7/8/05, TSa (Thomas Sandlaß) [EMAIL PROTECTED] wrote: * Constrained types in MMD position, as well as value-based MMDs, are _not_ resolved in the type-distance phase, but compile into a huge given/when loop that accepts the first alternative. So this: multi sub foo (3) { ...

Re: Hackathon notes

2005-07-08 Thread Luke Palmer
On 7/8/05, Yuval Kogman [EMAIL PROTECTED] wrote: I have a draft of a proposition for what I think is proper MMD dispatching order: http://svn.openfoundry.org/pugs/docs/mmd_match_order.txt He meant: http://svn.openfoundry.org/pugs/docs/notes/mmd_match_order.txt Luke

Re: Hackathon notes

2005-07-08 Thread Luke Palmer
On 7/8/05, Yuval Kogman [EMAIL PROTECTED] wrote: I have a draft of a proposition for what I think is proper MMD dispatching order: http://svn.openfoundry.org/pugs/docs/mmd_match_order.txt -- Order of definition tie breaking: Two signatures defined in the same file:

Re: Hackathon notes

2005-07-08 Thread Luke Palmer
On 7/8/05, Yuval Kogman [EMAIL PROTECTED] wrote: If we're going to reorder things for the user, it does need to happen in a predictable way, even if it's not correct 100% of the time. I find your tree to be pretty complex (that could be because I don't understand the reasoning for the

Re: How do I... create a value type?

2005-07-11 Thread Luke Palmer
On 7/11/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, my $x = 42; my $y = $x; $y++; say $x; # Still 42, of course class Foo { has $.data; method incr () { $.data++ } # Please fill in appropriate magic here } I think it's just `class Foo is

Re: How do I... create a value type?

2005-07-11 Thread Luke Palmer
On 7/11/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: class Foo { has $.data; method incr () { $.data++ } # Please fill in appropriate magic here } my Foo $x .= new(:data(42)); my Foo $y = $x; $y.incr(); say $x.data;# Should still be 42 say $x =:= $y;

Re: MML dispatch

2005-07-14 Thread Luke Palmer
Thanks for your very detailed explanation of your views on the Pure MMD scheme, Damian. I finally understand why you're opposed to it. I could never really buy your previous argument: Manhattan distance is better. Damian writes: Similarly, since the number of potential variants is the

Re: creating threas in BEGIN

2005-07-14 Thread Luke Palmer
On 7/14/05, Nicholas Clark [EMAIL PROTECTED] wrote: This is more a note to collective 'self' question than one I expect the answer to right now. (The answer I expect right now is a glib it will) How will the perl6 compiler cope with people creating threads inside BEGIN blocks? A glib it

Re: Type::Class::Haskell does Role

2005-07-16 Thread Luke Palmer
On 16 Jul 2005 12:22:31 -, David Formosa (aka ? the Platypus) [EMAIL PROTECTED] wrote: On Sat, 16 Jul 2005 12:14:24 +0800, Autrijus Tang [EMAIL PROTECTED] wrote: [...] On Sat, Jul 16, 2005 at 12:24:21AM +0300, Yuval Kogman wrote: There is a new generic comparison operator known as

Re: Type::Class::Haskell does Role

2005-07-16 Thread Luke Palmer
On 7/16/05, Luke Palmer [EMAIL PROTECTED] wrote: I'm going to have some coffee mugs thrown at me for saying this, but perhaps: Generic StringNumericIdentity +---+---++---+ Equality

Re: Type::Class::Haskell does Role

2005-07-17 Thread Luke Palmer
On 7/17/05, Yuval Kogman [EMAIL PROTECTED] wrote: I have another view. The Num role and the Str role both consume the Eq role. When your class tries to both be a Num and a Str, == conflicts. I have two scenarios: class Moose does Num does Str { ... } # Moose was

Re: The Use and Abuse of Liskov (was: Type::Class::Haskell does Role)

2005-07-19 Thread Luke Palmer
On 7/17/05, Damian Conway [EMAIL PROTECTED] wrote: You keep using that word. I do not think it means what you think it means -- Inigo Montoya Quite. I abused Liskov's name greatly here. Sorry about that. Anyway, my argument is founded on another

Re: Hash creation with duplicate keys

2005-07-21 Thread Luke Palmer
On 7/20/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, # Perl 5 my %hash = (a = 1, b = 2, a = 3); warn $hash{a}; # 3 But I vaguely remember having seen...: # Perl 6 my %hash = (a = 1, b = 2, a = 3); say %hasha;# 1 Can somebody confirm this? Yes.

Re: Do slurpy parameters auto-flatten arrays?

2005-07-27 Thread Luke Palmer
On 7/26/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, are the following assumptions correct? sub foo ([EMAIL PROTECTED]) { @args[0] } say ~foo(a, b, c); # a Yep. my @array = a b c d; say ~foo(@array);# a b c d (or a?) say ~foo(@array, z); # a b c

Re: Exposing the Garbage Collector (Iterating the live set)

2005-07-27 Thread Luke Palmer
On 7/26/05, TSa (Thomas Sandlaß) [EMAIL PROTECTED] wrote: Piers Cawley wrote: I would like to be able to iterate over all the objects in the live set. My Idea actually is to embedd that into the namespace syntax. The idea is that of looking up non-negativ integer literals with 0 beeing

Messing with the type heirarchy

2005-07-27 Thread Luke Palmer
http://repetae.net/john/recent/out/supertyping.html This was a passing proposal to allow supertype declarations in Haskell. I'm referencing it here because it's something that I've had in the back of my mind for a while for Perl 6. I'm glad somebody else has thought of it. Something that is

Re: The Use and Abuse of Liskov

2005-07-27 Thread Luke Palmer
On 7/19/05, Damian Conway [EMAIL PROTECTED] wrote: And now maybe you see why I am so disgusted by this metric. You see, I'm thinking of a class simply as the set of all of its possible instances. There's your problem. Classes are not isomorphic to sets of instances and derived classes

Re: The Use and Abuse of Liskov (was: Type::Class::Haskell does Role)

2005-07-27 Thread Luke Palmer
I just realized something that may be very important to my side of the story. It appears that I was skimming over your example when I should have been playing closer attention: On 7/18/05, Damian Conway [EMAIL PROTECTED] wrote: Consider the following classes: class A {...}

Re: Messing with the type heirarchy

2005-07-27 Thread Luke Palmer
On 7/27/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Luke Palmer wrote: role Complex does Object contains Num {...} I've probably misunderstood you, but...: role Complex does Object {...} Num does Complex; # That should work and DWYM, right

Re: Messing with the type heirarchy

2005-07-31 Thread Luke Palmer
On 7/27/05, Larry Wall [EMAIL PROTECTED] wrote: On Wed, Jul 27, 2005 at 11:00:20AM +, Luke Palmer wrote: Everything that is a Num is a Complex right? Not according to Liskov. Num is behaving more like a constrained subtype of Complex as soon as you admit that isa is about both

Re: Curious use of .assuming in S06

2005-07-31 Thread Luke Palmer
On 7/29/05, Autrijus Tang [EMAIL PROTECTED] wrote: In S06's Currying section, there are some strange looking examples: textfrom := substr.assuming(:str($text) :len(Inf)); textfrom := substr.assuming:str($text):len(Inf); woof ::= bark:(Dog).assuming :pitchlow; Why is it

Re: zip with ()

2005-08-01 Thread Luke Palmer
On 8/1/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: In general, (@foo, @bar) returns a new list with the element joined, i.e. @foo.concat(@bar). If you want to create a list with two sublists, you've to use ([EMAIL PROTECTED], [EMAIL PROTECTED]) or ([EMAIL PROTECTED], [EMAIL PROTECTED]).

Re: Do slurpy parameters auto-flatten arrays?

2005-08-03 Thread Luke Palmer
On 8/3/05, Aankhen [EMAIL PROTECTED] wrote: On 8/3/05, Piers Cawley [EMAIL PROTECTED] wrote: So how *do* I pass an unflattened array to a function with a slurpy parameter? Good question. I would have thought that one of the major gains from turning arrays and hashes into references in

Re: What role for exceptional types?

2005-08-03 Thread Luke Palmer
On 8/3/05, Nigel Hamilton [EMAIL PROTECTED] wrote: Instead of passing the buck from object to object via parameter lists and type inference (traversing OO hierarchies etc) maybe we could .. Model the flow of control through a program as a simple linear queue of topic changes. A central

If topicalization

2005-08-03 Thread Luke Palmer
I vaguely recall that we went over this already, but I forgot the conclusion if we did. In Damian and Larry's talk here at OSCON, I saw the example: if foo() - $foo { # use $foo } How can that possibly work? If a bare closure { } is equivalent to - ?$_ is rw { }, then the

Re: $pair[0]?

2005-08-04 Thread Luke Palmer
On 8/4/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, my $pair = (a = 1); say $pair[0]; # a? say $pair[1]; # 1? I've found this in the Pugs testsuite -- is it legal? Nope. That's: say $pair.key; say $pair.value; Also: say $paira; # 1 say

Re: undef.chars?

2005-08-04 Thread Luke Palmer
On 8/4/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, (found in the Pugs testsuite.) my $undef = undef; say $undef.chars? # 0? undef? die? say chars $undef; # 0? undef? die? I'd opt for undef.chars to be an error (no such method) and chars undef to return 0 (with a

Data constructors / Unidirectional unification

2005-08-04 Thread Luke Palmer
I'm writing a new module that optimizes sets of conditions into decision trees. Initially I allowed the user to specify conditions as strings, and if that condition began with a !, it would be the inverse of the condition without the !. But then I thought, the user will more than likely have

Re: Reassigning .ref and .meta? Rebinding class objects?

2005-08-05 Thread Luke Palmer
On 8/5/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, my $str = Hello; $str.ref = Int; # allowed? $str.meta = some_sub.meta; # allowed? I hardly think those work. Both of those require a change of implementation, which we can't do generically. So people

Re: Various questions on .ref and .meta

2005-08-05 Thread Luke Palmer
On 8/5/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, ~Str;# class? Str? Str ~::Str; # class? Str? I don't know how :: works anymore. I'll avoid these. ~Str.meta; # class? (fill in please)? Class

Re: $object.meta.isa(?) redux

2005-08-10 Thread Luke Palmer
On 8/9/05, Larry Wall [EMAIL PROTECTED] wrote: So why not just use describes? Then maybe Object.isa(Foo) delegates to $obj.meta.describes(Foo). Hmm. We have a similar problem with the new class-set notation. These two things: $a.does(Foo); Bar.does(Foo); Mean two different things:

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Luke Palmer
On 8/10/05, Autrijus Tang [EMAIL PROTECTED] wrote: But it's an toplevel optimization, which is not applicable to module authors. So I'd very much welcome a lexical pragma that forces static binding of subroutine calls. Yeah, but the whole point of not allowing that is so that you can override

Re: $object.meta.isa(?) redux

2005-08-10 Thread Luke Palmer
On 8/10/05, TSa [EMAIL PROTECTED] wrote: HaloO, Luke Palmer wrote: On 8/9/05, Larry Wall [EMAIL PROTECTED] wrote: So why not just use describes? Then maybe Object.isa(Foo) delegates to $obj.meta.describes(Foo). Hmm. We have a similar problem with the new class-set notation

Re: Perl 6 Meta Object Protocols and $object.meta.isa(?)

2005-08-10 Thread Luke Palmer
On 8/10/05, TSa [EMAIL PROTECTED] wrote: Here is an example of a 2D distance method role Point { has Num $.x; has Num $.y; } method distance( Point $a, Point $b -- Num ) { return sqrt( ($a.x - $b.x)**2 - ($a.y - $b.y)**2); } Now comes the

Re: Typed type variables (my Foo ::x)

2005-08-11 Thread Luke Palmer
On 8/11/05, TSa [EMAIL PROTECTED] wrote: HaloO, Autrijus Tang wrote: On Thu, Aug 11, 2005 at 08:02:00PM +1000, Stuart Cook wrote: my Foo ::x; a) ::x (=) ::Foo (i.e. any type assigned to x must be covariant wrt. Foo) b) ::x is an object of type Foo, where Foo.does(Class) c) Something

Re: $object.meta.isa(?) redux

2005-08-11 Thread Luke Palmer
On 8/10/05, Sam Vilain [EMAIL PROTECTED] wrote: On Wed, 2005-08-10 at 21:00 -0400, Joe Gottman wrote: Will there be an operator for symmetric difference? I nominate (^). That makes sense, although bear in mind that the existing Set module for Perl 6, and the Set::Scalar and Set::Object

Re: set questions -- Re: $object.meta.isa(?) redux

2005-08-11 Thread Luke Palmer
. Glock 2005/8/10, Dave Whipp [EMAIL PROTECTED]: Luke Palmer wrote: A new development in perl 6 land that will make some folks very happy. There is now a Set role. Among its operations are (including parentheses):

Re: Set operators in Perl 6 [was Re: $object.meta.isa(?) redux]

2005-08-11 Thread Luke Palmer
On 8/10/05, Dave Rolsky [EMAIL PROTECTED] wrote: [changing the subject line for the benefit of the summarizer ...] On Wed, 10 Aug 2005, Larry Wall wrote: And now some people will begin to wonder how ugly set values will look. We should also tell them that lists (and possibly

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Luke Palmer
On 8/16/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, 1_234; # surely 1234 1e23; # surely 1 * 10**23 1._5; # call of method _5 on 1? 1._foo; # call of method _foo on 1? 1.e5; # 1.0 * 10**5? 1.efoo; # call of method efoo on 1?

Re: my $pi is constant = 3;

2005-08-17 Thread Luke Palmer
On 8/17/05, Larry Wall [EMAIL PROTECTED] wrote: You could still reason about it if you can determine what the initial value is going to be. But certainly that's not a guarantee, which is one of the reasons we're now calling this write/bind-once behavior readonly and moving true constants to a

Re: Hoping that Params::Validate is not needed in Perl6

2005-08-17 Thread Luke Palmer
On 8/17/05, Dave Rolsky [EMAIL PROTECTED] wrote: I'm going to go over the various features in P::V and see if there are equivalents in Perl6, and bring up any questions I have. I think this will be interesting for folks still new to P6 (like myself) and existing P::V users (I think there's a

Rebinding binding

2005-08-17 Thread Luke Palmer
Two years ago or so, I became very happy to learn that the left side of binding works just like a routine signature. So what if binding *were* just a routine signature. That is, could we make this: sub foo () { say hello; my $x := bar(); say goodbye $x; }

Re: bug in pugs.

2005-08-19 Thread Luke Palmer
On 8/19/05, Yiyi Hu [EMAIL PROTECTED] wrote: { a b c }.paris; This will cause pugs run, won't stop until reached the world end.(out of memory) Fixed. hmm, BTW, What should { a } return by default? an hash ref or An error? Neither: a code block that exectues the (probably undefined)

Demagicalizing pairs

2005-08-19 Thread Luke Palmer
We've seen many problems come up with the current special treatment of pairs. Here's what I can think of: * Pairs are restricted to a particular position in the argument list, which leads to confusion (why isn't this being passed named?) and poor end-weight in something like this:

Multidimensional hyper

2005-08-19 Thread Luke Palmer
What is the resulting data structure in each of the following: - [1, 2] - [[1,2], [3,4]] - [[1,2], 3] [[1,2], 3] + [[4,5], 6] [1, 2, [3]] + [[4,5], 6] Luke

Synopsis 3 Update

2005-08-19 Thread Luke Palmer
Here is an update to Synopsis 3 incorporating recent additions. If any of this is wrong or disagreeable, this is the time to say so. Luke S03.pod.diff Description: Binary data

*%overflow

2005-08-21 Thread Luke Palmer
Output? sub foo (+$a, *%overflow) { say %overflow{}; } foo(:a(1), :b(2)); # b2 foo(:a(1), :overflow{ b = 2 }); # b2 foo(:a(1), :overflow{ b = 2 }, :c(3)); # ??? Luke

Re: Need correction to S06

2005-08-22 Thread Luke Palmer
On 8/22/05, Larry Wall [EMAIL PROTECTED] wrote: I think the simplest thing is to say that you can't bind to the name of the slurpy hash. You give a name to it so that you can refer to it inside, but that name is not visible to binding. Fixed in https://svn.perl.org/perl6/doc. Thanks. Luke

Re: Can a scalar be lazy ?

2005-08-22 Thread Luke Palmer
On 8/22/05, Yiyi Hu [EMAIL PROTECTED] wrote: my( $s, $t ); $s = value t is $t; $t = xyz; print $s; I have an answer for you that is much more detailed than what you want to hear. The short answer is yes. This is possible to implement, provided you appropriately declare $t. It all depends on

Re: Calling positionals by name in presence of a slurpy hash

2005-08-23 Thread Luke Palmer
On 8/23/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, (asking because a test testing for the converse was just checked in to the Pugs repository [1]) sub foo ($n, *%rest) {...} foo 13; # $n receives 13, of course, %rest is () foo 13, foo = bar; # $n

Re: Demagicalizing pairs

2005-08-25 Thread Luke Palmer
On 8/24/05, Damian Conway [EMAIL PROTECTED] wrote: Larry wrote: Plus I still think it's a really bad idea to allow intermixing of positionals and named. We could allow named at the beginning or end but still keep a constraint that all positionals must occur together in one zone. If

Re: Perl 6 code - a possible compile, link, run cycle

2005-08-25 Thread Luke Palmer
On 8/25/05, Yuval Kogman [EMAIL PROTECTED] wrote: On Thu, Aug 25, 2005 at 11:16:56 -, David Formosa (aka ? the Platypus) wrote: On Wed, 24 Aug 2005 16:13:03 +0300, Yuval Kogman [EMAIL PROTECTED] wrote: [...] perl6 creates a new instance of the perl compiler (presumably an

Manuthreading

2005-08-28 Thread Luke Palmer
While nothingmuch and I are gutting junctions and trying to find the right balance of useful/dangerous, I'm going to propose a new way to do autothreading that doesn't use junctions at all. First, let me show you why I think junctions aren't good enough: I can't extract the information that the

Operator sub names are not special

2005-08-31 Thread Luke Palmer
Let me just clarify something that my intuition led me to believe: sub foo(infix:+) { 1 + 2 } sub bar($a, $b) { say $a,$b } foo(bar); # 1,2 That is, operator names can be lexically bound just like any other name. Also, this doesn't have any affect on implicit coercions, etc.

Re: Operator sub names are not special

2005-08-31 Thread Luke Palmer
On 8/31/05, Yuval Kogman [EMAIL PROTECTED] wrote: On Wed, Aug 31, 2005 at 04:56:25 -0600, Luke Palmer wrote: (That is, lexically binding prefix:+ does not change things in numeric context; only when there's actually a + in front of them) Unless you override prefix:+ ? sub foo (prefix

Re: Operator sub names are not special

2005-09-01 Thread Luke Palmer
On 9/1/05, Yuval Kogman [EMAIL PROTECTED] wrote: On Wed, Aug 31, 2005 at 13:43:57 -0600, Luke Palmer wrote: Uh yeah, I think that's what I was saying. To clarify: sub foo (prefix:+) { 1 == 2 }# 1 and 2 in numeric context foo(say); # nothing printed But: sub foo

Re: for $arrayref {...}

2005-09-01 Thread Luke Palmer
On 9/1/05, Juerd [EMAIL PROTECTED] wrote: Ingo Blechschmidt skribis 2005-09-01 20:29 (+0200): for ($arrayref,) {...}; # loop body executed only one time Yes: scalar in list context. for ($arrayref) {...}; # loop body executed one or three times? Same thing: scalar in list

Re: for $arrayref {...}

2005-09-02 Thread Luke Palmer
On 9/2/05, Juerd [EMAIL PROTECTED] wrote: Luke Palmer skribis 2005-09-01 23:43 (+): I would probably say that scalars never automatically dereference. It's lists and hashes that automatically dereference/enreference. arrays Yes, arrays, right. That is, everything is a scalar

Re: multisub.arity?

2005-09-03 Thread Luke Palmer
On 9/3/05, Stuart Cook [EMAIL PROTECTED] wrote: On 03/09/05, Yuval Kogman [EMAIL PROTECTED] wrote: A multi sub is a collection of variants, so it doesn't have arity, each variant has arity. I'd say it 'fail's. But if the reason you're calling `foo.arity` is to answer the question Can

multi scoping

2005-09-04 Thread Luke Palmer
Here's a good Perl 6 final exam question: Spot the mistake (hint: it's not in the math): module Complex; sub i() is export { Complex.new(0,1) } multi sub infix:+ (Complex $left, Complex $right) is export { Complex.new($left.real + $right.real, $left.imag +

Re: multi scoping

2005-09-04 Thread Luke Palmer
On 9/4/05, Yuval Kogman [EMAIL PROTECTED] wrote: I always saw scoping of multis as something that applies to the variants... multi sub foo { } { my multi sub foo { }

Re: our constant pi, my constant pi?

2005-09-05 Thread Luke Palmer
On 9/5/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote: Hi, quick questions: constant pi = 3; # works # Is pi package- or lexically-scoped? our constant pi = 3; # legal? my constant pi = 3; # legal? Yep. Bare constant is package, just

<    1   2   3   4   5   6   7   8   9   10   >