Re: Perl 6 Summary for 2005-04-12 through 2005-04-19

2005-04-20 Thread Michele Dondi
On Tue, 19 Apr 2005, Matt Fowles wrote: Python on Parrot ^^ Kevin Tew wondered what the state of pyrate was. Sam Ruby provided a general explanation. (I'm not on all of the lists, so this may have come out before and I

Re: alarm() and later()

2005-04-20 Thread Leopold Toetsch
Gaal Yahas [EMAIL PROTECTED] wrote: Two things popped up while implementing a demo version of alarm() today. 1. In perl5 and in most underlying libraries, alarm() has 1 second granularity 2. ..., in which you can pass an optional closure to alarm() I can't say anything about the actual

Re: How do I... tie hashes/arrays?

2005-04-20 Thread Leopold Toetsch
Larry Wall [EMAIL PROTECTED] wrote: On Tue, Apr 19, 2005 at 02:02:41PM +, Ingo Blechschmidt wrote: : # Possibility #2 : multi sub *postcircumfix:'[', ']'(TiedArray $self, $index) { : # Body as above : } None of those are quite right, because you have to be prepared to

apo/A06.pod: spelling error(s)?

2005-04-20 Thread Steven Philip Schubiger
In macro circumfix:(*...*) () is parsed(/.*?/ { } is the second enclosing part of the parsed parentheses omitted by intention? If not, I'd volunteer to provide a patch. Steven

Re: apo/A06.pod: spelling error(s)?

2005-04-20 Thread Luke Palmer
Steven Philip Schubiger writes: In macro circumfix:(*...*) () is parsed(/.*?/ { } is the second enclosing part of the parsed parentheses omitted by intention? If not, I'd volunteer to provide a patch. Fixed. Thanks. Luke

Calling junctions of closures

2005-04-20 Thread Brad Bowman
Hi, Assuming this is allowed, what will the .() calls below return? Does the result depend on the calling context? use junctions; # still required? my @subs = ( sub { return 1 } , sub { return 2 } ); # call the closures in the junction any(@subs).(); all(@subs).();

Re: Calling junctions of closures

2005-04-20 Thread Thomas Sandlaß
Brad Bowman wrote: Assuming this is allowed, what will the .() calls below return? Does the result depend on the calling context? ... one(any(@subs),sub { ... }).(); Starting to argument from the statement that junctions are values the above plays in the league of 3.() which might not have

{ = } autocomposition

2005-04-20 Thread Autrijus Tang
In Pugs's t/pugsbugs/map_function_return_values.t, iblech added this test: %ret = map { $_ = uc $_ }, split , $text; This fails because it is parsed, undef the {=} autocomposition rule, into: # Fails because arg1 is not Code %ret = map(hash($_ = uc $_), split(, $text)); Instead of

embedding languages in Perl 6

2005-04-20 Thread BÁRTHÁZI András
Hi, I'm just wondering, if the following would be possible with Perl 6 or not? XML $a=elemselemContent #1/elemelemContent #2/elem/elems; say $a.elems[0].elem[1].content; # Content #1 for ($a.elems) { say $_.content; } or XPath like syntax on a structure? SQL $a=select * from table; for(select *

Re: { = } autocomposition

2005-04-20 Thread Ingo Blechschmidt
Hi, Autrijus Tang wrote: %ret = map { $_ = uc $_ }, split , $text; [...] I suppose my test is wrong. When I clicked on reply a moment ago, I wanted to propose to change the hash/code disambiguation rule, so that {...} is always parsed as Code if the body contains $_ or $^ But as this

Re: { = } autocomposition

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 05:08:53PM +0200, Ingo Blechschmidt wrote: : Hi, : : Autrijus Tang wrote: : %ret = map { $_ = uc $_ }, split , $text; : [...] : : I suppose my test is wrong. : : When I clicked on reply a moment ago, I wanted to propose to change the : hash/code disambiguation rule,

Re: { = } autocomposition

2005-04-20 Thread Autrijus Tang
On Wed, Apr 20, 2005 at 08:51:24AM -0700, Larry Wall wrote: That may look like an arbitrary amount of lookahead, but I tried to define the hash/closure rule in terms of a semantic analysis rule rather than a syntax rule, such that it's always parsed as a closure, but at some point in semantic

Re: embedding languages in Perl 6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 05:08:51PM +0200, BÁRTHÁZI András wrote: : Hi, : : I'm just wondering, if the following would be possible with Perl 6 or not? : : XML : : $a=elemselemContent #1/elemelemContent #2/elem/elems; : : say $a.elems[0].elem[1].content; # Content #1 : : for ($a.elems) { say

Re: { = } autocomposition

2005-04-20 Thread Larry Wall
On Thu, Apr 21, 2005 at 12:09:18AM +0800, Autrijus Tang wrote: : Adding a special form Parens that takes one Exp and simply returns : it is possible, but unless it serves to disambiguate other cases, : that approach seems more heavy-handed to me. As someone who is currently trying to write a

Re: { = } autocomposition

2005-04-20 Thread Autrijus Tang
On Wed, Apr 20, 2005 at 09:38:28AM -0700, Larry Wall wrote: As someone who is currently trying to write a perfect p5-to-p5 [sic] translator, you have to somehow remember the parens (and whitespace (and comments (and constant-folded subtrees))) to have a complete AST representation of the

Re: embedding languages in Perl 6

2005-04-20 Thread BÁRTHÁZI András
Hi, : I'm just wondering, if the following would be possible with Perl 6 or not? : : XML : : $a=elemselemContent #1/elemelemContent #2/elem/elems; : : say $a.elems[0].elem[1].content; # Content #1 : : for ($a.elems) { say $_.content; } : : or XPath like syntax on a structure? That's

Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Matt
Ok, I have 2 questions. 1. I know there is the xx operator for repeating strings. I also know you can use XX for repeating either closures, blocks, or subs; though I'm not sure which. Assuming you could use XX on a sub, how would you gather the results into an array? @names =

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Juerd
Matt skribis 2005-04-20 13:00 (-0400): 1. I know there is the xx operator for repeating strings. I also know you can use XX for repeating either closures, blocks, or subs; though I'm not sure which. Assuming you could use XX on a sub, how would you gather the results into an array?

Re: alarm() and later()

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 08:20:04AM +0200, Leopold Toetsch wrote: : I can't say anything about the actual Perl6 syntax, but Parrot provides : sub-second resolution as well as alarm callbacks and of course multiple : timers. We will certainly be pushing all the time interfaces of Perl 6 toward

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Juerd
Juerd skribis 2005-04-20 19:09 (+0200): I'm not sure the XX thing will happen, but if it does, it'd be most useful if it wouldn't treat a sub call differently. I forgot rationale. It shouldn't treat a sub call differently, so that a called sub can in a useful manner return a closure, which is

Re: { = } autocomposition

2005-04-20 Thread Larry Wall
On Thu, Apr 21, 2005 at 12:50:56AM +0800, Autrijus Tang wrote: : I see. Do you think preserving the /span/ (i.e. the character offset ranges) : of each AST element is enough to do that? That effectively means each : node points to a substring inside the original source string. Yes, though

Re: { = } autocomposition

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 10:21:32AM -0700, Larry Wall wrote: : Except that you've probably thrown away the definition of appropriate : by then as well. :-) Well, maybe not, since you presumably need to keep track of the current parser for eval. Larry

Re: embedding languages in Perl 6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 06:57:00PM +0200, BÁRTHÁZI András wrote: : It ends, when a non opened ')', a ';' or a '}' is coming. Of course, : that's not all cases, but it seems to be not so hard to find the all : possible cases. The question is what will be clear to the reader of the code. : We

Fwd: Re: embedding languages in Perl 6

2005-04-20 Thread Matt
I sent this to BÁRTHÁZI only instead of BÁRTHÁZI and the list as well. So here's a forward of what I sent and he replied to. --- Forwarded message --- From: Matt [EMAIL PROTECTED] To: BÁRTHÁZI András [EMAIL PROTECTED] Cc: Subject: Re: embedding languages in Perl 6 Date: Wed, 20 Apr

Re: { = } autocomposition

2005-04-20 Thread Autrijus Tang
On Wed, Apr 20, 2005 at 10:21:32AM -0700, Larry Wall wrote: On Thu, Apr 21, 2005 at 12:50:56AM +0800, Autrijus Tang wrote: : I see. Do you think preserving the /span/ (i.e. the character offset ranges) : of each AST element is enough to do that? That effectively means each : node points to

Re: Fwd: Re: embedding languages in Perl 6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 01:51:11PM -0400, Matt wrote: : If not already possible, it would be neat to be able to define your own : quote blocks. Such as being able to define how to parse the below lines: : : $result = q:sql/SELECT * FROM table/; : : for q:sql/SELECT * FROM table WHERE

Re: Fwd: Re: embedding languages in Perl 6

2005-04-20 Thread Juerd
Matt skribis 2005-04-20 13:51 (-0400): If not already possible, it would be neat to be able to define your own quote blocks. Such as being able to define how to parse the below lines: It is possible to create your own sql// if you want it. for q:sql/SELECT * FROM table WHERE id=$id/ {

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 07:17:14PM +0200, Juerd wrote: : Juerd skribis 2005-04-20 19:09 (+0200): : I'm not sure the XX thing will happen, but if it does, it'd be most : useful if it wouldn't treat a sub call differently. : : I forgot rationale. : : It shouldn't treat a sub call differently, so

Re: alarm() and later()

2005-04-20 Thread Gaal Yahas
On Wed, Apr 20, 2005 at 10:11:35AM -0700, Larry Wall wrote: We will certainly be pushing all the time interfaces of Perl 6 toward using floating-point time values. The only question is whether alarm() is the right name for one of the interfaces, and whether we even need an interface whose

Re: Fwd: Re: embedding languages in Perl 6

2005-04-20 Thread BÁRTHÁZI András
Hi, What is the benefit of this syntax over having a simple function that takes one argument, interpolating variables from CALLER::? for sql 'SELECT * FROM table WHERE id=$id' { ... } The difference is between compile time parsing and runtime parsing. This expression can be transformed to a

Re: Fwd: Re: embedding languages in Perl 6

2005-04-20 Thread Matt
On Wed, 20 Apr 2005 14:13:42 -0400, Larry Wall [EMAIL PROTECTED] wrote: Heredocs are variants on q:toSQLPROC these days, but if you're going to be mixing Perl and SQL syntax, it's probably better to dispense with the heredoc and just have a language variant so that you can parse it at compile

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Juerd
Larry Wall skribis 2005-04-20 11:25 (-0700): : It shouldn't treat a sub call differently, so that a called sub can in a : useful manner return a closure, which is then executed several times. : The same annoying special syntax can be found in perl 5's goto, that : can't go to a returned subref

Re: { = } autocomposition

2005-04-20 Thread Darren Duncan
At 10:38 PM +0800 4/20/05, Autrijus Tang wrote: In Pugs's t/pugsbugs/map_function_return_values.t, iblech added this test: %ret = map { $_ = uc $_ }, split , $text; This fails because it is parsed, undef the {=} autocomposition rule, into: # Fails because arg1 is not Code %ret =

Re: { = } autocomposition

2005-04-20 Thread Darren Duncan
At 8:43 PM +0200 4/20/05, Juerd wrote: Darren Duncan skribis 2005-04-20 11:40 (-0700): A clear way to disambiguate a block from a hash-ref when using map/grep/sort etc is to use a colon before the leading brace for a block rather than a space, like this: map:{ $_ = uc $_ } I think the best

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 07:17:14PM +0200, Juerd wrote: : Must LABEL be quoted/a normal string? Forgot to answer the more general question. Presuming we still have next LABEL; last LABEL; redo LABEL; goto LABEL; how do we parse something like this goto join , L, { rand 10 }

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 08:39:43PM +0200, Juerd wrote: : The same thing goes for all those places where a variable is expected : that begins with $, like foreach. You can't easily use an lvalue sub. : The workaround is like your goto workaround: : : for ${\thatsub()} (1..10) { ... } Yes, and

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Patrick R. Michaud
On Wed, Apr 20, 2005 at 12:00:22PM -0700, Larry Wall wrote: : Although admittedly, I only encountered this when playing with a : non-readonly undef ;) (This is something I can recommend to anyone: : redefining true, false and undef leads to very spectacular code, where : anything's possible,

Re: alarm() and later()

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 09:29:17PM +0300, Gaal Yahas wrote: : (FWIW, this is called signalProcess in Haskell.) Also in the FWIW department, I mislike mixed-case identifiers for anything in the core. That sort of things screams user-defined to me. To a lesser extent, I also tend to avoid

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 02:15:20PM -0500, Patrick R. Michaud wrote: : On Wed, Apr 20, 2005 at 12:00:22PM -0700, Larry Wall wrote: : : Although admittedly, I only encountered this when playing with a : : non-readonly undef ;) (This is something I can recommend to anyone: : : redefining true,

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Aaron Sherman
On Wed, 2005-04-20 at 15:15, Patrick R. Michaud wrote: On Wed, Apr 20, 2005 at 12:00:22PM -0700, Larry Wall wrote: Perl 6 culture might feebly try to discourage the redefinition of truth. Hmm, and here I was thinking that the culture was rapidly evolving towards There Is More Than One Way

Re: How do I... tie hashes/arrays?

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 08:39:02AM +0200, Leopold Toetsch wrote: : Larry Wall [EMAIL PROTECTED] wrote: : On Tue, Apr 19, 2005 at 02:02:41PM +, Ingo Blechschmidt wrote: : : : # Possibility #2 : : multi sub *postcircumfix:'[', ']'(TiedArray $self, $index) { : : # Body as above :

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 03:35:13PM -0400, Aaron Sherman wrote: : On Wed, 2005-04-20 at 15:15, Patrick R. Michaud wrote: : On Wed, Apr 20, 2005 at 12:00:22PM -0700, Larry Wall wrote: : : Perl 6 culture might feebly try to discourage the redefinition of truth. : : Hmm, and here I was thinking

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Juerd
Larry Wall skribis 2005-04-20 11:54 (-0700): goto(join , L, { rand 10 } XX rand 10); By the way -- Does this mean the XX operator is official now? And what about X? It'd let you write the same thing without the join: goto(L ~ { rand 10 } X rand 10) Juerd --

$?OS globals, etc.

2005-04-20 Thread Scott McWhirter
Hi, I've not been keeping very up to date in recent times of how this stuff is working. I've been noticing the use of these variables within pugs and have a slight suggestion. Currently there is rather limited abstraction with these items (as far as I am aware) and while they are usable and

Quick question: parens vs subroutine parameter

2005-04-20 Thread Autrijus Tang
So, following up on the Parens handling, are these two equivalent? # Assuming is has the parameter signature (Str, Str, Str) is((1,2), (3,4), hey); is([1,2], [3,4], hey); What happens if is is of type (Any, Any, Str)? Thanks, /Autrijus/ pgp0OW38SoE0X.pgp Description: PGP signature

Re: Quick question: parens vs subroutine parameter

2005-04-20 Thread Juerd
Autrijus Tang skribis 2005-04-21 4:19 (+0800): So, following up on the Parens handling, are these two equivalent? # Assuming is has the parameter signature (Str, Str, Str) is((1,2), (3,4), hey); is([1,2], [3,4], hey); I think so. What happens if is is of type (Any, Any, Str)?

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 09:45:08PM +0200, Juerd wrote: : Larry Wall skribis 2005-04-20 11:54 (-0700): : goto(join , L, { rand 10 } XX rand 10); : : By the way -- Does this mean the XX operator is official now? No. I just threw that in to see if anyone was awake. : And what about X? It'd

Re: Quick question: parens vs subroutine parameter

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 10:23:14PM +0200, Juerd wrote: : Autrijus Tang skribis 2005-04-21 4:19 (+0800): : So, following up on the Parens handling, are these two equivalent? : # Assuming is has the parameter signature (Str, Str, Str) : is((1,2), (3,4), hey); : is([1,2], [3,4],

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Matt Creenan
On Wed, 20 Apr 2005 13:00:01 -0400, Matt [EMAIL PROTECTED] wrote: 2. Is anyone working on making a Win32 module for Perl6 yet, or porting over the p5 one? If not, I may be willing to make one, along with some help from friends. If I do, does anyone have any pointers or suggestions for me

Re: $?OS globals, etc.

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 08:45:02PM +0100, Scott McWhirter wrote: : Hi, : : I've not been keeping very up to date in recent times of how this stuff : is working. I've been noticing the use of these variables within pugs : and have a slight suggestion. : : Currently there is rather limited

Re: Closure/block/sub multiplier /// Win32 module for Perl6

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 04:50:38PM -0400, Matt Creenan wrote: : To expand on this... : : How will you be able to access shared libraries with native code, such as : DLLs on windows? Is there a way to do this proposed for Perl6 yet? Already implemented in Parrot under the name NCI. : If so,

Re: $?OS globals, etc.

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 08:45:02PM +0100, Scott McWhirter wrote: : Why would this be useful? Why should anyone care? Well, a real world : example would be if I wished to find out through a large codebase to : locate all the areas within the codebase that are calling $?OS. To do : this, I would

[PATCH] Re: apo/A06.pod: spelling error(s)?

2005-04-20 Thread Steven Philip Schubiger
On 20 Apr, Luke Palmer wrote: : Steven Philip Schubiger writes: : In : macro circumfix:(*...*) () is parsed(/.*?/ { } : : is the second enclosing part of the parsed parentheses omitted : by intention? If not, I'd volunteer to provide a patch. : : Fixed. Thanks. : : Luke You missed some.

Inline code (was: Closure/block/sub multiplier)

2005-04-20 Thread Autrijus Tang
On Wed, Apr 20, 2005 at 04:50:38PM -0400, Matt Creenan wrote: To expand on this... How will you be able to access shared libraries with native code, such as DLLs on windows? Is there a way to do this proposed for Perl6 yet? If so, is it possible in PUGS? It is possible in Pugs's

Re: Inline code (was: Closure/block/sub multiplier)

2005-04-20 Thread Larry Wall
On Thu, Apr 21, 2005 at 05:31:05AM +0800, Autrijus Tang wrote: : Bringing the topic back to perl6-language, I'd like to inquire : how eval and inlining other languages works. Here's some thoughts: : : eval('printf(Hello!)', :languageC); : eval(:C('printf(Hello!)')); : : inline C =

Re: Inline code (was: Closure/block/sub multiplier)

2005-04-20 Thread Juerd
Autrijus Tang skribis 2005-04-21 5:31 (+0800): Bringing the topic back to perl6-language, I'd like to inquire how eval and inlining other languages works. Here's some thoughts: eval('printf(Hello!)', :languageC); Is that comma needed? eval(:C('printf(Hello!)')); Strange use of a

Re: Quick question: parens vs subroutine parameter

2005-04-20 Thread Juerd
Autrijus asked me to summarize here what I said on IRC #perl6, and ask Larry for another that's all correct. I've rephrased everything as facts/assumptions. Array context, as provided by a signature of Array $foo, is still a form of scalar context, even though Array.isa(List). Array is a

Re: alarm() and later()

2005-04-20 Thread Uri Guttman
GY == Gaal Yahas [EMAIL PROTECTED] writes: sub alarm ($secs) { { sendsignal $*PID, Signal::ALARM }.cue(:delay($secs)); } Though I suppose people really mostly just want something like sub alarm ($secs) { { sendsignal $*PID, Signal::ALARM }.delay($secs); } The

Re: Quick question: parens vs subroutine parameter

2005-04-20 Thread Larry Wall
On Wed, Apr 20, 2005 at 11:28:23PM +0200, Juerd wrote: : Autrijus asked me to summarize here what I said on IRC #perl6, and ask : Larry for another that's all correct. : : I've rephrased everything as facts/assumptions. : : Array context, as provided by a signature of Array $foo, is still : a

Re: [PATCH] Re: apo/A06.pod: spelling error(s)?

2005-04-20 Thread Patrick R. Michaud
On Wed, Apr 20, 2005 at 08:13:20PM +0200, Steven Philip Schubiger wrote: On 20 Apr, Luke Palmer wrote: : Steven Philip Schubiger writes: : In : macro circumfix:(*...*) () is parsed(/.*?/ { } : : is the second enclosing part of the parsed parentheses omitted : by intention? If not, I'd

Re: Inline code (was: Closure/block/sub multiplier)

2005-04-20 Thread Luke Palmer
Juerd writes: It'd be fun to have a different spelling for comma (here I assume that leading comma is ignored and that because of the special new leading keyword, non-slurpy can come after slurpy), for example: multi eval ($code, using ?$lang) { eval($code, :lang($lang)) } eval