Re: IO, Trees, and Time/Date
Darren Duncan wrote on 2009 Feb 17: Timothy S. Nelson wrote: Agreed, and that's kinda what I'm doing. But I still think there's room for improvement. I'll try and design an API that does what DateTime does, but: Talking about dates and times, I have some suggestions. Second of all, I think a more generic term than DateTime should be used to name an object that represents an instant in time; for example I suggest calling it Instant. The name Instant fits in a lot better in the company of other generic sounding temporal data types like Duration etc. Then, you can say that things like DateTime, Date, Time, etc are subtypes of Instant. See also http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Ext/Temporal.pod where I've specced out such matters, and that illustrates something I recommend for you. My Instant types very closely resemble both the Perl DateTime library as well as the SQL temporal types, which are actually very similar, though I've generalized it a bit. This spec explicitly does not support time zones (it has UTC or floating, that's it) and it doesn't include conversions with strings, but it has the foundation on which such could be built. And yours doesn't have to be the same of course. As a follow-up to my initial 2009 Feb 17 post that first suggested the name Instant and cited my Muldis D language as a specced example ... I'll start off by saying that the evolving design of Muldis D in general seeks a happy medium between the evolving design of Perl 6 and the established design of SQL, while being guided especially by The Third Manifesto's abstract concept of a D language. Over time, a significant portion of the input I've been making into the design of Perl 6 has been based on my prior work hashing out the same ideas in Muldis D, and similarly, ideas hashed out for Perl 6 have been attracting me to continue changing Muldis D to more closely resemble Perl 6. It's the whirlpool attractor development model but on a multi-language scale. And so, if anyone is interested in this tangent, I just released Muldis D version 0.60.0 on CPAN, whose feature change is an evolution of the language's temporal types and operators. The types named 'Instant' and 'Duration' now are in the language core rather than an optional extension, and are defined to mean exactly what the same-named types of Perl 6 do (see S02), a point on the TAI timeline measured in seconds, and a difference between 2 of those. I also kept my prior meanings, defined in terms of YMDHIS, as disjoint types UTCInstant and UTCDuration etc, in a language extension which would correspond to a CPAN module like DateTime. The TAI seconds and UTC YMDHIS are kept as disjoint types rather than being representations for the same types because there is no fixed rate of conversion between the two representations in general, with UTC leap seconds of the future being unknown; instead there are mapping functions that people can use between the types, that apply what we known sans future leap seconds, and so aren't expected to be consistent over time. The most relevant 2 files in the spec for this change are http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Core/Types.pod and http://search.cpan.org/dist/Muldis-D/lib/Muldis/D/Ext/Temporal.pod . So at this point, practically every Muldis D core type directly maps to a Perl 6 core type, and in most cases the types have the same names and semantics. -- Darren Duncan
r25578 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-26 11:00:39 +0100 (Thu, 26 Feb 2009) New Revision: 25578 Modified: docs/Perl6/Spec/S29-functions.pod docs/Perl6/Spec/S32-setting-library/IO.pod Log: S29: Fix formatting IO.pod: Get rid of tree, spec stat and LinkNode a bit better Modified: docs/Perl6/Spec/S29-functions.pod === --- docs/Perl6/Spec/S29-functions.pod 2009-02-26 09:08:17 UTC (rev 25577) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-26 10:00:39 UTC (rev 25578) @@ -998,11 +998,13 @@ setservent =item Flow control + break continue redo =item Other + bless -- is this dead? caller chr Modified: docs/Perl6/Spec/S32-setting-library/IO.pod === --- docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-26 09:08:17 UTC (rev 25577) +++ docs/Perl6/Spec/S32-setting-library/IO.pod 2009-02-26 10:00:39 UTC (rev 25578) @@ -545,15 +545,13 @@ This represents the filesystem. -class IO::FileSystem does IO::Streamable does Tree { +class IO::FileSystem does IO::Streamable { has Str $.fstype; # ext3, ntfs, vfat, reiserfs, etc has Str $.illegal_chars; # ie. /\x0 has Int $.max_path; ... } -It inherits $cwn and $root from Tree. - =over 4 =item glob @@ -570,7 +568,7 @@ =head2 IO::FSNode -class IO::FSNode does Tree::Node { +class IO::FSNode { has Array of IO::FSNodeACL @.ACLs; has Hash of %.times; ... @@ -813,12 +811,25 @@ ... } -=item link +=item new -=item readlink +Creates a new link in the filesystem. -=item symlink + IO::LinkNode.new( + Name = '/home/wayland/symlink.txt' + Target = '/home/wayland/realfile.txt', + Type = 'Hard', # Default is Symbolic + ); +Reads in the previously created symlink. + + $link = IO::LinkNode.new( + Name = '/home/wayland/symlink.txt', + ); + print $link.target; # prints /home/wayland/realfile.txt + +Neither of these is use portable compatible. + =head2 IO::Socket::TCP class IO::Socket::TCP does IO::Socket does IO::Streamable { @@ -989,17 +1000,12 @@ $mode = '0o644'; chmod $mode, 'foo'; # this is better $mode = 0o644; chmod $mode, 'foo'; # this is best -=item lstat - -Returns a stat buffer. If the lstat succeeds, the stat buffer evaluates -to true, and additional file tests may be performed on the value. If -the stat fails, all subsequent tests on the stat buffer also evaluate -to false. - =item stat =item IO.stat + $node.stat(Type = 'Link'); # Type = Link does an lstat instead + Returns a stat buffer. If the lstat succeeds, the stat buffer evaluates to true, and additional file tests may be performed on the value. If the stat fails, all subsequent tests on the stat buffer also evaluate @@ -1072,6 +1078,10 @@ See IO::FileDescriptor +=item lstat + +Use stat() with the Type = 'Link' option. + =item IO.name Changed to .path(), but we haven't gotten around to specifying this on all of them.
Re: Exceptions question
On Wed, 25 Feb 2009, Larry Wall wrote: 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. Hmm. S04 says: : That implicit topic is the current exception object, also known as C$! and also: : Because the contextual variable C$! contains all exceptions collected in : the current lexical scope... ...that implies to my mind that $! is an exception object, but that an exception object can contain more than one exception. Is that correct? But the spec also says: : Exceptions are not resumable in Perl 6unless the exception object does the : CResumable role. ...so Resumable is attached to a group of exceptions, not a single exception. Now I'm really confused :). My suggested solution would be to change $! to an exception container object. But then we have to use it in the implicit given in the CATCH block. If we used an any() Junction, would that do what we want? :) - | 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-
r25580 - docs/Perl6/Spec
Author: wayland Date: 2009-02-26 11:57:19 +0100 (Thu, 26 Feb 2009) New Revision: 25580 Modified: docs/Perl6/Spec/S28-special-names.pod Log: Added types to main table Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-26 10:19:21 UTC (rev 25579) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-26 10:57:19 UTC (rev 25580) @@ -58,60 +58,60 @@ =head2 Named variables - VariableSpec Description - --- + Variable Spec Type Description + --- - $/ S05 # match object from last match - $0, $1, $2 S05 # first captured value from match: $/[0] - @*ARGS S06 # command-line arguments - $*ARGFILES S02 # The magic command-line input handle - ?BLOCK S06 # current block (itself) - ::?CLASS # current class (as package or type name) - $?CLASS # current class (as package object) - @=COMMENT # All the comment blocks in the file - %?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 - $*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 (as object) - $*GID # group id - $*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 - $?OS # operating system compiled for - $*OS # operating system running under - $?OSVER # operating system version compiled for - $*OSVER # operating system version running under - $*OUT S16 # Standard output handle; is an IO object - $?PARSERS02 # Which Perl grammar was used to parse this statement? - $?PACKAGE # current package (as package object variable) - $?PERL S02 # Which Perl am I compiled for? - $*PERL# perl version running under - $*PID # system process id - %=POD S02 # (or some such) - $*PROGRAM_NAME# name of the Perl program being executed - ::?ROLE # current role (as package or type name) - $?ROLE# current role (as package object variable) - ?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 + $/S05 Match# match object from last match + $0, $1, $2S05 Str # first captured value from match: $/[0] + @*ARGSS06 Array of Str # command-line arguments + $*ARGFILESS02 IO # The magic command-line input handle + ?BLOCK S06 Block# current block (itself) + ::?CLASSStr # current class (as package or type name) + $?CLASS Class# current class (as package object) + @=COMMENT# All the comment blocks in the file + %?CONFIGHash of XXX # configuration hash + $=DATA # data block handle (=begin DATA ... =end) + @=DATA # Same as above, but array + %?DEEPMAGIC S13 Hash of XXX # Controls the mappings of magical names to sub definitions + $?DISTRO S02 Str # Which OS distribution am I compiling under + $*EGID Int
r25581 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-26 12:04:54 +0100 (Thu, 26 Feb 2009) New Revision: 25581 Modified: docs/Perl6/Spec/S29-functions.pod docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Moved Junctions from S29 to Containers.pod Modified: docs/Perl6/Spec/S29-functions.pod === --- docs/Perl6/Spec/S29-functions.pod 2009-02-26 10:57:19 UTC (rev 25580) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-26 11:04:54 UTC (rev 25581) @@ -921,28 +921,6 @@ last, my, next, no, our, package, return, sub, use -=head1 Junction - -All method calls on Junctions autohread if there's no such method in the -Junction class. - -=over 4 - -=item eigenstates - -our List multi method eigenstates (Junction $j) - -Returns an unordered list of the values that constitute the junction (formerly -called C.values). It flattens nested junctions of the same type, so -C(1|(2|3)).eigenstate returns an arbitrary permutation of the list -C1, 2, 3. - -This method has a rather unusual name by intention; a more common name might -cause confusion as it could clash with a method name over which autothreading -is expected. - -=back - =head1 Default Export Questions Not sure whether these are exported by default or not. Also, many may no longer exist; if @@ -1005,7 +983,7 @@ =item Other -bless -- is this dead? +bless caller chr die Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 10:57:19 UTC (rev 25580) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 11:04:54 UTC (rev 25581) @@ -26,6 +26,10 @@ =head1 Function Roles +This documents List, Seq, Range, Set, Bag, Junction. + +XXX So where are Seq, Range, Set, Bag? + =head2 Container =over @@ -634,11 +638,31 @@ =back +=head2 Junction +All method calls on Junctions autohread if there's no such method in the +Junction class. + +=over 4 + +=item eigenstates + +our List multi method eigenstates (Junction $j) + +Returns an unordered list of the values that constitute the junction (formerly +called C.values). It flattens nested junctions of the same type, so +C(1|(2|3)).eigenstate returns an arbitrary permutation of the list +C1, 2, 3. + +This method has a rather unusual name by intention; a more common name might +cause confusion as it could clash with a method name over which autothreading +is expected. + +=back + + + =head1 Additions Please post errors and feedback to perl6-language. If you are making a general laundry list, please separate messages by topic. - - -
r25582 - docs/Perl6/Spec
Author: wayland Date: 2009-02-26 12:05:45 +0100 (Thu, 26 Feb 2009) New Revision: 25582 Modified: docs/Perl6/Spec/S28-special-names.pod Log: Updated main table; refactoring after previous additions Modified: docs/Perl6/Spec/S28-special-names.pod === --- docs/Perl6/Spec/S28-special-names.pod 2009-02-26 11:04:54 UTC (rev 25581) +++ docs/Perl6/Spec/S28-special-names.pod 2009-02-26 11:05:45 UTC (rev 25582) @@ -61,13 +61,15 @@ Variable Spec Type Description --- - $/S05 Match# match object from last match - $0, $1, $2S05 Str # first captured value from match: $/[0] + @_ # ??? + $!S04# Current Exception object + $/S05 Match# Last match + $0, $1, $2S05 Str # First captured value from match: $/[0] @*ARGSS06 Array of Str # command-line arguments $*ARGFILESS02 IO # The magic command-line input handle ?BLOCK S06 Block# current block (itself) ::?CLASSStr # current class (as package or type name) - $?CLASS Class# current class (as package object) + $?CLASS Class# current class @=COMMENT# All the comment blocks in the file %?CONFIGHash of XXX # configuration hash $=DATA # data block handle (=begin DATA ... =end) @@ -80,7 +82,7 @@ $*EUID Int # effective user id $*EXECUTABLE_NAME Str # executable name $?FILE Str # current filename of source file - $?GRAMMAR Grammar # current grammar (as object) + $?GRAMMAR Grammar # current grammar $*GID Int # group id $*IN S16 IO # Standard input handle; is an IO object $*INC S11# where to search for user modules (but not std lib!) @@ -89,7 +91,7 @@ $*LANGS02 Str # LANG variable from %*ENV that defines what human language is used $?LINE Int # current line number in source file %*META-ARGS S19 Hash of XXX # Meta-arguments - $?MODULEModule # current module (as package object variable) + $?MODULEModule # current module %*OPTSS19 Hash of XXX # Options from command line %*OPT... S19 Hash of XXX # Options from command line to be passed down $?OSStr # operating system compiled for @@ -98,14 +100,14 @@ $*OSVER Str # operating system version running under $*OUT S16 IO # Standard output handle $?PARSER S02 Grammar # Which Perl grammar was used to parse this statement? - $?PACKAGE Package # current package (as package object variable) + $?PACKAGE Package # current package $?PERLS02 Str # Which Perl am I compiled for? $*PERL Str # perl version running under $*PID Int # system process id %=POD S02# (or some such) $*PROGRAM_NAME Str # name of the Perl program being executed ::?ROLE Str # current role (as package or type name) - $?ROLE Role # current role (as package object variable) + $?ROLE Role # current role ?ROUTINE S06 Routine # current sub or method (itself) $?SCOPE S02# Current my scope (XXX unnecessary?) $*UID Int # system user id
Re: Exceptions question
On Thu, 26 Feb 2009, Timothy S. Nelson wrote: My suggested solution would be to change $! to an exception container object. But then we have to use it in the implicit given in the CATCH block. If we used an any() Junction, would that do what we want? Ok, Moritz told me on IRC that this won't work. My next suggestion is to have @! be an array that replaces $! completely (freeing it up for $!foo things), and then have the CATCH block implicitly do: given(any(@!)) { ... } :) - | 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
Em Qui, 2009-02-26 às 22:26 +1100, Timothy S. Nelson escreveu: given(any(@!)) { } using junctions on exception handling doesn't seem like a good idea to me, because it is too much of a basic feature... but... for @! { } might provide the needed semantics... OTOH, I think it would be sane to have $! representing the last exception, so you can still use my $file = open 'file.txt' or die $!; no matter how many unthrown exceptions you have in that block. daniel
Re: Exceptions question
Em Qui, 2009-02-26 às 08:55 -0300, Daniel Ruoso escreveu: for @! {} might provide the needed semantics... After sending this mail I've just realized I don't know exactly which are the needed semantics... what happens if you have several unthrown exceptions in the block, does it throw every one of them? in sequence? autothreading? what happens if one CATCH handles one of the exception but only an outer CATCH handles the other? I'm not sure there is a sane way of having several unthrown exceptions at the same block, so I think the best thing we can do is to throw the first unthrown exception if a second exception happens... meaning... if $! is already set with an unhandled exception that exception is thrown. If that happens to be a resumable exception, the code can be resumed and the other exception will be stored in $! for a later evaluation. daniel
r25583 - docs/Perl6/Spec/S32-setting-library
Author: wayland Date: 2009-02-26 13:04:15 +0100 (Thu, 26 Feb 2009) New Revision: 25583 Added: docs/Perl6/Spec/S32-setting-library/Callable.pod Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod docs/Perl6/Spec/S32-setting-library/Exception.pod docs/Perl6/Spec/S32-setting-library/IO.pod docs/Perl6/Spec/S32-setting-library/Scalar.pod Log: Lots more stuff in S32. Documented Callable objects, and extended Containers a fair bit. Added little bits elsewhere in S32. Added: docs/Perl6/Spec/S32-setting-library/Callable.pod === --- docs/Perl6/Spec/S32-setting-library/Callable.pod (rev 0) +++ docs/Perl6/Spec/S32-setting-library/Callable.pod2009-02-26 12:04:15 UTC (rev 25583) @@ -0,0 +1,79 @@ +=encoding utf8 + +=head1 Title + +DRAFT: Synopsis 32: Setting Library - Executeable + +=head1 Version + + Author:Tim Nelson wayl...@wayland.id.au + Maintainer:Larry Wall la...@wall.org + Contributions: Tim Nelson wayl...@wayland.id.au + Date: 26 Feb 2009 + Last Modified: 26 Feb 2009 + Version: 1 + +The document is a draft. + +If you read the HTML version, it is generated from the pod in the pugs +repository under /docs/Perl6/Spec/S32-setting-library/Exception.pod so edit it there in +the SVN repository if you would like to make changes. + +This document documents Code, Block, Signature, Capture, Routine, Sub, Method, Submethod, +and Macro. + +=head1 Roles + +=head2 Callable + +role Callable {...} + +The CCallable role implies the ability +to support C postcircumfix:( ) . + +=head2 Code + +# Base class for all executable objects +role Code {...} + +=head2 Block + +# Executable objects that have lexical scopes +role Block does Code does Callable {...} + +=head2 Signature + +# Function parameters (left-hand side of a binding) +role Signature {...} + +=head2 Capture + +# Function call arguments (right-hand side of a binding) +role Capture does Positional does Associative {...} + +=head1 Classes + +=head2 Routine + +class Routine does Block {...} + +=head2 Sub + +class Sub isa Routine {...} + +=head2 Method + +class Method isa Routine {...} + +=head2 Submethod + +class Submethod isa Routine {...} # XXX or should this be isa Sub + +=head2 Macro + +class Macro isa Routine {...} + +=head1 Additions + +Please post errors and feedback to perl6-language. If you are making +a general laundry list, please separate messages by topic. Property changes on: docs/Perl6/Spec/S32-setting-library/Callable.pod ___ Added: svn:mergeinfo + Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 11:05:45 UTC (rev 25582) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 12:04:15 UTC (rev 25583) @@ -26,12 +26,22 @@ =head1 Function Roles -This documents List, Seq, Range, Set, Bag, Junction. +=head2 Positional -XXX So where are Seq, Range, Set, Bag? +role Positional {...} +The CPositional role implies the ability to support C postcircumfix:[ ] . + +=head2 Associative + +role Associative {...} + +The CAssociative role implies the ability to support C postcircumfix:{ } . + =head2 Container +role Container {...} + =over =item cat @@ -102,6 +112,8 @@ All these methods are defined in the CArray role/class. +role Array does Positional {...} + =over =item shape @@ -252,6 +264,8 @@ The following are defined in the CList role/class: +role List does Positional {...} + =over =item cat @@ -549,6 +563,8 @@ The following are defined in the CHash role. +role Hash does Associative {...} + =over 4 =item :delete @@ -638,6 +654,58 @@ =back +=head2 Tieable + +role Tieable {...} + +=head1 Classes + +This documents Buf, List, Seq, Range, Set, Bag, Junction, Array, Hash, KeyHash, KeySet, +KeyBag, Pair, and Mapping. + +XXX So where are they? Especially Set, Bag, KeyHash, KeySet, KeyBag, Pair, +and Mapping. + +=head2 Array + +class Array does Array {...} + +=head2 Seq + +class Seq does Positional {...} + +=head2 Range + +class Range does Positional {...} + +=head2 Buf + +class Buf does Positional {...} + +=head2 Hash + +class Hash does Hash {...} + +=head2 + +class Pair does Associative {...} + +=head2 + +class Mapping does Associative {...} + +=head2 + +class Set does Associative {...} + +=head2 + +class Bag does Associative {...} + +=head2 + +class KeyHash does Associative {...} + =head2 Junction All method calls on Junctions autohread if there's no such method in the Modified: docs/Perl6/Spec/S32-setting-library/Exception.pod === --- docs/Perl6/Spec/S32-setting-library/Exception.pod 2009-02-26 11:05:45 UTC (rev 25582)
Re: Exceptions question
On Thu, 26 Feb 2009, Daniel Ruoso wrote: Em Qui, 2009-02-26 às 08:55 -0300, Daniel Ruoso escreveu: for @! {} might provide the needed semantics... After sending this mail I've just realized I don't know exactly which are the needed semantics... what happens if you have several unthrown exceptions in the block, does it throw every one of them? in sequence? autothreading? what happens if one CATCH handles one of the exception but only an outer CATCH handles the other? I'm not sure there is a sane way of having several unthrown exceptions at the same block, so I think the best thing we can do is to throw the first unthrown exception if a second exception happens... meaning... if $! is already set with an unhandled exception that exception is thrown. If that happens to be a resumable exception, the code can be resumed and the other exception will be stored in $! for a later evaluation. Moritz suggested on IRC (in different words) that, as Match objects can do the Associative role, that maybe Exception objects could do the associative role as well. That would mean that we would retain $!, but would still have the others there, just as $/ is the most recent Match, but can also be a container of matches. That doesn't answer your question about how to handle multiple exceptions, though :). - | 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-
r25584 - docs/Perl6/Spec/S32-setting-library
Author: wayland Date: 2009-02-26 13:15:04 +0100 (Thu, 26 Feb 2009) New Revision: 25584 Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Container.pod fixes, based on IRC advice. Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 12:04:15 UTC (rev 25583) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 12:15:04 UTC (rev 25584) @@ -663,13 +663,8 @@ This documents Buf, List, Seq, Range, Set, Bag, Junction, Array, Hash, KeyHash, KeySet, KeyBag, Pair, and Mapping. -XXX So where are they? Especially Set, Bag, KeyHash, KeySet, KeyBag, Pair, -and Mapping. +XXX So where are KeySet and KeyBag. -=head2 Array - -class Array does Array {...} - =head2 Seq class Seq does Positional {...} @@ -682,10 +677,6 @@ class Buf does Positional {...} -=head2 Hash - -class Hash does Hash {...} - =head2 class Pair does Associative {...}
r25585 - docs/Perl6/Spec/S32-setting-library
Author: wayland Date: 2009-02-26 13:24:08 +0100 (Thu, 26 Feb 2009) New Revision: 25585 Added: docs/Perl6/Spec/S32-setting-library/Abstraction.pod Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Containers.pod: Got some composition straightened out Abstraction.pod: Documented these. Added: docs/Perl6/Spec/S32-setting-library/Abstraction.pod === --- docs/Perl6/Spec/S32-setting-library/Abstraction.pod (rev 0) +++ docs/Perl6/Spec/S32-setting-library/Abstraction.pod 2009-02-26 12:24:08 UTC (rev 25585) @@ -0,0 +1,44 @@ + +=encoding utf8 + +=head1 Title + +DRAFT: Synopsis 32: Setting Library - Abstraction + +=head1 Version + + Author:Tim Nelson wayl...@wayland.id.au + Maintainer:Larry Wall la...@wall.org + Contributions: Tim Nelson wayl...@wayland.id.au + Date: 26 Feb 2009 + Last Modified: 26 Feb 2009 + Version: 1 + +The document is a draft. + +If you read the HTML version, it is generated from the pod in the pugs +repository under /docs/Perl6/Spec/S32-setting-library/Abstraction.pod so edit it there in +the SVN repository if you would like to make changes. + +=head1 Roles + +=head2 Abstraction + +role Abstraction {...} + +=head1 Classes + +class Class does Abstraction {...} + +class Role does Abstraction {...} + +class Grammar does Abstraction {...} + +class Module does Abstraction {...} + +class Package does Abstraction {...} + +=head1 Additions + +Please post errors and feedback to perl6-language. If you are making +a general laundry list, please separate messages by topic. Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 12:15:04 UTC (rev 25584) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 12:24:08 UTC (rev 25585) @@ -108,163 +108,11 @@ =back -=head2 Array - -All these methods are defined in the CArray role/class. - -role Array does Positional {...} - -=over - -=item shape - - our Capture method shape (@array: ) is export - -Returns the declared shape of the array, as described in S09. - -=item end - - our Any method end (@array: ) is export - -Returns the final subscript of the first dimension; for a one-dimensional -array this simply the index of the final element. For fixed dimensions -this is the declared maximum subscript. For non-fixed dimensions (undeclared -or explicitly declared with C*), the index of the actual last element is used. - -=item elems - - our Int method elems (@array: ) is export - -Returns the length of the array counted in elements. (Sparse array -types should return the actual number of elements, not the distance -between the maximum and minimum elements.) - -=item delete - - our List method delete (@array : *...@indices ) is export - -Sets elements specified by C@indices in the invocant to a -non-existent state, as if they never had a value. Deleted elements at -the end of an Array shorten the length of the Array, unless doing so -would violate an Cis shape() definition. - -C@indices is interpreted the same way as subscripting is in terms of -slices and multidimensionality. See Synopsis 9 for details. - -Returns the value(s) previously held in deleted locations. - -An unary form is expected. See CHash::delete. - - -=item exists - - our Bool method exists (@array : Int *...@indices ) - -True if the specified Array element has been assigned to. This -is not the same as being defined. - -Supplying a different number of indices than invocant has dimensions is -an error. - -A unary form is expected. See CHash::delete. - - -=item pop - - our Scalar multi method pop ( @array: ) is export - -Remove the last element of C@array and return it. - -=item push - - our Int multi method push ( @array: *...@values ) is export - -Add to the end of C@array, all of the subsequent arguments. - -=item shift - - our Scalar multi method shift ( @array: ) is export - -Remove the first element from C@array and return it. - -=item splice - - our List multi method splice( @array is rw: Int $offset = 0, Int $size?, *...@values ) is export - -Csplice fills many niches in array-management, but its fundamental behavior -is to remove zero or more elements from an array and replace them with a -new (and potentially empty) list. This operation can shorten or lengthen -the target array. - -C$offset is the index of the array element to start with. It defaults -to C0. - -C$size is the number of elements to remove from C@array. It defaults -to removing the rest of the array from C$offset on. - -The slurpy list of values (if any) is then inserted at C$offset. - -Calling splice with a traditional parameter list, you must define C$offset -and C$size if you wish to pass a replacement list of values. To avoid -having to pass these otherwise optional parameters, use the piping operator(s): -
Re: Comparing inexact values (was Re: Temporal changes)
HaloO, Larry Wall wrote: 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); } This is strange. Having 1 == 1..3 and 3 == 1..3 as true is not what I expect. I think for consistency with lists and arrays a range should numify to the length of the list it represents. That is, we have 'a'..'z' == 26 and 4..6 == 3. Thinking of string ranges, how would infix ± treat these? 'm' ± 3 === 'j'..'p' seems reasonable albeit not overly useful. The overload infix:±:(Str,Ratio) will hardly work. BTW, here is a correct implementation of relative error range creation: multi infix:± (Num $x, Ratio $r -- Range of Num) { if $x == 0 { # range instead of plain 0 to comply with sig return 0..0; } elsif $x 0 { return $x * (1 + $r) ..^ $x * (1 - $r); } else { return $x * (1 - $r) ..^ $x * (1 + $r); } } The interesting thing is that 0 comes out as a special number that is exact as far as relative error goes. Note that it can't be subsumed by the other cases because that would produce 0..^0 which fails for 0 ~~ 0..^0 since that means 0 = 0 0 which is false. 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: Comparing inexact values (was Re: Temporal changes)
Em Qui, 2009-02-26 às 17:01 +0100, TSa escreveu: $y.error = 0.001; $x ~~ $y; Looking at this I just started wondering... why wouldn't that be made with: my $y = 10 but Imprecise(5%); $x ~~ $y; daniel
r25591 - docs/Perl6/Spec
Author: lwall Date: 2009-02-26 17:37:55 +0100 (Thu, 26 Feb 2009) New Revision: 25591 Modified: docs/Perl6/Spec/S03-operators.pod Log: 1-ary values for chaining operators should always be True even if negated Modified: docs/Perl6/Spec/S03-operators.pod === --- docs/Perl6/Spec/S03-operators.pod 2009-02-26 15:56:48 UTC (rev 25590) +++ docs/Perl6/Spec/S03-operators.pod 2009-02-26 16:37:55 UTC (rev 25591) @@ -12,9 +12,9 @@ Maintainer: Larry Wall la...@wall.org Date: 8 Mar 2004 - Last Modified: 24 Feb 2009 + Last Modified: 26 Feb 2009 Number: 3 - Version: 154 + Version: 155 =head1 Overview @@ -3795,9 +3795,8 @@ return that one argument. However, this default doesn't make sense for operators like C that don't return the same type as they take, so these kinds of operators overload the single-argument case -to return something more meaningful. All the comparison operators -return a boolean for either 1 or 0 arguments. Negated operators -return CBool::False, and all the rest return CBool::True. +to return something more meaningful. To be consistent with chaining +semantics, all the comparison operators return CBool::True for 1 or 0 arguments. You can also make a reduce operator of the comma operator. This is just the list operator form of the C circumfix:[ ] anonymous array composer: @@ -3833,7 +3832,7 @@ []() # all() [|]() # any() [^]() # one() -[!==]() # Bool::False (also for 1 arg) +[!==]() # Bool::True(also for 1 arg) [==]() # Bool::True(also for 1 arg) [before]() # Bool::True(also for 1 arg) [after]() # Bool::True(also for 1 arg) @@ -3842,23 +3841,23 @@ []() # Bool::True(also for 1 arg) [=]() # Bool::True(also for 1 arg) [~~]() # Bool::True(also for 1 arg) -[!~~]() # Bool::False (also for 1 arg) +[!~~]() # Bool::True(also for 1 arg) [eq]() # Bool::True(also for 1 arg) -[!eq]() # Bool::False (also for 1 arg) +[!eq]() # Bool::True(also for 1 arg) [lt]() # Bool::True(also for 1 arg) [le]() # Bool::True(also for 1 arg) [gt]() # Bool::True(also for 1 arg) [ge]() # Bool::True(also for 1 arg) [=:=]() # Bool::True(also for 1 arg) -[!=:=]()# Bool::False (also for 1 arg) +[!=:=]()# Bool::True(also for 1 arg) [===]() # Bool::True(also for 1 arg) -[!===]()# Bool::False (also for 1 arg) +[!===]()# Bool::True(also for 1 arg) [eqv]() # Bool::True(also for 1 arg) -[!eqv]()# Bool::False (also for 1 arg) +[!eqv]()# Bool::True(also for 1 arg) []() # Bool::True [||]() # Bool::False [^^]() # Bool::False -[//]() # undef +[//]() # Any [min]() # +Inf [max]() # -Inf [=]() # undef(same for all assignment operators) @@ -3957,6 +3956,9 @@ mean the normal reduction of C infix:\x operator, not the triangular reduction of C infix:x . This is deemed to be an insignificant problem. +Triangular reductions of chaining operators always consist of one or +more CTrue values followed by 0 or more CFalse values. + =head2 Cross operators The cross metaoperator, CX, may be followed by any infix operator.
Re: Comparing inexact values (was Re: Temporal changes)
TSa wrote: HaloO, Jon Lang wrote: �...@a[50%] # accesses the middle item in the list, since Whatever is set to the length of the list. I don't understand what you mean with setting Whatever. Whatever is a type that mostly behaves like Num and is used for overloaded postcircumfix:[ ]:(Array @self: Whatever $i). So *-1 just casts the -1. Postfix % would do the same for Ratio. Then one can overload postcircumfix[ ]:(Array @self: Ratio $r) and multiply $r with the size of the array to calculate the index. BTW, this indexing reminds me of the way how textures are indexd in OpenGL. With that in mind the index ratio could also interpolate between entries of a texture array. I'm not certain about the exact mechanism to use; all I know for certain is that I want a kind of dwimmery with postfix:% that returns a percentage of some other value when it's reasonably easy to decide what that other value should be, and a percentage of the number one otherwise. Perhaps that _is_ best handled by means of a Ratio type (or whatever), perhaps not. If so, I think that Rat (as in a Rational Number) should be kept distinct from Ratio (as in a portion of something else). Perhaps the latter should be called a Portion rather than a Ratio. So here comes some rant about Num as the type that in contrast to Rat carries an approximation error and an approximation closure that can be called to decrease the error. That is e.g. sqrt(2) returns such a thing that can be called again to continue the iteration. Numeric equality checks would then not only compare the approximate values but also the identity of the iteration closure. Whereas ~~ would check if the lhs number's interval falls into the range of the rhs which is build from the current approximation and the error. The approximation closure is never invoked by ~~. Infix ± would then not create a range but a Num with explicit error. I'm not sold on the notion that Num should represent a range of values (and I use range here in its mathematical sense of any number that's between the given lower and upper bounds, as opposed to its Perlish sense of a discrete list of numbers). However, I _do_ like the idea of distinguishing between is exactly equal to and is approximately equal to; and tracking the margin of error would be essential to getting the latter option to work. Another question is if we define some arithmetic on these closures so that asin(sin(2)) == 2 exactly. I don't know how relevant this is; but this sounds like the sort of optimization that pure functional programming allows for - that is, if the compiler ever sees a call like asin(sin($x)), it might optimize the code by just putting $x in there directly, and bypassing both the sin and asin calls - but only because both sin and asin are pure functions (i.e., they don't produce any side effects). As well, I have a certain fondness for the idea of lazy evaluation of mathematical functions (and pure functions in general), on the premise that whenever you actually carry out an operation such as sqrt or sin, you potentially introduce some error into the value with which you're working; and if you postpone the calculation long enough, you may find that you don't need to perform it at all (such as in the aforementioned asin(sin(2)) example). -- Jonathan Dataweaver Lang
Re: Comparing inexact values (was Re: Temporal changes)
Daniel Ruoso wrote: Em Qui, 2009-02-26 às 17:01 +0100, TSa escreveu: $y.error = 0.001; $x ~~ $y; Looking at this I just started wondering... why wouldn't that be made with: my $y = 10 but Imprecise(5%); $x ~~ $y; That's not bad; I like it. -- Jonathan Dataweaver Lang
Re: Comparing inexact values (was Re: Temporal changes)
On 2009 Feb 26, at 13:00, Jon Lang wrote: I'm not sold on the notion that Num should represent a range of values Arguably a range is the only sane meaning of a floating point number. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH PGP.sig Description: This is a digitally signed message part
Re: Comparing inexact values (was Re: Temporal changes)
I don't know how relevant this is; but this sounds like the sort of optimization that pure functional programming allows for - that is, if the compiler ever sees a call like asin(sin($x)), it might optimize the code by just putting $x in there directly, and bypassing both the sin and asin calls - but only because both sin and asin are pure functions (i.e., they don't produce any side effects). Don't get too hung up on that example. If $x is 2*pi, asin(sin($x)) would return 0.0 and not 2*pi. -- -- From the U S of A, the only socialist country that refuses to admit it. --
Re: Comparing inexact values (was Re: Temporal changes)
Jon Lang wrote: TSa wrote: Jon Lang wrote: �...@a[50%] # accesses the middle item in the list, since Whatever is set to the length of the list. I don't understand what you mean with setting Whatever. Whatever is a type that mostly behaves like Num and is used for overloaded postcircumfix:[ ]:(Array @self: Whatever $i). So *-1 just casts the -1. Postfix % would do the same for Ratio. Then one can overload postcircumfix[ ]:(Array @self: Ratio $r) and multiply $r with the size of the array to calculate the index. BTW, this indexing reminds me of the way how textures are indexd in OpenGL. With that in mind the index ratio could also interpolate between entries of a texture array. I'm not certain about the exact mechanism to use; all I know for certain is that I want a kind of dwimmery with postfix:% that returns a percentage of some other value when it's reasonably easy to decide what that other value should be, and a percentage of the number one otherwise. Perhaps that _is_ best handled by means of a Ratio type (or whatever), perhaps not. If so, I think that Rat (as in a Rational Number) should be kept distinct from Ratio (as in a portion of something else). Perhaps the latter should be called a Portion rather than a Ratio. Another possible approach would be to define postfix:% as returning a code block: sub postfix:%(Num $x) generates { $x / 100 * ($_ \\ 1.0) } This would allow it to partake of nearly all of the same dwimmery of which Whatever can partake, save for the purely Whatever stuff. Brandon S. Allbery wrote: Jon Lang wrote: I'm not sold on the notion that Num should represent a range of values Arguably a range is the only sane meaning of a floating point number. Perhaps; but a Num is not necessarily a floating point number - at least, it shouldn't always be. Doug McNutt wrote: Jon Lang wrote: I don't know how relevant this is; but this sounds like the sort of optimization that pure functional programming allows for - that is, if the compiler ever sees a call like asin(sin($x)), it might optimize the code by just putting $x in there directly, and bypassing both the sin and asin calls - but only because both sin and asin are pure functions (i.e., they don't produce any side effects). Don't get too hung up on that example. If $x is 2*pi, asin(sin($x)) would return 0.0 and not 2*pi. True enough: asin is not the inverse function of sin, although it's probably as close as you can get. And even there, some sort of compiler optimization could potentially be done, replacing the composition of asin and sin (both of which have the potential to intensify error) with a normalization of the value into the -pi ..^ pi range (which might also introduce error). -- Jonathan Dataweaver Lang
Help re-building rakudo
I have rakudo built under my parrot directory. I updated and rebuilt parrot, then updated and rebuilt rakudo, but rakudo won ~/parrot $ svn up (lots of files update) ~/parrot $ gmake (parrot re-builds OK) ~/parrot $ cd languages/rakudo/ ~/parrot/languages/rakudo $ git pull (files update) ~/parrot/languages/rakudo $ gmake /home/yary/parrot/parrot /home/yary/parrot/runtime/parrot/library/PGE/Perl6Grammar.pbc \ --output=src/gen_grammar.pir \ src/parser/grammar.pg src/parser/grammar-oper.pg /home/yary/parrot/parrot /home/yary/parrot/compilers/nqp/nqp.pbc --output=src/gen_actions.pir \ --encoding=fixed_8 --target=pir src/parser/actions.pm cd src/pmc perl /home/yary/parrot/tools/build/dynpmc.pl generate perl6str objectref perl6scalar mutablevar perl6multisub cd src/pmc perl /home/yary/parrot/tools/build/dynpmc.pl compile perl6str objectref perl6scalar mutablevar perl6multisub cc -c -o perl6str.o -I/home/yary/parrot/include -I/home/yary/parrot/src/pmc -fno-delete-null-pointer-checks -pipe -I/usr/local/include -pthread -DHASATTRIBUTE_CONST -DHASATTRIBUTE_DEPRECATED -DHASATTRIBUTE_MALLOC -DHASATTRIBUTE_NONNULL -DHASATTRIBUTE_NORETURN -DHASATTRIBUTE_PURE -DHASATTRIBUTE_UNUSED -falign-functions=16 -maccumulate-outgoing-args -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization -Wendif-labels -Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winline -Wmissing-braces -Wno-missing-format-attribute -Wpacked -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wswitch-default -Wtrigraphs -Wundef -Wunknown-pragmas -Wno-unused -Wwrite-strings -Wbad-function-cast -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wnonnull -DPIC -fPIC -g -DHAS_JIT -DI386 -DHAVE_COMPUTED_GOTO perl6str.c ./perl6str.pmc: In function `Parrot_Perl6Str_decrement': ./perl6str.pmc:372: error: `Parrot_Perl6Str_attributes' undeclared (first use in this function) ./perl6str.pmc:372: error: (Each undeclared identifier is reported only once ./perl6str.pmc:372: error: for each function it appears in.) ./perl6str.pmc:372: error: `attrs' undeclared (first use in this function) ./perl6str.pmc:372: warning: implicit declaration of function `PARROT_PERL6STR' ./perl6str.pmc: In function `Parrot_Perl6Str_get_number': ./perl6str.pmc:124: error: `Parrot_Perl6Str_attributes' undeclared (first use in this function) ./perl6str.pmc:124: error: `attrs' undeclared (first use in this function) ./perl6str.pmc: In function `Parrot_Perl6Str_increment': ./perl6str.pmc:276: error: `Parrot_Perl6Str_attributes' undeclared (first use in this function) ./perl6str.pmc:276: error: `attrs' undeclared (first use in this function) compile perl6str.c failed (256) gmake: *** [src/pmc/perl6_group.so] Error 2 Something is looking for Parrot_Perl6Str_attributes but can't find it? Is there something I need to do after git pull? Any other tips? thanks in advance -y
Re: Help re-building rakudo
On Thu, Feb 26, 2009 at 11:53:21AM -0800, yary wrote: I have rakudo built under my parrot directory. I updated and rebuilt parrot, then updated and rebuilt rakudo, but rakudo won A longer announcement should be hitting the list later today, but for now the recommended build sequence for rakudo is: $ git clone git://github.org/rakudo/rakudo.git $ cd rakudo $ perl Configure.pl --gen-parrot $ make The --gen-parrot option to Configure.pl causes it to automatically download and build the appropriate Parrot revision for whatever version of Rakudo you happen to have. If you get a later version of Rakudo, you can re-invoke Configure.pl with --gen-parrot to build a new version of Parrot if necessary. (If the version you already have is sufficient, then --gen-parrot just uses that.) Hopefully this will make things easier for people wanting to use Rakudo, and it's the method I recommend from now on. Going back to the original post: ~/parrot $ svn up (lots of files update) ~/parrot $ gmake (parrot re-builds OK) ~/parrot $ cd languages/rakudo/ ~/parrot/languages/rakudo $ git pull (files update) ~/parrot/languages/rakudo $ gmake [...] Is there something I need to do after git pull? Any other tips? You probably needed to do another Configure.pl invocation prior to the gmake step here, so that Rakudo's Makefile is updated. Also, if building Rakudo from inside a Parrot tree (which we're no longer really doing any longer), it's a really good idea to do make realclean for both Rakudo and Parrot prior to building. Otherwise it's easy for things to become out-of-sync. Or better still, just use the --gen-parrot option described above, and let Configure.pl do all the work. :-) Pm
Re: Comparing inexact values (was Re: Temporal changes)
On Feb 26, 2009, at 14:27 , Jon Lang wrote: Jon Lang wrote: Brandon S. Allbery wrote: Jon Lang wrote: I'm not sold on the notion that Num should represent a range of values Arguably a range is the only sane meaning of a floating point number. Perhaps; but a Num is not necessarily a floating point number - at least, it shouldn't always be. But that's not the point; it's can be that matters, not must be. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon universityKF8NH
Re: Help re-building rakudo
OK, I'll try some/all of the suggestions. I have a few comments- On Thu, Feb 26, 2009 at 12:06 PM, Patrick R. Michaud pmich...@pobox.com wrote: ... A longer announcement should be hitting the list later today, but for now the recommended build sequence for rakudo is: $ git clone git://github.org/rakudo/rakudo.git I'm new to git- if there's already a rakudo directory, will git clone also be good for updating it? Or is the recommendation to build from scratch each time there's a new release? ... Also, if building Rakudo from inside a Parrot tree (which we're no longer really doing any longer), Hope your announce also includes an update to http://perlgeek.de/blog-en/perl-6/where-rakudo-lives.writeback which lists Rakudo inside Parrot first. Conceptually I prefer Rakudo under Parrot, as it emphasizes that Rakudo is one parrot-compatible language implementation among many. I also understand how it's easier to keep the dependencies in sync when Parrot is under Rakudo instead, so won't protest any further. -y
Re: Help re-building rakudo
On Thu, Feb 26, 2009 at 10:06:53PM +0100, Moritz Lenz wrote: But after that please do a 'make clean; perl Configure.pl' to make sure that the fallout of the previous build don't affect the new one. I've been thinking that Configure.pl should force a 'make clean' to avoid the problem altogether. Pm
Re: Comparing inexact values (was Re: Temporal changes)
On Thu, 26 Feb 2009, Jon Lang wrote: asin is not the inverse function of sin, although it's probably as close as you can get. And even there, some sort of compiler optimization could potentially be done, replacing the composition of asin and sin (both of which have the potential to intensify error) with a normalization of the value into the -pi ..^ pi range (which might also introduce error). Hmmm ... the normal mathematical range of arc-sine is (-π,+π], rather than [-π,+π), especially where complex numbers are concerned: arg(-1) == +π. (Well, so much for consistently using lower half-open ranges.) -Martin
Re: Comparing inexact values (was Re: Temporal changes)
Martin D Kealey wrote: On Thu, 26 Feb 2009, Jon Lang wrote: asin is not the inverse function of sin, although it's probably as close as you can get. And even there, some sort of compiler optimization could potentially be done, replacing the composition of asin and sin (both of which have the potential to intensify error) with a normalization of the value into the -pi ..^ pi range (which might also introduce error). Hmmm ... the normal mathematical range of arc-sine is (-π,+π], rather than [-π,+π), especially where complex numbers are concerned: arg(-1) == +π. (Well, so much for consistently using lower half-open ranges.) ...you're right. Sorry; my error. -- Jonathan Dataweaver Lang
r25601 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-27 03:44:46 +0100 (Fri, 27 Feb 2009) New Revision: 25601 Modified: docs/Perl6/Spec/S03-operators.pod docs/Perl6/Spec/S29-functions.pod docs/Perl6/Spec/S32-setting-library/Callable.pod docs/Perl6/Spec/S32-setting-library/Containers.pod docs/Perl6/Spec/S32-setting-library/Str.pod Log: - Standardised on .signature vs. .sig - Added some things to S29/S32 that Masak highlighted needed to be added Modified: docs/Perl6/Spec/S03-operators.pod === --- docs/Perl6/Spec/S03-operators.pod 2009-02-26 23:53:35 UTC (rev 25600) +++ docs/Perl6/Spec/S03-operators.pod 2009-02-27 02:44:46 UTC (rev 25601) @@ -3096,7 +3096,7 @@ Any Type type membership $_.does(X) Signature Signature sig compatibility $_ is a subset of X ??? -Code Signature sig compatibility $_.sig is a subset of X ??? +Code Signature sig compatibility $_.signature is a subset of X ??? Capture Signature parameters bindable $_ could bind to X (doesn't!) Any Signature parameters bindable |$_ could bind to X (doesn't!) Modified: docs/Perl6/Spec/S29-functions.pod === --- docs/Perl6/Spec/S29-functions.pod 2009-02-26 23:53:35 UTC (rev 25600) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 02:44:46 UTC (rev 25601) @@ -118,8 +118,8 @@ =item Ordering - subset KeyExtractor of Code where { .sig === :(Any -- Any) }; - subset Comparator of Code where { .sig === :(Any, Any -- Int ) }; + subset KeyExtractor of Code where { .signature === :(Any -- Any) }; + subset Comparator of Code where { .signature === :(Any, Any -- Int ) }; subset OrderingPair of Pair where { .left ~~ KeyExtractor .right ~~ Comparator }; subset Ordering where Signature | KeyExtractor | Comparator | OrderingPair | Whatever; Modified: docs/Perl6/Spec/S32-setting-library/Callable.pod === --- docs/Perl6/Spec/S32-setting-library/Callable.pod2009-02-26 23:53:35 UTC (rev 25600) +++ docs/Perl6/Spec/S32-setting-library/Callable.pod2009-02-27 02:44:46 UTC (rev 25601) @@ -34,12 +34,20 @@ =head2 Code # Base class for all executable objects -role Code {...} +role Code { + method Signature signature() {...} +} =head2 Block # Executable objects that have lexical scopes -role Block does Code does Callable {...} +role Block does Code does Callable { + method next() {...} + method last() {...} + method redo() {...} + method leave() {...} + method labels() {...} +} =head2 Signature Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-26 23:53:35 UTC (rev 25600) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 02:44:46 UTC (rev 25601) @@ -669,7 +669,13 @@ =head2 Range -class Range does Positional {...} +class Range does Positional { + method from() {...} + method to() {...} + method min() {...} + method max() {...} + method List minmax() {...} +} =head2 Buf Modified: docs/Perl6/Spec/S32-setting-library/Str.pod === --- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-26 23:53:35 UTC (rev 25600) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 02:44:46 UTC (rev 25601) @@ -503,6 +503,22 @@ =item unpack +=item match + + method Match match(Str $self: Regex $search); + +=item subst + + method subst(Str $self: Regex $search, Str $replacement); + +XXX Does this return a Match? A Str? + +=item trans + + method trans(Str $self: Str $key, Str $val); + + our multi trans(List of Pair %data); + =back =head1 Additions
Masak's S29 list
Here's my comments on Carl Masak's S29 list. Note that some of the things that say that they're now in something still need a lot of work. # Range objects have .from, .to, .min, .max and .minmax methods Now in S32/Containers.pod # .contains on Hash and Array Where's this from? # Code has a .sig Seems (from what I can tell) to be synonymous with .signature, so I standardised on .signature. # .ACCEPTS and .REJECTS on most everything -- provided by the Pattern role. Likely a mistake to put one under each section, though. Perhaps put one under Object and put a reference to S03. What does Pattern? Should we have Object does Pattern? # The cat contextualizer. There's a .cat() method on Container in Containers.pod. Is this what you want? # Object has .print and .say. Ok, this makes things difficult. The algorithm of these functions is obviously something like: 1. Object - Str 2. Output Str on handle Something that makes this interesting is, what happens when you call IO.print? At the moment, S16 says that this will print a string on the IO object. So to print the IO object itself, you would have to do the algorithm above manually. The obvious solution is to rename the function on the IO object to something like doprint, and have Object.print, Object.say, and Object.printf all call on IO.doprint. Where this starts to get difficult is that the IO object currently has input/output record/field separators specced on it. If the new algorithm converts an array to a string, it's obviously going to have to call on these. My question is, would we be better off having the string conversion routine for arrays worry about the input/output record/field separators, rather than the IO object? The downside I can see is that you couldn't have separate separators for different IO objects; you'd have to code specially if you wanted that functionality. Is this too much of a downside, or is it a good way to go? # Block types have .next, .last, .redo and .leave on them. These are also functions, and need to be specced as such. # Block also has a .labels method. Now in S32/Callable.pod # fail and .handled (the former is in S29, but has no signature/summary). Now in S32/Exceptions.pod. But note the role/class Failure double declaration. This is not allowed by the spec, but according to how I read the spec for Failure, that's how it has to be. Obviously I need someone to explain how Failure should *really* be implemented :). # .match, .subst and .trans from S05. Now in S32/Str.pod. But I wasn't sure what subst() returns. # Match objects: .from, .to, .chars, .orig and .text. # Match state objects: .pos. Now added to S32/Regex.pod The rest I'll leave for another time. - | 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: Masak's S29 list
On 2009-Feb-26, at 7:46 pm, Timothy S. Nelson wrote: # Object has .print and .say. [...] My question is, would we be better off having the string conversion routine for arrays worry about the input/output record/field separators, rather than the IO object? The downside I can see is that you couldn't have separate separators for different IO objects; you'd have to code specially if you wanted that functionality. What about having separators that exist in different scopes? Objects could define their own separators, or if they don't, default to those defined on the IO item, which in turn could default to whatever is defined in the current block, working outwards from there. This may also mean we don't need .print and .say methods on Object. Am I missing the reason why such methods would exist, other than to allow certain objects to define their own special distinctions between printing and saying (presumably because simply adding a newline wouldn't be suitable)? In that case, all the object would need to do is to define its own record-separator. -David
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] { [...] } On Wed, 26 Feb 2009, Larry Wall wrote: Oops, too late, by about 23 months. Please see S09. Aah yes! The hash-like syntax is much nicer! S09 (http://perlcabal.org/syn/S09.html#User-defined_array_indexing) saith: User-defined array indexing Any array may also be given a second set of user-defined indices, which need not be zero-based, monotonic, or even integers. Whereas standard array indices always start at zero, user-defined indices may start at any finite value of any enumerable type. Standard indices are always contiguous, but user-defined indices need only be distinct and in an enumerable sequence. But if the indexes are floating point values, do they have error margins? *Should* they have error margins? my @labels{ atan(1)*2, exp(1), (1+sqrt(5))/2 } = pi e golden-mean ; To define a set of user-defined indices, specify an explicit or enumerable list of the indices of each dimension (or the name of an enumerable type) in a set of curly braces immediately after the array name: my @dwarves{ 1..7 }; my @seasons{ Spring Summer Autumn Winter }; my enum Months «:Jan(1) Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec»; my @calendar{ Months; 1..31; 9..12,14..17 };# Business hours only Hmmm, that reminds me, I was going to ask about enum types that have implicit modulus: my enum Season «Spring Summer Autumn Winter»; my Season $s = Winter; ++$s; assert($s == Spring); -Martin
More S29/S32 Masak ideas
Apologies to Carl Masak for writing his name in ASCII. # context(). Added to S29, but I still don't know where these should go. Maybe on Block? # .wrap, .unwrap and .assuming. Added to S32/Callable. # callsame, callwith, nextsame, nextwith, lastcall. Didn't know where these should go, but probably the same place as context()/caller(). # VAR(), though a macro, could possibly get honourable mention. Added to S32/Scalar.pod # Method descriptor objects: .name, .signature, .as, .multi, .do. In Callable.pod .name is on Routine .signature is on Code .do is on Code (I'm guessing here) I'm not sure where the others go: .multi must be on something that gets it into Routine .as must be on something that gets it into Method (higher?) I'm guessing that .^methods should really return a bunch of Method objects. # Attribute descriptor objects: .name, .type, .scope, .rw, .private, .accessor, .build, .readonly. I wonder what type would be appropriate for an attribute descriptor object. I haven't done anything with these either. :) - | 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-
r25602 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-27 04:58:37 +0100 (Fri, 27 Feb 2009) New Revision: 25602 Added: docs/Perl6/Spec/S32-setting-library/Rules.pod Modified: docs/Perl6/Spec/S29-functions.pod docs/Perl6/Spec/S32-setting-library/Callable.pod docs/Perl6/Spec/S32-setting-library/Containers.pod docs/Perl6/Spec/S32-setting-library/Scalar.pod Log: More masak-inspired changes. Modified: docs/Perl6/Spec/S29-functions.pod === --- docs/Perl6/Spec/S29-functions.pod 2009-02-27 02:44:46 UTC (rev 25601) +++ docs/Perl6/Spec/S29-functions.pod 2009-02-27 03:58:37 UTC (rev 25602) @@ -205,6 +205,10 @@ See LS06/The Ccontext and Ccaller functions. +=item context + +See LS06/The Ccontext and Ccaller functions. + =item eval multi eval ( Str $code, Grammar :$lang = CALLER::$?PARSER) Modified: docs/Perl6/Spec/S32-setting-library/Callable.pod === --- docs/Perl6/Spec/S32-setting-library/Callable.pod2009-02-27 02:44:46 UTC (rev 25601) +++ docs/Perl6/Spec/S32-setting-library/Callable.pod2009-02-27 03:58:37 UTC (rev 25602) @@ -36,6 +36,8 @@ # Base class for all executable objects role Code { method Signature signature() {...} + method Code assuming(...) {...} + method do() {...} # See LS12/Introspection } =head2 Block @@ -59,12 +61,30 @@ # Function call arguments (right-hand side of a binding) role Capture does Positional does Associative {...} +=head2 WrapHandle + +role WrapHandle {...} + =head1 Classes =head2 Routine -class Routine does Block {...} +class Routine does Block { + method WrapHandle wrap(Code $code) {...} + method Routineunwrap(Wraphandle $original) {...} + method Strname() {...} +} +=item unwrap + +See LS06/Wrapping. + +=item wrap + + method wrap(Code $code) {...} + +See LS06/Wrapping. + =head2 Sub class Sub isa Routine {...} Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 02:44:46 UTC (rev 25601) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 03:58:37 UTC (rev 25602) @@ -681,23 +681,23 @@ class Buf does Positional {...} -=head2 +=head2 Pair class Pair does Associative {...} -=head2 +=head2 Mapping class Mapping does Associative {...} -=head2 +=head2 Set class Set does Associative {...} -=head2 +=head2 Bag class Bag does Associative {...} -=head2 +=head2 KeyHash class KeyHash does Associative {...} Added: docs/Perl6/Spec/S32-setting-library/Rules.pod === --- docs/Perl6/Spec/S32-setting-library/Rules.pod (rev 0) +++ docs/Perl6/Spec/S32-setting-library/Rules.pod 2009-02-27 03:58:37 UTC (rev 25602) @@ -0,0 +1,56 @@ + +=encoding utf8 + +=head1 Title + +DRAFT: Synopsis 32: Setting Library - Rules + +=head1 Version + + Author:Tim Nelson wayl...@wayland.id.au + Maintainer:Larry Wall la...@wall.org + Contributions: Tim Nelson wayl...@wayland.id.au + Date: 27 Feb 2009 + Last Modified: 27 Feb 2009 + Version: 1 + +The document is a draft. + +If you read the HTML version, it is generated from the pod in the pugs +repository under /docs/Perl6/Spec/S32-setting-library/Exception.pod so edit it there in +the SVN repository if you would like to make changes. + +=head1 Roles + +=head2 Regex + +role Regex {...} + +=head2 Match + +role Match { + method Int from() {...} + method Int to(){...} + method Int chars() {...} + method orig() {...} + method Str text() {...} +} + +=head2 Cursor + +role Cursor { + method Int pos() {...} + method orig() {...} +} + +=head2 Grammar + +See Abstractions.pod + +=head1 Additions + +Please post errors and feedback to perl6-language. If you are making +a general laundry list, please separate messages by topic. + + + Modified: docs/Perl6/Spec/S32-setting-library/Scalar.pod === --- docs/Perl6/Spec/S32-setting-library/Scalar.pod 2009-02-27 02:44:46 UTC (rev 25601) +++ docs/Perl6/Spec/S32-setting-library/Scalar.pod 2009-02-27 03:58:37 UTC (rev 25602) @@ -82,6 +82,10 @@ Perl 5's unary Cundef function is renamed Cundefine to avoid confusion with the value Cundef (which is always 0-ary now). +=item VAR + +This is not really a method, but some kind of macro. See LS12 for details. + =back =head1 Additions
Re: Masak's S29 list
On Thu, 26 Feb 2009, David Green wrote: On 2009-Feb-26, at 7:46 pm, Timothy S. Nelson wrote: # Object has .print and .say. [...] My question is, would we be better off having the string conversion routine for arrays worry about the input/output record/field separators, rather than the IO object? The downside I can see is that you couldn't have separate separators for different IO objects; you'd have to code specially if you wanted that functionality. What about having separators that exist in different scopes? Objects could define their own separators, or if they don't, default to those defined on the IO item, which in turn could default to whatever is defined in the current block, working outwards from there. This is interesting, but I think separators should probably just be defined in one place, whether this be Object, scopes, or IO. This may also mean we don't need .print and .say methods on Object. Am I missing the reason why such methods would exist, other than to allow certain objects to define their own special distinctions between printing and saying (presumably because simply adding a newline wouldn't be suitable)? In that case, all the object would need to do is to define its own record-separator. I would've suggested this, but this seems to be widely used. The specs write things like: (for 1..100 { $_ if .prime}).say I suspect 99% of objects will use the .print and .say methods from Object, and simply override stringification if they need to change things. :) - | 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: r25573 - in docs/Perl6/Spec: . S32-setting-library
On Fri, 27 Feb 2009, Martin D Kealey wrote: On Thu, 26 Feb 2009, pugs-comm...@feather.perl6.nl wrote: +The exceptions are: + + Signal Action R Comment + -- + ControlExceptionSigHUPTerm? Hangup detected on controlling terminal or death of controlling process [...] + ControlExceptionSigCHLD Ign ? Child stopped or terminated [...] + ControlExceptionSigURGIgn ? Urgent condition on socket (4.2BSD) [...] + ControlExceptionSigWINCH Ign ? Window resize signal (4.3BSD, Sun) [...] +XXX I'm unsure how the actions in the table above can be made to make sense. The Ign +actions are already dealt with because %SIG{CHLD}.exception already defaults to undef. +The Term action will probably be self-solving (ie. will terminate the process). The +others I'm just plain unsure about. XXX That looks a lot like a mangled version of man 7 signal from Linux. IMHO the default action shouldn't be specified at all by the Perl standard; it should simply refer to the appropriate external standard. It is a mangled signal(7), but the reason it's there is that I want it to become more Perl-specific. In particular, I want to have the R field filled in, so that I know which are to be resumeable. Also, as my understanding of the plan is that the low-level signal handling in perl6 will capture the signal, throw the exception, and then continue or something (cf. Larry's earlier message if what I just said doesn't make sense), then presumably we want to make the signal-caused exceptions do the same thing as they would've done if we hadn't handled them. Of course, I could be all confused again :). Also, by documenting this system of defaults, it will hopefully act as a beginning for user documentation :). In POSIX the settings terminate, ignore, catch and default have 3½ distinct meanings. For *most* signals default is the same as terminate (sometimes with a core), but not for all. Ok, I see that now. Probably the Action column should go, then, but I'd like to keep it until we figure out how to simulate the other actions in our signal/exception-handling code. In particular, for SIGCHLD, if you ignore it, the wait call will always fail (having delayed until all child processes have exited), whereas if you leave it as default, your process will still ignore it, but wait will work properly. Ok, I'll tell that one to throw the proper exception. We'll probably have to make it resumeable, and have PROCESS catch it if we can, unless a CONTROL block (ie. inside a wait()) gets it first. On some implementations SIGUSR1 and/or SIGUSR2 are ignored by default. Well, we're overriding everything we can, handling them, and creating exceptions. Core dumps are subject to ulimit controls, even when the signal in question would normally trigger them. Good point :). That'll be hard to simulate. Btw, I'm glad to have someone here who understands signals better than I do :). - | 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-
r25604 - in docs/Perl6/Spec: . S32-setting-library
Author: wayland Date: 2009-02-27 06:04:59 +0100 (Fri, 27 Feb 2009) New Revision: 25604 Modified: docs/Perl6/Spec/S16-io.pod docs/Perl6/Spec/S32-setting-library/Str.pod Log: Various small fixes, mostly to signals Modified: docs/Perl6/Spec/S16-io.pod === --- docs/Perl6/Spec/S16-io.pod 2009-02-27 04:28:08 UTC (rev 25603) +++ docs/Perl6/Spec/S16-io.pod 2009-02-27 05:04:59 UTC (rev 25604) @@ -106,7 +106,7 @@ SIGTERMControlExceptionSigTERM SIGUSR1ControlExceptionSigUSR1 SIGUSR2ControlExceptionSigUSR2 - SIGCHLDundef + SIGCHLDControlExceptionSigCHLD SIGCONTControlExceptionSigCONT SIGSTOPControlExceptionSigSTOP SIGTSTPControlExceptionSigTSTP @@ -116,7 +116,7 @@ SIGPROFControlExceptionSigPROF SIGSYS ControlExceptionSigSYS SIGTRAPControlExceptionSigTRAP - SIGURG undef + SIGURG Undefined SIGVTALRM ControlExceptionSigVTALRM SIGXCPUControlExceptionSigXCPU SIGXFSZControlExceptionSigXFSZ @@ -125,7 +125,7 @@ SIGIO ControlExceptionSigIO SIGPWR ControlExceptionSigPWR SIGLOSTControlExceptionSigLOST - SIGWINCH undef + SIGWINCH Undefined =head2 Signal exceptions @@ -163,7 +163,7 @@ ControlExceptionSigTERM Term? Termination signal ControlExceptionSigUSR1 Term? User-defined signal 1 ControlExceptionSigUSR2 Term? User-defined signal 2 - ControlExceptionSigCHLD Ign ? Child stopped or terminated + ControlExceptionSigCHLD Ign * Child stopped or terminated ControlExceptionSigCONT Cont* Continue if stopped ControlExceptionSigSTOP Stop? Stop process ControlExceptionSigTSTP Stop? Stop typed at tty Modified: docs/Perl6/Spec/S32-setting-library/Str.pod === --- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 04:28:08 UTC (rev 25603) +++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 05:04:59 UTC (rev 25604) @@ -3,7 +3,7 @@ =head1 Title -DRAFT: Synopsis 32: Setting Library - Miscellaneous Scalars +DRAFT: Synopsis 32: Setting Library - Str =head1 Version
Rakudo Perl development release #14 (Vienna)
On behalf of the Rakudo development team, I'm pleased to announce the February 2009 development release of Rakudo Perl #14 Vienna. Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine [1]. The tarball for the February 2009 release is available from http://www.pmichaud.com/perl6/rakudo-2009-02.tar.gz However, because of the rapid pace of Rakudo development and addition of new features, we still recommend that people wanting to use or work with Rakudo obtain the latest version directly from the main repository at github -- more on this in a bit. This is the fourteenth development release of Rakudo Perl, but it's the first release independent from Parrot releases. We will continue to follow a monthly release cycle, with each release to be code named after a Perl Mongers group. This release is named for Vienna.pm (http://vienna.pm.org), who have been sponsoring Jonathan Worthington's work on Rakudo since April 2008. A list of the other planned release dates and codenames for 2009 is available in the docs/release_guide.pod file. In general, Rakudo development releases are scheduled to occur two days after each Parrot monthly release. Parrot releases the third Tuesday of each month. Rakudo Perl now uses git [2] for its version control system, hosted at http://github.com/rakudo/rakudo . The README file there is kept up-to-date with the latest instructions for obtaining and building Rakudo Perl. In this release of Rakudo Perl, we've made the following major changes and improvements: * Rakudo is now passing 7076 spectests. This is an increase of 796 passing tests since the January 2009 release. * The Configure.pl script supports a --gen-parrot option to automatically fetch and build the appropriate version of Parrot. * The default make target now builds a binary executable directly, either perl6 or perl6.exe. It's still a Parrot fakecutable, but we think we've made it more reliable so that it doesn't generate segmentation faults on exits. (If you don't know what a fakecutable is you can safely ignore this.) * Many builtins are beginning to be written in pure Perl 6, or Perl 6 functions with inline PIR. These builtins are part of the core setting for Perl 6, and appear in the src/setting/ directory. Previously this was known as the prelude. * Improved Test.pm diagnostic output. Also, Rakudo now implements the following Perl 6 features: * Anonymous classes may be specified using :: * Existing parameterized roles are now reused instead of creating new ones. * Roles pun a class when .new is invoked on them. * proto now marks all same-named routines as multi. * XopX is now Xop. * - (rw) pointy blocks. * min= and max= metaoperators. * Many many bugfixes and documentation improvements. The development team thanks all of our contributors and sponsors for making Rakudo Perl possible. The next release of Rakudo (#15) is scheduled for March 19, 2009. References: [1] Parrot, http://parrot.org/ [2] Git version control system, http://git-scm.org/
Rakudo Perl development release #14 (Vienna)
On behalf of the Rakudo development team, I'm pleased to announce the February 2009 development release of Rakudo Perl #14 Vienna. Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine [1]. The tarball for the February 2009 release is available from http://www.pmichaud.com/perl6/rakudo-2009-02.tar.gz However, because of the rapid pace of Rakudo development and addition of new features, we still recommend that people wanting to use or work with Rakudo obtain the latest version directly from the main repository at github -- more on this in a bit. This is the fourteenth development release of Rakudo Perl, but it's the first release independent from Parrot releases. We will continue to follow a monthly release cycle, with each release to be code named after a Perl Mongers group. This release is named for Vienna.pm (http://vienna.pm.org), who have been sponsoring Jonathan Worthington's work on Rakudo since April 2008. A list of the other planned release dates and codenames for 2009 is available in the docs/release_guide.pod file. In general, Rakudo development releases are scheduled to occur two days after each Parrot monthly release. Parrot releases the third Tuesday of each month. Rakudo Perl now uses git [2] for its version control system, hosted at http://github.com/rakudo/rakudo . The README file there is kept up-to-date with the latest instructions for obtaining and building Rakudo Perl. In this release of Rakudo Perl, we've made the following major changes and improvements: * Rakudo is now passing 7076 spectests. This is an increase of 796 passing tests since the January 2009 release. * The Configure.pl script supports a --gen-parrot option to automatically fetch and build the appropriate version of Parrot. * The default make target now builds a binary executable directly, either perl6 or perl6.exe. It's still a Parrot fakecutable, but we think we've made it more reliable so that it doesn't generate segmentation faults on exits. (If you don't know what a fakecutable is you can safely ignore this.) * Many builtins are beginning to be written in pure Perl 6, or Perl 6 functions with inline PIR. These builtins are part of the core setting for Perl 6, and appear in the src/setting/ directory. Previously this was known as the prelude. * Improved Test.pm diagnostic output. Also, Rakudo now implements the following Perl 6 features: * Anonymous classes may be specified using :: * Existing parameterized roles are now reused instead of creating new ones. * Roles pun a class when .new is invoked on them. * proto now marks all same-named routines as multi. * XopX is now Xop. * - (rw) pointy blocks. * min= and max= metaoperators. * Many many bugfixes and documentation improvements. The development team thanks all of our contributors and sponsors for making Rakudo Perl possible. The next release of Rakudo (#15) is scheduled for March 19, 2009. References: [1] Parrot, http://parrot.org/ [2] Git version control system, http://git-scm.org/
Range and continuous intervals
I don't know if this was previously discussed and dismissed but ... Inspired by some recent discussion in the comparing inexact values thread plus some temporal discussion and some older thoughts ... I was thinking that Perl 6 ought to have a generic interval type that is conceptually like Range, in that it is defined using a pair of values of an ordered type and includes all the values between those, but unlike Range that type is not expected to have discrete consecutive values that can be iterated over. I'm thinking of a Range-alike that one could use with Rat|Num or Instant etc, and not just Int etc. There would be operators to test membership of a value in the interval, and set-like operators to compare or combine intervals, such as is_inside, is_subset, is_overlap, union, intersection, etc. Such an interval would be what you use for inexact matching and would be the result of a ± infix operator or % postfix operator. Also, as Range has a .. constructor, this other type should have something. Now, ideally the type would also support discontinuous ranges, or maybe it would be best to have 2 types, one that is a single continuous range and the other which is a set of the first and supports discontinuous ranges. So, union|intersection etc would generally only work with the discontinuous version but the other operators could work with the continuous ones. In any event I only had closed-ended intervals in mind, and not open-ended ones. I'm thinking that at least the simpler continuous version of the range should be in core since it is generic in the way that Range is generic, and it is simple, and could be widely usable in common contexts such as fuzzy matching of numerics and instants. The noncontinuous version is less important, though quite useful. Barring a better name coming along, I suggest calling the type Interval, and it would be immutable. As for determination of where ranges overlap or not, eg whether a matching start and end point counts as an overlap or just an adjacency, this could be customizable (eg, an overlap if the ordered type is discrete like Int, and an adjacency if it is continuous like Rat|Num) unless there are general rules best applied generally. I cite the comparing inexact values for prior discussion of these matters, that don't necessarily need repeating. -- Darren Duncan
r25605 - docs/Perl6/Spec/S32-setting-library
Author: wayland Date: 2009-02-27 07:46:09 +0100 (Fri, 27 Feb 2009) New Revision: 25605 Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod Log: Typo. martin++ Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod === --- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 05:04:59 UTC (rev 25604) +++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-02-27 06:46:09 UTC (rev 25605) @@ -703,7 +703,7 @@ =head2 Junction -All method calls on Junctions autohread if there's no such method in the +All method calls on Junctions autothread if there's no such method in the Junction class. =over 4
r25606 - docs/Perl6/Spec
Author: lwall Date: 2009-02-27 08:03:18 +0100 (Fri, 27 Feb 2009) New Revision: 25606 Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S12-objects.pod Log: some enum cleanup Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-02-27 06:46:09 UTC (rev 25605) +++ docs/Perl6/Spec/S02-bits.pod2009-02-27 07:03:18 UTC (rev 25606) @@ -12,9 +12,9 @@ Maintainer: Larry Wall la...@wall.org Date: 10 Aug 2004 - Last Modified: 25 Feb 2009 + Last Modified: 26 Feb 2009 Number: 2 - Version: 155 + Version: 156 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -2459,8 +2459,8 @@ Fat arrow Adverbial pair Paren form = == == -a = 1 :a -a = 0 :!a +a = True :a +a = False :!a a = 0 :a(0) a = $x :a($x) a = 'foo' :afoo :a(foo) Modified: docs/Perl6/Spec/S12-objects.pod === --- docs/Perl6/Spec/S12-objects.pod 2009-02-27 06:46:09 UTC (rev 25605) +++ docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:03:18 UTC (rev 25606) @@ -12,9 +12,9 @@ Maintainer: Larry Wall la...@wall.org Date: 27 Oct 2004 - Last Modified: 12 Feb 2009 + Last Modified: 26 Feb 2009 Number: 12 - Version: 69 + Version: 70 =head1 Overview @@ -1298,11 +1298,6 @@ my enum Day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; my enum Day Sun Mon Tue Wed Thu Fri Sat; -For any enum value the C.perl method will return its long name. -A numeric enum value numifies to its numeric value and stringifies to its short name. -A string enum value has no special numeric value, and stringifies to its string value -rather than its name. [XXX inconsistent] - If the first value is unspecified, it defaults to 0. To specify the first value, use pair notation (see below). @@ -1316,6 +1311,23 @@ my Int enum day ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; my enum day of uint4 Sun Mon Tue Wed Thu Fri Sat; +For any enum value of an object type, the object itself knows its own +type, so the C.perl method will return its long name, while C.name +returns its short name. Other than that, number valued enums act +just like numbers, while string valued enums act just like strings. + +Enums based on native types may be used only for their value, since a +native value doesn't know its own type. To translate such a value back to its name +requires a call to the name method, which must be qualified by the type: + +3.day::name # returns Wed + +Alternatively, native types may be placed in a typed variable, which determines +which method to call: + +my day $d = 3; +$d.name # returns Wed + An anonymous enum just makes sure each string turns into a pair with sequentially increasing values, so: @@ -1414,11 +1426,11 @@ Two built-in enums are: -our bit enum Bool False True; -our bit enum Taint Untainted Tainted; +our Bit enum Bool False True; +our Bit enum Taint Untainted Tainted; Note that CBool and CTaint are really role names, and the enum -values are really subset types of the Cbit integer type. You can +values are really subset types of the CBit integer type. You can call the C.Bool coercion or the Ctrue function or the C? prefix operator on any built-in type, but the value returned is of type Cbit. Never compare a value to Ctrue, or even CTrue.
Re: Rakudo Perl development release #14 (Vienna)
On Thu, Feb 26, 2009 at 22:04, Patrick R. Michaud pmich...@pobox.com wrote: On behalf of the Rakudo development team, I'm pleased to announce the February 2009 development release of Rakudo Perl #14 Vienna. Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine [1]. The tarball for the February 2009 release is available from http://www.pmichaud.com/perl6/rakudo-2009-02.tar.gz However, because of the rapid pace of Rakudo development and addition of new features, we still recommend that people wanting to use or work with Rakudo obtain the latest version directly from the main repository at github -- more on this in a bit. This is the fourteenth development release of Rakudo Perl, but it's the first release independent from Parrot releases. We will continue to follow a monthly release cycle, with each release to be code named after a Perl Mongers group. This release is named for Vienna.pm (http://vienna.pm.org), who have been sponsoring Jonathan Worthington's work on Rakudo since April 2008. A list of the other planned release dates and codenames for 2009 is available in the docs/release_guide.pod file. In general, Rakudo development releases are scheduled to occur two days after each Parrot monthly release. Parrot releases the third Tuesday of each month. Rakudo Perl now uses git [2] for its version control system, hosted at http://github.com/rakudo/rakudo . The README file there is kept up-to-date with the latest instructions for obtaining and building Rakudo Perl. In this release of Rakudo Perl, we've made the following major changes and improvements: * Rakudo is now passing 7076 spectests. This is an increase of 796 passing tests since the January 2009 release. * The Configure.pl script supports a --gen-parrot option to automatically fetch and build the appropriate version of Parrot. * The default make target now builds a binary executable directly, either perl6 or perl6.exe. It's still a Parrot fakecutable, but we think we've made it more reliable so that it doesn't generate segmentation faults on exits. (If you don't know what a fakecutable is you can safely ignore this.) * Many builtins are beginning to be written in pure Perl 6, or Perl 6 functions with inline PIR. These builtins are part of the core setting for Perl 6, and appear in the src/setting/ directory. Previously this was known as the prelude. * Improved Test.pm diagnostic output. Also, Rakudo now implements the following Perl 6 features: * Anonymous classes may be specified using :: * Existing parameterized roles are now reused instead of creating new ones. * Roles pun a class when .new is invoked on them. * proto now marks all same-named routines as multi. * XopX is now Xop. * - (rw) pointy blocks. * min= and max= metaoperators. * Many many bugfixes and documentation improvements. The development team thanks all of our contributors and sponsors for making Rakudo Perl possible. The next release of Rakudo (#15) is scheduled for March 19, 2009. References: [1] Parrot, http://parrot.org/ [2] Git version control system, http://git-scm.org/ congratulations, patrick. this is a *giant* step for rakudo, and by extension for parrot. the first independent release of a parrot-based perl 6 has now landed--and it's already passing 40% of the official spec test suite. rakudo has a strong and growing community of developers, testers, and contributors, and this is due in no small part to a lead developer who never seems to run out of enthusiasm, isn't afraid to take a step back and refactor to get things right, and leads by stellar example. i expect your attitude and enthusiasm will continue to foster this burdgeoning community into a true representation of perl 6 culture, and will carry forward to ensure the continued success of rakudo and perl 6. i hope you will take a little time and reflect on what you've accomplished, before you get back into the thick of things. speaking as both a developer and a sponsor of rakudo, i'd like to thank you for your invaluable contributions, without which we'd be, in a word, lost. ~jerry
r25607 - docs/Perl6/Spec
Author: lwall Date: 2009-02-27 08:39:57 +0100 (Fri, 27 Feb 2009) New Revision: 25607 Modified: docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S12-objects.pod Log: deprecate is also and is instead in favor of augment and supersede declarators Modified: docs/Perl6/Spec/S06-routines.pod === --- docs/Perl6/Spec/S06-routines.pod2009-02-27 07:03:18 UTC (rev 25606) +++ docs/Perl6/Spec/S06-routines.pod2009-02-27 07:39:57 UTC (rev 25607) @@ -13,9 +13,9 @@ Maintainer: Larry Wall la...@wall.org Date: 21 Mar 2003 - Last Modified: 24 Feb 2009 + Last Modified: 26 Feb 2009 Number: 6 - Version: 103 + Version: 104 This document summarizes Apocalypse 6, which covers subroutines and the @@ -239,7 +239,8 @@ Redefining a stub subroutine does not produce an error, but redefining an already-defined subroutine does. If you wish to redefine a defined sub, -you must explicitly use the Cis instead trait. +you must explicitly use the Csupersede declarator. (The compiler may +refuse to do this if it has already commited to the previous definition.) The C... is the yadayadayada operator, which is executable but returns a failure. You can also use C??? to produce a warning, or C!!! to Modified: docs/Perl6/Spec/S12-objects.pod === --- docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:03:18 UTC (rev 25606) +++ docs/Perl6/Spec/S12-objects.pod 2009-02-27 07:39:57 UTC (rev 25607) @@ -14,7 +14,7 @@ Date: 27 Oct 2004 Last Modified: 26 Feb 2009 Number: 12 - Version: 70 + Version: 71 =head1 Overview @@ -1463,15 +1463,16 @@ you can add more methods to them, though you have to be explicit that that is what you're doing: -class Object is also { +augment class Object { method wow () { say Wow, I'm an object. } } Otherwise you'll get a class redefinition error. (Also, to completely -replace a definition, use Cis instead instead of Cis also...but -don't do that.) +replace a definition, use Csupersede instead of Caugment...but +don't do that, since the compiler may have already committed to +optimizations based on the old definition.) -In order to discourage casual misuse of these traits, they are not +In order to discourage casual misuse of these declarators, they are not allowed on global classes unless you put a special declaration at the top: use MONKEY_PATCHING;
r25609 - docs/Perl6/Spec
Author: lwall Date: 2009-02-27 08:42:32 +0100 (Fri, 27 Feb 2009) New Revision: 25609 Modified: docs/Perl6/Spec/S06-routines.pod Log: typo Modified: docs/Perl6/Spec/S06-routines.pod === --- docs/Perl6/Spec/S06-routines.pod2009-02-27 07:40:26 UTC (rev 25608) +++ docs/Perl6/Spec/S06-routines.pod2009-02-27 07:42:32 UTC (rev 25609) @@ -240,7 +240,7 @@ Redefining a stub subroutine does not produce an error, but redefining an already-defined subroutine does. If you wish to redefine a defined sub, you must explicitly use the Csupersede declarator. (The compiler may -refuse to do this if it has already commited to the previous definition.) +refuse to do this if it has already committed to the previous definition.) The C... is the yadayadayada operator, which is executable but returns a failure. You can also use C??? to produce a warning, or C!!! to