Re: Ruby iterators
On Tue, Jul 02, 2002 at 07:32:00PM -0600, Luke Palmer wrote: On Tue, 2 Jul 2002, Michael G Schwern wrote: * Yes, Perl 6 will have named arguments to subroutines. What I can remember from the Perl 6 BoF is it will look something like this: sub foo ($this, $that) { print $this if $that; } which is like: sub foo { my($this, $that) = _; print $this if $that; } somebody else on this list can handle explaining how that all works better than I can. There's stuff about pointy subroutines, -, method topics, etc... *hand wave* Yep (far as I know. The only way I can secure my knowledge is to be arrogant and then be confirmed or negated). After this, you can call foo like so: foo(Bar, 1); Or like this: foo(that = 1, this = Bar); Or like this: foo(Bar, that = 1); They all do the same thing. Yes. As far as pointy subs, - is just a synonym for sub, with some extra sugar sprinkled on. You don't need to put parenthesis around the arglist, and I think $_ is always aliased to the first argument. Yes, yes and yes. If there are no arguments, the sub takes one argument and it is aliased to $_. Am I right? If you think you want a pointy sub with no parameters, like: for stuff - { print; } stuff = grep - { /blarf/ } list; %commands = ( add = - { $^a + $^b }, incr = - { $_ + 1 }, ) what you really want is a bare closure: for stuff { print; } stuff = grep { /blarf/ } list; %commands = ( add = { $^a + $^b }, incr = { $_ + 1 }, ); which will alias $_ to the first argument. The pointy sub with no parameters may even be a syntax error. (Methods do act like you suggested, because even when they have no parameter list or explicit arguments, they still have 1 argument -- the invocant, a.k.a. $self -- and it is aliased to $_.) Of course you can't make named subs with -, just anonymous ones. Yes. I *think* you will also be able to do this, at least I can't see why you wouldn't be able to: stuff = grep { length $^foo = 42 } list; which is nice for nested greps and maps. You don't have to fight over who has $_. Yep, grep takes a closure argument now. And if Larry goes with what he suggested last Thursday, that may be the only type of argument it takes in that position, no more bare expressions. Two curly-braces seem a small price to pay for the gains in consistency. If you wanted to make things interesting, you could do it this way too. stuff = grep - $foo { length $foo = 42 } list; I'd even say that's the preferred way of doing it, though it's more a matter of style. tips hat to Luke Nicely explained. Allison
Re: Reflection...
At 8:32 AM +0100 7/3/02, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Just a thought, I hope that we're going to be able to do things like: my $sub = {$^a + $^b}; $sub.arity; # 2 $sub.prototype; # ('$^a', '$^b') Getting access to this sort of thing will make the life of someone, say, writing a refactoring browser, so much easier... And, for scary madness, how about: $sub.current_continuation; For true scariness, consider: $sub.current_continuation($new_continuation); Which may well make a certain amount of sense from an AOP point of view. ... $target.current_continuation($post_handler_continuation); ... Some days you really, really scare me Piers... This would be an interesting thing to do, though. I don't see why it couldn't be done. -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Perl 6, The Good Parts Version
I've just submitted a short talk to the Scandinavian Conference on Java And Object Orientation (JAOO.org) [1] entitled Perl 6, The Good Parts. This talk will be given to an audience of mostly Java, Python and Ruby programmers with a smattering of XP Agile methodology folks and OO and Pattern gurus. It will try to convince them of two things: Perl 6 is not a joke (anymore). The Perl 6 language, design and implementation contains revolutionary ideas that you should pay attention to. I've been trying to pick out what parts of Perl 6 would make a Java programmer sit up and go I wish I had that or a Python programmer think Hmm, maybe there is more than one way to do it and, in fine Perl tradition, a few things which make the whole audience go what a bunch of fruitcakes! Here's what I've got: Parrot Both as our answer to the JVM and .Net and that the language design and the coding of the internals are going on simultaneously. Topicalizers Perl 5 has Do What I Mean, Perl 6 will have Ya Know What I Mean. A language which understands the concept of it. Community Funding A programming community with employees. $200,000 raised so far. Community Design The sometimes rocky process of design by community. Closures, Continuations, Currying, Everything Is An Object, Multimethod Dispatch, Slots, Introspection... Sure, other languages have these features, but all together in one language? Attributes Transcending mere objects and classes, Perl 6 introduces adverbs. Parrot, Funding and Design are pretty straight forward to explain to an audience of Java programmers. For the rest, I'm asking for help placing the proper spin on it. Topicalizers will be particularly tricky to explain without making it just sound like an opportunity to write more incomprehensible Perl code. I'm also trying to think of more bits to throw in. Particularly in terms of the OO system, this being a conference about OO. From what I've heard so far, Perl 6's OO system will be largely playing catch up with other languages. Hopefully the Cabal [2] can debunk that. What will Perl 6's class system offer that will impress a Java programmer? [1] I was invited to speak there last year by mistake and liked it so much I'm trying to weasel my way in again. [2] Of which there is none. -- This sig file temporarily out of order.
Re: Perl 6, The Good Parts Version
In a message dated Wed, 3 Jul 2002, Michael G Schwern writes: Attributes Transcending mere objects and classes, Perl 6 introduces adverbs. confused Attributes are adjectives, not adverbs. Aren't they? Trey
Re: Perl 6, The Good Parts Version
On Wed, Jul 03, 2002 at 01:23:24PM -0400, Michael G Schwern wrote: Hopefully the Cabal [2] can debunk that. [snip] [2] Of which there is none. and http://www.perlcabal.com/ doesn't exist, right? ;-) -- I do not resent critisism, even when, for the sake of emphasis, it parts for the time with reality. Winston Churchill, House of Commons, 22nd Jan 1941.
Re: Perl 6, The Good Parts Version
On Wed, Jul 03, 2002 at 01:23:24PM -0400, Michael G Schwern wrote: I'm also trying to think of more bits to throw in. Particularly in terms of the OO system, this being a conference about OO. From what I've heard so far, Perl 6's OO system will be largely playing catch up with other languages. Don't forget Apocalypse 5. Personally I believe the elegant and thorough integration of regular expressions and backtracking into the large-scale logic of an application is one of the most radical things about Perl 6. Tim.
Re: Perl 6, The Good Parts Version
Trey Harris wrote at Wed, 03 Jul 2002 19:44:45 +0200: In a message dated Wed, 3 Jul 2002, Michael G Schwern writes: Attributes Transcending mere objects and classes, Perl 6 introduces adverbs. confused Attributes are adjectives, not adverbs. Aren't they? Attributes describe the behaviour of sub routines, I think. As a sub routine is a Doing word - a verb, I would say an attribute can be an adverb. Of course an attribute of a variable is an adjective from this point of view :-) I think it's a possible point of view as there are many natural languages (e.g. German) that doesn't care a lot about the differences of adverbs to adjectives. Cheerio, Janek
Re: Perl 6, The Good Parts Version
At 9:20 PM +0100 7/3/02, Dave Mitchell wrote: On Wed, Jul 03, 2002 at 01:23:24PM -0400, Michael G Schwern wrote: Hopefully the Cabal [2] can debunk that. [snip] [2] Of which there is none. and http://www.perlcabal.com/ doesn't exist, right? ;-) Of course not. Otherwise it wouldn't 404, now would it? ;-P -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Perl 6 Summary
On Tue, 02 Jul 2002 10:36:45 -0700, Erik Steven Harrisan wrote: ESH my $a = 'foo'; ESH ESH pass_by_name ( sub { print $a} ); ESH ESH sub pass_by_name { ESH my $a = 'bar'; ESH _[0]; ESH } ESH ESH Now, I have trouble keeping Perl 6 and 5 straight, but what I think this does is ESH print 'foo', as the sub ref is a closure, and gets $a bound to it. Fair enough. ESH ESH But in pass by name, expressions passed to a function aren't evaluated until they ESH are used inside that function, and are evaluated in the context of the surrounding ESH function. In a pass by name environment, the above code would print 'bar' as the ESH sub isn't evaluated until it is used in pass_by_name, and then it gets pass_by_name's ESH value of $a. Understand? Isn't that weird? If you s/my/local/ in your example, you WILL get 'bar' instead of `foo'. But what you are really describing then is dynamic scoping for variables, not pass-by-name. BTW: I've never heard of Jensen's Machine, but Jensen's Device is a technique used to implement pass-by-name. To get a better feel for the weirdness that happens with pass-by-name, consider this example: sub check_it_out { $_[0] = 0; #step 1 $_[1] = 7; #step 2 } my a = (0,1,2,3,4); my $i = 2; check_it_out($i, $a[$i]); print join '', a; This prints '01734' under Perl 5, because the arguments ($i and $a[2]) are passed by reference. If the arguments to check_it_out() were passed by name instead, the result would be '71234', because step 1 would change $i to have the value 0, and *then* $a[$i] would be evaluated in step 2 (using $i's new value), causing the 7 to be assigned to $a[0] (not $a[2]). As Larry said elsewhere in this thread, Ruby doesn't have pass-by-name. And I don't think anybody seriously wants it anyway. I'm personally MUCH more interested in Python's generators http://www.python.org/peps/pep-0255.html. A generator is like an iterator in that it can produce a series of values. But unlike iterators, when you ask a generator for the next value, it picks up execution exactly where it left off when it returned the last value -- including all it's stack. This makes it much easier to solve certain classes of problems (like the same-fringe problem: given two trees, answer the question do these trees have the same leaves in the same order?) If you are interested in Jensen's Device, or if you would like to see an example of how pass-by-name MIGHT be considered useful, check out http://www.cs.rit.edu/~afb/20013/plc/slides/procedures-07.html or just google Jensen's Device. =thom
Re: Perl 6, The Good Parts Version
On Wed, Jul 03, 2002 at 09:20:01PM +0100, Dave Mitchell wrote: On Wed, Jul 03, 2002 at 01:23:24PM -0400, Michael G Schwern wrote: Hopefully the Cabal [2] can debunk that. [snip] [2] Of which there is none. and http://www.perlcabal.com/ doesn't exist, right? ;-) Not Found The requested URL / was not found on this server. TINPC/1.3.14 Server at www.perlcabal.com Port 80 *snort* :) -- This sig file temporarily out of order.
Re: Perl 6, The Good Parts Version
On Wed, 3 Jul 2002, Janek Schleicher wrote: : Trey Harris wrote at Wed, 03 Jul 2002 19:44:45 +0200: : : In a message dated Wed, 3 Jul 2002, Michael G Schwern writes: : Attributes : Transcending mere objects and classes, Perl 6 introduces adverbs. : : confused Attributes are adjectives, not adverbs. Aren't they? : : Attributes describe the behaviour of sub routines, I think. : As a sub routine is a Doing word - a verb, : I would say an attribute can be an adverb. When a sub is declared, it's just an object, and so any properties you apply to it at that point really are functioning as adjectives. Perl 6 will support adverbs, but that's just a way to pass additional arguments to something like the range operator. It really does modify the operation, not the operator. And it's syntactically distinguished from adjectives. Admittedly the concepts mush together in many natural languages. But please don't continue to call the adjectives attributes. They're properties now. We're reserving the term attribute for object instance variables. That is, attributes are formally defined per-class, whereas properties are defined per-object on an ad hoc basis. It will reduce confusion if we can keep those terms straight. It was a mistake to call what Perl 5 has attributes, because that's a standard industry term for instance variables. Larry
XML escaping, etc..
I've been meaning to ask- is there any plan to add special support for XML features such as string escaping? It would be very useful, IMHO, to have something analogous to the \Q feature in perl5 for escaping regexps, but which would do XML-style and escaping. I'm specifically interested in how features like this might be applicable to the problem of Cross-Site Scripting security vulnerabilities in perl-based web applications. The types of escaping which are necessary for this are described at http://www.cert.org/tech_tips/malicious_code_mitigation.html I think tainting is a BIG part of the solution. But is there more that might make sense to provide in the language? With XML generation and parsing becoming so common, it seems to me that an argument could be made that low-level mechanisms for properly parsing and generating XML/HTML content in a flexible way belongs in the core libraries, if not the language itself. --Josh -- Josh Wilmes ([EMAIL PROTECTED]) | http://www.hitchhiker.org
Re: Perl 6 Summary
On Wednesday 03 July 2002 12:54 pm, Thom Boyer wrote: To get a better feel for the weirdness that happens with pass-by-name, consider this example: sub check_it_out { $_[0] = 0; #step 1 $_[1] = 7; #step 2 } my a = (0,1,2,3,4); my $i = 2; check_it_out($i, $a[$i]); print join '', a; This prints '01734' under Perl 5, because the arguments ($i and $a[2]) are passed by reference. If the arguments to check_it_out() were passed by name instead, the result would be '71234', because step 1 would change $i to have the value 0, and *then* $a[$i] would be evaluated in step 2 (using $i's new value), causing the 7 to be assigned to $a[0] (not $a[2]). Creepy. Here's my creepy thought for the day: is there a possibility for a prototype which would implicitly wrap a sub{} around a passed-in argument? i.e. lazy evaluation via sub prototype? sub check_it_out ($idx is rw, $val is rw) { $idx = 0; $val = 7; } check_it_out($i, $a[$i]); # really means: check_it_out(sub is rw { $i }, sub is rw { $a[$i] }); I would guess parser tricks and tied scalars would allow it somehow, if not out of the box. Still creepy. Ashley Winters
Re: Perl 6, The Good Parts Version
On Wed, Jul 03, 2002 at 05:13:01PM -0400, Michael G Schwern wrote: On Wed, Jul 03, 2002 at 09:20:01PM +0100, Dave Mitchell wrote: On Wed, Jul 03, 2002 at 01:23:24PM -0400, Michael G Schwern wrote: Hopefully the Cabal [2] can debunk that. [snip] [2] Of which there is none. and http://www.perlcabal.com/ doesn't exist, right? ;-) Not Found The requested URL / was not found on this server. TINPC/1.3.14 Server at www.perlcabal.com Port 80 *snort* :) Odd how that text isn't what it seems... Tim.
Re: what's new continued
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 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 what you wanted). Let's someone of the anti-perl camp tell me that this upper-cap noise makes the code hard to read and I will smash him with a hammer in the head :) and leave him to type from here to tommorow loop after loop after loop after loop :). Gees those perl designers with LW in the head are mad-scientists . Do you really need to say this? 7.) Quantum superpositions === if ($x == any($a, $b, $c) { ... } if any of the variables equals $x then the code will be executed. Probably we will be able to say : $x ^== ($a,$b,$c) too. The difference as I understand it in that particular case is [?? correct me if i'm wrong ??] : case1 - superposition : if ($x == $a || $x == $b || $x == $c) { ... } Correct. case2 - hyperoperator : my $result = 0; for ($a,$b,$c) { if ($x == $_) { $result =1; last} } Not correct. The second case is the same as: ($x == $a, $x == $b, $x == $c) which reduces in effect to: $x == $c while ($nextval all(thresholds) { ... } This time all() binds the threshold with not with || as it was with any(). It's equivalent to: while ($nextval thresholds[0] $nextval thresholds[1] ...) { ... } $max = any(value) all(values); That's: $max = any(values) = all(values); and all they (except CATCH) are in fact proprietes of the block So is CATCH. [?? the apo4 uses undo instead of keep, 'm I right ??] It uses both, because they have different effects. undo(...) is only invoked if the block fails, keep(...) is only invoked if the block succeeds. CATCH { when Error::DB {}; when Error::XX {}; } is : CATCH $! { when $!.isa(Error::DB) {}; when $!.isa(Error::XX) {}; default die;#!! not sure } No, it's equivalent to: switch $! { when .isa(Error::DB) {} when .isa(Error::XX) {} default { die; } } try { ... } is equivalent to: try { ... CATCH { default { } } } Except it also returns Cundef. for a; b; c - $x { ... } One at a time across all arrays sequentally i.e. a[0],a[1],...@b[0], b[1], ..., c[0], c[1], ... . No. This one pulls one from each array in turn. i.e. a[0], b[0], c[0], a[1], b[1], c[1], a[2], b[2], c[2],... Damian
Re: Perl 6 Summary
At 01:54 PM 7/3/02 -0600, Thom Boyer wrote: I'm personally MUCH more interested in Python's generators http://www.python.org/peps/pep-0255.html. A generator is like an iterator in that it can produce a series of values. But unlike iterators, when you ask a generator for the next value, it picks up execution exactly where it left off when it returned the last value -- including all it's stack. Isn't that a coroutine? I thought they were already slated for P6. *Rummage* Yes: http://www.yetanother.org/damian/diary_April_2001.html Or if you like: http://www.yetanother.org/damian/Perl5+i/coroutines.html -- Peter Scott Pacific Systems Design Technologies
Re: Perl 6 Summary
At 5:07 PM -0700 7/3/02, Peter Scott wrote: At 01:54 PM 7/3/02 -0600, Thom Boyer wrote: I'm personally MUCH more interested in Python's generators http://www.python.org/peps/pep-0255.html. A generator is like an iterator in that it can produce a series of values. But unlike iterators, when you ask a generator for the next value, it picks up execution exactly where it left off when it returned the last value -- including all it's stack. Isn't that a coroutine? A simple form of it, yep. IIRC you can't yield out from inside a block, but I could be wrong there. (They do interesting things with Duff's Device for them) -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: what's new continued
case2 - hyperoperator : my $result = 0; for ($a,$b,$c) { if ($x == $_) { $result =1; last} } Not correct. The second case is the same as: ($x == $a, $x == $b, $x == $c) which reduces in effect to: $x == $c Hold on---something's awry here. I thought C comma was going away, and being replaced with an always-listifying comma. So wouldn't it in effect reduce to 3 or.. that's just for arrays. But I'm sure I read that there's no more C comma. Luke
Re: Perl 6 Summary
But unlike iterators, when you ask a generator for the next value, it picks up execution exactly where it left off when it returned the last value -- i Aren't these what The Damien calls coroutines? Are we getting coroutines (RFC 30, as I recall . . .)? I'm also big on seeing these. Also, thanks to everyone who answered my question. My understanding of pass by name means I understand that we can do iterators without them, and would prefer to. As is often the case, the technical information one recieves online is incorrect. I'm not looking for pass by name to be in the core, and I never was except in as much was necessarry to see strong iterator support. Again, thanks guys and gels. -Erik Is your boss reading your email? Probably Keep your messages private by using Lycos Mail. Sign up today at http://mail.lycos.com
Re: Perl 6 Summary
On Wed, 3 Jul 2002, Ashley Winters wrote: : Creepy. Here's my creepy thought for the day: is there a possibility for a : prototype which would implicitly wrap a sub{} around a passed-in argument? : i.e. lazy evaluation via sub prototype? : : sub check_it_out ($idx is rw, $val is rw) { : $idx = 0; : $val = 7; : } That'd have to be more like: sub check_it_out (idx is rw, val is rw) { idx() = 0; val() = 7; } Note that that's almost a macro definition: sub check_it_out is inline (idx is rw, val is rw) { idx() = 0; val() = 7; } That might not be enough info, though. May need to declare the parameters to have no arguments: sub check_it_out is inline (idx() is rw, val() is rw) { idx() = 0; val() = 7; } Larry
Re: what's new continued
On Wed, 3 Jul 2002, Damian Conway wrote: : Date: Wed, 03 Jul 2002 19:33:33 -0400 : From: Damian Conway [EMAIL PROTECTED] : To: [EMAIL PROTECTED] [EMAIL PROTECTED] : Subject: Re: what's new continued : : Comments (otherwise you have things pretty much right): I didn't see the original here. : 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 what you wanted). It *might* possibly work to hyper the constructor: my ($a, $b) = ^new Foo : 7.) Quantum superpositions === : : if ($x == any($a, $b, $c) { ... } The wave function of QS has not yet collapsed in Perl 6. It's still in the same state(s) as the cat. Larry
Re: Perl6 grammar (take III)
Here's a later, greater version of the parser. It hopefully addresses all the limitations listed for the previous parser. New limits: - While I haven't specified argument contexts for the builtin functions, it should be possible to do so in the same way as for control structures). - Error reporting is awful -- the error will appear at the start of the top-level statement that failed. If it's a sub definition, this will leave you with several iterations of remove the outermost brackets and try again. This iteration is somewhat faster, though still dog-slow. Run it as $0 --cache [modulename] to save or use a precompiled parser in modulename.pm. It parses an updated[1] version of the calculator in Exegesis 4 in a blinding 12 sec, including a bit over 2 sec in startup time. And yes, it still just produces hideous LISP-like gibberish. Sorry. Some of the output cruft results from squashing circular data references in the autotree output. I haven't tracked down why they're there yet. Differences from Perl 5 (and/or previous version), in order from good to controversial: - Bare blocks and all kinds of closures can appear anywhere. The rule is: if it contains only pairs, it's an anonymous hash ref. Otherwise, it's a block. - Semicolons are very optional, in the sense that you can leave them off of anything that ends in a closing bracket. So this: for x - $y; $z { ... } $x = { a = 23 } $y += 3; is actually accepted as three statements. I don't know if this is a good thing or not, but I think it's unambiguous, and isn't too hard to implement. Note that this if 1 { 2 } else { 3 } +4 is a single statement whose value is 6, since if ... is treated like a weird-looking function call. - There are no right list operators. All declared functions have an associated want rule that decides how what follows them should be parsed. The default rule considers the rest of the statement as an argument list. Unary operators want a high-precedence scalar item. Control structures like for and if... want closures and other strange things. Eventually, similar want-age should be created from prototypes to user subs, but for now any subs you define take a single flat list. - There is only a single precedence level for prefix operators (sort of -- context operators are top-precedence). This includes file tests, unary =~ /!~\\-/, and named operators (function calls w/o parens). - The pair constructor (=) has precedence between =~ and unary prefix operators, instead of being just a fat comma. Since it is the constructor syntax for a datatype, I don't think the former low precedence makes sense. Consider a = blah =~ { ... } (a = blah) =~ { ... }# with new precedence a = (blah =~ { ... })# with old precedence I think the first makes more sense if a pair is an object. I initially had it as term-precedence, but people like to do things like this: -23 = 4 # == (-23) = 4, not -(23 = 4) so it has to bind less tightly than high-precedence unary operators. - Precedence for the adverbial colon and 'but' (as well as 'err', which appears in Exe 4) have migrated a bit. 'but' and 'err' bind to scalar expressions (more tightly than commas), while the colon is between 'or' and comma. - Error reporting is awful -- the error will appear at the start of the top-level statement that failed. If it's a sub definition, this will leave you with several iterations of remove the outermost brackets and try again. Anyways, enjoy, /s [1] Need some class defs: class Err::Reportable is Exception {...} class NoData is Exception {...} class Inf { ... } use Data::Dumper; use Getopt::Long; use strict; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; use Term::ReadLine; ## # Argument context for functions and control structures ## my %WANT; sub ::find_want { my $f = shift; $f = $f-{__VALUE__} || $f-{__PATTERN1__} if ref $f; # print STDERR find_want $f: $WANT{$f}\n; $WANT{$f} || '__fail__'; } ## # Functions (list operators): # XXX: many of these need their own special want_* rules my $FUNCTION_ARGS = 'maybe_comma'; my builtin_funcs = qw(crypt index pack rindex sprintf substr join unpack split push unshift splice warn die print printf read select syscall sysread sysseek syswrite truncate write vec chmod chown fcntl ioctl link open opendir rename symlink sysopen unlink return fail not); WANT{@builtin_funcs} = ($FUNCTION_ARGS) x builtin_funcs; sub ::add_function { my $fname =
Re: what's new continued
: 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 what you wanted). It *might* possibly work to hyper the constructor: my ($a, $b) = ^new Foo How would this know how may times to hype? By the count of its list context? And would that also work in dot notation: my ($a, $b) = Foo.^new(); ??? If so, will people be able to grok the subtle difference between C.^ and C^.? : 7.) Quantum superpositions === : : if ($x == any($a, $b, $c) { ... } The wave function of QS has not yet collapsed in Perl 6. It's still in the same state(s) as the cat. grin Damian
Re: what's new continued
On Wednesday 03 July 2002 06:39 pm, Larry Wall wrote: On Wed, 3 Jul 2002, Damian Conway wrote: : Date: Wed, 03 Jul 2002 19:33:33 -0400 : From: Damian Conway [EMAIL PROTECTED] : To: [EMAIL PROTECTED] [EMAIL PROTECTED] : Subject: Re: what's new continued : : Comments (otherwise you have things pretty much right): I didn't see the original here. : 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 what : you wanted). 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? @x = qw(foo bar baz); @y = (one); for @x, ^unseen; @y, ^too high - $x; $y { # foo, one # bar, too high # baz, too high } Ashley Winters