Re: Regex syntax

2008-03-18 Thread Jon Lang
Moritz Lenz wrote: I noticed that in larger grammars (like STD.pm and many PGE grammars in the parrot repo) string literals are always quoted for clarity regex foo { 'literal' subregex } Since I think this is a good idea, we could just as well enforce that, and drop the ...

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
Larry Wall wrote: So here's another question in the same vein. How would mathematicians read these (assuming Perl has a factorial postfix operator): 1 + a(x)**2! 1 + a(x)²! The 1 + ... portion is not in dispute: in both cases, everything to the right of the addition sign gets

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
Larry Wall wrote: Now, I think I know how to make the parser use precedence on either a prefix or a postfix to get the desired effect (but perhaps not going both directions simulatenously). But that leads me to a slightly different parsing question, which comes from the asymmetry of

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
TSa wrote: Jon Lang wrote: all unary operators, be they prefix or postfix, should be evaluated before any binary operator is. Note that I see ** more as a parametric postscript then a real binary. That is $x**$y sort of means $x(**$y). That's where we differ, then. I'm having

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
On Wed, Mar 26, 2008 at 12:03 PM, Larry Wall [EMAIL PROTECTED] wrote: On Wed, Mar 26, 2008 at 11:00:09AM -0700, Jon Lang wrote: : all unary operators, be they prefix or postfix, should be evaluated : before any binary operator is. And leaving the pool of voting mathematicians out

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
Mark J. Reed wrote: Jon Lang wrote: Those don't strike me as being unary operators; they strike me as being function calls that have left out the parentheses. At least through Perl5, 'tain't no difference between those two in Perl land. True enough - though the question at hand

Re: Musings on operator overloading

2008-03-26 Thread Jon Lang
Thom Boyer wrote: But the main point I was trying to make is just that I didn't see the necessity of positing 1,2,3\say when (if I understand correctly) you could write that as simply as 1,2,3 say Nope. This is the same situation as the aforementioned '++' example, in that

Re: First look: Advanced Polymorphism whitepaper

2008-04-28 Thread Jon Lang
John M. Dlugosz wrote: Here is a first look at the ideas I've worked up concerning the Perl 6 type system. It's an overview of the issues and usage of higher-order types in comparison with traditional subtyping subclasses. http://www.dlugosz.com/Perl6/ Very interesting, if puzzling, read.

Re: First look: Advanced Polymorphism whitepaper

2008-04-28 Thread Jon Lang
TSa wrote: The use of £ in sub foo (£ pointlike ::PointType $p1, PointType $p2 -- PointType) is that of *structural* subtyping. Here FoxPoint is found to be pointlike. In that I would propose again to take the 'like' operator from JavaScript 2. Doing that the role should be better

Re: First look: Advanced Polymorphism whitepaper

2008-04-28 Thread Jon Lang
chromatic wrote: Jon Lang wrote: Ah; that clears things up considerably. If I understand you correctly, John is using '£' to mean use Duck Typing here. _That_, I can definitely see uses for. As well, spelling it as 'like' instead of '£' is _much_ more readable. With this in mind

Re: First look: Advanced Polymorphism whitepaper

2008-04-28 Thread Jon Lang
John M. Dlugosz wrote: TSa wrote: Jon Lang wrote: I'm having some difficulty understanding the business with £. I _think_ that you're saying that £ sort of acts as a prefix operator that changes the meaning of the type with which it is associated; and the only time that a change

Re: treatment of isa and inheritance

2008-04-30 Thread Jon Lang
Brandon S. Allbery KF8NH wrote: TSa wrote: I totally agree! Using 'isa' pulls in the type checker. Do we have the same option for 'does' e.g. 'doesa'? Or is type checking always implied in role composition? Note that the class can override a role's methods at will. It occurs to me that

Re: OK, ::?CLASS not virtual

2008-04-30 Thread Jon Lang
John M. Dlugosz wrote: And you can use CLASS in a role also, confidant that it will be looked up according to the normal rules when the class is composed using that role, just like any other symbol that is not found when the role is defined. Using ::?CLASS in a role is an error (unless you

Re: First look: Advanced Polymorphism whitepaper

2008-04-30 Thread Jon Lang
On Wed, Apr 30, 2008 at 9:58 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On May 1, 2008, at 0:53 , chromatic wrote: correctness sense. Sadly, both trees and dogs bark.) Hm, no. One's a noun, the other's a verb. Given the linguistic orientation of Perl6, it seems a bit

Re: treatment of isa and inheritance

2008-05-02 Thread Jon Lang
John M. Dlugosz wrote: Jon Lang dataweaver-at-gmail.com |Perl 6| wrote: IIRC, the supertyping proposal involved being able to anti-derive roles from existing roles or classes, working from subtypes to supertypes (or from derived roles to base roles) instead of the other way around

Re: What does 'eqv' do exactly?

2008-05-03 Thread Jon Lang
John M. Dlugosz wrote: I've searched the archives, but did not see a good explanation of what eqv does, and what is meant by snapshotting in the description of the synopses. Try this: http://markmail.org/message/vub5hceisf6cuemk Can anyone explain it (with examples?) or point to an

Re: What does 'eqv' do exactly?

2008-05-03 Thread Jon Lang
I suspect that at the core of John's question is the fact that nobody has ever actually said what 'snapshot semantics' is: it's a term that's been tossed around with the assumption that people already know its meaning. My own understanding of it is that snapshot semantics involves looking at an

Re: nested 'our' subs - senseless?

2008-05-05 Thread Jon Lang
On Mon, May 5, 2008 at 6:01 AM, John M. Dlugosz [EMAIL PROTECTED] wrote: TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: No, because {...} is just a declaration. You can give a definition later in the surrounding module/package/class. Within that scope there can be only one definition,

Re: my TypeName $x;

2008-05-06 Thread Jon Lang
My thoughts: .HOW returns information concerning the implementation type; .WHAT returns information concerning the value type. .HOW and .WHAT stringify to something resembling the declarations that would be used to create them. Also bear in mind that Perl 6 uses prototype-based object

Re: my TypeName $x;

2008-05-06 Thread Jon Lang
Upon further review: It might be possible that $x.WHAT returns a Signature object, with the value type of $x as the invocant (or return type?), and everything else empty. But that merely begs the question of how to introspect a Signature object. If I tell Perl 6 to say a Signature, what gets

Re: my TypeName $x;

2008-05-06 Thread Jon Lang
TSa wrote: Jon Lang wrote: My thoughts: .HOW returns information concerning the implementation type; .WHAT returns information concerning the value type. BTW, S12 more or less confirms the above: .WHAT returns a prototype object that stringifies to its short name, while .HOW allows

Re: my TypeName $x;

2008-05-06 Thread Jon Lang
Larry Wall wrote: Jonathan Worthington wrote: role Bar { } my Bar $x; # $x is ??? say $x; # ??? say $x.WHAT; # ??? # This means we can only assign to $x something that does Bar? Correct, and for the same reason. The container checks the role--it has little to do

Re: my TypeName $x;

2008-05-06 Thread Jon Lang
On Tue, May 6, 2008 at 8:09 PM, Larry Wall [EMAIL PROTECTED] wrote: On Tue, May 06, 2008 at 07:01:29PM -0700, Jon Lang wrote: : 1. Apparently, my presumption that $x.WHAT was for retrieving the : value type was wrong; from the above, it's sounding like it is : supposed to retrieve

ordinal access to autosorted hashes

2008-05-27 Thread Jon Lang
From S09: The default hash iterator is a property called .iterator that can be user replaced. When the hash itself needs an iterator for .pairs, .keys, .values, or .kv, it calls %hash.iterator() to start one. In item context, .iterator returns an iterator object. In list context, it returns a lazy

Re: ordinal access to autosorted hashes

2008-06-01 Thread Jon Lang
David Green wrote: Jon Lang wrote: Would it be reasonable to allow hashes to use .[] syntax as something of a shortcut for .iterator in list context, thus allowing autosorted hashes to partake of the same sort of dual cardinal/ordinal lookup capabilities that lists with user-defined array

Re: assignable mutators (S06/Lvalue subroutines)

2008-06-01 Thread Jon Lang
Jon Lang wrote: This approach could be functionally equivalent to the proxy object approach, but with a potentially more user-friendly interface. That is, sub foo (*$value) { yadda } might be shorthand for something like: sub foo () is rw { return new Proxy: FETCH = method

Re: assignable mutators (S06/Lvalue subroutines)

2008-06-01 Thread Jon Lang
David Green wrote: It seems overly complex to me, but perhaps I'm missing good reasons for such an approach. I see lvalue subs mainly as syntactic sugar: foo(42); # arg using normal syntax foo == 42; # arg using feed syntax foo = 42; # arg using assignment

Re: The Inf type

2008-06-02 Thread Jon Lang
TSa wrote: John M. Dlugosz wrote: The sqrt(2) should be a Num of 1.414213562373 with the precision of the native floating-point that runs at full speed on the platform. That makes the Num type an Int with non-uniform spacing. E.g. there are Nums where $x++ == $x. And the -Inf and +Inf were

Re: The Inf type

2008-06-02 Thread Jon Lang
Ryan Richter wrote: Jon Lang wrote: TSa wrote: John M. Dlugosz wrote: The sqrt(2) should be a Num of 1.414213562373 with the precision of the native floating-point that runs at full speed on the platform. That makes the Num type an Int with non-uniform spacing. E.g. there are Nums

Re: ordinal access to autosorted hashes

2008-06-02 Thread Jon Lang
David Green wrote: Jon Lang wrote: Bear in mind that keys are not necessarily sortable, let alone autosorted. For instance, consider a hash that stores values keyed by complex numbers: since there's no way to determine .before or .after when comparing two complex numbers, there's no way

Re: assignable mutators (S06/Lvalue subroutines)

2008-06-02 Thread Jon Lang
David Green wrote: Jon Lang wrote: If a routine is rw, you may optionally define a single slurpy scalar (e.g., '*$value') in its signature. This scalar counts as the last positional parameter, much like slurpy arrays and hashes must be declared after all of the positional parameters have

Re: ordinal access to autosorted hashes

2008-06-02 Thread Jon Lang
Mark J. Reed wrote: The point is that %h[0] should be legal syntax that works on any hash, returning the first element. It doesn't matter if the elements are sorted or even sortable. You get an element. More to the point, if you don't add any elements to (or remove any elements from) the

Re: The Inf type

2008-06-03 Thread Jon Lang
Brandon S. Allbery wrote: John M. Dlugosz wrote: Jon Lang wrote: type (i.e., 'num'). Somehow, I had got it into my head that Num was a role that is done by all types that represent values on the real number line, be they integers, floating-point, rationals, or irrationals. And really, I'd

Re: Building Junctions from Junctions

2008-06-23 Thread Jon Lang
I'd say that this ought to be implemented using :v (as in, 'values'; cf. :k, :kv, and :p for lists and hashes): this should let you look at the values within the Junction as if they were merely a list of values, at which point you can construct a new Junction from them. -- Jonathan Dataweaver

Re: step size of nums

2008-07-10 Thread Jon Lang
Mark J. Reed wrote: All of this is IMESHO, of course, but I feel rather strongly on this issue. ++ means += 1 . Agreed. Anything else violates the principle of least surprise. Mind you, this is only true for numerics, where the concept of 1 potentially has meaning. For non-numerics,

Re: meta_postfix:*

2008-07-13 Thread Jon Lang
So you're suggesting that A op* n should map to [op] A xx n ? -- Jonathan Dataweaver Lang

Re: meta_postfix:*

2008-07-15 Thread Jon Lang
Dave Whipp wrote: Jon Lang wrote: So you're suggesting that A op* n should map to [op] A xx n I don't think that that mapping works for Thomas' proposal of a repetition count on post-increment operator. I.e. $a ++* 3 is not the same as [++] $a xx 3 (which I think

Re: meta_postfix:*

2008-07-15 Thread Jon Lang
Kealey, Martin, wrote: Nice idea; introduces one particular ambiguity though: would $m ** $n then be pow($m, $n) or pow($n, $m) ? Neither. As with the reducing meta-operator, you would need to have the ability to define an operator that takes precedence over a meta'd operator,

Re: Complex planes

2008-07-16 Thread Jon Lang
Larry Wall wrote: On Tue, Jul 15, 2008 at 03:30:24PM +0200, Moritz Lenz wrote: : Today bacek++ implement complex logarithms in rakudo, and one of the : tests failed because it assumed the result to be on a different complex : plane. (log(-1i) returned 0- 1.5708i, while 0 + 3/2*1i was

Re: Complex planes

2008-07-16 Thread Jon Lang
Moritz Lenz wrote: Jon Lang wrote: By the principle of least surprise, I'd recommend against this. Most programmers, when they see 'sqrt(1)', will expect a return value of 1, And that's what they get unless they write it as sqrt(1 + 0i). I suppose that you _could_ use the programmer's

Re: Complex planes

2008-07-16 Thread Jon Lang
Moritz Lenz wrote: If the programmer errs on what he thinks is in a variable, it'll always be a bug. Yes; but some bugs are easier to make, and harder to catch, than others. Principle of least surprise: Suppose sqrt(1) returns any(1, -1): if sqrt($x) 0.5 { do something } I can see the

Re: Complex planes

2008-07-16 Thread Jon Lang
Mark Biggar wrote: Let's worry about getting principal values, branch cuts and handling signed zeros correct before dealing with the interaction of junctions and multi-valued complex functions. Indeed. BTW, two good references on this that we might want to plagiarizer.I mean borrow

Re: Another adverb on operator question

2008-08-07 Thread Jon Lang
Perhaps I'm missing something; but why couldn't you say '[lt]:lc $a, $b, $c'? That is, I see the reducing meta-operator as a way of taking a list-associative infix operator and treating it as a function call, albeit one with a funny name. As such, you should be able to do things with a reduced

Re: [svn:perl6-synopsis] r14574 - doc/trunk/design/syn

2008-08-08 Thread Jon Lang
But are 'twas and -x valid identifiers? IMHO, they should not be. -- Jonathan Dataweaver Lang

Re: Differential Subscripts

2008-08-08 Thread Jon Lang
On Fri, Aug 8, 2008 at 7:41 PM, John M. Dlugosz [EMAIL PROTECTED] wrote: How is @array[*-2] supposed to be implemented? S09v28 // reported again 8-Aug-2008 Is this magic known to the parser at a low level, or is it possible to define your own postcircumfix operators that interact with the

Re: Multiple Return Values - details fleshed out

2008-08-09 Thread Jon Lang
John M. Dlugosz wrote: I wrote http://www.dlugosz.com/Perl6/web/return.html to clarify and extrapolate from what is written in the Synopses. A few comments: 1. I was under the impression that identifiers couldn't end with - or '. 2. While list context won't work with named return values, hash

Re: The False Cognate problem and what Roles are still missing

2008-08-20 Thread Jon Lang
On Wed, Aug 20, 2008 at 3:16 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: Hi $Larry et al, I brought this up as a question at YAPC::EU and found to my surprise that no one seems to have thought of it yet. This is the mail I said I'd write. (And apologies, Larry. :-) ) Consider the

Re: adverbial form of Pairs notation question

2008-09-08 Thread Jon Lang
TSa wrote: Ahh, I see. Thanks for the hint. It's actually comma that builds lists. So we could go with () for undef and require (1,) and (,) for the single element and empty list respectively. But then +(1,2,3,()) == 4. Actually, note that both infix:, and circumfix:[ ] can be used to build

Re: Should $.foo attributes without is rw be writable from within the class

2008-09-19 Thread Jon Lang
Daniel Ruoso wrote: TSa wrote: May I pose three more questions? 1. I guess that even using $!A::bar in methods of B is an access violation, right? I.e. A needs to trust B for that to be allowed. Yes 2. The object has to carry $!A::bar and $!B::bar separately, right? Yes 3.

Re: Should $.foo attributes without is rw be writable from within the class

2008-09-19 Thread Jon Lang
Daniel Ruoso wrote: Jon Lang wrote: Note that this ought only be true of class inheritance; with role composition, there should only be one $!bar in the class, no matter how many roles define it. er... what does that mean exactly? Unless something has drastically changed since I last

Re: XPath grammars (Was: Re: globs and trees in Perl6)

2008-10-02 Thread Jon Lang
For tree-oriented pattern matching syntax, I'd recommend for inspiration the RELAX NG Compact Syntax, rather than XPath. Technically, RELAX NG is an XML schema validation language; but the basic principle that it uses is to describe a tree-oriented pattern, and to consider the document to be valid

Re: globs and rules and trees, oh my! (was: Re: XPath grammars (Was: Re: globs and trees in Perl6))

2008-10-03 Thread Jon Lang
Timothy S. Nelson wrote: TimToady note to treematching folks: it is envisaged that signatures in a rule will match nodes in a tree My question is, how is this expected to work? Can someone give an example? I'm assuming that this relates to Jon Lang's comment about using

Re: [svn:perl6-synopsis] r14586 - doc/trunk/design/syn

2008-10-05 Thread Jon Lang
[EMAIL PROTECTED] wrote: Log: Add missing series operator, mostly for readability. Is there a way for the continuing function to access its index as well as, or instead of, the values of one or more preceding terms? And/or to access elements by counting forward from the start rather than

Re: [svn:perl6-synopsis] r14586 - doc/trunk/design/syn

2008-10-06 Thread Jon Lang
Larry Wall wrote: On Sun, Oct 05, 2008 at 08:19:42PM -0700, Jon Lang wrote: : [EMAIL PROTECTED] wrote: : Log: : Add missing series operator, mostly for readability. : : Is there a way for the continuing function to access its index as well : as, or instead of, the values of one or more

Re: [svn:perl6-synopsis] r14598 - doc/trunk/design/syn

2008-10-17 Thread Jon Lang
also seems to be the junctive equivalent of andthen. Should there be a junctive equivalent of orelse? -- Jonathan Dataweaver Lang

Re: Are eqv and === junction aware?

2008-11-13 Thread Jon Lang
Larry Wall wrote: eqv and === autothread just like any other comparisons. If you really want to compare the contents of two junctions, you have to use the results of some magical .eigenmumble method to return the contents as a non-junction. Possibly stringification will be sufficient, if it

Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-24 Thread Jon Lang
On Mon, Nov 24, 2008 at 7:19 AM, Rafael Garcia-Suarez [EMAIL PROTECTED] wrote: Moritz Lenz wrote in perl.perl6.compiler : jerry gay wrote: On Fri, Nov 21, 2008 at 10:43, via RT Moritz Lenz [EMAIL PROTECTED] wrote: # New Ticket Created by Moritz Lenz # Please include the string: [perl

Re: Support for ensuring invariants from one loop iteration to the next?

2008-12-03 Thread Jon Lang
Aristotle Pagaltzis wrote: * Bruce Gray [EMAIL PROTECTED] [2008-12-03 18:20]: In Perl 5 or Perl 6, why not move the grep() into the while()? Because it's only a figurative example and you're supposed to consider the general problem, not nitpick the specific example… But how is that not a

Re: Support for ensuring invariants from one loop iteration to the next?

2008-12-03 Thread Jon Lang
Mark J. Reed wrote: Mark J. Reed wrote: loop { doSomething(); last unless someCondition(); doSomethingElse(); } That is, of course, merely the while(1) version from Aristotle's original message rewritten with Perl 6's loop keyword. As I said, I'm OK with that, personally, but

Re: how to write literals of some Perl 6 types?

2008-12-03 Thread Jon Lang
Darren Duncan wrote: Now, with some basic types, I know how to do it, examples: Bool # Bool::True Please forgive my ignorance; but are there any cases where 'Bool::True' can be spelled more concisely as 'True'? Otherwise, this approach seems awfully cluttered. -- Jonathan Dataweaver

Re: Roles and IO?

2008-12-11 Thread Jon Lang
Leon Timmermans wrote: What I propose is using role composition for *everything*. Most importantly that includes the roles Readable and Writable, but also things like Seekable, Mapable, Pollable, Statable, Ownable, Buffered (does Readable), Socket, Acceptable (does Pollable), and more. That

Re: List.end - last item and last index mixing

2008-12-12 Thread Jon Lang
Moritz Lenz wrote: From S29: : =item end : : our Any method end (@array: ) is export : : Returns the final subscript of the first dimension; for a one-dimensional : array this simply the index of the final element. For fixed dimensions : this is the declared maximum subscript. For

Re: Roles and IO?

2008-12-12 Thread Jon Lang
Leon Timmermans wrote: I assumed a new role makes a new interface. In other words, that a type that happens to do Pollable, Mappable, Statable and Ownable wouldn't automatically do File in that case. If I was wrong my abuse of subset wouldn't be necessary. Otherwise, maybe there should be a

Re: What does a Pair numify to?

2008-12-15 Thread Jon Lang
Mark Biggar wrote: The only use case I can think of is sorting a list of pairs; should it default to sort by key or value? But this isn't a case of numifying a Pair, or of stringifying it - or of coercing it at all. If you've got a list of Pairs, you use a sorting algorithm that's designed

Re: What does a Pair numify to?

2008-12-16 Thread Jon Lang
On Mon, Dec 15, 2008 at 10:26 PM, Larry Wall la...@wall.org wrote: On Mon, Dec 15, 2008 at 04:43:51PM -0700, David Green wrote: I can't really think of a great example where you'd want to numify a pair, but I would expect printing one to produce something like a = 23 (especially since that's

Re: What does a Pair numify to?

2008-12-16 Thread Jon Lang
TSa wrote: I see no problem as long as say gets a pair as argument. Then it can print the key and value separated with a tab. More problematic are string concatenations of the form say the pair is: ~ (foo = $bar); which need to be written so that say sees the pair say the pair is: ,

Re: What does a Pair numify to?

2008-12-16 Thread Jon Lang
Moritz Lenz wrote: Off the top of my head, see S06 for the gory details: my $pair = a = 'b'; named(a = 'b'); named(:ab); named(|$pair); positional((a = 'b')); positional((:ab)); positional($pair); As you say: the gory details, emphasis on gory. But if that's the way of things, so be

Re: Support for ensuring invariants from one loop iteration to the next?

2008-12-16 Thread Jon Lang
How do you compute '*'? That is, how do you know how many more iterations you have to go before you're done? Should you really be handling this sort of thing through an iteration count mechanism? How do you keep track of which iteration you're on? Is it another detail that needs to be handled

Re: Support for ensuring invariants from one loop iteration to the next?

2008-12-18 Thread Jon Lang
Aristotle Pagaltzis wrote: And it says exactly what it's supposed to say in the absolutely most straightforward manner possible. The order of execution is crystal clear, the intent behind the loop completely explicit. If it works for you, great! Personally, it doesn't strike me as being as

Re: returning one or several values from a routine

2009-01-05 Thread Jon Lang
Daniel Ruoso wrote: Hi, As smop and mildew now support ControlExceptionReturn (see v6/mildew/t/return_function.t), an important question raised: sub plural { return 1,2 } sub singular { return 1 } my @a = plural(); my $b = plural(); my @c = singular(); my $d = singular(); What

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote: I've just realized we were missing some spots, so remaking the list of possibilities my $a = sub s1 { return a = 1 } my $b = sub s2 { return a = 1, b = 2 } my $c = sub s3 { return 1, 2, 3, a = 1, b = 2 } my $d = sub s4 { return 1 } my $e = sub s5 { return 1, 2, 3 }

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Daniel Ruoso wrote: Hmm... I think that takes the discussion to another level, and the question is: what does a capture returns when coerced to a context it doesn't provide a value for? The easy answer would be undef, empty array and empty hash, but that doesn't DWIM at all. The hard

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
TSa wrote: Jon Lang wrote: item($x) # Dwimmey use of item context. IIRC this is the same as $$x, right? Or does that extract the invocant slot without dwimmery? Umm... good question. This is a rather nasty paradox: on the one hand, we want to be able to stack $, @, and % with capture

Re: returning one or several values from a routine

2009-01-06 Thread Jon Lang
Dave Whipp wrote: Daniel Ruoso wrote: Hmm... I think that takes the discussion to another level, and the question is: what does a capture returns when coerced to a context it doesn't provide a value for? I'd like to take one step further, and ask what it is that introduced capture

Writing to an iterator

2009-01-07 Thread Jon Lang
I was just reading through S07, and it occurred to me that if one wanted to, one could handle stacks and queues as iterators, rather than by push/pop/shift/unshift of a list. All you'd have to do would be to create a stack or queue class with a private list attribute and methods for reading from

Re: r24819 - docs/Perl6/Spec

2009-01-08 Thread Jon Lang
Darren Duncan wrote: pugs-comm...@feather.perl6.nl wrote: Log: [S02] clarify that Pairs and Mappings are mutable in value, but not in key snip KeyHash Perl hash that autodeletes values matching default KeySet KeyHash of Bool (does Set in list/array context) KeyBag

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: Is it possible to modify the core Perl6Array class like that (without extra keywords)? If so, is it possible for each programmer to make such a change so that it's lexically scoped? AFAIK, it is not possible to modify a core class; however, I believe that it _is_ possible to

Re: Not a bug?

2009-01-12 Thread Jon Lang
On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak cma...@gmail.com wrote: Ovid (): $ perl6 -e 'my $foo = foo;say { ~ $foo ~ }' ~ foo ~ Easy solution: only use double quotes when you want to interpolate. :) This is not really an option when running 'perl6 -e' under bash, though. $ perl6 -e 'my

Re: Not a bug?

2009-01-12 Thread Jon Lang
On Mon, Jan 12, 2009 at 1:08 PM, Larry Wall la...@wall.org wrote: On Mon, Jan 12, 2009 at 03:43:47AM -0800, Jon Lang wrote: : On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak cma...@gmail.com wrote: : Ovid (): : $ perl6 -e 'my $foo = foo;say { ~ $foo ~ }' :~ foo ~ : : Easy solution

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: Actually, I'd prefer to go much further than this: use Core 'MyCore'; And have that override core classes lexically. That solves the but I want it MY way issue that many Perl and Ruby programmers have, but they don't shoot anyone else in the foot. Since 'use' imports its

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: - Original Message From: Jon Lang datawea...@gmail.com Actually, I'd prefer to go much further than this: use Core 'MyCore'; And have that override core classes lexically. That solves the but I want it MY way issue that many Perl and Ruby programmers have

Re: design of the Prelude (was Re: Rakudo leaving the Parrot nest)

2009-01-15 Thread Jon Lang
Forgive my ignorance, but what is a Prelude? -- Jonathan Dataweaver Lang

Re: design of the Prelude (was Re: Rakudo leaving the Parrot nest)

2009-01-15 Thread Jon Lang
On Thu, Jan 15, 2009 at 6:45 PM, Jonathan Scott Duff perlpi...@gmail.com wrote: On Thu, Jan 15, 2009 at 8:31 PM, Jon Lang datawea...@gmail.com wrote: Forgive my ignorance, but what is a Prelude? -- Jonathan Dataweaver Lang The stuff you load (and execute) to bootstrap the language

Re: Operator sleuthing...

2009-01-15 Thread Jon Lang
Mark Lentczner wrote: STD has sym; as both an infix operator ( -- Sequencer), and as a terminator. ?? Which is it? Since I think most people think of it as a statement terminator, I plan on leaving it off the chart. It is both. Examples where it is used as an infix operator include: loop

Re: r25060 - docs/Perl6/Spec src/perl6

2009-01-27 Thread Jon Lang
On Tue, Jan 27, 2009 at 9:43 AM, pugs-comm...@feather.perl6.nl wrote: +=head2 Reversed comparison operators + +Any infix comparison operator returning type COrder may be transformed into its reversed sense +by prefixing with C-. + +-cmp +-leg +-= + +To avoid confusion with

Re: r25060 - docs/Perl6/Spec src/perl6

2009-01-27 Thread Jon Lang
Larry Wall wrote: Jon Lang wrote: : If there are only a handful of operators to which the new : meta-operator can be applied, why do it as a meta-operator at all? As a metaoperator it automatically extends to user-defined comparison operators, but I admit that's not a strong argument

Re: r25102 - docs/Perl6/Spec

2009-01-30 Thread Jon Lang
Larry Wall wrote: So I'm open to suggestions for what we ought to call that envelope if we don't call it the prelude or the perlude. Locale is bad, environs is bad, context is bad...the wrapper? But we have dynamic wrappers already, so that's bad. Maybe the setting, like a jewel? That has

Re: r25200 - docs/Perl6/Spec t/spec

2009-02-04 Thread Jon Lang
pugs-comm...@feather.perl6.nl wrote: -=item --autoloop-split, -F *expression* +=item --autoloop-delim, -F *expression* Pattern to split on (used with -a). Substitutes an expression for the default split function, which is C{split ' '}. Accepts unicode strings (as long as Should the

Re: r25200 - docs/Perl6/Spec t/spec

2009-02-05 Thread Jon Lang
On Thu, Feb 5, 2009 at 9:21 AM, Larry Wall la...@wall.org wrote: On Thu, Feb 05, 2009 at 07:47:01AM -0800, Dave Whipp wrote: Jon Lang wrote: Pattern to split on (used with -a). Substitutes an expression for the default split function, which is C{split ' '}. Accepts unicode strings

Re: 2 questions: Implementations and Roles

2009-02-06 Thread Jon Lang
Timothy S. Nelson wrote: Also, is there a simple way to know when I should be using a class vs. a role? If you plan on creating objects with it, use a class. If you plan on creating classes with it, use a role. -- Jonathan Dataweaver Lang

Re: References to parts of declared packages

2009-02-11 Thread Jon Lang
On Wed, Feb 11, 2009 at 12:15 PM, Jonathan Worthington jonat...@jnthn.net wrote: Hi, If we declared, for example: role A::B {}; Then what should a reference to A be here? At the moment, Rakudo treats it as a post-declared listop, however I suspect we should be doing something a bit

Re: References to parts of declared packages

2009-02-11 Thread Jon Lang
Carl Mäsak wrote: * A should be treated as a post-declared package. Whatever this means, it sounds preferable. :) It means that you can define package A without ever declaring it, by declaring all of its contents using such statements as 'role A::B ', 'sub A::Foo', and so on. -- Jonathan

S03: how many metaoperators?

2009-02-11 Thread Jon Lang
With the addition of the reversing metaoperator, the claim that there are six metaoperators (made in the second paragraph of the meta operators section) is no longer true. Likewise, the reduction operator is no longer the fourth metaoperator (as stated in the first sentence of the reduction

Re: References to parts of declared packages

2009-02-13 Thread Jon Lang
TSa wrote: Does that imply that packages behave like C++ namespaces? That is a package can be inserted into several times: package A { class Foo {...} } # later elsewhere package A { class Bar {...} } I would think that this is just different syntax to the

Synopsis for Signatures?

2009-02-13 Thread Jon Lang
At present, signatures appear to serve at least three rather diverse purposes in Perl 6: * parameter lists for routines (can also be used to specify what a given routine returns; explored in detail in S06). * variable declaration (see declarators in S03). * parametric roles (currently only

Re: References to parts of declared packages

2009-02-13 Thread Jon Lang
Larry Wall wrote: Jon Lang wrote: : Well, we _do_ have a mechanism in place for adding to an existing : class (e.g., class Foo is also { ... }), and classes are a special : case of modules; so I don't see why you shouldn't be able to do : likewise with modules and even packages. That said

Re: References to parts of declared packages

2009-02-13 Thread Jon Lang
Larry Wall wrote: Jon Lang wrote: : And with package versioning, you may not need an is instead : equivalent: if you want to redefine a package, just create a newer : version of it in a tighter lexical scope than the original package was : in. You can still access the original package if you

infectious traits and pure functions

2009-02-13 Thread Jon Lang
In reading over the Debugging draft (i.e., the future S20), I ran across the concept of the infectious trait - that is, a trait that doesn't just get applied to the thing to which it is explicitly applied; rather, it tends to spread to whatever else that thing comes in contact with. Taint is the

Re: infectious traits and pure functions

2009-02-16 Thread Jon Lang
Darren Duncan wrote: There are ways to get what you want if you're willing to trade for more restrictiveness in the relevant contexts. If we have a way of marking types/values and routines somehow as being pure, in the types case marking it as consisting of just immutable values, and in the

Re: Comparing inexact values (was Re: Temporal changes)

2009-02-24 Thread Jon Lang
Daniel Ruoso wrote: What about...  if $x ~~ [..] $x ± $epsilon {...} That would mean that $x ± $epsilon in list context returned each value, where in scalar context returned a junction, so the reduction operator could do its job... (I'm assuming that you meant something like if $y ~~ [..]

  1   2   3   4   >