Re: Possible syntax for code as comment

2005-01-07 Thread Luke Palmer
Stphane Payrard writes: canon( subjet = $mysub, complement = $mycomp ); canon( :subjet($mysub) :complement($mycomp) ); I suppose you meant canon( :subjet($mysub), :complement($mycomp) ); The comma is optional between those kinds of pairs. btw, are the parentheses

Re: Let the hacking commence!

2005-01-08 Thread Luke Palmer
Luke Blanshard writes: Luke Palmer wrote: This list is for people interested in building the Perl 6 compiler. Now you have your first real task! We have to make a formal grammar for Perl 6. Perl 6 is a huge language, so the task seems better done incrementally by the community

Re: Making control variables local in a loop statement

2005-01-13 Thread Luke Palmer
Joe Gottman writes: It would be nice if there were some easy way to mimic the Perl5 behavior in Perl6. In Perl6, the canonical way to make a variable local to a block is by making it a parameter. I therefore suggest allowing the following syntax: loop 0 - $n; $n 10; ++$n {...}

Re: Scope exit and timely destruction

2005-01-14 Thread Luke Palmer
Hildo Biersma writes: If the number of objects that needs this is relatively small, we could play a trick somewhat like the following (with small changes to the perl compiler): 1. Break the filehandle object into two: a generic wrapper that uses refcounting and forwards all calls, plus

Re: Scope exit and timely destruction

2005-01-14 Thread Luke Palmer
Dave Mitchell writes: On Fri, Jan 14, 2005 at 02:40:43PM -0700, Luke Palmer wrote: What I'd most like is to convince Larry to waive the timely destruction requirement. However, that doesn't really solve the problem for other languages that need timely destruction. Are there any? Perl 5

Re: Scope exit and timely destruction

2005-01-14 Thread Luke Palmer
Shevek writes: On Fri, 2005-01-14 at 16:56 -0700, Luke Palmer wrote: I thought C++ only guaranteed destruction (on return or exception) for objects which were directly on the stack. That's true, you have to explicitly delete most memory. I was actually referring to the template

Re: Scope exit and timely destruction

2005-01-14 Thread Luke Palmer
Unknown writes: On Fri, 2005-01-14 at 17:57 -0500, Michael Walter wrote: You could change the GC scheme (*cough*) to use one similar to Python's (ref-counting + additional GC for cyclic references *double-cough*). You could adapt Java's last-generation GC scheme to do a really fast GC

Re: Perl 6 How Do I? (Was: Perl 6 Summary for 2005-01-11 through 2005-01-18)

2005-01-18 Thread Luke Palmer
Matt Fowles writes: Perl 6 Language idiomatic Perl 6 Stphane Payrard expressed a desire for more Perl 6 sample code. Luke Palmer issued the following, possibly foolish, response: post some \how do I\s to the list, and I'll reply with code. Austin Hastings posed a couple

Re: Perl 6 How Do I? (Was: Perl 6 Summary for 2005-01-11 through 2005-01-18)

2005-01-19 Thread Luke Palmer
Austin Hastings writes: Luke Palmer wrote: Austin Hasting writes: How do I concisely code a loop that reads in lines of a file, then calls mysub() on each letter in each line? Or each xml tag on the line? And I guess the answer is the same as in Perl 5. I don't understand

Re: Perl 6 How Do I?

2005-01-19 Thread Luke Palmer
Uri Guttman writes: LP == Luke Palmer [EMAIL PROTECTED] writes: LP use Rule::XML; LP for { LP mysub($_) for m:g/(Rule::XML::tag)/; LP } shouldn't that be in the Grammar namespace? not that we have finalized namespaces but i was under the impression

Re: where without type?

2005-01-28 Thread Luke Palmer
Juerd writes: Consider: my $foo of Num where { 0 = $^n 10 }; Is the following also valid? my $foo where { 0 = $^n 10 }; I don't see why not. The main place Cwhere will be useful is in multimethods, and I see that as a reasonable shorthand: multi sub foo(Bar $x, $y where

Re: where without type?

2005-01-28 Thread Luke Palmer
Juerd writes: Luke Palmer skribis 2005-01-28 9:31 (-0700): And can $_ be used instead of $^n? Of course it can. You know that. I do? Can't say I understand well when a topic is implicitly defined and when not. It's obvious for for-loops and given, but everything else is blurry

Re: Calling conventions, invocations, and suchlike things

2005-01-28 Thread Luke Palmer
Sam Ruby writes: Mmm, syntax! :) Luckily it makes no difference to us at the parrot level. What that should translate to is something like: $P0 = find_method Parrot_string, find # Elided check for failed lookup and fallback to attribute fetch $P1 =

Re: where without type?

2005-01-29 Thread Luke Palmer
Carl Msak writes: On Fri, 28 Jan 2005 11:38:51 -0700, Luke Palmer [EMAIL PROTECTED] wrote: I don't think it's the cleanest solution, but it works. Just out of curiosity, what do you think would be a cleaner solution? And why would one not want to implement such a solution instead? I

Re: operator

2005-01-30 Thread Luke Palmer
Markus Laire writes: [EMAIL PROTECTED] kirjoitti: Please, I have a question if exists in Perl somethink like keyword 'operator' in C++ ? That will exist in perl6. And to quite a larger extent. Not only can you overload existing operators, you can make up whatever operator name you like.

Re: Featherweight Perl6.

2005-02-02 Thread Luke Palmer
Autrijus Tang writes: Hi. Today I have started working on specifying and implementing Featherweight Perl6 (FP6), a side-effect-free subset of Perl6: http://autrijus.org/pugs/fp6/ # FP6, the language http://autrijus.org/pugs/ # Pugs, the implementation Awesome. This should be

Autothreading generalization

2005-01-31 Thread Luke Palmer
S09 states (in Parallelized parameters and autothreading) that if you use a parameter as an array subscript in a closure, the closure is a candidate for autothreading. - $x, $y { @foo[$x;$y] } Means: - ?$x = @foo.shape[0].range, ?$y = @foo.shape[1].range { @foo[$x;$y] } And each

Re: Autothreading generalization

2005-01-31 Thread Luke Palmer
Luke Palmer writes: Or to write another typical tensor product: a^j = L_i^j b^i You write either of: @a[$^j] = @L[$^i; $^j] * @b[$^i] @a = @L * @b; Or not. There's that implicit Einstein summation involved, and a general purpose programming language isn't about to give

Re: Autothreading generalization

2005-01-31 Thread Luke Palmer
Craig DeForest writes: Quoth Luke Palmer on Monday 31 January 2005 03:46 pm, C_{ijkl} = A_{ij} * B_{kl} You write either of: @C[$^i; $^j; $^k; $^l] = @A[$^i; $^j] * @B[$^k; $^l] @C = @A[$^i; $^j] * @B[$^k; $^l] Hmm... This is both insanely great and also greatly

Re: Retry: ITypes and VTypes.

2005-02-06 Thread Luke Palmer
Brent 'Dax' Royal-Gordon writes: Alexey Trofimenko [EMAIL PROTECTED] wrote: my $var = test; my @arr := $var; error? or maybe it would be the same weirdness, like in former example? or maybe it's a [test]? The := operator uses the same rules as parameter passing. So, what do you

Re: Junctive puzzles.

2005-02-08 Thread Luke Palmer
Miroslav Silovic writes: [EMAIL PROTECTED] wrote: So Pugs will evaluate that to (#f|#f), by lifting all junctions out of a multiway comparison, and treat the comparison itself as a single variadic operator that is evaluated as a chain individually. I think this is correct, however... this is

Re: Junctive puzzles.

2005-02-08 Thread Luke Palmer
Luke Palmer writes: Miroslav Silovic writes: [EMAIL PROTECTED] wrote: So Pugs will evaluate that to (#f|#f), by lifting all junctions out of a multiway comparison, and treat the comparison itself as a single variadic operator that is evaluated as a chain individually. I think

Re: S04

2005-02-10 Thread Luke Palmer
David Storrs writes: Given that Perl 6 won't support an actual do-while loop a la C++ (and yes, I know that Perl5 didn't either), how would you accomplish that? That is, I'd like to have a loop that runs once, then checks its condition to see if it should repeat and continues to repeat as long

Re: proposal: use \ as none junction delimeter

2005-02-11 Thread Luke Palmer
Thomas Sandla writes: This gives: my @x = (1,2,3); my $x = [1,2,3]; my $x = ref (1,2,3); # also without ()? my $x = \* (1,2,3); # also without ()? Accepting the above completes the junction constructing operators: my $x = 1|2|3; # any my $x = 1^2^3; # one my $x

Re: proposal: use \ as none junction delimeter

2005-02-14 Thread Luke Palmer
Thomas Sandla writes: Luke Palmer wrote: That's quite nice, but I've been kind of wanting to go the other way. You know, not every operation in Perl 6 needs to have a punctuation operator. I think we should not use \, and also get rid of ^. I'm interested in seeing an example where

Re: proposal: use \ as none junction delimeter

2005-02-14 Thread Luke Palmer
Thomas Sandla writes: HaloO Luke, you wrote: if $a \ $b == 3 {...} *If A nor B is 3 ... What does the * in front of the if mean? Not? Ungrammatical With grammar reason I meant the formal grammar of Perl6 not the one of natural english. Are you aware of such reasons? Ahh.

Re: Containers vs Objects.

2005-02-15 Thread Luke Palmer
Rod Adams writes: So I'm interested in hearing what pushes Arrays and Hashes over the edge for needing their own container and sigil, whereas Junctions/Sets do not. Nothing. In fact, arrays and hashes aren't atomic or fundamental in any respect, and the main thing that keeps them there is

Re: Fun with junctions (was Sets vs Junctions)

2005-02-15 Thread Luke Palmer
David Storrs writes: On Tue, Feb 15, 2005 at 11:06:51AM -0800, Larry Wall wrote: But what y'all are talking about above is the other end--the return type. And maybe we need to enforce a newbie-friendly invariant on that end as well. I suppose we could default to not accepting

Re: proposal: use \ as none junction delimeter

2005-02-15 Thread Luke Palmer
Thomas Sandla writes: Luke Palmer wrote: But I counter that arguability by saying that you really shouldn't be putting one() in type signatures. If you want something to be an A or a B, and you're not doing any checking later on in the code, then it's fine if it's both A and B. If you

Re: Junction Values

2005-02-18 Thread Luke Palmer
Rod Adams writes: Junctions are intended to be used mainly within conditionals and other statements; If the set of these other statements is limited, consider creating a Junction class (which needs a use Junction; to activate), which overloads the various comparison operators for when a

Re: Junctions, Sets, and Threading.

2005-02-22 Thread Luke Palmer
Juerd writes: Damian Conway skribis 2005-02-22 22:13 (+1100): @x = func($a, [EMAIL PROTECTED]); That's: @x = func($a, @y); But, y'know, this one almost convinces me. Especially when you consider: sub func ($i, $j, $k) {...} @x = func($a, [EMAIL PROTECTED], @z);

Octals

2005-02-22 Thread Luke Palmer
Some time ago on perl6-documentation (when it existed) we decided that octals would now be represented as 0o777 and, in strings, \o777. Should 0777 and, in particular, \777 come with warnings? What, exactly, does \777 mean in a string? Luke

Re: scoping functions as list operators?

2005-02-24 Thread Luke Palmer
Stphane Payrard writes: Giving scoping functions the status of list operators would allow to drop parentheses when not used in conjunction with initializer so one could write: my $a, $b, $c; instead of my ($a, $b, $c); Hmm, but that kills the Perl 5 ability to do concise inline

Re: scoping functions as list operators?

2005-02-24 Thread Luke Palmer
Rod Adams writes: Luke Palmer wrote: We have discussed making equals low precedence enough to eliminate the parentheses in the standard swap: $x, $y = $y, $x; $x, $y == $y, $x; Heh, oh yeah. I guess I wasn't so off suggesting -, then. Well, there's half the problem. Now we just

[PUGS] [PATCH] support for arbitrary delimiters in qq

2005-02-24 Thread Luke Palmer
This patch adds support for: qq{} qq[] qq qq() qq}{ qq][ qq qq)( As well as qq// for any nonalphanumeric /. I know that qq() isn't actually supported in Perl 6, but we don't have options on quoters yet, so it's in. Luke Index: t/02atoms.t

Re: [PUGS] [PATCH] support for arbitrary delimiters in qq

2005-02-24 Thread Luke Palmer
Luke Palmer writes: This patch adds support for: qq{} qq[] qq qq() qq}{ qq][ qq qq)( As well as qq// for any nonalphanumeric /. I know that qq() isn't actually supported in Perl 6, but we don't have options on quoters yet, so it's in. Luke Thanks, committed. :-) Luke

[PUGS] [PATCH] Fix unary -

2005-02-26 Thread Luke Palmer
I hunted down the -1 + 10 == -11 bug. I came up with a fix, but I'm not sure how apporpriate the fix is, which is why I'm submitting it as a patch. The problem was that in Prim.hs all the symbolic unaries were being listed alongside the named unaries, and the unaries in the precedence table were

Re: S06: Pairs as lvalues

2005-02-26 Thread Luke Palmer
Ingo Blechschmidt writes: that's really convenient, but what will the following code do? my $x = (a = 42); # $x is a Pair. $x = 13; # Is $x now the Pair (a = 13) or # the Int 13? It's the Int 13. Your example looks a lot like this one: my $x

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Autrijus Tang writes: Just a quick question: Is Hash keys still Strings, or can they be arbitary values? They can be declared to be arbitrary: my %hash is shape(Any); If the latter, can Int 2, Num 2.0 and Str 2 point to different values? That's an interesting question. Some people

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Luke Palmer writes: Autrijus Tang writes: Just a quick question: Is Hash keys still Strings, or can they be arbitary values? They can be declared to be arbitrary: my %hash is shape(Any); If the latter, can Int 2, Num 2.0 and Str 2 point to different values? That's

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Nigel Sandever writes: On Sun, 27 Feb 2005 02:20:59 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: I forgot an important concretity. Hashes should compare based on the generic equal operator, which knows how to compare apples and apples, and oranges and oranges, and occasionally a red

Re: Valid hash keys?

2005-02-27 Thread Luke Palmer
Nigel Sandever writes: On Sun, 27 Feb 2005 15:36:42 -0700, [EMAIL PROTECTED] (Luke Palmer) wrote: As far as getting 2, 2.0, and 2 to hash to the same object, well, we know they're 'equal', so we just need to know how to hash them the same way. In fact, I don't believe 2.0 can

Re: Valid hash keys?

2005-03-01 Thread Luke Palmer
Alex Burr writes: On Sun, Feb 27, 2005 at 03:36:42PM -0700, Luke Palmer wrote: But the biggest problem is that if the user overloads 'equal' on two objects, the hash should consider them equal. We could require that to overload 'equal', you also have to overload .hash so that you've given

Re: Rule Parameters

2005-03-01 Thread Luke Palmer
Rod Adams writes: Since the line between rules and subs is already blurring significantly, I want to blur it a little more. I want to write rules which can take parameters. No no no! That's too powerful. Wow, skimming through both S5 and A5 and I see no mention of such a thing. I know

Re: darcs patch: Add myself to AUTHORS file

2005-03-04 Thread Luke Palmer
Yuval Kogman writes: Fri Mar 4 20:06:00 IST 2005 Yuval Kogman [EMAIL PROTECTED] * Add myself to AUTHORS file Thanks, applied. Luke

Re: [pugs] fix TODO tests in given.t

2005-03-04 Thread Luke Palmer
Garrett Rooney writes: There are two todo tests in given.t that have # in their desc string, which is confusing 'make test'. Here's a diff to remove the #s, so they no longer show up as failing. Thanks, applied. Luke

Re: [pugs] ?SUB and pointy subroutines

2005-03-04 Thread Luke Palmer
Garrett Rooney writes: I'm having some trouble using the ?SUB variable in a subroutine declared with the - operator. The following code results in an error about ?SUB being undefined: my $s = - $count { if $count 10 { say $count; ?SUB($count + 1); } }; $s(1); If I

Re: [pugs] ?SUB and pointy subroutines

2005-03-04 Thread Luke Palmer
Garrett Rooney writes: Not all code objects are Subs. If you call return, then you return from the innermost enclosing sub, which is marked by that word. Likewise does $?SUB. I don't believe $?BLOCK has been implemented yet, but it will. If that's the case then the Pointy subs section of

Re: [pugs] spurious successes in t/base/given.t

2005-03-04 Thread Luke Palmer
Garrett Rooney writes: There are two unexpected successes in given.t (it must be my night for finding things with that file...), but unfortunately they're not because pugs is magically doing the right thing, they're because it's doing the wrong thing in a way that exactly matches what the

Re: darcs patch: Bug in test: conditional of expected value was not wor...

2005-03-04 Thread Luke Palmer
Yuval Kogman writes: Fri Mar 4 20:59:46 IST 2005 Yuval Kogman [EMAIL PROTECTED] * Bug in test: conditional of expected value was not working Thanks, applied. Kept Garrett's change in the conflict. Luke

Re: [pugs] loop + my test

2005-03-04 Thread Luke Palmer
Garrett Rooney writes: It seems that the loop statement currently doesn't let you declare variables inside it, so the following code: loop (my $i = 0; $i 10; $i++) { } doesn't work. Here's a test for the problem. Thanks, applied.

Optional binding

2005-03-06 Thread Luke Palmer
What is output: sub foo($x, ?$y, [EMAIL PROTECTED]) { say x = $x; y = $y; z = @z[]; } my @a = (1,2,3); foo($x, @a); Thanks, Luke

Method call parsing

2005-03-06 Thread Luke Palmer
In Parser.hs:589, we have the code: parseParamList parse =parseParenParamList parse | parseNoParenParamList parse parseParenParamList parse = do [inv, norm] - maybeParens $

Argument Patterns

2005-03-08 Thread Luke Palmer
All this Haskell programming has opened my eyes to what our multimethod dispatch could be. As we have seen with Csort, the dispatch system is a pattern matcher. But it's a pretty terrible one. I think we should replace our multimethod system with a more general pattern matcher, a variadic

Re: Adding linear interpolation to an array

2005-03-08 Thread Luke Palmer
Thomas Sandla writes: Larry Wall wrote: One can always mixin a does LinearInterpolation at run time in the body of the sub to get the effect of a directive, so I think the most useful thing is to treat roles in signatures as constraints where they can be used to select for MMD. Further

Re: Argument Patterns

2005-03-09 Thread Luke Palmer
Leopold Toetsch writes: Luke Palmer [EMAIL PROTECTED] wrote: I think we should replace our multimethod system with a more general pattern matcher, a variadic multimethod system of sorts. Multimethods need to be variadic anyway, because we want pugs's quicksort example to work. I'd

Re: Logic Programming with Rules (and Argument Patterns)

2005-03-09 Thread Luke Palmer
Rod Adams writes: Indeed, a great deal of logical testing can be performed with the current P6RE definition. For instance: rule Equal ($x, $y) {{ $x ~~ $y or fail }}; rule Substr (Str $str, Str $in) {{ $in ~~ /$str/ or fail }}; rule IsAbsValue (Num $x, Num $y) { {$x ==

Re: Argument Patterns

2005-03-09 Thread Luke Palmer
Thomas Sandla writes: Luke Palmer wrote: But we always have enough knowledge to optimize the hell out of this, and they're not not handwavy we can probably optimizations. They're real, and they're pretty darn easy. I fully agree. But I like to add that a single 'where' on general types

Re: splat operator and context

2005-03-09 Thread Luke Palmer
Aldo Calpini writes: my @a = [1,2,3]; # or does it make @a[0] = (1,2,3)? Yes, @a[0] = [1,2,3]; and I have absolutely no clue about the following: my *$a = @a; my *$a = [EMAIL PROTECTED]; my *$a = (1,2,3); my *$a = [1,2,3]; Those are all illegal. You need to use binding for

Re: Logic Programming with Rules (and Argument Patterns)

2005-03-09 Thread Luke Palmer
Rod Adams writes: You could do all of this with a library of rules. / $x:=generate(@values) test($x) / I don't think this does what I want. In this, generate returns a rule or string of some kind, matches the string being tested, captures what matches, and then binds the

Re: MMD as an object.

2005-03-09 Thread Luke Palmer
Rod Adams writes: I wasn't intending it to be junctive. I was just noting that you needed separate holders for subs and methods, since you shouldn't be able to stuff a method into a multi sub. Keep in mind that the two following definitions are equivalent: class A { method foo () {...}

Re: Junctions - feedback and desires

2005-03-10 Thread Luke Palmer
Rod Adams writes: Dave Whipp wrote: Rod Adams wrote: I do not believe that you can create a 'lazy junction'. But I don't recall the topic coming up before, so we'll have to wait for Damian to come back unless someone else knows for certain. My understanding is that all lists are

Re: SEND + MORE = MONEY (works now in pugs with junctions!)

2005-03-11 Thread Luke Palmer
Larry Wall writes: There's no doubt that the QM view of extended entanglement is very useful. After all, that's what the whole universe runs on. But most mortals will want the classical view to be the default, so we'll require some kind of explicit markup or pragma if you want to extend

Re: [Pugs] New Pugs developer with no svn (subversion) experience

2005-03-12 Thread Luke Palmer
Andrew Savige writes: # pwd /home/andrew/mypugs/examples # ls -l golf total 28 -rwxr-xr-x 1 andrew andrew 47 Mar 13 11:14 head.p6 -rwxr-xr-x 1 andrew andrew 91 Mar 13 11:14 mid.p6 -rwxr-xr-x 1 andrew andrew 70 Mar 13 11:14 rev.p6 -rwxr-xr-x 1 andrew andrew 96 Mar 13 11:14

Re: for @list sub;

2005-03-12 Thread Luke Palmer
Rod Adams writes: Are the following all legal and equivalent? for 1..10 - $a, $b { say $a, $b }; for 1..10 { say $^a, $^b }; sub foo ($a, $b) { say $a, $b }; for 1..10 foo; Almost. The last one should be: for 1..10, foo; What happens with: for 1..10 - [EMAIL

Re: The fate of reduce() in Python 3000

2005-03-13 Thread Luke Palmer
A. Pagaltzis writes: Hi all, so Guido is talking about his reasoning behind dropping lambda, reduce(), filter() and map() in the next generation of Python: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 [Prime quote: I think having the two choices side-by-side just

Re: named subroutine parameters

2005-03-14 Thread Luke Palmer
Nathan Gray writes: I tried using named parameters (S06) and found this to work: pugs sub formalize($text, +$case) { say $text } formalize('hello'); hello bool::true But unfortunately, this did not: pugs sub formalize($text, +$case) { say $text } formalize('hello',

Re: The S29 Functions Project

2005-03-14 Thread Luke Palmer
Thomas Sandla writes: Rod Adams wrote: And then internally dispatch on what is defined and undefined. Why all that burden if Perl 6 is getting a strong type system, that can do the sub selection and compile in dynamic dispatch if needed? I imagine: multi sub cos( Num +$angle ) returns

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Luke Palmer
Autrijus Tang writes: On Mon, Mar 14, 2005 at 08:06:08AM -0800, Larry Wall wrote: On Mon, Mar 14, 2005 at 10:58:00PM +1100, Andrew Savige wrote: : my $fh = open(@ARGS[0]); : my @lines = =$fh; : $fh.close(); : for @lines { print$_ } : Hmm. It's probably a design bug. I'm

Re: [Pugs] Closing a file handle surprised the heck out of me

2005-03-14 Thread Luke Palmer
Larry Wall writes: The Principle of Maximum Differentiation of Similar Constructs also tends to argue for eager =. Plus there's the fact that it's the sort of restriction we can relax if we figure out how, but it would be hard to impose if people started to rely on lazy assignment and then we

Re: [RFC] A more extensible/flexible POD (ROUGH-DRAFT)

2005-03-15 Thread Luke Palmer
Stevan Little writes: Introspection is nice, but I disagree that documentation should be that transparent. One of the nice things I have found about perl and CPAN in particular is that many people tend to document their modules very well. Which not only includes information about

Re: test logging

2005-03-15 Thread Luke Palmer
Stevan Little writes: On Mar 15, 2005, at 6:45 AM, Nathan Gray wrote: I think it would be really nice for failed, todo, and skipped tests to log their $expected and $got values, with any $desc or $context information to a log file (probably test.log). I also think it would be very nice

Re: int(0x123) == int(0x123) ?

2005-03-15 Thread Luke Palmer
Autrijus Tang writes: Currently Pugs numifies hexadecimal and octal strings as if they are literals; that means 0x123 and 0o456 all work as expected. Is that an acceptable treatment? What about Inf and NaN in numeric context? If we follow Perl 5's lead, they all numify to zero (generalizing

Re: test logging

2005-03-15 Thread Luke Palmer
Stevan Little writes: So if I understand you correctly, then the implementation code would look something like this right? sub cmp_ok (Str $got, Code $comparison_func, Str $expected, Str ?$desc) returns Bool is export { my $test := $comparison_func($got, $expected); }

Re: s/true/better name/

2005-03-16 Thread Luke Palmer
Juerd writes: Nicholas Clark skribis 2005-03-15 17:53 (+): On Tue, Mar 15, 2005 at 05:57:57PM +0100, Juerd wrote: And re its spelling, that's a very good feature, because it'll slowly teach me how to spell this word. And when I know how to spell it, I can use it on IRC without

Re: s/true/better name/

2005-03-16 Thread Luke Palmer
Marcus Adair writes: Additionally I question whether this is truly a case improving to the point of least surprise? After all, I don't know a programmer who's going to be surprised by what true means. There are still *some* things you may have to learn in software dev 101 ;) The problem is

Re: Markup language-like features in Perl6?

2005-03-16 Thread Luke Palmer
Michele Dondi writes: However I have the impression that there's still too much to it. Granted, GUIs are intrinsically some order of complexity above textual IO, but I think that letting the language have intrinsic markup language(-like) features may make things much easier from the

Re: [Pugs] short-circuit operators

2005-03-16 Thread Luke Palmer
Markus Laire writes: Larry Wall wrote: Since it's not a problem for syntax that can be recognized at compile time, your slice above might be allowed if you declare the thunks with curlies: @3d_slice = @array[ {!($_ % 2)}; 0..9:3; {?test($_)} ]; How does the compiler know that those

Re: Referencing a caller's slurpy array.

2005-03-16 Thread Luke Palmer
Larry Wall writes: Certainly. The zone markers are as orthogonal to sigils as we can make 'em. Though I'm not sure we've given a meaning to *foo yet. I suppose that would have to mean that the next slurpy parameter has to be a sub ref. Uhmm... isn't *foo the adverbial block? That is, isn't

Re: Referencing a caller's slurpy array.

2005-03-16 Thread Luke Palmer
Rod Adams writes: Uhmm... isn't *foo the adverbial block? That is, isn't it where grep gets its code block in: @list.grep:{ $_ % 2 } In S29, I currently have Cgrep as: multi sub grep (Any|Junction $test : [EMAIL PROTECTED]) returns List { gather { for @values - $x {

Re: New S29 draft up

2005-03-16 Thread Luke Palmer
Joe Gottman writes: multi sub kv (Array @array : [EMAIL PROTECTED]) returns List Returns the indexes and associated values stored in @array, lazily and in order by index. Optionally, only those of the slice defined by @indices. This one is real easy: multi sub kv (@array) returns List {

Re: return of copies vs references

2005-03-16 Thread Luke Palmer
Darren Duncan writes: I need some clarification on the semantics of subroutine or method return statements, regarding whether copies or references are returned. It will help me in my p6ification of p5 code. Say I had a class with 3 private attributes, named [$:foo, @:bar, %:baz], and I

Re: return of copies vs references

2005-03-17 Thread Luke Palmer
Larry Wall writes: Perl 5 always makes a copy of return values, but that just turns out to not matter for references, since a copy of a reference is as good as the original reference. Perl 5 also propagates scalar/list context into subs. For $:foo it doesn't matter--it always behaves as a

Re: .method == $self.method or $_.method?

2005-03-17 Thread Luke Palmer
Larry Wall writes: In that case we'd have to say that given and for always require - $x inside methods, and that $x is never automatically aliased to $_. But there are other ramifications with switch statements and exception handlers I have to think through, In particular, the fact that

Re: s/true/better name/

2005-03-17 Thread Luke Palmer
Mark J. Reed writes: Luke Palmer wrote: Marcus Adair writes: Additionally I question whether this is truly a case improving to the point of least surprise? After all, I don't know a programmer who's going to be surprised by what true means. There are still *some* things you may have

Re: Junctions Question

2005-03-17 Thread Luke Palmer
Stevan Little writes: my $a = 'a'; my $b = ''; my $c = ''; my $any_of_them = $b | $c | $a; # this test passes ok('a' eq $any_of_them, '($b | $c | $a) matches at least one a'); $b = 'b'; $c = 'c'; # this test passes ... ok('a' eq $any_of_them, '($b | $c | $a) matches at least one

Re: [Pugs] Stumbled into another Pugs sand trap (indirect object call I think)

2005-03-17 Thread Luke Palmer
Andrew Savige writes: # cat h3.p6 my $label = 'abc'; print($label: is this new indirect object call business?\n); # perl -w h3.p6 abc: is this new indirect object call business? # pugs h3.p6 Undefined variable $label: Var $label: That's actually because of the list of allowed

Re: [Pugs] Stumbled into another Pugs sand trap (indirect object call I think)

2005-03-17 Thread Luke Palmer
Autrijus Tang writes: On Fri, Mar 18, 2005 at 12:20:31AM -0700, Luke Palmer wrote: That's actually because of the list of allowed characters in a variable name included : to support $Foo::bar. Unfortuately, it would also support $Fo:oba:r, and your $label . It appears to be fixed

Re: [Pugs] Stumbled into another Pugs sand trap (indirect object call I think)

2005-03-18 Thread Luke Palmer
Larry Wall writes: On Fri, Mar 18, 2005 at 03:27:04PM +0800, Autrijus Tang wrote: : On Fri, Mar 18, 2005 at 12:25:26AM -0700, Luke Palmer wrote: : Of course not. infix:Y refers to the infix Y operator, but you need : the hashy subscript. : : So, what is the full name for the operator

Re: Precedence of where (of, is, will)?

2005-03-19 Thread Luke Palmer
Chip Salzenberg writes: Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } I think it's this one. The junctive operators naturally feel pretty tight precedence, and named operators feel loose. or: Str | (Int where {

Re: Perl6 and Duff's Device

2005-03-20 Thread Luke Palmer
Gaal Yahas writes: It looks like Duff's Device http://www.lysator.liu.se/c/duffs-device.html won't be possible in Perl6. This is a shame. sub duff ($from) { # real life would use reference here, this is a demo # dummy: simulate write to serial i/o port my

Re: New S29 draft up

2005-03-20 Thread Luke Palmer
Matt Diephouse writes: Juerd [EMAIL PROTECTED] wrote: Matt Diephouse skribis 2005-03-18 13:35 (-0500): Too bad sub names can't start with numbers: 0x $hex; # hex $hex But they can, if you call them prefix operators instead of subs. See also -e and alike operators, which start

Re: study

2005-03-20 Thread Luke Palmer
Rod Adams writes: Cstudy 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

Re: Slices

2005-03-20 Thread Luke Palmer
Matt Diephouse writes: Is it possible to assign to an array slice? @array[0..4] = ( 0..4 ); # splice @array, 0, 5, 0..4 Of course. You could in Perl 5, right? If so (and I'm hoping it is), is there an equivalent of Ruby's `[]=` method? (Is there a way to define this behavior within my

Re: study

2005-03-20 Thread Luke Palmer
Rod Adams writes: Luke Palmer wrote: Ummm... yeah, keep a function around if it's not currently implemented. I don't think so. I see that as preferable to saying we had it in 5.10, we dropped it in 6.0, then added it back in for 6.2. Umm... your statement isn't quite so shocking when

Re: study

2005-03-21 Thread Luke Palmer
Nicholas Clark writes: On Sun, Mar 20, 2005 at 10:54:15PM -0700, Luke Palmer wrote: in the same form if it does come back. So consider 6.0 its usage deprecation cycle, so we can redefine its meaning (if we decide to). I don't see why study needs a deprecation cycle when length doesn't

Re: Currying positionals

2005-03-24 Thread Luke Palmer
Yuval Kogman writes: More! can you have several slurpy params, of the same type, which are assigned contiguous sequences of the thing they can slurp? foo([EMAIL PROTECTED], *%a, [EMAIL PROTECTED]) foo(1, 2, 3, a = b, c = d, 4, 5, 6); for me that makes sense for

Re: Currying positionals

2005-03-24 Thread Luke Palmer
Larry Wall writes: Step A: For each positional parameter, if the next supplied argument is: 1) a non-pair 2) a pair, and this parameter is explicitly declared Pair, or 3) a hash, and this parameter is declared Hash, either explicitly, or implicitly with a % sigil, Wait,

Re: [Pugs] A couple of string interpolation edge cases

2005-03-25 Thread Luke Palmer
Andrew Savige writes: I stumbled across a couple of interesting quote interpolation edge cases: Case 1 -- # cat ttt.p6 my $x = {; # pugs ttt.p6 unexpected end of input expecting \, $!, $/, \\ or block NonTerm SourcePos ttt.p6 2 1 Is this a bug? No. Braces in strings are

Re: [Pugs] Semicolon as statement terminator

2005-03-25 Thread Luke Palmer
Andrew Savige writes: I was flabbergasted by this one. # cat weird.p6 my$x=42my$y=Zaphod~Beeblebroxmy$z=I think they're just strange symbols of some kindsayx='$x' y='$y' z='$z' # pugs weird.p6 x='42' y='ZaphodBeeblebrox' z='I think they're just strange symbols of some kind' Wow! It

<    6   7   8   9   10   11   12   13   >