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' > } > > Since I think this is a good idea, we could just as well enforce that, and > drop the <...> ar

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 get

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 po

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

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 v

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

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

postfix and postcircumfix

2008-04-02 Thread Jon Lang
In "Question on your last change to S02", Larry Wall wrote: > (By the way, you'll note the utility of being able to talk about a > postfix by saying .[], which is one of the reasons we allow the optional > dot there. :) Can I take this as an indication that the rules for postcircumfix operators

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, re

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 bet

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'

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 w

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

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 see

Re: treatment of "isa" and inheritance

2008-05-02 Thread Jon Lang
John M. Dlugosz wrote: > TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: > > Take e.g. my supertyping proposal. I guess it was regarded as > > a curiosity rather than an innovative feature. > > Which idea was that? Maybe I already took the wind into account when I > rounded up the ideas in need

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 r

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 exis

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 d

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 orientation,

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 dis

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 it

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 li

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 &g

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 laz

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 >> loo

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

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 assignm

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

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. >> > >> >

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 >

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 b

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) th

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,

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" L

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

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

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 expect

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 +

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 s

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 > borr

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? > > S09 > // 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

Re: Multiple Return Values - details fleshed out

2008-08-09 Thread Jon Lang
John M. Dlugosz wrote: > I wrote 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, "h

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 t

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 bu

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

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

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: >> 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 ba

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,

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

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

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 no

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, per

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. > >

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.

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 f

Re: What does a Pair numify to?

2008-12-16 Thread Jon Lang
On Mon, Dec 15, 2008 at 10:26 PM, Larry Wall 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 what a

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

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(:a); > named(|$pair); > > positional((a => 'b')); > positional((:a)); > positional($pair); As you say: the gory details, emphasis on gory. But if that's the way of thin

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: Support for ensuring invariants from one loop iteration to the next?

2008-12-19 Thread Jon Lang
not telling you that you're wrong; TIMTOWTDI. I'm telling you that it's a matter of taste. On Fri, Dec 19, 2008 at 5:52 AM, Aristotle Pagaltzis wrote: > * Jon Lang [2008-12-19 03:50]: >> Personally, it doesn't strike me as being as straightforward >> as put

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

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 { retu

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. > >

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 stac

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 >

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 a

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 > > >> >> KeyHash Perl hash that autodeletes values matching default >> KeySet KeyHash of Bool (does Set in list/array context) >>

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 d

Re: Not a bug?

2009-01-12 Thread Jon Lang
On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak 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 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 wrote: > : > Ovid (>): > : >> $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}&

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' import

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: > - Original Message > >> From: Jon Lang > >> > Actually, I'd prefer to go much further than this: >> > >> > use Core 'MyCore'; >> > >> > And have that override core classes lexically. >

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 wrote: > On Thu, Jan 15, 2009 at 8:31 PM, Jon Lang wrote: >> >> Forgive my ignorance, but what is a Prelude? >> >> -- >> Jonathan "Dataweaver" Lang > > The stuff you load (and execute)

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:

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

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

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'

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

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

2009-02-04 Thread Jon Lang
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 default pattern be ' ', o

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

2009-02-05 Thread Jon Lang
On Thu, Feb 5, 2009 at 9:21 AM, Larry Wall 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

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 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 smarter? If so,

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 operat

S06: named arguments and long names

2009-02-12 Thread Jon Lang
Are required named parameters (e.g., ':$foo!') considered to be part of the long name provided by a signature? (S06 seems to indicate that they aren't.) Either way, can their status with respect to the long name be changed? That is, if they aren't included in the long name, can they be added to

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 sy

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 addre

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 wi

  1   2   3   4   >