Re: Perl6 Operator List, Damian's take

2002-10-29 Thread Damian Conway
Aaron Crane wrote: Mmm, yummy. I do have a question though (and apologies if I've merely missed the answer). We've got two productive operation-formation rules: one saying add a final = to operate-and-assign, and the other saying wrap in [] to vectorise. But no-one's said which order they

Re: Perl6 Operator List, Take 3

2002-10-28 Thread Damian Conway
Scott Duff asked: How do we get at the eigenstates of a superposition? We obviously need another operator! ducks Actually, I think we need a universal method on scalars that gives the eigenstates of that value. It might be C$val.eigenstates or maybe just C$val.states. The method would work

Re: perl6 operator precedence table

2002-10-26 Thread Damian Conway
Deborah Pickett wrote: Which looks better? if ($a == 1|2|3 || $b eq x|y|z) or if ($a == 1||2||3 | $b eq x||y||z ? No question thatthe former works better. Lower precedence operators govern larger chunks, and so should themselves be larger (i.e. more easily detected). I just need some

Re: Perl6 Operator List, Take 2

2002-10-26 Thread Damian Conway
Simon Cozens wrote: I don't understand this, on several levels. The lowest level on which I don't understand it is that testing whether an array is full of threes: array 3 Err...that's not what that does. What you wrote creates a scalar value that superimposes the scalar values C

Re: Perl6 Operator List

2002-10-26 Thread Damian Conway
Larry mused: Now I'm wondering whether these should be split into: ++|+! - bitwise operations on int += +|= +!= ~~|~! - bitwise operations on str ~= ~|= ~!= I think this is UME (Unnecessary Multiplication of Entities),

Re: Perl6 Operator List, Take 2

2002-10-26 Thread Damian Conway
Simon Cozens wrote: Ah, I see. So (x y) is equivalent to all(x,y) ? Yes. Cany, Call, and Cone are the n-ary prefix versions of binary infix C|, C, C! respectively. One might imagine others of this ilk too, perhaps: BinaryN-ary +sum *prod

Re: Perl6 Operator List

2002-10-26 Thread Damian Conway
Luke Palmer wrote: You know, \ and friends as xor is appealing to me. H. I quite like that too. :-) Also, a question about superpositions: Is $x = 1 | 2 | 3 equivalent to $x = 1 | 2 $x |= 3 No. The precedence is wrong. or $x = (1 | 2) | 3 Yes. or is there a

Re: Perl6 Operator List, Take 2

2002-10-26 Thread Damian Conway
fearcadi wrote: * do we have have an axcess to the signature of the subroutine if we have been passed only its reference . that is , for exemple , can process( x , step ) guess how many arguments step expects ? I'd expect that Code objects would have a Csignature or Csig method:

Re: Perl6 Operator List

2002-10-26 Thread Damian Conway
Larry wrote: And you get the C || and for free Yeah, but it's the same sense of free in which spam is free. You pay for it in other ways. But distinguishing int ops from str ops fixes the really nasty rule in Perl 5 that says If this value (these values) has (have) ever been used in a

Re: Perl6 Operator List

2002-10-26 Thread Damian Conway
Larry wrote: : H. I quite like that too. :-) Except what about unary xor, i.e. 1's complement? I was carefully ignoring that. ;-) Besides, Windows programmers would continually be writing $a / $b and wonder why they don't get one($a,$b); grin : Also, a question about

Re: Perl6 Operator List, Take 2

2002-10-25 Thread Damian Conway
Excellent (and valuble) work Michael. Thank-you. My turn for a few comments: | ! - superpositional all any one (none?) Although there certainly are good uses for a Cnone superpositional: push list, $newval if $newval eq none(list); print In range\n

Re: Perl6 Operator List

2002-10-25 Thread Damian Conway
Brent Dax wrote: Larry Wall: # We're obviously missing the force to string context, negate # operator. :-) Which would create a superposition of all strings besides the given one, right? (Oh crap, I think I gave Damian an idea... :^) ) The C~none operator covers that quite nicely: $not_foo

Re: perl6 operator precedence table

2002-10-23 Thread Damian Conway
On top of which, Damian has expressed an interest in ! for a superpositional xor. Which would behave how, exactly? Well, that's still a matter for conjecture. N-ary xor isn't particularly useful, because binary xor naturally generalizes to: an odd number of these N operands are true. (Hint:

Re: perl6 operator precedence table

2002-10-23 Thread Damian Conway
Brent Dax wrote: Can the new nefarious use be concat? Pretty please? There was a brief period 18 months ago when tilde *was* the designated Perl 6 concatenation operator. I certainly wouldn't mind seeing it return to that role, now that it's not needed elsewhere. And, of course, that would

Re: perl6 operator precedence table

2002-10-23 Thread Damian Conway
Adam D. Lopresto wrote: Really what I've been wishing for was an operator (or whatever) to let me do an s// without changing the variable. I would hope/expect that that's what the subroutine form of Cs would do. That is, it takes a string, a pattern, and a replacement string, and returns a

Re: hotplug regexes, other misc regex questions

2002-09-19 Thread Damian Conway
Josh Jore wrote: Would it be correct for this to print 0? Would it be correct for this to print 2? my $n = 0; aargh =~ /a* { $n++ } aargh/; print $n; Yes. ;-) Wouldn't that print 2 if $n is lexical Err. It *is* lexical in this example. and 0 if it's localized? No. Without the

Re: hotplug regexes, other misc regex questions

2002-09-18 Thread Damian Conway
Steve Fink wrote: What should this do: my $x = the letter x; print yes if $x =~ /the { $x .= ! } .* !/; Does this print yes? If it's allowed at all, I think the match should succeed. print yes if helo =~ /hel { .pos-- } lo/; This definitely has to work. But remember the call

Re: Throwing lexicals

2002-09-10 Thread Damian Conway
Luke Palmer fretted: This is terrible. Calling foo which calls bar mysteriously overwrites $date? Why is $date changing? the programmer asks. He does an exhaustive search through his code and finally says ohh, and has to change all references to the inner $date to something like

Re: More A5/E5 questions

2002-09-09 Thread Damian Conway
Nicholas Clark wrote: Related, I think: no-one answered my question about what happens when I define sub dumb ($var, var) { ... } and then call it with the pair var=$thing Exception, probably. Perhaps the error would be something like: Dumb ambiguous binding of dumb named parameter

Re: reduce via ^ again

2002-09-09 Thread Damian Conway
John Williams wrote: Back in October I suggested that $a ^+= b would act like reduce, but in discussion it was decided that it would act like length I now pose the question: Is ^+= a hyper assignment operator or an assignment hyper operator? with a scalar involved the method and

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Erik Steven Harrison wrote: Just found this hidden in my inbox. I didn't think anyone was paying attention ;-). Oh, we *always* pay attention. We just don't always respond. ;-) What I most like about the Cis syntax is (like methods in OO Perl), it associates a meaningful *name* with each

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Erik Steven Harrison wrote: But still, what counts as a runtime property, other than true or false, as in the delightful '0 but true'? What other kind of runtime labels can I slap on a value? Here's ten to start with... for but tainted(0) {...} # note that external data is

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Steve Canfield wrote: I was under the impression that compile time properties, like runtime properties, can be arbitrarily invented and/or assigned. Yes, but not purely lower-case ones. They're reserved for Perl 6 itself. (i.e. only Larry can invent/assign them ;-) If that is correct, why

Re: More A5/E5 questions

2002-09-09 Thread Damian Conway
David Helgason wrote: [worry #1] The hypothetical 'variables' we bind to aren't really variables but keys to a hash. Welcome to Perl 6. Where *no* variable is really a variable, but all are keys to a hash (which is known as the symbol table) ;-) Thus they shouldn't have sigils in their

Re: More A5/E5 questions

2002-09-09 Thread Damian Conway
David Helgason wrote: Coming to think of it, why have a named variable at all? If the match object gets returned anyhow there is no need for a cleverly named magical variable ($0, $MATCH, ...). Probably for the same reason that we have $1, $2, $_, etc. Because people are lazy. :-) Damian

Re: Hypothetical variables and scope

2002-09-08 Thread Damian Conway
Jonathan Scott Duff wrote: Because what you do with a hypothetical has to be reversible. I thought it was just the hypothetical's existence that has to be reversible. That's not my understanding. You need to be able to cope with this too: rule alias :w { \$ $name:=ident [is named

Re: Argument aliasing for subs

2002-09-08 Thread Damian Conway
Peter Behroozi wrote: sub hidden (str $name, int $force is aka($override)) {...} Hang on a moment! In your original answer to this question, you used the is named('alias') syntax, but now you are suggesting using the sigil in the syntax. Yes, but for a *different* property. The

Re: Request for default rule modifiers in a grammar

2002-09-06 Thread Damian Conway
Ken Fox wrote: Excellent. Will there be an abstract syntax for tree rewriting or is it Perl 6 all the way down? I'd expect it to be Perl all the way down. Though a tree rewriting module might make it seem abstract. ;-) This is really amazing stuff. I was expecting some support for

Re: Defaulting params (reprise)

2002-09-05 Thread Damian Conway
Trey Harris wrote: A more practical application would be: my $foo; # Code which might or might not set $foo... $foo //= 23; # or $foo is default(23); In such a case, the Cis default just looks plain odd to me. It is. More than that, it's plain wrong. Cis properties are

Re: Argument aliasing for subs

2002-09-05 Thread Damian Conway
Erik Steven Harrison wrote: Is it just me or is the 'is' property syntax a little too intuitive? Seems like everywhere I turn, the proposed syntax to solve a problem is to apply a property. That's because most of the problems we're discussing are solved by changing the semantics of a

Re: Argument aliasing for subs

2002-09-05 Thread Damian Conway
Erik Steven Harrison wrote: I know that the property syntax is pseudo established, but I'm beggining to become a bit jaded about all the built in properties were building. What about good ol' aliases? sub hidden (str $name, int $force := $override) {...} I'm not keen on it because it

Re: Hypothetical variables and scope

2002-09-05 Thread Damian Conway
Jonathan Scott Duff wrote: This continues to make no sense to me. The hypotheticality of a variable seems quite orthogonal to what you do with it (bind, assign, whatever). Why should these two things be intimate? Because what you do with a hypothetical has to be reversible. And binding is

Re: Request for default rule modifiers in a grammar

2002-09-05 Thread Damian Conway
Ken Fox wrote: I'm messing around with regex code generation by converting first to a grammar. The modifiers seem to need intimate knowledge of regex - grammar conversion. This may be a quirk of my approach. People using tree traversal or generating code directly from the regex might see

Re: Hypothetical variables and scope

2002-09-04 Thread Damian Conway
Ken Fox wrote: / $x := (gr\w+) /vs/ (gr\w+) { let $x = $1 } / Shouldn't they both use C := ? They should. The second version is a typo. It should be: / (gr\w+) { let $x := $1 } / Depends on what you want. The $x := in the rule binds the

Re: atomicness and \n

2002-09-04 Thread Damian Conway
Jonathan Scott Duff wrote: How can you be sure that roundascii is implemented as a character class instead of being some other arbitrary rule? An answer is that perl should know how these things are implemented and if you try arithmetic on something that's not a character class, it should

Re: Argument aliasing for subs

2002-09-04 Thread Damian Conway
Peter Behroozi wrote: Has anyone considered a syntax for allowing subroutines to have many different names for the same argument? If it were allowed, it would probably be done via properties instead: sub hidden (str $name, int $force, int $override is aka($force)) { ... } Damian

Re: Argument aliasing for subs

2002-09-04 Thread Damian Conway
[EMAIL PROTECTED] wrote: sub hidden (str $name, int $force, int $override is aka($force)) { ... } Would the following be simpler...? sub hidden (str $name, int $force is aka($override)) { ... } Yeah, that's what I meant. Sorry. I've travelled 14,000 miles and given 93 hours of

Re: Hypothetical variables and scope

2002-09-04 Thread Damian Conway
Jonathan Scott Duff wrote: It seems odd to require two syntactic elements to achieve one semantic. And actually, after looking at A5, that's not what Larry wrote: my $x; / (\S*) { let $x = .pos } \s* foo / A typo, I believe. He has been very consistent in

Re: Multimethod Dispatch

2002-09-04 Thread Damian Conway
Dan Sugalski wrote: Dan, can you explain what multimethod dispatch is? Damian can explain it better than I can, I thought you did a great job! However, anyone who wants to know more about multiple dispatch might also like to read:

Re: Hypotheticals again

2002-09-04 Thread Damian Conway
Trey Harris wrote: So, each time I use a hypothetical, I have to be concious of which variables are currently in scope? Perl can't help be with this task because how does it know if I meant to hypothetically clobber that lexical or store something in the match object. This is only really a

Re: Request for default rule modifiers in a grammar

2002-09-02 Thread Damian Conway
Ken Fox wrote: The thing I'd like to do right now is turn on :w for all rules. A Fortran grammar might want to turn on :i for all rules. Maybe add modifiers to the grammar declaration? grammar Fortran :i { ... } Maybe. Or a property: grammar Fortran is modified(:i) { ... }

Re: @array = %hash

2002-09-02 Thread Damian Conway
Uri Guttman wrote: so what that attribute does is force the hash to keep all pairs as single objects. but what about run time control of it? sometimes you might want a list of pairs to be handled like pairs and other times you want pairs to be scalars in a hash assignment. is there any way

Re: auto deserialization

2002-09-02 Thread Damian Conway
Adam D. Lopresto wrote: That's pretty close to what I was thinking of, but I don't think the constructors actually have to be special. What if my Date $date; lets the compiler know that $date belongs to the Date class, even if it's undef? If that's the case you could call static functions

Re: auto deserialization

2002-09-02 Thread Damian Conway
Graham Barr wrote: I would say it is not always redundant to specify the type on both sides my Dog $dog = Greyhound.new('black'); Sure. But it's the redundant case we were trying to simplify. And, furthermore, that you could easily define special semantics for void-context

Re: auto deserialization

2002-09-02 Thread Damian Conway
Trey Harris wrote: An alias? Isn't class Date is Really::Long::Package::Name::Ugh; a new class declaration, declaring 'Date' as a subclass of Really::Long::Package::Name::Ugh? Yes. It's not an alias. it will have a similar effect to aliasing Really::Long::Package::Name::Ugh

Re: auto deserialization

2002-09-02 Thread Damian Conway
Nicholas Clark wrote: So, based on what I remember about variables, would class Date := Really::Long::Package::Name::Ugh; express aliasing of classes? By analogy to: my $date := $really::long::variable::name::ugh; yes. If Larry allows aliasing of classnames at all, that is.

Re: auto deserialization

2002-09-02 Thread Damian Conway
Mike Lambert wrote: class Date is Really::Long::Package::Name::Ugh; class DateManipulator; our Date $date2manip; ...date manip methods here... An external class is thus unable to do: $DateManipulator::date2manip = new Really::Long::Package::Name::Ugh() Is that correct? Yes. You

Re: @array = %hash

2002-09-02 Thread Damian Conway
Uri Guttman wrote: but what about mixing pairs and scalars which was the core of this thread? Then you get whatever behaviour you defined the hash to give. by default it seems assigning such a list to a hash would use the pairs as 2 elements It's not the right way to think about what

Re: @array = %hash

2002-09-01 Thread Damian Conway
Uri Guttman wrote: but what simon was saying (and i agree) is the the pair IS a single item. it becomes the key and its value is 'scalars'. No. If it's a PAIR, then its key is the key and its value is the value. hashes can now take objects as keys and won't just stringify them. Correct.

Re: auto deserialization

2002-09-01 Thread Damian Conway
David Wheeler wrote: Yes, but this: my Really::Long::Package::Name::Ugh $date is now {.init 'June 25, 2002' }; Is shorter than this: my Really::Long::Package::Name::Ugh $date = Really::Long::Package::Name::Ugh.new( 'June 25, 2002' ); It's not the short package names like

Re: prebinding questions

2002-08-31 Thread Damian Conway
HellyerP wrote: This week I was fortunate enough to hear Damian speak twice, once on everything and once on Perl6. Damian, it was tremendous of you to come and speak to us in London - thank-you very much. It was my pleasure. If he's coming to a city near you, book your seats now.

Re: @array = %hash

2002-08-31 Thread Damian Conway
Nicholas Clark asked: %hash3 = kv_array Is perl6 going to spot that kv_array has an even number of entries, all are scalars (no pairs), and so do this for kv_array - key, value { %hash3{$key} = $value; } Yes. Just like in Perl 5. Or is it going to treat non-pairs

Re: rule, rx and sub

2002-08-31 Thread Damian Conway
Trey Harris wrote: sub repeat is multi ($desc is valued(1), body) { body(1); } sub repeat is multi ($desc is valued(0), body) { } sub repeat is multi ($desc is valued(['A'..'F']), body) { die Can't repeat hexadecimally; This is very nice.

Re: Regex stuff...

2002-08-31 Thread Damian Conway
Piers Cawley wrote: If I replace C ($key, $val) with ary = m/$pattern/ and the match succeeds, how many elements are there in ary? Zero. No explicit captures in that pattern. Suppose you want to use a hypothetical variable to bind a name to a capture: /

Re: atomicness and \n

2002-08-31 Thread Damian Conway
Aaron Sherman wrote: Is C\n going to be a rule (e.g. C eol ) There might be an named rule like that. But C\n will certainly still be available. or is it implicitly translated to: [\x0a\x0d...]+ No. It will be equivalent to: [\x0a\x0d...] (no repetition) Along those

Re: auto deserialization

2002-08-31 Thread Damian Conway
Larry wrote: :my $date = Date.new('June 25, 2002'); Assignment is wrong for conferring compile-time properties, I think. Agreed. For a start, it's too late. The declaration is compile-time; the assignment, run-time. We almost need some kind of topicalization: my Date $date =

Re: rule, rx and sub

2002-08-30 Thread Damian Conway
Larry wrote: sub while (test is rx/expr/, body); or some such. That probably isn't sufficient to pick expr out of Perl's grammar rather than the current lexical scope. I love the idea, but the property name needs to be more expressive (and Huffmanly longer). Maybe: sub

Re: backtracking into { code }

2002-08-30 Thread Damian Conway
Ken Fox wrote: A question: Do rules matched in a { code } block set backtrack points for the outer rule? I don't believe so. From A5: A pattern nested within a closure is classified as its own rule, however, so it never gets the chance to pass out of a {...} closure.

Re: Capturing alternations (was Re: Hypothetical synonyms)

2002-08-29 Thread Damian Conway
Piers wrote: Not exactly DWIM, but how about: my $stuff = /^\s* [ (.*?) | (\S+) ] : { $foo := $+ }/; Assuming $+ means 'the last capture group matched' as it does now. Or just: my $stuff = /^\s* [ $foo:=(.*?) | $foo:=(\S+) ]/; BTW, that doesn't actually *do* the match. It

Re: rule, rx and sub

2002-08-28 Thread Damian Conway
Sean O'Rourke wrote: I hope this is wrong, because if not, it breaks this: if 1 { do something } foo $x; in weird ways. Namely, it gets parsed as: if(1, sub { do something }, foo($x)); which comes out as wrong number of arguments to `if', which is just strange. Any

Re: rule, rx and sub

2002-08-26 Thread Damian Conway
Debbie Pickett wrote: So . . correct me if I'm wrong . . . Crule allows us to define both named and anonymous rules, Yes. depending on context. Depending on whether or not you provide a name. Crx allows us to define only anonymous rules. Yes. And they can't take parameter lists.

Re: E5: questions

2002-08-26 Thread Damian Conway
Markus Laire asked: So, would this be right short explanation: o: backtrack fails preceding atom (as atom fails, it's skipped) o:: backtrack fails surrounding group (OK) o::: backtrack fails rule (OK) ocommitbacktrack fails whole match So

Re: rule, rx and sub

2002-08-26 Thread Damian Conway
Not quite arbitrary. Alphanumerics aren't allowed, nor are colon or parens. Of course. I didn't want to poison my entire sentence with footnotes for the obvious exceptions. Yes. It wasn't directed at you particularly, but at those for whom the exception isn't obvious. The problem being, of

Re: rule, rx and sub

2002-08-26 Thread Damian Conway
Luke Palmer wrote: Hang on... I thought parens weren't allowed as delimiters. Or does that not apply to rx()? Well, yes, we *did* say that in A5 and E5. But we were thinking of m// and s/// in particular and of patterns with modifiers (which might take argument lists) in general. For an

Re: rule, rx and sub

2002-08-26 Thread Damian Conway
Glenn Linderman asked: So one thing that bothers me in the whole discussion of rule vs rx differences and similarities, is that there was a previous discussion that said regular expression and regex should be deprecated terms because the rules and patterns are no longer regular, but if rx

Re: :, ::, :::, and :::: in P6REs

2002-08-22 Thread Damian Conway
Simon Cozens wrote: While I'm messing about with REs, is it specified how :any and hypotheticals interoperate? ab =~ rx:any / $match := (\w) /; print $match; Can that be undefined behaviour? Please? :) I don't think so. It would probably result in $0 containing an array of match

Re: :, ::, :::, and :::: in P6REs

2002-08-22 Thread Damian Conway
Paul Marquess wrote: Is that the soon to be released E5? No, that's the to be released today E5. ;-) Damian

Re: Perl summary for week ending 2002-08-04

2002-08-18 Thread Damian Conway
Tim Bunce wrote: Personally, I'm deprecating regex and its variants in my own writing and speaking, and trying to stick to rule and pattern. Using pattern in general and rule in the context of a grammar? Using pattern for the contents and rule for the container. But not being too much of

Re: A Perl 6 class question

2002-08-18 Thread Damian Conway
Trey Harris asked: Another one... class Foo is Bar; method a { setup(); } 1; # EOF (Is the 1 still required? No. I think I heard Damian say it was going away.) Yes. The question is, is this valid, if Bar defines a sub/static method 'setup'? If Csetup is a Csub, yes.

Re: Just reading up on Pike...

2002-08-16 Thread Damian Conway
Chris Dutton wrote: and this just jumped out at me: class Foo { private string|int bar; static create(string|int newBar) { bar = newBar; } } In other words, as I understand it, you can type the variable bar as either an int or a string. Aside from simply,

Re: Light ideas

2002-08-02 Thread Damian Conway
Miko O'Sullivan wrote: OK, would that notation ( arr[] = $var ) be something that could be added by a module, in the same way that operators and /* */ will be addable? I don't know exactly what the syntax for adding /* */ will be Something like this: grammar

Re: Light ideas

2002-08-01 Thread Damian Conway
Miko O'Sullivan aksed: what would true (the string) be converted to? In a numeric context: 0 (as in Perl 5). Here's my point more explicitly: in a boolean context, there's no need to get any specific string (0, 1, yup) as long as it correctly expresses true or false. It's when you

Re: perl6-language@perl.org

2002-08-01 Thread Damian Conway
Having the subscript operator change the topic is, IMHO, a rather strong violation of the principle of least surprise. I'm inclined to agree. I think I'd much rather not have it change there, since I'll frequently do stuff like this: my %hash; for qw(one two three) { %hash{$_} =

Re: what's new continued

2002-07-07 Thread Damian Conway
Ashley Winters asked: It *might* possibly work to hyper the constructor: my ($a, $b) = ^new Foo Would prefix ^ always return 'wanted' number of repetitions? Like a smart Cx Inf? This does bother me about the above proposed syntax/semantics. Hyperoperations take their magnitude

Re: what's new continued

2002-07-07 Thread Damian Conway
Ashley Winters wrote: How about: $_ = new Doberman for my Dog ($spot, $rover) is rw; grin I don't think so. In Perl 6 you'd just need: $_ = new Doberman for $spot, $rover; Or, if you really did want that strong type-checking: for $spot, $rover - Dog $dog is rw { $dog =

Re: what's new continued

2002-07-07 Thread Damian Conway
will perl6 still support the indirect object syntax? i thought it was going away and that would be: Doberman.new That works too, but the indirect object syntax isn't going away. TMTOWTDI, after all. also is $_ an lvalue alias (topic) for $spot and $rover? Yep. Only *named*

Re: what's new continued

2002-07-07 Thread Damian Conway
Ashley Winters wrote: $_ = new Doberman for $spot, $rover; Hmm, I thought the for topic was made ro at some point. Odd. Not the standard $_ topic. Only named topics default to read-only. However, I still expect to be able to use my() in a loop condition/iterator and have it

Re: what's new continued

2002-07-03 Thread Damian Conway
Comments (otherwise you have things pretty much right): Every subrotine or variable or method or object can have a notes (out of bound data) out-of-band data we can even have hyper-assignment : my ($a, $b) ^= new Foo; This is unlikely to do what you wanted. It creates a new Foo object

Re: what's new continued

2002-07-03 Thread Damian Conway
: we can even have hyper-assignment : : : my ($a, $b) ^= new Foo; : : This is unlikely to do what you wanted. It creates a new Foo object and then : assigns a reference to that one object to both $a and $b. It doesn't create two : Foo objects. (But maybe one object referenced twice is

Re: what's new

2002-06-22 Thread Damian Conway
[EMAIL PROTECTED] wrote: [Summary of some of the new Perl 6 constructs] I have answered your questions and made a few comments. Apart from these what you wrote is accurate. Damian -cut--cut--cut--cut--cut- my $x is foo = 0; Now $x.foo is equal to 1

Re: = ?

2002-06-22 Thread Damian Conway
I've seen in theDamian Sypnosys following code : $val = $key That's not code, that's the contents of a regex. And it's a joke: that's a less-than-or-equals comparison. Damian

Re: More 6PAN musings: local namespaces

2002-06-18 Thread Damian Conway
Larry has previously mentioned the prospect of Perl 6 module names being extended to include version number and author. If this were to be done, would seem reasonable for the author component to simply be the author's CPAN username. These are guaranteed unique, are frequently mnemonic, are

Re: More 6PAN musings: local namespaces

2002-06-18 Thread Damian Conway
Larry has previously mentioned the prospect of Perl 6 module names being extended to include version number and author. If this were to be done, would seem reasonable for the author component to simply be the author's CPAN username. These are guaranteed unique, are frequently mnemonic, are

Re: Implementing Parse::RecDescent directives

2002-06-16 Thread Damian Conway
Luke Palmer wrote: I know you heavyweights are working out how to specify the return value from a rule or a capture. Larry says if the hypothetical variable $0 is assigned to, that assigned value becomes the (only) return value of the rule. It's an elegant solution to the problem. Now,

Re: lex behavior

2002-06-13 Thread Damian Conway
I'm still unclear as to how you implement lex-like longest token rule with P6 regexes. If the | operator grabs the first one it matches, how do I match bacamus out of this?: bacamus =~ / b.*a | b.*s / Borrow this trick from Parse::RecDescent: rule max (*@candidates) {{

Re: m:foobar syntax

2002-06-13 Thread Damian Conway
I came across this problem when writing the vim syntax file: How can we tell the difference between these?: m:option(pattern) m:option(argument)/pattern/ Easy. As A5 states, (...) are no longer leagal regex delimiters. So the first is a syntax error. :-) Damian

Re: Apoc 5 questions/comments

2002-06-10 Thread Damian Conway
Jonathan Scott Duff wrote: rule val { [ # quoted $b := ['] ( [ \\. | . ]*? ) $b ] | # or not (\H+) } Not quite. Assigning to $b is a capture. I'm confused. The examples in A5 all show $var := (pattern). So are you saying that

Re: Apoc 5 questions/comments

2002-06-09 Thread Damian Conway
Richard Nuttall wrote: I have no doubt that, once Perl 6 is available, we'll see a rash of modules released in the Grammar:: namespace. Including Grammar::Romana, Grammar::Klingon, Grammar::Buffy, Grammer::Mispelt, and others... :-) Grammar::Python, Grammar::Ruby, Grammar::PHP ? I

Re: A5: comment regexes please

2002-06-09 Thread Damian Conway
Uri Guttman asked: now, why does $0.{comment} refer to the internal regex and not the outer one? Technically, $0 refers to the *match object* of the inner regex, not the inner regex itself. is it because of it being in the closure? Yes. And because $0 is lexically scoped. could you

Re: Apoc 5 questions/comments

2002-06-09 Thread Damian Conway
Trey Harris wrote: On second reading, it occurs to me that this wouldn't work quite right, because the :w would imply a \s+ between lt and identifier, between the equals, and before the gt. No. Under :w you get \s+ between literal sequences that are potential identifiers, and \s* between

Re: Apoc 5 questions/comments

2002-06-09 Thread Damian Conway
Erik Steven Harrison henched: Ahhh, duh . . . Docter Claw . . .er Conway, uh, the Python always throws up Perl Coders . . . Shoulds we maybe bash him with the Giant Shell, or TCL him to death . . . EvilScientist face=red Dammit, you fools! Do I have to think of *everything*??? Just tie him

Re: Apoc 5 questions/comments

2002-06-08 Thread Damian Conway
Dave Storrs yiked: Yikes. Ok, I obviously badly misunderstood that. I'll go back and reread it. So, can you provide an example of a pattern nested within a closure, since I obviously didn't understand? Sure: m/ if { /comment? ::: keyword/ and print $0.{comment} } / The

Re: Apoc 5 questions/comments

2002-06-07 Thread Damian Conway
Dave Storrs wrote: I admit I'm a bit nervous about that...so far, I'm completely sold on (basically) all the new features and changes in Perl 6, and I'm eagerly anticipating working with them. But this level of change...I don't know. I've spent a lot of time getting to be (reasonaly) good

Re: Apoc 5 questions/comments

2002-06-07 Thread Damian Conway
[EMAIL PROTECTED] wrote: Likewise, could we please have a modifier that makes literal, and aliases as something else so *ml can match easier? I very much doubt it. But I'm sure someone will eventually write the five-line (!) module that changes assertion to assertion, thereby freeing up

Re: Apoc 5 questions/comments

2002-06-07 Thread Damian Conway
John Siracusa wrote: I have no doubt that, once Perl 6 is available, we'll see a rash of modules released in the Grammar:: namespace. Including Grammar::HTML and Grammar::XML. Why not just make Grammar::DTD, and then make Grammar::Generator::FromDTD. Then use those to make all the other

Re: A5: hypotheticals outside regexen

2002-06-06 Thread Damian Conway
Page 13 tells use about Clet decls. But it also says that the topic must be a regex. Whilst it explains that this isn't really a problem, I'm not sure that it justifies it. So perhaps someone can clarify why this (hypothetical) code in not a reasonable generalization: Because Perl code

Re: A5: hypotheticals outside regexen

2002-06-06 Thread Damian Conway
You have Ino idea how often that would have been useful. It's a great exception safety mechanism... like C++'s resource aquisition is initialization thingy, but without having to write a class for every variable. Have you already forgotten KEEP and UNDO (that we introduced in A4/E4):

Re: A5: a few simple questions

2002-06-06 Thread Damian Conway
David Whipp wrote: First, a slight clarification: if I say: m:w/ %foo := [ (\w+) = (\w+) [ , (\w+) ]* ] / does this give me a hash of arrays? (i.e. is the rhs of a hash processed as a scalar context) That's an error. The grouping bound to a hypothetical hash has to have either

Re: A5: making a production out of REs

2002-06-06 Thread Damian Conway
Rich Morin wrote: I'd like to be able to use REs to generate lists of strings. For example, it might be nice to create a loop such as: for $i (sort(p:p5|[0-9A-F]{2}|)) { # p operator for production? and have $i walk from '00' through 'FF'. Or whatever. You mean: $ch =

Re: A5: Is this right?

2002-06-06 Thread Damian Conway
Brent Dax wrote: grammar Perl6::Regex { rule metachar { [{(\[\])}:*+?\\|]} rule ws { [[\h\v]|\#\N*]*} Or just: rule ws { [\s|\#\N*]* } rule atom { ws (!metachar | \\ . | group) ws }

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