Re: [svn:parrot] r30123 - in trunk: src src/ops src/pmc t/op
On Thursday 07 August 2008 23:50:54 [EMAIL PROTECTED] wrote: Add a return continuation attribute to the Exception pmc and fill it in the throw opcode. Modified: trunk/src/ops/core.ops === === --- trunk/src/ops/core.ops (original) +++ trunk/src/ops/core.ops Thu Aug 7 23:50:53 2008 @@ -816,7 +816,9 @@ inline op throw(invar PMC) :flow { opcode_t * const ret = expr NEXT(); - opcode_t * const dest = Parrot_ex_throw_from_op(interp, $1, ret); + Parrot_cont * resume = new_ret_continuation_pmc(interp,ret); + VTABLE_set_attr_str(interp,$1,string_from_literal(interp,retcont),resume ); That should be const_string( ... ). Normally it would be CONST_STRING( ... ), but we don't have that working in .ops files yet (though I realize that would be reasonably easy to add). -- c
Re: windows XP copyfile
Seek the wisdom of the Perl Monks at www.perlmonks.org. Short answer: http://perldoc.perl.org/functions/-X.html -M gives the file age. --John Tara taralish-at-yahoo.com |Perl 6| wrote: I'm trying to do a Perl script (PC has Perl5 installed) in a BAT file which will open the CMD prompt, interact with the user and copy files from one location to other directories. Does anyone know how to dir the files in a directory into an array and sort by date and return the ones within the past week? So far I have this code and it returns all the files: @files = `dir`; chomp (@files); print $#files \n; if ( @files =~ /[Qq]/ ) { exit 0; } if ( @files =~ /xml$/ ) { print Recently added XML files: $files \n; printf COPYLOG Recently added XML files: @files \n; $type = xml; } elsif ( @files =~ /tc$/ ) { print You are copying an expected result file \n ; printf COPYLOG You are copying an expected result file \n ; $type = tc; } else { print Invalid file type or @files doesn't exist in current directory\n ; printf COPYLOG Invalid file type or @files doesn't exist in current directory\n ; $type = bad; }
Re: new article, A Romp Through Infinity
Xavier Noria fxn-at-hashref.com |Perl 6| wrote: IMO to include something related to infinity you need to stick with some particular model and forget the rest. I couldn't have said it any better.
Re: new article, A Romp Through Infinity
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: Could we get confirmation for that from @Larry. I remember $Larry mentioning that Num fails over to Rat or so when necessary. IOW, does my Rat $rat = 1/3; # assuming infix:/ returns a Rat my Num $num = 1/3; my Rat $diff = abs($rat - $num); store a non-zero value in $diff? I assume that Num is discrete with a binary representation and infix:-:(Rat,Num--Rat) converts $num to a fraction with a power of two in the denominator. BTW, with floor semantics I would expect $num $rat. I've not seen any detailed design for how those types interact. Whichever direction is the promotion, the two values are unequal.
Re: new article, A Romp Through Infinity
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, [EMAIL PROTECTED] wrote: Let's just make sure we're handling inf and -inf right and leave all that other stuff until later. The point is: what is the minimum we need to be future proof and compatible to other language features. Regards, TSa. So why don't you try designing a module that provides one of these other models, and see if it runs into trouble stepping on the proposed built-ins or runs into problems being upward compatible with the basic. --John
Re: Humorous but serious article
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, John M. Dlugosz wrote: See my latest creation at http://www.dlugosz.com/Perl6/web/APL.html Nice write-up! You say that there's no syntax for refering to a multi as a whole. But is that not simply the short name? E.g. infix:+ is the multi of all targets in a scope. You need infix:+:(Int,Int) to refer to a single target. Regards, TSa. I think that should be the case: have the unqualified form still return a Routine. But it's not clear from the Synopses that this is allowed, and it does open up other questions that need to be fleshed out about the semantics. So I'm making the point that we should go to the trouble of fleshing it out rather than saying don't do that. --John
[perl #56748] [BUG] Null PMC access in type()
On Wed Jul 09 10:48:19 2008, [EMAIL PROTECTED] wrote: I found a small piece of code that reproduces the Null PMC access in type() error: sub f(Int $n){ if ($n = 0 ){ f($n-1); } } f(0); produces the above error on parrot + rakudo r29207, Debian GNU Linux i386 32bit. I fixed a while ago the bug that prevented us seeing the real exception. Today I have fixed the root cause of this, which was the type check failure. So this now runs as it should (I stuck a say $n in and tried it with f(4) and so forth, and it works as expected). Thanks, Jonathan
[perl #56944] [BUG] integer arithmtics should result in integers
On Tue Jul 15 04:12:36 2008, [EMAIL PROTECTED] wrote: Rakudo r29470: $ ../../parrot perl6.pbc -e 'say (1+1).WHAT' Num $ ../../parrot perl6.pbc -e 'say (1*1).WHAT' Num $ ../../parrot perl6.pbc -e 'say (1**1).WHAT' Num All of these should print Int instead. And they do as of r30092. Thanks! Jonathan
Re: new article, A Romp Through Infinity
On Thu, Aug 7, 2008 at 11:29 AM, [EMAIL PROTECTED] wrote: Supporting multiple levels of infinities, transfinite numbers or even Surreal Numbers should be considered in the same category of features as returning multiple answers from complex trig functions. They're an interesting thing to discuss and experiment with but shouldn't distract form getting Perl 6 out the door. Let's just make sure we're handling inf and -inf right and leave all that other stuff until later. +1 -- Mark Biggar [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] -- Will Coke Coleda
[perl #54736] error on winxp with perl6.exe 0.6.2
Hi, On Fri May 23 14:26:47 2008, [EMAIL PROTECTED] wrote: a simple say 6; throws Null PMC access in isa() current instr.: 'parrot;Perl6Object;make_proto' pc 58 (src/gen_builtins.pir:81) called from Sub 'parrot;Perl6Str;onload' pc 1181 (src/gen_builtins.pir:804) called from Sub 'parrot;Perl6::Compiler;main' pc -1 ((unknown file):-1) This bug dates back to 0.6.2 - can you give it another try now and see if this problem is gone? Thanks! Jonathan
[perl #57722] Substr with negative start and length gives different results from perl5
# New Ticket Created by Ron Schmidt # Please include the string: [perl #57722] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57722 Index: src/builtins/any-str.pir === --- src/builtins/any-str.pir(revision 30090) +++ src/builtins/any-str.pir(working copy) @@ -89,8 +89,10 @@ len = self.'chars'() have_len: if len = 0 goto len_done +if start 0 goto neg_start $I0 = self.'chars'() len += $I0 + neg_start: len -= start len_done: $S0 = self Index: t/spec/S29-str/substr.t === --- t/spec/S29-str/substr.t (revision 21834) +++ t/spec/S29-str/substr.t (working copy) @@ -2,7 +2,7 @@ use Test; -plan 42; +plan 43; # LS29/Str/=item substr @@ -24,6 +24,7 @@ is(substr($str, 0, -2), foob, from beginning, with negative length); is(substr($str, 2, -2), ob, in middle, with negative length); is(substr($str, 3, -3), , negative length - gives empty string); +is(substr($str, -4, -1), oba, negative start and length ); is($str, foobar, original string still not changed); }; From the irc log for today (8/7) 15:50 /perl6/2008-08-07#i_426959 ron perl6: my $a = '0123456'; say substr($a, -5, -2); 15:50 /perl6/2008-08-07#i_426960 p6eval elf 21826, pugs: OUTPUT[234?] 15:50 /perl6/2008-08-07#i_426961 ..rakudo 29834: OUTPUT[23456?] perl5 agrees with the pugs output. Attached patch fixes the problem and includes a test in: S29-str/substr.t Ron
[perl #56014] bug in spectest_regression
On Sun Jun 29 14:06:44 2008, pmichaud wrote: On Wed Jun 18 09:38:09 2008, [EMAIL PROTECTED] wrote: A test in spectest_regression failed, It was in S02-polymorphic_types: I'm running on Win32 (XP SP2), parrot/perl6 was built with Visual Studio 9 Express and Activestate 5.8 Output is below: t\spec\S02-polymorphic_types\subset-code...ok t\spec\S02-polymorphic_types\subset-range..ok 5/6set_pmc_keyed_str() not impleme nted in class 'Key' current instr.: 'eval_dies_ok' pc 1623 (EVAL_18:648) called from Sub '_block11' pc 151 (EVAL_12:43) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src\PCT\HLLCompiler.pir:4 81) called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1088 (src\PCT\HLLCompiler .pir:610) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1267 (src\PCT\HLLCompi ler.pir:699) called from Sub 'parrot;Perl6::Compiler;main' pc 11945 (perl6.pir:173) t\spec\S02-polymorphic_types\subset-range..dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 6 Charlie Could you perhaps try again with an updated version of Rakudo Perl? I'm thinking this bug may have been resolved but don't have an easy way to check under the environment you're running. I'm on WinXP and using the MSVC++ compiler and the ActiveState Perl 5.8, and don't see this issue. If there's no followup on this for the next week or so I suggest we assume this is resolved and close it. Thanks, Jonathan
[perl #56618] [BUG] rakudo segfaults calling subs in a module
On Sun Jul 06 10:13:15 2008, jhorwitz wrote: excellent, this fixes my problem. do we want to close out this ticket and let RT #47956 handle the rest, or are there still some lingering issues to address with :instanceof? Maybe, but we're not using it for the moment and there's some larger design discussions to be had around this stuff. So I think we can close this ticket now the issue it reports is resolved, and any :instanceof issues can have tickets of their own. Thanks, Jonathan
[perl #57388] Namespaces don't work in class declarations
On Tue Jul 29 11:27:34 2008, [EMAIL PROTECTED] wrote: Hi there, declaring classes in other namespaces except the toplevel one results in emtpy classes (revision 29850). This code: class Foo::Bar { method foo {} } my $b = Foo::Bar.new; $b.foo; Gives this stacktrace Method 'foo' not found for invocant of class 'Foo::Bar' Thanks for reporting; this is resolved in r30105. Jonathan
[perl #57740] Dotty method calls confuse rakudo's MMD mechanism
# New Ticket Created by Carl Mäsak # Please include the string: [perl #57740] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57740 r30120: $ ./perl6 -e 'my $s = hi; $s = $s.uc' # works $ ./perl6 -e 'my $s = hi; $s.=uc' # oughta MMD function __concatenate not found for types (160, -98) [...] Segmentation fault The segfault only occurs when running ./perl6, not when running ../../parrot perl6.pbc.
Re: windows XP copyfile
On Thu, Aug 7, 2008 at 9:38 AM, Tara [EMAIL PROTECTED] wrote: I'm trying to do a Perl script (PC has Perl5 installed) in a BAT file which will open the CMD prompt, interact with the user and copy files from one location to other directories. Does anyone know how to dir the files in a directory into an array and sort by date and return the ones within the past week? So far I have this code and it returns all the files: @files = `dir`; chomp (@files); print $#files \n; if ( @files =~ /[Qq]/ ) { exit 0; } if ( @files =~ /xml$/ ) { print Recently added XML files: $files \n; printf COPYLOG Recently added XML files: @files \n; $type = xml; } elsif ( @files =~ /tc$/ ) { print You are copying an expected result file \n ; printf COPYLOG You are copying an expected result file \n ; $type = tc; } else { print Invalid file type or @files doesn't exist in current directory\n ; printf COPYLOG Invalid file type or @files doesn't exist in current directory\n ; $type = bad; } Apologies, but this list is for the discussion about the next generation of perl (perl 6). For help with the current version (perl 5), I'd recommend starting at http://www.perl.org/ and looking through the online documentation and the various community links. That said, I'd recommend taking a look at the output of the command perldoc find2perl Regards. -- Will Coke Coleda
Re: Catching exceptions with the // operator
Thank you very much! my $bill = try ack() orelse try thpp() orelse do ppt(); This certainly does what I asked for, and it's short enough (even if we need to add a few brackets). Yes, the basic problem with the proposal is that it catches all exceptions willy nilly and uses them all for control flow whether that is appropriate or not. I have some sympathy with the proposal, however, because I'm currently using exceptions for just that purpose in the STD grammar. But it's suffering from the same difficulty, and I have to be careful to rethrow if the exception I trapped wasn't the one I expected. ... It might also be useful to have a try variant that only catches exceptions intended as benign failure to match. Or maybe try should have a way of indicating the severity of exception it wishes to trap by default. This could be a keyword variant, or an adverb, or a pragma. I'm thinking the pragma is most likely to distribute syntactic relief nicely over a lexical scope. In any case it would only set the default CATCH handler which could still be overridden in any particular try block. ... Larry I believe that ---from a usability point of view--- it's very important to: * classify exceptions by severity or other characteristics, * provide named adverbs/pragmas to modify default CATCH handlers, * make them configurable by outer scopes. Without such conventions (e.g. with just catching individually named exception classes), the programmer of a function often cannot reasonably know what exceptions he should catch and how he should handle them. There are two reasons for this and here are two examples. The first reason is: The programmer isn't supposed to know all exceptions that can be thrown by sub-routines. Otherwise, you can't add a new feature to a library function (and introduce a new exception with it) without breaking the error handling of all code that uses this library function. Also, some general functions (e.g. macro/template-expanders) can include an unspecified set of extension modules and hence can't know all the exceptions that will be needed for these extensions. This problem can be solved by grouping exceptions into meaningful groups and catching groups, not individual exceptions. For example, there are quite a lot of situations where a function cannot produce an expected result (e.g. read_file($non_existing_file)). Such exceptions just say that you can't rely on any results that depend on the output of this function. These exceptions should be catched by //. A different group of exceptions is where the user wants to terminate a computation (e.g. CTRL-C//HUP). The second problem goes into the opposite direction: Even if you have well-defined exception groups, you cannot always know how they should be handled. Take, for example, a macro processor (like LaTeX) used for typesetting a book and an exception that indicates that some required information (e.g. a reference) is not available. Should this exception be catched and a placeholder be included --- or should this exception be fatal for this job? The answer is: during proofreading, this should produce a warning and a readable result. In production scripts (process and print a few million books), this needs to be fatal. Of course, the programmer of the macro processor cannot decide whether the processor is used in proofreading or in production code. This decision must be made upstream, by callers of the processor. The same problem is: should attempts to access protected files be fatal security alerts or just missing values? This problem can be resolved by having configurable CATCH handlers that are defined by the callers of a function and only referred to by name. So, we may have three separate programmers that are responsible for separate decisions: The programmer of a low-level function or extension module throws exceptions and classifies them into meaningful severity groups. The programmer of the top-level function defines the severity of particular exception groups for this specific application by defining named CATCH handlers. The middle-ware programmer doesn't have the responsibilities of the low-level or top-level programmers, and can't make decisions for them. He just uses the appropriate named CATCH handler to do the right thing. And if we really go so far, we can have standard names for two CATCH handlers: CATCH:// and CATCH:orelse. The operators can catch the corresponding exceptions --- leaving the specification of which exceptions to handle to the programmer.
[perl #57340] Empty {} or pair {1=2} does not create anonymous hash in rakudo
On Sun Jul 27 08:27:18 2008, masak wrote: From S06 http://dev.perl.org/perl6/doc/design/syn/S06.html: ] {...} is always a block. However, if it is completely empty or consists ] of a single list, the first element of which is either a hash or a pair, it ] is executed immediately to compose a Hash object. ] ] [...] ] ] $obj = { 1=2, 3=4, 5=6 }; # Anonymous hash Rakudo is not up to spec on this point: $ ./perl6 -e 'my $a = { 1 = 2 }; say $a1' get_pmc_keyed() not implemented in class 'Closure' This and the other cases that are mentioned in the bit of spec you quoted are implemented as of r30104. Thanks, Jonathan
compile error Win32/MSVC in src/ops/core.ops
Wasn't able to build parrot for smoke testing. This was using the MS Visual C++ compiler. src\ops\core_ops.c src\ops\core.ops(821) : error C2275: 'opcode_t' : illegal use of this type as an expression C:\work\parrot\include\parrot/config.h(128) : see declaration of 'opcode _t' src\ops\core.ops(821) : error C2059: syntax error : 'const' src\ops\core.ops(822) : error C2065: 'dest' : undeclared identifier src\ops\core.ops(825) : error C2143: syntax error : missing '{' before '*' src\ops\core.ops(826) : warning C4431: missing type specifier - int assumed. Not e: C no longer supports default-int src\ops\core.ops(826) : warning C4142: benign redefinition of type src\ops\core.ops(827) : warning C4057: 'return' : 'int *' differs in indirection to slightly different base types from 'opcode_t *' NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0x2' Stop. C:\work\parrotsvn info Path: . URL: https://svn.perl.org/parrot/trunk Repository Root: https://svn.perl.org/parrot Repository UUID: d31e2699-5ff4-0310-a27c-f18f2fbe73fe Revision: 30128 Node Kind: directory Schedule: normal Last Changed Author: julianalbo Last Changed Rev: 30128 Last Changed Date: 2008-08-08 07:59:17 -0400 (Fri, 08 Aug 2008) --- tjh
Re: [svn:parrot] r30123 - in trunk: src src/ops src/pmc t/op
On Fri, Aug 8, 2008 at 9:12 AM, chromatic [EMAIL PROTECTED] wrote: On Thursday 07 August 2008 23:50:54 [EMAIL PROTECTED] wrote: Add a return continuation attribute to the Exception pmc and fill it in the throw opcode. Modified: trunk/src/ops/core.ops === === --- trunk/src/ops/core.ops (original) +++ trunk/src/ops/core.ops Thu Aug 7 23:50:53 2008 @@ -816,7 +816,9 @@ inline op throw(invar PMC) :flow { opcode_t * const ret = expr NEXT(); -opcode_t * const dest = Parrot_ex_throw_from_op(interp, $1, ret); +Parrot_cont * resume = new_ret_continuation_pmc(interp,ret); + VTABLE_set_attr_str(interp,$1,string_from_literal(interp,retcont),resume ); That should be const_string( ... ). Normally it would be CONST_STRING( ... ), but we don't have that working in .ops files yet (though I realize that would be reasonably easy to add). resume must be a PMC * for coherence with the type returned from new_ret_continuation_pmc and the argument taken by Parrot_ex_throw_from_op. Fixed in r30128 -- Salu2
Re: compile error Win32/MSVC in src/ops/core.ops
On Fri, Aug 8, 2008 at 2:16 PM, Tim Heckman [EMAIL PROTECTED] wrote: Wasn't able to build parrot for smoke testing. This was using the MS Visual C++ compiler. src\ops\core_ops.c src\ops\core.ops(821) : error C2275: 'opcode_t' : illegal use of this type as an expression Please try again with r30129 -- Salu2
Some details of function return captures
I was trying to figure out exactly how Captures manage to stay invisible even though functions return them, yet still let you use Capture objects when you want to. Please see my conclusions at http://www.dlugosz.com/Perl6/web/return.html. The Summary at the very bottom clarifies the Synopses. --John
Re: new article, A Romp Through Infinity
On Thu, Aug 7, 2008 at 11:31 AM, Will Coleda [EMAIL PROTECTED] wrote: On Thu, Aug 7, 2008 at 11:29 AM, [EMAIL PROTECTED] wrote: Supporting multiple levels of infinities, transfinite numbers or even Surreal Numbers should be considered in the same category of features as returning multiple answers from complex trig functions. They're an interesting thing to discuss and experiment with but shouldn't distract form getting Perl 6 out the door. Let's just make sure we're handling inf and -inf right and leave all that other stuff until later. +1 Agreed. Let's not fall into the trap of thinking that because a general-purpose programming language necessarily does arithmetic, it is also a domain-specific language for mathematics. I agree that we should try not to make it too hard to layer such language into Perl6, but I see no point in bending over backwards to make it particularly easy compared to other domain-specific languages... -- Mark J. Reed [EMAIL PROTECTED]
[svn:perl6-synopsis] r14573 - doc/trunk/design/syn
Author: larry Date: Fri Aug 8 07:59:12 2008 New Revision: 14573 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S06.pod doc/trunk/design/syn/S13.pod Log: clarify that foo is a real function even when representing a multiple dispatch s/q:code/quasi/ Modified: doc/trunk/design/syn/S02.pod == --- doc/trunk/design/syn/S02.pod(original) +++ doc/trunk/design/syn/S02.podFri Aug 8 07:59:12 2008 @@ -12,9 +12,9 @@ Maintainer: Larry Wall [EMAIL PROTECTED] Date: 10 Aug 2004 - Last Modified: 5 Aug 2008 + Last Modified: 8 Aug 2008 Number: 2 - Version: 134 + Version: 135 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1503,9 +1503,11 @@ =item * -With multiple dispatch, Cfoo may not be sufficient to uniquely name a -specific function. In that case, the type may be refined by using a -signature literal as a postfix operator: +With multiple dispatch, Cfoo may actually be the name of a set +of candidate functions (which you can use as if it were an ordinary function). +However, in that case Cfoo by itself is not be sufficient to uniquely +name a specific function. To do that, the type may be refined by +using a signature literal as a postfix operator: foo:(Int,Num) @@ -2455,7 +2457,7 @@ macro qx { 'qq:x ' } # equivalent to P5's qx// macro qTO { 'qq:x:w:to ' }# qq:x:w:to// -macro quote:❰ ❱ ($text) { q:code{ $text.quoteharder } } +macro quote:❰ ❱ ($text) { quasi { $text.quoteharder } } All the uppercase adverbs are reserved for user-defined quotes. All Unicode delimiters above Latin-1 are reserved for user-defined quotes. Modified: doc/trunk/design/syn/S06.pod == --- doc/trunk/design/syn/S06.pod(original) +++ doc/trunk/design/syn/S06.podFri Aug 8 07:59:12 2008 @@ -2490,10 +2490,10 @@ =head2 Quasiquoting In aid of returning syntax tree, Perl provides a quasiquoting -mechanism using the quote Cq:code, followed by a block intended to +mechanism using the quote Cquasi, followed by a block intended to represent an AST: -return q:code { say foo }; +return quasi { say foo }; Modifiers to the C:code adverb can modify the operation: @@ -2508,7 +2508,7 @@ To make a symbol resolve to the (partially compiled) scope of the macro call, use the CCOMPILING:: pseudo-package: -macro moose () { q:code { $COMPILING::x } } +macro moose () { quasi { $COMPILING::x } } moose(); # macro-call-time error my $x; @@ -2545,15 +2545,15 @@ unquoted expression of either type within a quasiquote, use the quasiquote delimiter tripled, typically a bracketing quote of some sort: -return q:code { say $a + {{{ $ast }}} } -return q:code [ say $a + [[[ $ast ]]] ] -return q:code say $a + $ast -return q:code ( say $a + ((( $ast ))) ) +return quasi { say $a + {{{ $ast }}} } +return quasi [ say $a + [[[ $ast ]]] ] +return quasi say $a + $ast +return quasi ( say $a + ((( $ast ))) ) The delimiters don't have to be bracketing quotes, but the following is probably to be construed as Bad Style: -return q:code / say $a + /// $ast /// / +return quasi / say $a + /// $ast /// / (Note to implementors: this must not be implemented by finding the final closing delimiter and preprocessing, or we'll violate our @@ -2588,17 +2588,17 @@ the text determines subsequent expectations.) Quasiquotes default to hygienic lexical scoping, just like closures. -The visibility of lexical variables is limited to the q:code expression +The visibility of lexical variables is limited to the quasi expression by default. A variable declaration can be made externally visible using the CCOMPILING:: pseudo-package. Individual variables can be made visible, or all top-level variable declarations can be exposed using the -Cq:code(:COMPILING) form. +Cquasi :COMPILING form. Both examples below will add C$new_variable to the lexical scope of the macro call: - q:code { my $COMPILING::new_variable; my $private_var; ... } - q:code(:COMPILING) { my $new_variable; { my $private_var; ... } } + quasi { my $COMPILING::new_variable; my $private_var; ... } + quasi :COMPILING { my $new_variable; { my $private_var; ... } } (Note that C:COMPILING has additional effects described in LMacros.) Modified: doc/trunk/design/syn/S13.pod == --- doc/trunk/design/syn/S13.pod(original) +++ doc/trunk/design/syn/S13.podFri Aug 8 07:59:12 2008 @@ -233,6 +233,4 @@ $someclass = generate_class(); $someclass($x); -=cut - =for vim:set expandtab sw=4:
Re: Some details of function return captures
HaloO John M. Dlugosz wrote: I was trying to figure out exactly how Captures manage to stay invisible even though functions return them, yet still let you use Capture objects when you want to. Please see my conclusions at http://www.dlugosz.com/Perl6/web/return.html. The Summary at the very bottom clarifies the Synopses. I like the concept of auto-collapsing ReturnCaptures. It reminds me to my idea of an AssignmentProxy as discussed in assignable mutators (S06/Lvalue subroutines). If such a ReturnCapture could also be preliminary of some kind, then lvalue subs could be lazily resumed when the rvalue comes in. Also infix:/ needs a lazy item that is collapsed into Int, Num or Rat depending on the constraint of the container it ends up in eventually. An Any gets the Rat. Hmm, and a Str perhaps the two constituting Ints as fraction put into lowest terms? Regards, TSa. -- The unavoidable price of reliability is simplicity -- C.A.R. Hoare Simplicity does not precede complexity, but follows it. -- A.J. Perlis 1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan
Re: Catching exceptions with the // operator
HaloO, Yaakov Belch wrote: I believe that ---from a usability point of view--- it's very important to: * classify exceptions by severity or other characteristics, * provide named adverbs/pragmas to modify default CATCH handlers, * make them configurable by outer scopes. [..] The programmer of the top-level function defines the severity of particular exception groups for this specific application by defining named CATCH handlers. I want to propose---possibly again ;)---to use the dispatch semantics for this purpose. The idea is that CATCH blocks can be made into multis first of all with the multi keyword or with a proto which then makes inner CATCH blocks also multi unless they are explicitly declared only. Generally speaking I find multiple CATCH blocks with a signature better than a big switch inside a single one. Such a CATCH without signature would be good for low-level handling, though. It has implicit signature :(Any) and is easily overridden from outer scopes. The grouping comes naturally since packages are recognized as type names. So we can have proto CATCH {...} # force multi { multi CATCH (Math::DivZero) {...} { multi CATCH (Math) {...} multi CATCH (Math::Overflow) {...} # more specific # outer catch seen here as well { CATCH { when Math {...} # never called } } } } And if we really go so far, we can have standard names for two CATCH handlers: CATCH:// and CATCH:orelse. So with CATCH a magic namespace these would be CATCH::// and CATCH::orelse respectively. Using the namespace is another approach. But to me it doesn't feel as natural as the exception type approach. Regards, TSa. -- The unavoidable price of reliability is simplicity -- C.A.R. Hoare Simplicity does not precede complexity, but follows it. -- A.J. Perlis 1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan
Re: [svn:perl6-synopsis] r14573 - doc/trunk/design/syn
On 2008 Aug 8, at 10:59, [EMAIL PROTECTED] wrote: Modified: doc/trunk/design/syn/S06.pod = = = = = = = = == --- doc/trunk/design/syn/S06.pod(original) +++ doc/trunk/design/syn/S06.podFri Aug 8 07:59:12 2008 @@ -2490,10 +2490,10 @@ =head2 Quasiquoting In aid of returning syntax tree, Perl provides a quasiquoting -mechanism using the quote Cq:code, followed by a block intended to +mechanism using the quote Cquasi, followed by a block intended to represent an AST: -return q:code { say foo }; +return quasi { say foo }; Modifiers to the C:code adverb can modify the operation: Is that last now the quasi adjective? -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH
[svn:perl6-synopsis] r14574 - doc/trunk/design/syn
Author: larry Date: Fri Aug 8 10:34:49 2008 New Revision: 14574 Modified: doc/trunk/design/syn/S02.pod Log: allow isolated ' and - in identifiers (only if followed by alpha) Modified: doc/trunk/design/syn/S02.pod == --- doc/trunk/design/syn/S02.pod(original) +++ doc/trunk/design/syn/S02.podFri Aug 8 10:34:49 2008 @@ -14,7 +14,7 @@ Date: 10 Aug 2004 Last Modified: 8 Aug 2008 Number: 2 - Version: 135 + Version: 136 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1589,7 +1589,8 @@ An Iidentifier is composed of an alphabetic character followed by any sequence of alphanumeric characters. The definitions of alphabetic and numeric include appropriate Unicode characters. Underscore is -always considered alphabetic. +always considered alphabetic. An identifier may also contain isolated +apostrophes or hyphens provided the next character is alphabetic. A Iname is anything that is a legal part of a variable name (not counting the sigil). This includes
Re: [svn:perl6-synopsis] r14574 - doc/trunk/design/syn
On Fri, Aug 08, 2008 at 10:34:50AM -0700, [EMAIL PROTECTED] wrote: : Author: larry : Date: Fri Aug 8 10:34:49 2008 : New Revision: 14574 : : Modified: :doc/trunk/design/syn/S02.pod : : Log: : allow isolated ' and - in identifiers (only if followed by alpha) Darn the syntax highlighers, full speed ahead! :) I should point out that this change only caused two failures in the entire test suite, both of which were easily caught as syntax errors. (The main change is you can't say q'foo' anymore, but have to say q/foo/ or q 'foo', since q'foo is now a valid identifier.) Note this still doesn't allow identifiers like 'twas happenin' however. Larry
Re: [svn:perl6-synopsis] r14574 - doc/trunk/design/syn
But are 'twas and -x valid identifiers? IMHO, they should not be. -- Jonathan Dataweaver Lang
Re: [svn:perl6-synopsis] r14574 - doc/trunk/design/syn
On Fri, Aug 8, 2008 at 12:57 PM, Jon Lang [EMAIL PROTECTED] wrote: But are 'twas and -x valid identifiers? IMHO, they should not be. no, indeed they are not, because they don't start with underscore or alpha. that's why they won't work. ~jerry
Re: [perl #57636] [TODO][PDD19] Document the reason for :unique_reg flag
On Thu, Aug 07, 2008 at 10:15:24AM -0400, Will Coleda wrote: Now, if the problem is that the register allocator is broken, then let's fix the register allocator. If :unique_reg is just a workaround because fixing it is hard, let's document it as deprecated with the expectation that it will be removed when the allocator is no longer broken. Here's my slightly different interpretation: Before we had variable register frames, the register allocator was something of a necessary evil, because we needed something that could fit a large number of symbolic registers into a fixed number of absolute registers. However, now that we have variable register frames, the register allocator is really more of an optimizer than anything else -- i.e., it allows our code to run using fewer registers. And as with any other optimization, we ought to provide the compiler writers with an option to turn the optimization off. This is effectively what :unique_reg does on a per-symbol basis. Of course, :unique_reg on individual symbols might not be the best way to achieve this, but it does at least have historical precedent. If we eliminate :unique_reg, I'd still like to have a way to generate PIR code where I know that the register allocator isn't re-using registers or doing other fancy allocation. Pm
Re: [svn:perl6-synopsis] r14573 - doc/trunk/design/syn
Don't forget I still have edits posted at http://www.dlugosz.com/Perl6/offerings/. larry-at-cvs.perl.org |Perl 6| wrote: Author: larry Date: Fri Aug 8 07:59:12 2008 New Revision: 14573 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S06.pod doc/trunk/design/syn/S13.pod Log: clarify that foo is a real function even when representing a multiple dispatch s/q:code/quasi/
Re: Some details of function return captures
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: If such a ReturnCapture could also be preliminary of some kind, then lvalue subs could be lazily resumed when the rvalue comes in. Can you elaborate on that? I don't follow. Also infix:/ needs a lazy item that is collapsed into Int, Num or Rat depending on the constraint of the container it ends up in eventually. An Any gets the Rat. Hmm, and a Str perhaps the two constituting Ints as fraction put into lowest terms? I don't think you need something that fancy. If / produces a Rat, then subsequent assignment coerces the value to a Num, you get the correct result because Rat is exact. Likewise converting to Int would give the same result as int division would have in the first place. And stringifying produces a Str. --John
Differential Subscripts
How is @array[*-2] supposed to be implemented? S09v28 // reported again 8-Aug-2008 Is this magic known to the parser at a low level, or is it possible to define your own postcircumfix operators that interact with the interpretation of the argument? Does this use of * apply to any user-defined postcurcumfix:[ ] or just those defining the function for the Positional role, or what? And whether or not it always works or is particular to the built-in Array class, we need to define preciely what the * calls on the object, because Ithose may be overridden. For example, it is obvious that a lone * in an expression calls .length. But the *{$idx} and *[$idx] work by calling some method on the Array object, right? Something like @array.user_defined_indexMay to discover that May maps to 5, or @array.user_defined_index[5] to produce May. That is, the accessor .user_defined_index() returns an object that supports [] and {} just like an Array. It may or might not be an Array populated with the inverse mappings. But it behaves that way. But that doesn't work for multidimensional arrays. The meaning of *{} is dependent on its position in the list. This means that it must be able to count the semicolons! If the slice is composed at runtime, it needs to operate at runtime as well, and this implies that the called function is told which dimension it is operating upon! In any case, there should be ordinary methods that do the same thing, and * magic is documented as calling them. Perhaps @array.user_defined_index($dimenstion)May . If creating your own object that has the Positional role, these member functions need to be provided. Or, to do strange things, you may derive from Array and alter these functions, or wrap them, or whatever. Point is, you need to know that these functions are being called to support the special * syntax. Is it possible to write: @i = (1, 3, *-1); say @data[$i]; and get the same meaning as say @data[1, 3, *-1]? --John
Quick question: (...) vs [...]
What is the difference between (1,2,3) and [1,2,3] ? --John
List of captures, why?
Why is 3;3;3 a list of captures rather than a list of lists? --John
Re: Quick question: (...) vs [...]
On 2008 Aug 8, at 22:53, John M. Dlugosz wrote: What is the difference between (1,2,3) and [1,2,3] ? IIRC one is a list, the other a reference to a list --- which in perl6 will be hidden for the most part. so practically speaking the difference is minimal. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH
Re: List of captures, why?
On 2008 Aug 8, at 23:06, John M. Dlugosz wrote: Why is 3;3;3 a list of captures rather than a list of lists? IIRC it has to do with providing enough information for slices and/or * to work in multiple dimensions. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH
Re: List of captures, why?
Brandon S. Allbery KF8NH allbery-at-ece.cmu.edu |Perl 6| wrote: On 2008 Aug 8, at 23:06, John M. Dlugosz wrote: Why is 3;3;3 a list of captures rather than a list of lists? IIRC it has to do with providing enough information for slices and/or * to work in multiple dimensions. So how does a * work in multiple dimensions? --John
Re: Differential Subscripts
On Fri, Aug 8, 2008 at 7:41 PM, John M. Dlugosz [EMAIL PROTECTED] wrote: How is @array[*-2] supposed to be implemented? S09v28 // reported again 8-Aug-2008 Is this magic known to the parser at a low level, or is it possible to define your own postcircumfix operators that interact with the interpretation of the argument? IMHO, this can best be answered by the implementors: it depends on how difficult it would be to enable user-defined code. My own bias would be toward the latter; but I'm not an implementor. Does this use of * apply to any user-defined postcurcumfix:[ ] or just those defining the function for the Positional role, or what? And whether or not it always works or is particular to the built-in Array class, we need to define preciely what the * calls on the object, because Ithose may be overridden. For example, it is obvious that a lone * in an expression calls .length. But the *{$idx} and *[$idx] work by calling some method on the Array object, right? Something like @array.user_defined_indexMay to discover that May maps to 5, or @array.user_defined_index[5] to produce May. That is, the accessor .user_defined_index() returns an object that supports [] and {} just like an Array. It may or might not be an Array populated with the inverse mappings. But it behaves that way. But that doesn't work for multidimensional arrays. The meaning of *{} is dependent on its position in the list. This means that it must be able to count the semicolons! If the slice is composed at runtime, it needs to operate at runtime as well, and this implies that the called function is told which dimension it is operating upon! This is also true when using a lone * in an expression: the number of elements that it represents depends on which dimension it appears in. As well, a similar point applies to **. IIRC, there's supposed to be a 'shape' method that provides introspection on the index. Exactly what it's capable of and how it works has not been established AFAIK. Is it possible to write: @i = (1, 3, *-1); say @data[$i]; and get the same meaning as say @data[1, 3, *-1]? I believe so. IIRC, evaluation of * is lazy; it gets postponed until there's enough context to establish what its meaning is supposed to be. -- Jonathan Dataweaver Lang