r25542 - docs/Perl6/Spec
Author: lwall Date: 2009-02-25 09:31:28 +0100 (Wed, 25 Feb 2009) New Revision: 25542 Modified: docs/Perl6/Spec/S28-special-names.pod docs/Perl6/Spec/S29-functions.pod Log: name whackage of various sorts Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-25 06:08:52 UTC (rev 25541) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-25 08:31:28 UTC (rev 25542) @@ -8,8 +8,8 @@ Maintainer:Larry Wall la...@wall.org Contributions: Tim Nelson wayl...@wayland.id.au Date: 23 Feb 2009, created from miscellaneous documents lying around - Last Modified: 23 Feb 2009 - Version: 3 + Last Modified: 24 Feb 2009 + Version: 4 =head1 Introduction @@ -27,18 +27,37 @@ =head2 Secondary Sigils (also known as twigils): -A quick reminder of the relevant twigils: +A quick reminder of the relevant twigils from S02: -$?foo # Lexically-scoped (compile time, see S02) -$*foo # Contextualiseable Global variable (run time, see S02) -$=foo # File-scoped (see S02) +$?foo # Compiler constants (fixed at compile time) +$*foo # Context variable, default global (run time) +$=foo # File-scoped POD data -XXX Something else claimed that $=foo was a POD variable; Larry says it's not -well-defined, yet, and we're waiting on Damian to write S26 before we'll know what's going -on XXX +The various C$?foo variables are determined at compile time, and are +not modifiable at run time. This does not mean that the variable has the +same value everywhere; for instance, C$?LINE is different on every line +of the program. -=head2 Named variables (see S02): +The C$*foo variables function both as dymamically scoped variables +and as globals. Globalness is relative, in other words. Any dynamic +scope may modify the set of globals visible via the C$*foo notation. +Most of the standard globals listed below actually live either in +the CPROCESS or the CGLOBAL package, where CPROCESS contains +globals belonging to the entire process, while CGLOBAL contains the +globals belonging to the current interpreter, since a process may be +running more than one interpreter. Unless otherwise indicated below, +the outermost definition of these variables are kept in the CPROCESS +package. +The C$=foo variables are related to the the C$?foo variables +insofar as the text of the program is known at compile time, so the +values are static. However, the different twigil indicates that the +variable contains POD data, which is primarily under user control +rather than compiler control. The structure of these variables will +be fleshed out in S26. + +=head2 Named variables: + VariableSpec Description --- @@ -46,43 +65,41 @@ $0, $1, $2 S05 # first captured value from match: $/[0] @*ARGS S06 # command-line arguments ?BLOCK S06 # current block (itself) - ::?CLASS # current class (as package name) - $?CLASS # current class (as variable) + ::?CLASS # current class (as package or type name) + $?CLASS # current class (as package object) %?CONFIG # configuration hash $=DATA# data block handle (=begin DATA ... =end) $?DISTROS02 # Which OS distribution am I compiling under $*EGID# effective group id - %*ENV # system environment + %*ENV # system environment variables $*ERR S16 # Standard error handle; is an IO object $*EUID# effective user id $*EXECUTABLE_NAME # executable name $?FILE# current filename of source file - $?GRAMMAR # current grammar + $?GRAMMAR # current grammar (as object) $*GID # group id $*INS16 # Standard input handle; is an IO object - $?LABEL # label of current block + $*INC S11 # where to search for user modules (but not std lib!) + $?LABEL # label of current block (XXX unnecessary?) $?LINE# current line number in source file - $?MODULE # current module + $?MODULE # current module (as package object variable) %*OPTS S19 # Options from command line %*OPT...S19 # Options from command line to be passed down - %*OPTS S19 # Options from command line - %*OPT...S19 # Options from command line to be passed down $?OS # operating system compiled for $*OS # operating system running under $?OSVER # operating system version compiled for $*OSVER # operating system version running under
Re: S28 update?
For those who missed it, these were answered by Larry in an update to the specs. - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
Re: @*INPLACE_AUTOSPLIT_FIELDS
In answer to this, Larry put something in the spec that says that @F is replaced with @_ Now I'm happy :). - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
r25545 - docs/Perl6/Spec
Author: wayland Date: 2009-02-25 13:03:29 +0100 (Wed, 25 Feb 2009) New Revision: 25545 Modified: docs/Perl6/Spec/S28-special-names.pod Log: A few minor fixes Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-25 12:01:34 UTC (rev 25544) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-25 12:03:29 UTC (rev 25545) @@ -1,15 +1,15 @@ =head1 Name - [DRAFT] Synopsis 28 - Special Variables [DRAFT] + [DRAFT] Synopsis 28 - Special Names [DRAFT] =head1 Version Author:Larry Wall la...@wall.org Maintainer:Larry Wall la...@wall.org Contributions: Tim Nelson wayl...@wayland.id.au - Date: 23 Feb 2009, created from miscellaneous documents lying around - Last Modified: 24 Feb 2009 - Version: 4 + Date: 23 Feb 2009, created by Tim Nelson from miscellaneous documents lying around + Last Modified: 25 Feb 2009 + Version: 5 =head1 Introduction
[perl #62902] Rakudo thinks that a proto-object in an attribute isn't ===-equal to its class
On Thu Jan 29 05:13:48 2009, masak wrote: A protoobject in a normal lexical variable: masak rakudo: class A {}; my A $a; say $a === A # works p6eval rakudo 36143: OUTPUT«1» A protoobject in an object attribute: masak rakudo: class A {}; class D { has A $!a; method foo { say $!a === A } }; D.new.foo # fails p6eval rakudo 36143: OUTPUT«0» Fixed in git d912db6 and added a test to S12-attributes/instance.t. Thanks, Jonathan
[perl #62364] [BUG] *
On Wed Jan 14 14:02:17 2009, publiustemp-perl6interna...@yahoo.com wrote: I tried to implement plan * for 'no_plan' and this is the minimal test case: perl6 $ perl6 -e 'my $plan = *; say $plan.isa(Whatever)' Method 'isa' not found for invocant of class 'Whatever' Ah yes, Whatever was wrongly inheriting from Object, not Any (as S02 says it should), and thus didn't get the .isa helper method declared. Fixed in git 23e8e02 and test added in S02-builtin-datatypes/whatever.t. Thanks, Jonathan
[perl #62004] Enum values aren't recognized without their namespace
On Tue Jan 06 02:51:59 2009, masak wrote: Rakudo r34997 doesn't allow enum values to be written without their namespace: $ perl6 -e 'enum Color white gray black; my Color $c = Color::white; say $c' 0 $ perl6 -e 'enum Color white gray black; my Color $c = white'too few arguments passed (0) - 1 params expected [...] Just tried this and it works now; it has probably worked since we gained the type registry. Added tests to S12-enums/basic.t to make sure it keeps on working, though. :-) Thanks, Jonathan
Re: AnyEvent
On Wed, Feb 25, 2009 at 5:56 AM, Timothy S. Nelson wayl...@wayland.id.au wrote: Am I right in guessing that the AnyEvent stuff should go in S17 ? I would suggest to rename that to Event (since unlike Perl 5 that name is still available in Perl 6). Leon
r25552 - docs/Perl6/Spec/S32-setting-library
Author: moritz Date: 2009-02-25 15:03:24 +0100 (Wed, 25 Feb 2009) New Revision: 25552 Modified: docs/Perl6/Spec/S32-setting-library/Any.pod docs/Perl6/Spec/S32-setting-library/Containers.pod docs/Perl6/Spec/S32-setting-library/IO.pod docs/Perl6/Spec/S32-setting-library/Numeric.pod docs/Perl6/Spec/S32-setting-library/Scalar.pod docs/Perl6/Spec/S32-setting-library/Str.pod docs/Perl6/Spec/S32-setting-library/Temporal.pod Log: [spec] set svn props on S32/*.pod Property changes on: docs/Perl6/Spec/S32-setting-library/Any.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/Containers.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/IO.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/Numeric.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/Scalar.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/Str.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native Property changes on: docs/Perl6/Spec/S32-setting-library/Temporal.pod ___ Added: svn:mime-type + text/plain; charset=UTF-8 Added: svn:eol-style + native
[perl #63146] [TODO] Implement (*) in the LHS of 'my' declarations
On Wed Feb 11 01:21:29 2009, masak wrote: Larry (): Actually, that would have to be (*@) in a my, since a my takes a signature. You can only use (*) in an ordinary list assignment: (*) = 5; ($a,$b,$c,*) = @values; Ok, since the latter two work already, I'm rescuing this bug ticket by re-naming it [TODO] Implement (*@) in the LHS of 'my' declarations. masak rakudo: my (*@) = 1,2,3 p6eval rakudo e73c95: OUTPUT«Statement not terminated properly at line 1, near @) = 1,2,3 [...] Implemented in git dfe942d (the patch actually makes bare sigils in signatures generally work, with the happy result that I could also unskip various other things in assign.t). assign.t did miss a test for this case though, so added that as well. Thanks, Jonathan
r25555 - docs/Perl6/Spec
Author: wayland Date: 2009-02-25 15:30:12 +0100 (Wed, 25 Feb 2009) New Revision: 2 Modified: docs/Perl6/Spec/S28-special-names.pod Log: S28: Added some more variables drawn from other documents, and added some notes about confusing bits. Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-25 14:12:10 UTC (rev 25554) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-25 14:30:12 UTC (rev 2) @@ -72,6 +72,7 @@ %?CONFIG # configuration hash $=DATA# data block handle (=begin DATA ... =end) @=DATA# Same as above, but array + %?DEEPMAGIC S13 # Controls the mappings of magical names to sub definitions $?DISTROS02 # Which OS distribution am I compiling under $*EGID# effective group id %*ENV # system environment variables @@ -84,7 +85,10 @@ $*INS16 # Standard input handle; is an IO object $*INC S11 # where to search for user modules (but not std lib!) $?LABEL # label of current block (XXX unnecessary?) + $?LANG S02 # Which Perl parser should embedded closures parse with? + $*LANG S02 # LANG variable from %*ENV that defines what human language is used $?LINE# current line number in source file + %*META-ARGS S19 # Meta-arguments $?MODULE # current module (as package object variable) %*OPTS S19 # Options from command line %*OPT...S19 # Options from command line to be passed down @@ -105,6 +109,7 @@ ?ROUTINE S06 # current sub or method (itself) $?SCOPE S02 # Current my scope (XXX unnecessary?) $*UID # system user id + $?USAGE S06 # Default usage message generated at compile time $?VMS02 # Which virtual machine am I compiling under $?XVM S02 # Which virtual machine am I cross-compiling for @@ -208,6 +213,11 @@ XXX Don't remove this line until this section is completely blank. +We also seem to have $*INC in the table at the top, @*INC in S19 and the table +immediately above, %*INC also in the table above. + +The $?LANG and $*LANG variables are also confusing (both in S02). + =head2 Form.pm These go in the Perl5 to Perl6 conversion table: @@ -239,7 +249,8 @@ =head2 S15-unicode.pod -${^ENCODING} and ${^UNICODE} variables +${^ENCODING} variable -- S32/Str.pod implies this is $*ENC +${^UNICODE} variable =head2 Infectious trait spec
[perl #63232] Rakudo doesn't Z together mixes of elements and ranges properly
On Wed Feb 18 09:02:32 2009, ml...@physik.uni-wuerzburg.de wrote: Vasily Chekalkin via RT wrote: On Sat Feb 14 08:16:28 2009, masak wrote: jnthn rakudo: say a..c Z ?, a..b; p6eval rakudo a0a390: OUTPUT«a?bab» From the last example, we see that there's a 'c' missing from the result of the Z. One-line fix available at http://github.com/bacek/rakudo/commit/40254c113c0a87155c08be82baa1b47fd62a07d7 Someone (read moritz) have to add tests :) someone added tests to S29-container/zip.t (and added that file to t/spectest.data) And yet someone else applied bacek's patch as git f9b9041 and untodo'd the test. Thanks all, Jonathan
S28 -- more profusion of confusion on my part :)
Hi. I wrote a variable finding program. The output is below for those interested (yes, it relies on ack), but the questions the output raises are: - Does the $?TABSTOP have a special meaning, or is it just an example like $?FOO is in so many places? - Should those @?ROUTINE, etc, variables be removed from S02 like they were from S28? - Is $?NF a special Unicode variable? Maybe also the questions that I put in the Not yet defined section are appropriate here too: - We seem to have $*INC in the table at the top, @*INC in S19 and the table immediately above, %*INC also in the table above. Are all 3 correct? - The $?LANG and $*LANG variables are also confusing (both in S02, with completely different meanings). Thanks. Output follows. Perl6/Spec/S02-bits.pod:2105:constant $?TABSTOP = 4; # assume heredoc tabs mean 4 spaces Perl6/Spec/S02-bits.pod:2129:@?ROUTINE Which nested routines am I in? Perl6/Spec/S02-bits.pod:2131:@?BLOCK Which nested blocks am I in? Perl6/Spec/S02-bits.pod:2133:@?LABEL Which nested block labels am I in? Perl6/Spec/S02-bits.pod:2147:@?PACKAGE Which nested packages am I in? Perl6/Spec/S02-bits.pod:2149:@?MODULEWhich nested modules am I in? Perl6/Spec/S02-bits.pod:2151:@?CLASS Which nested classes am I in? Perl6/Spec/S02-bits.pod:2153:@?ROLE Which nested roles am I in? Perl6/Spec/S02-bits.pod:2155:@?GRAMMAR Which nested grammars am I in? Perl6/Spec/S02-bits.pod:3255:to be C ($?TABSTOP // 8) spaces, but as long as tabs and spaces are used consistently Perl6/Spec/S05-regex.pod:711:$OPEN = '(' SETGOAL: ')' expression [ $GOAL || FAILGOAL ] Perl6/Spec/S32-setting-library/Str.pod:219: our Int multi method codes ( Str $string: $nf = $?NF) is export - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
[perl #63462] .parse doesn't work on many-jointed grammars
On Wed Feb 25 01:06:52 2009, masak wrote: masak rakudo: grammar A::B { regex TOP { foo } }; A::B.parse() p6eval rakudo 7f8ba6: OUTPUT«Null PMC access in get_string() [...] masak Huston, we have a problem. * masak submits rakudobug Problem resolved in git 59fcc4e and test added to S05-grammar/parse_and_parsefile.t. Thanks, Jonathan
[perl #63442] MMD doesn't take methods of parent class into account
On Tue Feb 24 09:33:18 2009, ml...@physik.uni-wuerzburg.de wrote: class Foo { multi method a($d) { say Any-method in Foo; } } class Bar is Foo { multi method a(Int $d) { say Int-method in Bar; } } Bar.new.a(not an Int); # vim: ft=perl6 Output: No applicable candidates found to dispatch to for 'a' current instr.: 'parrot;P6metaclass;dispatch' pc 109 (src/classes/ClassHOW.pir:85) Ah yes, I've been needing to fix this up for a while. Finally it's done in git f43750a. This will be a test in t/spec/S12-methods/multi.t in a few minutes. Corrected and unfudged. Thanks, Jonathan
[perl #63374] [BUG] Build fails with segfault while generating gen_settings.pir
On Sun Feb 22 23:38:52 2009, rooneg wrote: On Fri, Feb 20, 2009 at 11:23 AM, perl6 via RT perl6-bugs-follo...@perl.org wrote: I'm getting a crash on OS X when trying to build rakudo. This is with parrot r36907 and the current version of rakudo (f23eda2c5251db5a90f5fdd3b587d4c234ee70e4) from github. Note that rolling back to parrot r36866 fixes the crash. I haven't done a binary search between the two versions to figure out the exact cause of the crash, but it's somewhere in there. A patch was applied to resolve this issue recently, and current Rakudo from GIT combined with the version of Parrot in build/PARROT_REVISION now builds (and that is pretty much Parrot HEAD at the moment). Thanks for reporting, Jonathan
Re: Comparing inexact values (was Re: Temporal changes)
HaloO, Doug McNutt wrote: Thinking about what I actually do. . . A near equal test of a float ought to be a fractional error based on the current value of the float. $x tested for between $a*(1.0 + $errorfraction) and $a*(1.0 - $errorfraction) I strongly agree that checking relative errors in floating point algorithms is ubiquitous and thus the creation of relative ranges deserves a dedicated operator. So I wanted to make the heretic proposal to use % for that. That is $x % $y; to actually mean $x * (1 - $y/100) ..^ $x * (1 + $y/100); I think that this reads good for numeric matches: if $x ~~ $y % 5 { say within five percent } even though postfix % and infix ± read even better: if $x ~~ $y ± 5% { say within five percent } and so I'm proposing to add these and 'within' as ASCII fallback for ±. The intended semantics could be achieved with postfix % returning a Ratio type for which infix ± has an overloaded version that creates a relative range as given above. Other operators that don't have overloads for Ratio use it as a Num. This is much easier than the closure generation with subsequent currying as proposed by Larry elsewhere in this thread. This nicely allows $x += 5%; to mean $x += $x * 0.05; But defining the corresponding overloads of infix + is tricky for infix:+:(Ratio,Num) because it could mean to increase the Ratio and return a Ratio or ignore the Ratio type and return a plain Num. I think the latter is saner. BTW, in numerics one usually needs small values so we could have a .ppm postfix operator that also returns a Ratio, albeit one that is smaller by a factor of 1. Alternatively a triple application of % gives the same ratio. And of course we should have ‰ (promille) and ‱ (permyriad) as well. And when we are at it .ppb and .ppt are common as well. At least Wikipedia has them. There one also finds that ratios are expressed with the SI prefixes like nano without a unit or U for uno. But I guess at the latest this all belongs into a Ratio (standard?) module. 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
[perl #57398] Actually assigning to a read-only variable in rakudo causes parrot to segfault
On Tue Jul 29 21:49:31 2008, masak wrote: $ svn info | grep Revi Revision: 29869 $ ./perl6 -e 'sub a($x) { $x = 5 }; my $y = 7; a($y);' Cannot assign to readonly variable [...] works, but the following works but segfaults: $ ./perl6 -e 'sub a($x) { $x = 5 }; my $y = 7; a($y);' Cannot assign to readonly variable current instr.: 'a' pc 138 (EVAL_14:59) called from Sub '_block11' pc 45 (EVAL_14:20) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14623 (perl6.pir:172) perl6(33762) malloc: *** error for object 0x29c1250: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault A patch today is believed to have resolved the double frees, so this should no longer segfault, and it already gives a good enough error, so resolving ticket. Thanks, Jonathan
[perl #57396] Accessing an uninitialized value inside a sub in rakudo makes parrot segfault
On Tue Jul 29 21:40:30 2008, masak wrote: $ ./perl6 -e 'my $x; $x.foo()' works, but $ ./perl6 -e 'sub a { my $x; $x.foo() }; a()' Method 'foo' not found for invocant of class 'Undef' current instr.: 'a' pc 82 (EVAL_13:42) called from Sub '_block11' pc 17 (EVAL_13:11) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14623 (perl6.pir:172) perl6(33740) malloc: *** error for object 0x2994f90: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault doesn't. The double frees by and large should now be resolved (am closing other tickets related to that issue, but won't Cc every one to the list), and the error here is fine IMO (if a little over-backtraced, but there's another ticket about that which is more general). The method call $x.foo() can be replaced with other things that attempt to read $x -- such as $x++ or $x[0] -- with similar results. Actually, this segfaults too, even though execution never enters the sub: $ ./perl6 -e 'sub a { my $x; $x.foo() }; A()' invoke() not implemented in class 'Undef' current instr.: '_block11' pc 23 (EVAL_13:15) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14902 (perl6.pir:172) perl6(37079) malloc: *** error for object 0x298f720: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault This now doesn't segfault, and also gives a better error saying you tried to call a non-existent sub. Thanks, Jonathan
Re: Comparing inexact values (was Re: Temporal changes)
I think the use of % for the modulus operator is too deeply ingrained to repurpose its infix incarnation. I do quite like the magical postfix %, but I wonder how far it should go beyond ±: $x += 5%; # becomes $x += ($x * .05)? Or maybe $x *= 1.05 ? $x * 5%; # becomes $x * .05 ?
[perl #63264] [BUG] Subsets are defined by default.
On Mon Feb 16 12:46:55 2009, bacek wrote: jnthn perl6: subset Strand where {$_ == 0 | 1 | -1}; say Strand.defined p6eval rakudo c4f0f9: OUTPUT«1» This now gives 0 as expected as of git 3484985. Added spectest for it to S12-subset/subtypes.t. Thanks! Jonathan
Re: Comparing inexact values (was Re: Temporal changes)
Mark J. Reed wrote: I do quite like the magical postfix %, but I wonder how far it should go beyond ±: $x += 5%; # becomes $x += ($x * .05)? Or maybe $x *= 1.05 ? $x * 5%; # becomes $x * .05 ? If it works with ±, it ought to work with + and -. Rule of thumb: if there's no easy way to answer 5% of what? then default to 5% of 1.0, or 0.05. +, -, and ± would need to be set up to provide the necessary answer for of what? by means of setting Whatever; and by basing it on Whatever, you have other options, such as: @a[50%] # accesses the middle item in the list, since Whatever is set to the length of the list. -- Concerning - $val, $err { [..^] $val - $err, $val + $err } vs - $val, $err { any $val - $err, $val + $err }: I'm not sold on the notion that Huffman coding might imply that ± should go with the former. Perhaps an argument can be made for it; but I suspect that the relative commonness of the two uses is extremely similar (which, per Huffman coding, would imply that their names should have similar lengths). Whichever one we go with, we have a conundrum: if we use ± as the name of the latter, the conundrum is that the only other intuitive name for the former that has thus far been proposed (i.e., within) is too long; if we use ± as the name for the former, the conundrum is that no other intuitive name has been proposed for the latter. So: what we need are proposals for short, understandable names for each operator. Suggestions? -- Jonathan Dataweaver Lang
Re: r25490 - docs/Perl6/Spec
On Wed, 25 Feb 2009, Timothy S. Nelson wrote: I'm in favour of retaining the $[ functionality, but lets give it some name like $*INDEX_BEGINNING or something like that, so that it's quite long for people to type :). Surely the interpretation of the index should be up to each array-type? role OffsetArray[::ElementType = Object;; int $MinIndex = 1] { is Array; has ElementType @.contents; method circumflex:? [ ] ? (int $index where { $_ = $MinIndex } ) { return @.contents[$index - $MinIndex]; } } -Martin
Re: Comparing inexact values (was Re: Temporal changes)
At 13:58 -0500 2/25/09, Mark J. Reed wrote: I do quite like the magical postfix %, but I wonder how far it should go beyond ±: $x += 5%; # becomes $x += ($x * .05)? Or maybe $x *= 1.05 ? $x * 5%; # becomes $x * .05 ? For ratio-like comparisons for effective equality of floats some thought might be given to operating on the mantissa part of the IEEE float. For normalized floats it's possible to get nearly equal tests by simply truncating the mantissa at some number of bits and comparing the floats as longs for equality. I suspect most technical users would have no problem in specifying a number of significant bits. They certainly can do it with decimal digits. Rounding from 52 to, say, 16 bits ought to be easy in binary. But then with everyone using processors with floating point hardware the efficiency might not be important. -- -- Marriage and kilo are troubled words. Turmoil results when centuries-old usage is altered in specialized jargon --.
Re: r25490 - docs/Perl6/Spec
On Thu, 26 Feb 2009, Martin D Kealey wrote: On Wed, 25 Feb 2009, Timothy S. Nelson wrote: I'm in favour of retaining the $[ functionality, but lets give it some name like $*INDEX_BEGINNING or something like that, so that it's quite long for people to type :). Surely the interpretation of the index should be up to each array-type? role OffsetArray[::ElementType = Object;; int $MinIndex = 1] { is Array; has ElementType @.contents; method circumflex:? [ ] ? (int $index where { $_ = $MinIndex } ) { return @.contents[$index - $MinIndex]; } } Good idea. That retains the functionality, but without us having to spec it :). - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
r25569 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-26 02:56:30 +0100 (Thu, 26 Feb 2009) New Revision: 25569 Modified: docs/Perl6/Spec/S28-special-names.pod docs/Perl6/Spec/S32-setting-library/IO.pod Log: S32: Mentioned IPv6 S28: bugfixes Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-26 01:46:30 UTC (rev 25568) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-26 01:56:30 UTC (rev 25569) @@ -25,7 +25,7 @@ =head1 Overview -=head2 Secondary Sigils (also known as twigils): +=head2 Secondary Sigils (also known as twigils) A quick reminder of the relevant twigils from S02: @@ -56,7 +56,7 @@ rather than compiler control. The structure of these variables will be fleshed out in S26. -=head2 Named variables: +=head2 Named variables VariableSpec Description --- Modified: docs/Perl6/Spec/S32-setting-library/IO.pod === --- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-26 01:46:30 UTC (rev 25568) +++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-26 01:56:30 UTC (rev 25569) @@ -846,6 +846,8 @@ The NoOpen option is passed to IO::Streamable.new() +IPv6 is supported. + =item open method open()
r25570 - docs/Perl6/Spec
Author: lwall Date: 2009-02-26 03:05:41 +0100 (Thu, 26 Feb 2009) New Revision: 25570 Modified: docs/Perl6/Spec/S02-bits.pod Log: [S02] more package and variable name cleanups Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-02-26 01:56:30 UTC (rev 25569) +++ docs/Perl6/Spec/S02-bits.pod2009-02-26 02:05:41 UTC (rev 25570) @@ -12,9 +12,9 @@ Maintainer: Larry Wall la...@wall.org Date: 10 Aug 2004 - Last Modified: 24 Feb 2009 + Last Modified: 25 Feb 2009 Number: 2 - Version: 154 + Version: 155 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -1861,12 +1861,8 @@ Package names are searched for from inner lexical scopes to outer, then from inner packages to outer. Variable names are searched for from inner lexical scopes to outer, but unlike package names -are looked for in only the current package and the global package. +are looked for in only the current package. -The global namespace is the last place it looks in either case. -You must use the C* (or CGLOBAL) package on the front of the -string argument to force the search to start in the global namespace. - Use the CMY pseudopackage to limit the lookup to the current lexical scope, and COUR to limit the scopes to the current package scope. @@ -1879,7 +1875,7 @@ To bind package variables into a lexical scope, simply say Cour ($x, @y). To bind global variables into a lexical scope, predeclare them with Cuse: -use GLOBAL $IN $OUT; +use PROCESS $IN $OUT; Or just refer to them as C$*IN and C$*OUT. @@ -1889,7 +1885,7 @@ the package name as a hash: Foo::Bar::{'baz'} # same as Foo::Bar::baz -GLOBAL::$IN # Same as $*IN +PROCESS::$IN # Same as $*IN FooBar::Baz # same as Foo::Bar::Baz The C:: before the subscript is required here, because the CFoo::Bar{...} @@ -2052,33 +2048,32 @@ =item * -Truly global variables live in the C* package: C$*UID, C%*ENV. -(The C* may be omitted if you import the name from the CGLOBAL -package.) C$*foo is short for C$*::foo, suggesting that the -variable is wild carded into every package. +Interpreter globals live in the CGLOBAL package. The user's program +starts in the CGLOBAL package, so our declarations in the mainline +code go into that package by default. Process-wide variables live in +the CPROCESS package. Most predefined globals such as C$*UID +and C%*PID are actually process globals. =item * -For an ordinary Perl program running by itself, the CGLOBAL and -CPROCESS namespaces are considered synonymous. However, in certain +There is only ever a single CPROCESS package. +For an ordinary Perl program running by itself, there is only one CGLOBAL +package as well. However, in certain situations (such as shared hosting under a webserver), the actual -process may contain multiple virtual processes, each running its own +process may contain multiple virtual processes or interpreters, each running its own main code. In this case, the CGLOBAL namespace holds variables that properly belong to the individual virtual process, while the CPROCESS namespace holds variables that properly belong to the actual -process as a whole. From the viewpoint of the CGLOBAL namespace -there is little difference, since process variables that normally -appear in CGLOBAL are automatically imported from CPROCESS. -However, the process as a whole may place restrictions on the +process as a whole. From the viewpoint of the program +there is little difference as long as all global variables are accessed +as if they were context variables (by using the C* twigil). +The process as a whole may place restrictions on the mutability of process variables as seen by the individual subprocesses. Also, individual subprocesses may not create new process variables. If the process wishes to grant subprocesses the ability to communicate -via the CPROCESS namespace, it must supply a writeable variable +via the CPROCESS namespace, it must supply a writeable context variable to all the subprocesses granted that privilege. -When these namespaces are so distinguished, the C* shortcut always refers -to CGLOBAL. There is no twigil shortcut for CPROCESS. - =item * The magic command-line input handle is C$*ARGFILES. @@ -2108,8 +2103,8 @@ expression at compile time.) C$?FILE and C$?LINE are your current file and line number, for -instance. C? is not a shortcut for a package name like C* is. -Instead of C$?OUTER::SUB you probably want to write C OUTER::$?SUB . +instance. +Instead of C$?OUTER::FOO you probably want to write C OUTER::$?FOO . Within code that is being run during the compile, such as CBEGIN blocks, or macro bodies, or constant initializers, the compiler variables must be referred to as (for instance) C COMPILING::$?LINE if the bare C$?LINE would @@
Re: r25490 - docs/Perl6/Spec
On Thu, Feb 26, 2009 at 11:57:07AM +1100, Timothy S. Nelson wrote: On Thu, 26 Feb 2009, Martin D Kealey wrote: On Wed, 25 Feb 2009, Timothy S. Nelson wrote: I'm in favour of retaining the $[ functionality, but lets give it some name like $*INDEX_BEGINNING or something like that, so that it's quite long for people to type :). Surely the interpretation of the index should be up to each array-type? role OffsetArray[::ElementType = Object;; int $MinIndex = 1] { is Array; has ElementType @.contents; method circumflex:? [ ] ? (int $index where { $_ = $MinIndex } ) { return @.contents[$index - $MinIndex]; } } Good idea. That retains the functionality, but without us having to spec it :). Oops, too late, by about 23 months. Please see S09. Larry
Re: Comparing inexact values (was Re: Temporal changes)
On Wed, Feb 25, 2009 at 02:34:50PM -0800, Jon Lang wrote: : Mark J. Reed wrote: : I do quite like the magical postfix %, but I wonder how far it should : go beyond ±: : : $x += 5%; # becomes $x += ($x * .05)? Or maybe $x *= 1.05 ? : $x * 5%; # becomes $x * .05 ? : : If it works with ±, it ought to work with + and -. Rule of thumb: if : there's no easy way to answer 5% of what? then default to 5% of : 1.0, or 0.05. +, -, and ± would need to be set up to provide the : necessary answer for of what? by means of setting Whatever; and by : basing it on Whatever, you have other options, such as: : : @a[50%] # accesses the middle item in the list, since Whatever is : set to the length of the list. Coolness. : Concerning - $val, $err { [..^] $val - $err, $val + $err } vs - : $val, $err { any $val - $err, $val + $err }: I'm not sold on the : notion that Huffman coding might imply that ± should go with the : former. Perhaps an argument can be made for it; but I suspect that : the relative commonness of the two uses is extremely similar (which, : per Huffman coding, would imply that their names should have similar : lengths). Whichever one we go with, we have a conundrum: if we use ± : as the name of the latter, the conundrum is that the only other : intuitive name for the former that has thus far been proposed (i.e., : within) is too long; if we use ± as the name for the former, the : conundrum is that no other intuitive name has been proposed for the : latter. : : So: what we need are proposals for short, understandable names for : each operator. Suggestions? I'm not sure we should give up on unification so soon. Hmm. Here's another approach. Suppose we define $a ± $b to mean something $a ..^ $b :interval and :interval causes the Range object to return $a and $b in list context. Then, since any() supplies list context, we could write if $x == any($a ± $b) {...} That seems a bit ugly though. Another way would be to define ± as simple half-open Range and then overload comparison: multi sub infix:==(Num $x,Range $r) { $x == any($r.minmax); } Of course, that would potentially introduce a failure mode where people say == when they mean ~~, or vice versa. Maybe that wouldn't be a big problem in practice. Larry
Exceptions question
S04 says: Because the contextual variable C$! contains all exceptions collected in the current lexical scope, saying Cdie $! will throw all exceptions, whether they were handled or not. A bare Cdie/Cfail takes C$! as the default argument. Does this mean that $! is a container of some sort? - | Name: Tim Nelson | Because the Creator is,| | E-mail: wayl...@wayland.id.au| I am | - BEGIN GEEK CODE BLOCK Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+++ PGP-+++ R(+) !tv b++ DI D G+ e++ h! y- -END GEEK CODE BLOCK-
Re: Exceptions question
On Thu, Feb 26, 2009 at 02:05:28PM +1100, Timothy S. Nelson wrote: Does this mean that $! is a container of some sort? It's an object, which (in the abstract) can contain anything it jolly well pleases. The main question beyond that is how it responds if used like one of the standard containers. I don't see any great motivation for that offhand, but we'll have to examine the use cases as things progress. Larry
r25573 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-26 04:43:20 +0100 (Thu, 26 Feb 2009) New Revision: 25573 Added: docs/Perl6/Spec/S32-setting-library/Exception.pod Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S32-setting-library/Numeric.pod Log: Numeric.pod: Added some notes on what needs to be documented here S16 and Exception.pod: Did some work on turning signals into exceptions. I probably need to pre-emptively ask for forgiveness for just making stuff up here :). Modified: docs/Perl6/Spec/S16-io.pod === --- docs/Perl6/Spec/S16-io.pod 2009-02-26 02:46:46 UTC (rev 25572) +++ docs/Perl6/Spec/S16-io.pod 2009-02-26 03:43:20 UTC (rev 25573) @@ -73,22 +73,125 @@ =head1 POSIX Signals +The %*SIG variable contains a Hash of Proc::Signals::Signal. + +class Signal { + has $exception; # This specifies what exception will be raised when this signal is received + has $interrupt; # See siginterrupt(3) + has $blocked; # Is this signal blocked? cf. sigprocmask +} + +The @*SIGQUEUE array contains a queue of the signals that are blocked and queued. + The standard POSIX signals simply raise control exceptions that are handled as normal -through the signal handler, except for the fact that some of them are resumeable. The -exception names are: +through the control signal handler, and caught by CONTROL blocks. -=over +=head2 Signal defaults -=item * ControlExceptionSigHUP +The signals have defaults as specified in the table below. $blocked always defaults to +false. -=item * ControlExceptionSigTERM + Signal Default Exception + -- - + SIGHUP ControlExceptionSigHUP + SIGINT ControlExceptionSigINT + SIGQUITControlExceptionSigQUIT + SIGILL ControlExceptionSigILL + SIGABRTControlExceptionSigABRT + SIGFPE ControlExceptionSigFPE + SIGKILLControlExceptionSigKILL + SIGSEGVControlExceptionSigSEGV + SIGPIPEControlExceptionSigPIPE + SIGALRMControlExceptionSigALRM + SIGTERMControlExceptionSigTERM + SIGUSR1ControlExceptionSigUSR1 + SIGUSR2ControlExceptionSigUSR2 + SIGCHLDundef + SIGCONTControlExceptionSigCONT + SIGSTOPControlExceptionSigSTOP + SIGTSTPControlExceptionSigTSTP + SIGTTINControlExceptionSigTTIN + SIGTTOUControlExceptionSigTTOU + SIGBUS ControlExceptionSigBUS + SIGPROFControlExceptionSigPROF + SIGSYS ControlExceptionSigSYS + SIGTRAPControlExceptionSigTRAP + SIGURG undef + SIGVTALRM ControlExceptionSigVTALRM + SIGXCPUControlExceptionSigXCPU + SIGXFSZControlExceptionSigXFSZ + SIGEMT ControlExceptionSigEMT + SIGSTKFLT ControlExceptionSigSTKFLT + SIGIO ControlExceptionSigIO + SIGPWR ControlExceptionSigPWR + SIGLOSTControlExceptionSigLOST + SIGWINCH undef -=item * ControlExceptionSigINT +=head2 Signal exceptions -=back +A table below describes the exceptions. +Each of these has a default action as well. The possible actions are: + + Term Default action is to terminate the process. + + IgnDefault action is to ignore the signal ($signal.exception is undef by default) + + Core Default action is to terminate the process and dump core (see core(5)). + + Stop Default action is to stop the process. + + Cont Default action is to continue the process if it is currently stopped. + +Some actions do the Resumeable role. An exception listed in the table below that does the +Resumeable role is marked with a * in the R column. + +The exceptions are: + + Signal Action R Comment + -- + ControlExceptionSigHUPTerm? Hangup detected on controlling terminal or death of controlling process + ControlExceptionSigINTTerm? Interrupt from keyboard + ControlExceptionSigQUIT Core? Quit from keyboard + ControlExceptionSigILLCore? Illegal Instruction + ControlExceptionSigABRT Core? Abort signal from abort(3) + ControlExceptionSigFPECore? Floating point exception + ControlExceptionSigKILL Term? Kill signal + ControlExceptionSigSEGV Core Invalid memory reference + ControlExceptionSigPIPE Term? Broken pipe: write to pipe with no readers + ControlExceptionSigALRM Term? Timer signal from alarm(2) + ControlExceptionSigTERM Term? Termination signal + ControlExceptionSigUSR1 Term? User-defined signal 1 + ControlExceptionSigUSR2 Term? User-defined signal 2 + ControlExceptionSigCHLD Ign ? Child stopped or terminated + ControlExceptionSigCONT Cont* Continue if stopped + ControlExceptionSigSTOP Stop? Stop process + ControlExceptionSigTSTP Stop? Stop typed at tty + ControlExceptionSigTTIN Stop? tty input for background process + ControlExceptionSigTTOU Stop? tty output for background process + ControlExceptionSigBUSCore? Bus error (bad memory access) +