Re: pod variables?

2009-02-27 Thread Darren Duncan

Jon Lang wrote:

Under the section about twigils in S02, "$=var" is described as a "pod
variable".  I'm not finding any other references to pod variables;
what are tey, and how are they used?  (In particular, I'm wondering if
they're a fossil; if they aren't, I'd expect further information about
them to be in S26.)


The principle of pod variables as I recall them discussed a few years ago is 
that it is a way for code to programmatically access its own documentation, such 
as, for example code introspecting a routine could also print out the 
documentation for that routine, I suppose.  Whatever it was, it sounded useful 
at the time. -- Darren Duncan


pod variables?

2009-02-27 Thread Jon Lang
Under the section about twigils in S02, "$=var" is described as a "pod
variable".  I'm not finding any other references to pod variables;
what are tey, and how are they used?  (In particular, I'm wondering if
they're a fossil; if they aren't, I'd expect further information about
them to be in S26.)

-- 
Jonathan "Dataweaver" Lang


Re: Range and continuous intervals

2009-02-27 Thread Jon Lang
On Fri, Feb 27, 2009 at 1:19 AM, Darren Duncan  wrote:
> Jon, I like all of your stated ideas in general.  I also don't care about
> the postfix %; that was just a concept example pulled from the inexact
> comparison thread.  The idea of using zero is also appropriate conceptually
> with shades of how calculus works.  I actually prefer the existing Range
> constructor of .. visually, as long as it works unambiguously in both roles.

Yeah; I was thinking of calculus when I made that suggestion; still,
it's intuitive enough of an approach that I don't think that someone
who lacks calculus training would have a problem with it.  And I was
aiming for an unambiguous way of distinguishing between Range
construction and Interval construction.

>  It does make a lot of sense for Range to do Set.  So we just need some way,
> probably a role, to distinguish whether this broader definition of a set is
> enumerable or not on a case by case basis.  When talking about any/all/etc
> this also means that junctions would have to work with the non-enumerable
> set. -- Darren Duncan

I'm not sure that it [i]does[/i] make sense for Range to do Set: in
S02, Range is among the immutable types that are said to do
Positional, while Set is among the ones that are said to do
Associative; and I'm leery about mixing Positional and Associative
without good reason.

More generally, though, both Positional and Associative carry an
unstated assumption that the object in question will be using a
discrete type such as Int or Str as the index or key.  In the
abstract, what we're talking about here is how one would handle an
object that uses a continuous type such as Num as the index or key.
As mentioned before, "loop through the members" (or, in the case of
Junctions, "autothread the members") simply isn't feasible with a
continuous key.

One question is whether Intervals should be Positional (i.e.,
list-like) or Associative (i.e., Set-like).  The former has the
advantage that Ranges are Positional, meaning that Intervals would
conform closely to Ranges, which is the intuitive result of having
them share a constructor.  The latter is what we both jumped to when
we first considered the idea of Intervals in their own right: we want
the Set operations, which Positional objects don't have; and indices
aren't particularly useful for Intervals.

As well, your concept about "disjoint intervals" maps quite nicely to
a Set of Nums (or other continuous types such as Rat or Instant); with
that concept, I'm not sure that we would actually _need_ an Interval
type: we could just have the .. constructor return a Set of Num (or
Rat, or Instant, etc.) when the step is zero, and a Range object
otherwise.  This, of course, assumes that Set is up to the task of
handling the continuous nature of Num, and doesn't merely collect a
bunch of discrete points on the Num line.

So start by addressing the issue of how to handle continuous indices
and/or keys.  Are lists conceptually compatible with the notion of
continuous indices, or is the whole idea too much of a divergence from
the underlying concept?  A basic assumption about lists is that if you
provide custom indices for a list, they can be mapped one-to-one to
non-negative integers; and continuous values, by definition, cannot be
so mapped.  So I'd say that whether or not continuous indices in
general are viable, they are _not_ viable for List.

Keys, OTOH, don't have any such requirement; so continuous keys may
very well be doable.  If they _are_ doable, you have to ask questions
such as "how do I assign values to a continuous interval of keys?"  To
truly be robust, we ought also answer this question in terms of
multidimensional keys, which can be a nightmare.

-- 
Jonathan "Dataweaver" Lang


Re: r25626 - docs/Perl6/Spec

2009-02-27 Thread Larry Wall
On Fri, Feb 27, 2009 at 12:33:42PM -0800, Jon Lang wrote:
: Let me see if I'm grasping the concept here: by default, all functions
: are British in the sense that they always do things the British way no
: matter where they are in the world:their behavior is determined by the
: culture in which they were raised.  In contrast, lifted code "goes
: native" and does things according to the local culture and customs
: unless you explicitly tell it to do otherwise.  Does this sound about
: right?

Yes, indeed.  You will also find the idea of "functional equivalence"
running through some of the more enlightened literature of missiology.
As we were told in our training with Wycliffe, "Your job is *not*
to go out and build a little white church with a steeple."

Given the influence of linguistics and anthropology on Perl, your
cultural metaphor is not just an accidental resemblance.  :)

Larry


r25633 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: lwall
Date: 2009-02-27 22:12:45 +0100 (Fri, 27 Feb 2009)
New Revision: 25633

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
typo from Jon++


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-02-27 20:53:38 UTC (rev 25632)
+++ docs/Perl6/Spec/S04-control.pod 2009-02-27 21:12:45 UTC (rev 25633)
@@ -664,7 +664,7 @@
 multi infix: (Str $a, Str $b)  { !Str::leg($a, $b) }   # 
primitive leg, primitive !
 
 
-Note that in each piec of lifted code there are references to
+Note that in each piece of lifted code there are references to
 variables defined in the multi, such as C<$a>, C<$b>, and C<&f>.
 These are taken at face value.  Everything else within a lift is
 assumed to mean something in the caller's context.  (This implies



Re: r25541 - docs/Perl6/Spec

2009-02-27 Thread Henry Baragar
I am starting to get overwhelmed by the number of special names and I am 
wondering why we need to have a flat naming space?


For example, wouldn't it be easier to remember (and to introspect) the 
following?


   $*SYSTEM.uid
   $*SYSTEM.euid
   $*SYSTEM.pid
   $*SYSTEM.perl
   $*SYSTEM.env
   $*SYSTEM.program_name
   $*SYSTEM.error_handle

   $?COMPILER.vm
   $?COMPILER.svm
   $?COMPILER.perl
   $?COMPILER.parser
   $?COMPILER.setting
   $?COMPILER.os_distro

   $?PROGRAM.scope
   $?PROGRAM.routine
   $?PROGRAM.role
   $?PROGRAM.class

This way we only have a few special names (objects?) that organize 
everything in this synopsis.


Regards,
Henry




pugs-comm...@feather.perl6.nl wrote:

Author: wayland
Date: 2009-02-25 07:08:52 +0100 (Wed, 25 Feb 2009)
New Revision: 25541

Modified:
   docs/Perl6/Spec/S28-special-names.pod
Log:
S28: Incorporated some more stuff from the old documentation lower down, and a few 
variables from S02.  



Modified: docs/Perl6/Spec/S28-special-names.pod
===
--- docs/Perl6/Spec/S28-special-names.pod   2009-02-25 05:31:24 UTC (rev 
25540)
+++ docs/Perl6/Spec/S28-special-names.pod   2009-02-25 06:08:52 UTC (rev 
25541)
@@ -50,6 +50,7 @@
  $?CLASS   # current class (as variable)
  %?CONFIG  # configuration hash
  $=DATA# data block handle (=begin DATA ... =end)
+ $?DISTROS02   # Which OS distribution am I compiling under
  $*EGID# effective group id
  %*ENV # system environment
  $*ERR   S16   # Standard error handle; is an IO object
@@ -71,16 +72,20 @@
  $?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 object)
  $?PACKAGENAME   S10   # name of current package
- $?PERLVER # perl version compiled for
- $*PERLVER # perl version running under
+ $?PERL  S02   # Which Perl am I compiled for?
+ $*PERL# perl version running under
  $*PROGRAM_NAME# name of the program being executed
  $*PID # system process id
  ::?ROLE   # current role (as package name)
  $?ROLE# current role (as variable)
  &?ROUTINE   S06   # current sub or method (itself)
+ $?SCOPE S02   # Current "my" scope
  $*UID # system user id
+ $?VMS02   # Which virtual machine am I compiling under
+ $?XVM   S02   # Which virtual machine am I cross-compiling for
 
 Note that contextual variables such as C<$*OUT> may have more than

 one current definition in the outer dynamic context, in which case
@@ -166,10 +171,11 @@
  $^H -  These were only ever internal anyway
  %^H -
  -   $! Current exception (see L)
- $! $ERRNO $OS_ERROR -  Can get some info from new $!
- $?  $CHILD_ERROR-
- $@  $EVAL_ERROR -  Just throws an exception now (see 
L)
- $^E -
+ $! $ERRNO $OS_ERROR -  Use shiny new $!
+ $?  $CHILD_ERROR-  Use shiny new $!
+ $@  $EVAL_ERROR -  Use shiny new $!
+ $^E -  Use shiny new $!
+ $^S -
  $. $NR  $*IN.input_record_number()
  $/ $RS  $*IN.input_record_separator()
  $|  $*OUT.autoflush()
@@ -203,14 +209,22 @@
  ARGVOUT $*ARGVOUT  Another IO object
  @F  @*INPLACE_AUTOSPLIT_FIELDS   ..or some such
  %ENV%*ENV
+ ${^OPEN}-  This was internal; forget it
 
 =head2 Old stuff for p5/p6 comparison
 
 This section will eventually die, but for now, it contains some old information on which 
-Perl5 special variables will turn into Perl6 special variables.  
+Perl5 special variables will turn into Perl6 special variables.  The reason they are 
+retained is either:
 
-=over 4

+=over
 
+=item * Their status is undecided

+
+=item * They have some commentary on stuff that needs consideration
+
+=back
+
 Because a blank entry in either column could be taken to mean either 
 "not in Perl 6" or "unknown", the information as presented 
 below presumes an entry in both columns for every entry. 
@@ -229,29 +243,25 @@

 Other organizational
 schemes may become appropriate when the table is more complete.
 
-=back

-
  *** XXX the columns seem to have switched! *
 
  ?   ${^ENCODING}

+ ?   ${^UNICODE} Pending S15 Unicode
 
-

  -   $^V $PERL_VERSION
  -   $] version + patchlevel / 1000 of Perl interpreter
  

Re: r25626 - docs/Perl6/Spec

2009-02-27 Thread Jon Lang
> +Note that in each piec of lifted code there are references to

Typo: s/piec/piece/

--
Jonathan "Dataweaver" Lang



-- 
Jonathan "Dataweaver" Lang


Re: r25626 - docs/Perl6/Spec

2009-02-27 Thread Jon Lang
Let me see if I'm grasping the concept here: by default, all functions
are British in the sense that they always do things the British way no
matter where they are in the world:their behavior is determined by the
culture in which they were raised.  In contrast, lifted code "goes
native" and does things according to the local culture and customs
unless you explicitly tell it to do otherwise.  Does this sound about
right?


r25629 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: lwall
Date: 2009-02-27 19:43:29 +0100 (Fri, 27 Feb 2009)
New Revision: 25629

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
correct fossil


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2009-02-27 18:28:01 UTC (rev 25628)
+++ docs/Perl6/Spec/S06-routines.pod2009-02-27 18:43:29 UTC (rev 25629)
@@ -288,7 +288,7 @@
 
 This may then be invoked via the syntax for contextual variables:
 
-&+myfunc(42);
+&*myfunc(42);
 
 =head2 Lvalue subroutines
 



r25627 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: lwall
Date: 2009-02-27 19:27:22 +0100 (Fri, 27 Feb 2009)
New Revision: 25627

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
off-by-one on the year


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-02-27 18:24:47 UTC (rev 25626)
+++ docs/Perl6/Spec/S04-control.pod 2009-02-27 18:27:22 UTC (rev 25627)
@@ -12,7 +12,7 @@
 
   Maintainer: Larry Wall 
   Date: 19 Aug 2004
-  Last Modified: 27 Feb 2008
+  Last Modified: 27 Feb 2009
   Number: 4
   Version: 72
 



r25626 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: lwall
Date: 2009-02-27 19:24:47 +0100 (Fri, 27 Feb 2009)
New Revision: 25626

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
Document new lift statement for writing generic multis


Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-02-27 17:47:30 UTC (rev 25625)
+++ docs/Perl6/Spec/S04-control.pod 2009-02-27 18:24:47 UTC (rev 25626)
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall 
   Date: 19 Aug 2004
-  Last Modified: 27 Dec 2008
+  Last Modified: 27 Feb 2008
   Number: 4
-  Version: 71
+  Version: 72
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -571,7 +571,7 @@
 # Not an error: Equivalent to "if foo() -> $x { say $x }"
 { say $^x } if foo();
 
-=head2 The gather statement
+=head2 The C statement prefix
 
 A variant of C is C.  Like C, it is followed by a
 statement or block, and executes it once.  Unlike C, it evaluates
@@ -638,6 +638,40 @@
 C object is generated, not when it is bound (which could
 happen more than once).
 
+=head2 The C statement prefix
+
+When writing generic multi routines you often want to write a bit of
+code whose meaning is dependent on the context of the caller.  It's
+somewhat like virtual methods where the actual call depends on the type
+of the invocant, but here the "invocant" is really the lexical scope of
+the caller, and the virtual calls are name bindings.  Within a lift,
+special rules apply to how names are looked up.  Only names defined
+in the lexical scope of the immediately surrounding routine are considered 
concrete.
+All other names (including implicit names of operators) are looked up
+in the lexical scope of the caller when we actually know who the caller
+is at run time.  (Note the caller can vary from call to call!)
+Through this mechanism, a generic multi can redirect execution to
+a more specific version, but the candidate list for this redirection
+is determined by the caller, not by the lexical scope of the multi,
+which can't see the caller's lexical scope except through the CALLER::
+pseudo package.  For example, Perl forces generic C to coerce to
+string comparison, like this:
+
+proto infix: (Any $a, Any $b)  { lift ~$a eq ~$b } # 
user's eq, user's ~
+multi infix: (Whatever, Any $b){ -> $a { lift $a eq $b } } 
# user's eq
+multi infix: (Any $a, Whatever){ -> $b { lift $a eq $b } } 
# user's eq
+multi infix: (&f:($), Any $b)  { -> $a { lift f($a) eq $b } }  # 
user's eq
+multi infix: (Str $a, Str $b)  { !Str::leg($a, $b) }   # 
primitive leg, primitive !
+
+
+Note that in each piec of lifted code there are references to
+variables defined in the multi, such as C<$a>, C<$b>, and C<&f>.
+These are taken at face value.  Everything else within a lift is
+assumed to mean something in the caller's context.  (This implies
+that there are some errors that would ordinarily be found at
+compile time that cannot be found until we know what the caller's
+lexical scope looks like at run time.  That's okay.)
+
 =head2 Other C-like forms
 
 Other similar C-only forms may also take bare statements,



r25623 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 13:41:26 +0100 (Fri, 27 Feb 2009)
New Revision: 25623

Modified:
   docs/Perl6/Spec/S16-io.pod
Log:
Fixed name of NameServices.  wayland-- for not picking this up before :).  


Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-02-27 12:32:32 UTC (rev 25622)
+++ docs/Perl6/Spec/S16-io.pod  2009-02-27 12:41:26 UTC (rev 25623)
@@ -75,21 +75,6 @@
 
 =head1 Name Services
 
-=head NameServices role
-
-The NameServices role has a bunch of functions that between them will return 
the whole 
-Name Services database between them, as lists of objects.  The lists are 
specifically 
-intended to be lazy.  
-
-role   NameServices {
-   method List of User users() {...} # getpwent, setpwent, endpwent
-   method List of Groupgroups(){...} # getgrent, setgrent, endgrent
-   method List of Service  services()  {...} # getservent, setservent, 
endservent
-   method List of Protocol protocols() {...} # getprotoent, setprotoent, 
endprotoent
-   method List of Network  networks()  {...} # getnetent, setnetent, 
endnetent
-   method List of Host hosts() {...} # gethostent, sethostent, 
endhostent
-}
-
 =head2 User role
 
 role   User {
@@ -148,6 +133,21 @@
 
 Tries to write the group entry into the system group database.  
 
+=head OS::Unix::NameServices role
+
+The NameServices role has a bunch of functions that between them will return 
the whole 
+Name Services database between them, as lists of objects.  The lists are 
specifically 
+intended to be lazy.  
+
+role   NameServices {
+   method List of User users() {...} # getpwent, setpwent, endpwent
+   method List of Groupgroups(){...} # getgrent, setgrent, endgrent
+   method List of Service  services()  {...} # getservent, setservent, 
endservent
+   method List of Protocol protocols() {...} # getprotoent, setprotoent, 
endprotoent
+   method List of Network  networks()  {...} # getnetent, setnetent, 
endnetent
+   method List of Host hosts() {...} # gethostent, sethostent, 
endhostent
+}
+
 =head1 Additions
 
 Please post errors and feedback to perl6-language.  If you are making



r25622 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 13:32:32 +0100 (Fri, 27 Feb 2009)
New Revision: 25622

Modified:
   docs/Perl6/Spec/S16-io.pod
   docs/Perl6/Spec/S29-functions.pod
Log:
Replaced iterators with NameServices role, based on an idea of ruoso++ 
(although I doubt 
he wants credit for some of the things I've done with his ideas :) )


Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-02-27 12:06:57 UTC (rev 25621)
+++ docs/Perl6/Spec/S16-io.pod  2009-02-27 12:32:32 UTC (rev 25622)
@@ -3,7 +3,7 @@
 
 =head1 Title
 
-DRAFT: Synopsis 16: IO / User / Group
+DRAFT: Synopsis 16: IO / Name Services
 
 =head1 Version
 
@@ -73,8 +73,23 @@
 S32-setting-library/IO.pod.  The main functions used are listed in S29 with 
references to 
 S32-setting-library/IO.pod.  
 
-=head1 Users and Groups
+=head1 Name Services
 
+=head NameServices role
+
+The NameServices role has a bunch of functions that between them will return 
the whole 
+Name Services database between them, as lists of objects.  The lists are 
specifically 
+intended to be lazy.  
+
+role   NameServices {
+   method List of User users() {...} # getpwent, setpwent, endpwent
+   method List of Groupgroups(){...} # getgrent, setgrent, endgrent
+   method List of Service  services()  {...} # getservent, setservent, 
endservent
+   method List of Protocol protocols() {...} # getprotoent, setprotoent, 
endprotoent
+   method List of Network  networks()  {...} # getnetent, setnetent, 
endnetent
+   method List of Host hosts() {...} # gethostent, sethostent, 
endhostent
+}
+
 =head2 User role
 
 role   User {
@@ -115,13 +130,6 @@
 All the information is naturally fetched from the system via getpwuid, 
getpwnam, or the 
 like.  
 
-=head2 UserIterator role
-
-role   UserIterator does Iterator {...}
-
-In the Unix implementation, this deals with getpwent, setpwent, and endpwent.  
Basically, 
-it returns a User object with each iteration.  
-
 =head2 Group role
 
 role   Group {
@@ -140,13 +148,6 @@
 
 Tries to write the group entry into the system group database.  
 
-=head2 GroupIterator role
-
-role   GroupIterator does Iterator {...}
-
-In the Unix implementation, this deals with getgrent, setgrent, and endgrent.  
Basically, 
-it returns a Group object with each iteration.  
-
 =head1 Additions
 
 Please post errors and feedback to perl6-language.  If you are making

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-02-27 12:06:57 UTC (rev 25621)
+++ docs/Perl6/Spec/S29-functions.pod   2009-02-27 12:32:32 UTC (rev 25622)
@@ -777,9 +777,9 @@
 
 See .pairs() method, above.  
 
-=item endpwent, endgrent
+=item endpwent, endgrent, endservent, endprotoent, endnetent, endhostent
 
-The UserIterator and GroupIterator roles in S16 cover most of these.  
+The NameServices role in S16 covers most of these.  
 
 =item format, formline
 
@@ -789,9 +789,9 @@
 
 The User and Group roles in S16 cover most of these.  
 
-=item getpwent, getgrent
+=item getpwent, getgrent, getservent, getnetent, gethostent
 
-The UserIterator and GroupIterator roles in S16 cover most of these.  
+The NameServices role in S16 covers most of these.  
 
 =item length()
 
@@ -841,9 +841,9 @@
 
 See IPC::SysV;
 
-=item setpwent, setgrent
+=item setpwent, setgrent, setservent, setprotoent, setnetent, sethostent
 
-The UserIterator and GroupIterator roles in S16 cover most of these.  
+The NameServices role in S16 covers most of these.  
 
 =item shmctl, shmget, shmread, shmwrite
 
@@ -926,34 +926,18 @@
  getservbyname
  getservbyport
 
- getservent
- setservent
- endservent
-
  --Protocol
  getprotobyname
  getprotobynumber
 
- getprotoent
- setprotoent
- endprotoent
-
  --Network
  getnetbyaddr
  getnetbyname
 
- getnetent
- setnetent
- endnetent
-
  --Host
  gethostbyaddr
  gethostbyname
 
- gethostent
- sethostent
- endhostent
-
 =item Flow control
 
 break



Re: r25614 - docs/Perl6/Spec/S32-setting-library

2009-02-27 Thread Ruud H.G. van Tol

pugs-comm...@feather.perl6.nl wrote:

Author: wayland
Date: 2009-02-27 10:19:30 +0100 (Fri, 27 Feb 2009)
New Revision: 25614

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
Return type for subst


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 08:29:42 UTC (rev 
25613)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:19:30 UTC (rev 
25614)
@@ -509,7 +509,7 @@
 
 =item subst
 
- method subst(Str $self: Regex $search, Str $replacement);

+ method Str subst(Str $self: Regex $search, Str $replacement);
 
 XXX Does this return a Match?  A Str?  


Both? (well, more like: what's requested)

Then this DWIMs:

   my Str $s = "some text" =~ s/some/another/;

--
Ruud


r25621 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 13:06:57 +0100 (Fri, 27 Feb 2009)
New Revision: 25621

Modified:
   docs/Perl6/Spec/S16-io.pod
   docs/Perl6/Spec/S29-functions.pod
Log:
Created UserIterator and GroupIterator, and grouped some S29 functions 
together.  


Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-02-27 11:57:30 UTC (rev 25620)
+++ docs/Perl6/Spec/S16-io.pod  2009-02-27 12:06:57 UTC (rev 25621)
@@ -115,6 +115,13 @@
 All the information is naturally fetched from the system via getpwuid, 
getpwnam, or the 
 like.  
 
+=head2 UserIterator role
+
+role   UserIterator does Iterator {...}
+
+In the Unix implementation, this deals with getpwent, setpwent, and endpwent.  
Basically, 
+it returns a User object with each iteration.  
+
 =head2 Group role
 
 role   Group {
@@ -133,6 +140,13 @@
 
 Tries to write the group entry into the system group database.  
 
+=head2 GroupIterator role
+
+role   GroupIterator does Iterator {...}
+
+In the Unix implementation, this deals with getgrent, setgrent, and endgrent.  
Basically, 
+it returns a Group object with each iteration.  
+
 =head1 Additions
 
 Please post errors and feedback to perl6-language.  If you are making

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-02-27 11:57:30 UTC (rev 25620)
+++ docs/Perl6/Spec/S29-functions.pod   2009-02-27 12:06:57 UTC (rev 25621)
@@ -777,6 +777,10 @@
 
 See .pairs() method, above.  
 
+=item endpwent, endgrent
+
+The UserIterator and GroupIterator roles in S16 cover most of these.  
+
 =item format, formline
 
 See Exegesis 7.
@@ -785,6 +789,10 @@
 
 The User and Group roles in S16 cover most of these.  
 
+=item getpwent, getgrent
+
+The UserIterator and GroupIterator roles in S16 cover most of these.  
+
 =item length()
 
 This word is banned in Perl 6.  You must specify units.  In practise, this 
probably means 
@@ -833,6 +841,10 @@
 
 See IPC::SysV;
 
+=item setpwent, setgrent
+
+The UserIterator and GroupIterator roles in S16 cover most of these.  
+
 =item shmctl, shmget, shmread, shmwrite
 
 See IPC::SysV;
@@ -896,42 +908,52 @@
 
 =item OS or library related
 
-chroot
-crypt
-endgrent
-endhostent
-endnetent
-endprotoent
-endpwent
-endservent
-getgrent
-gethostbyaddr
-gethostbyname
-gethostent
-getlogin
-getnetbyaddr
-getnetbyname
-getnetent
-getpeername
-getpgrp
-getppid
-getpriority
-getprotobyname
-getprotobynumber
-getprotoent
-getpwent
-getservbyname
-getservbyport
-getservent
-setgrent
-sethostent
-setnetent
-setpgrp
-setpriority
-setprotoent
-setpwent
-setservent
+ chroot
+ crypt
+ getlogin
+ getpeername -- should this go on Pipe?
 
+OS objects:
+
+ --Process
+ getpgrp
+ getppid
+ getpriority
+ setpgrp
+ setpriority
+
+ --Service
+ getservbyname
+ getservbyport
+
+ getservent
+ setservent
+ endservent
+
+ --Protocol
+ getprotobyname
+ getprotobynumber
+
+ getprotoent
+ setprotoent
+ endprotoent
+
+ --Network
+ getnetbyaddr
+ getnetbyname
+
+ getnetent
+ setnetent
+ endnetent
+
+ --Host
+ gethostbyaddr
+ gethostbyname
+
+ gethostent
+ sethostent
+ endhostent
+
 =item Flow control
 
 break



r25619 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 12:34:30 +0100 (Fri, 27 Feb 2009)
New Revision: 25619

Modified:
   docs/Perl6/Spec/S16-io.pod
   docs/Perl6/Spec/S29-functions.pod
Log:
Did some work on users and groups


Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-02-27 11:10:45 UTC (rev 25618)
+++ docs/Perl6/Spec/S16-io.pod  2009-02-27 11:34:30 UTC (rev 25619)
@@ -24,8 +24,10 @@
 corresponding global function, it's merely an exported version of
 the method.
 
-=head1 Overridable IO handles
+=head1 IO
 
+=head2 Overridable IO handles
+
 In Perl 6, there are the I IO handles, and any number of overriding
 inner filehandles for the same symbol.  
 
@@ -65,15 +67,78 @@
 }
 # stdout reverts to outer scope's definition
 
-=head1 Roles and Classes
+=head2 Roles and Classes
 
 The roles and classes that define most of the functionality for IO are defined 
in 
 S32-setting-library/IO.pod.  The main functions used are listed in S29 with 
references to 
 S32-setting-library/IO.pod.  
 
+=head1 Users and Groups
+
+=head2 User role
+
+role   User {
+   has $username; # Username (some descendants(?) may want to implement a 
real $name)
+   has $id;  # User ID
+   has $dir; # Home directory for files
+}
+
+=item new
+
+ method User new($Username?, $UID?) {...}
+
+Creates a new User object, fetching the information either by username or user 
ID.  
+
+=item write
+
+ method write() {...}
+
+Tries to write the current User object to the user database.  This may well 
fail.  
+
+=item Str
+
+When converted to a Str, returns $username.  
+
+=item Num
+
+When converted to a Num, returns $uid.  
+
+=head2 OS::Unix::User role
+
+role   OS::Unix::User does User {
+   has $password;
+   has $gid;
+   has $gecos;
+   has $shell;
+}
+
+All the information is naturally fetched from the system via getpwuid, 
getpwnam, or the 
+like.  
+
+=head2 Group role
+
+role   Group {
+   has $name;
+   has $id;
+   has @members;
+}
+
+=item new
+
+ method Group new(:$Name, :$ID);
+
+=item write
+
+ method write();
+
+Tries to write the group entry into the system group database.  
+
 =head1 Additions
 
 Please post errors and feedback to perl6-language.  If you are making
 a general laundry list, please separate messages by topic.
 
 =cut
+
+=encoding utf8
+

Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-02-27 11:10:45 UTC (rev 25618)
+++ docs/Perl6/Spec/S29-functions.pod   2009-02-27 11:34:30 UTC (rev 25619)
@@ -420,53 +420,6 @@
   my $address = gethost("foo.example.com").addr;
   my $hostname = gethost(:addr<"10.1.2.3">);
 
-=item getpw
-
- our OS::PW multi getpw()
- our OS::PW multi getpw( Int $uid )
- our OS::PW multi getpw( Str $name )
-
- our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: )
- our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Int $uid )
- our OS::PW multi method OS::PWEnt::getpw( OS::PWEnt $pw: Str $name )
-
-The C function operates on system login information, returning
-data about users in the form of an C object ("PW" refers
-to the historical C functions that are part of the POSIX
-standard, and stands for "password").
-
-When given no parameters, the "next" user entry is returned (C is
-returned when the list of users has been exhausted).
-
-When C<$uid> is provided, a user with the given UID is found and returned.
-C is returned if no matching entry is found.
-
-When C<$name> is provided, a user with the matching name is found and
-returned. C is returned if no matching entry is found.
-
-The return value is an object that represents the system-specific
-information about the user. When numified, this object returns the
-UID of the user. When stringified, this object returns the username.
-
-Therefore, the typical convention of:
-
-  my Int $uid = getpw(~$name);
-
-and
-
-  my Str $name = getpw(+$uid);
-
-Will work as expected.
-
-See the documentation for the C and C classes for more
-information and the equivalent of the Perl 5 setpwent / endpwent functions.
-
-WARNING: Even when used as a method on an C object, there
-may be system-specific, global state associated with the implementation
-of these routines.
-
-[Note: TODO setpgrp setpriority times -ajs ]
-
 =item chroot
 
  our Bool multi chroot ( Str $path = CALLER::<$_> )
@@ -828,6 +781,10 @@
 
 See Exegesis 7.
 
+=item getgrgid, getgrnam, getpwnam, getpwuid
+
+The User and Group roles in S16 cover most of these.  
+
 =item length()
 
 This word is banned in Perl 6.  You must specify units.  In practise, this 
probably means 
@@ -948,8 +905,6 @@
 endpwent
 endservent
 getgrent
-getgrgid
-getgrnam
 gethostbyaddr
 gethostbyname
 gethostent
@@ -965,8 +920,6 @@
 getprotobynumber
 getprotoent
 getpwent
-getpwnam
-getpwuid
 getservbyname
 getservbyport
 getservent



r25616 - docs/Perl6/Spec

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 10:58:10 +0100 (Fri, 27 Feb 2009)
New Revision: 25616

Modified:
   docs/Perl6/Spec/S16-io.pod
   docs/Perl6/Spec/S17-concurrency.pod
Log:
Moved Signals and IPC from S16 to S17, which can now be processes and 
concurrency.  


Modified: docs/Perl6/Spec/S16-io.pod
===
--- docs/Perl6/Spec/S16-io.pod  2009-02-27 09:33:12 UTC (rev 25615)
+++ docs/Perl6/Spec/S16-io.pod  2009-02-27 09:58:10 UTC (rev 25616)
@@ -3,7 +3,7 @@
 
 =head1 Title
 
-DRAFT: Synopsis 16: IPC / IO / Signals
+DRAFT: Synopsis 16: IO / User / Group
 
 =head1 Version
 
@@ -71,127 +71,6 @@
 S32-setting-library/IO.pod.  The main functions used are listed in S29 with 
references to 
 S32-setting-library/IO.pod.  
 
-=head1 POSIX Signals
-
-The %*SIG variable contains a Hash of Proc::Signals::Signal.  
-
-class  Signal {
-   has $exception; # This specifies what exception will be raised when 
this signal is received
-   has $interrupt; # See siginterrupt(3)
-   has $blocked;   # Is this signal blocked?  cf. sigprocmask
-}
-
-The @*SIGQUEUE array contains a queue of the signals that are blocked and 
queued.  
-
-The standard POSIX signals simply raise control exceptions that are handled as 
normal 
-through the control signal handler, and caught by CONTROL blocks.  
-
-=head2 Signal defaults
-
-The signals have defaults as specified in the table below.  $blocked always 
defaults to 
-false.  
-
- Signal Default Exception
- -- -
- SIGHUP ControlExceptionSigHUP
- SIGINT ControlExceptionSigINT
- SIGQUITControlExceptionSigQUIT
- SIGILL ControlExceptionSigILL
- SIGABRTControlExceptionSigABRT
- SIGFPE ControlExceptionSigFPE
- SIGKILLControlExceptionSigKILL
- SIGSEGVControlExceptionSigSEGV
- SIGPIPEControlExceptionSigPIPE
- SIGALRMControlExceptionSigALRM
- SIGTERMControlExceptionSigTERM
- SIGUSR1ControlExceptionSigUSR1
- SIGUSR2ControlExceptionSigUSR2
- SIGCHLDControlExceptionSigCHLD
- SIGCONTControlExceptionSigCONT
- SIGSTOPControlExceptionSigSTOP
- SIGTSTPControlExceptionSigTSTP
- SIGTTINControlExceptionSigTTIN
- SIGTTOUControlExceptionSigTTOU
- SIGBUS ControlExceptionSigBUS
- SIGPROFControlExceptionSigPROF
- SIGSYS ControlExceptionSigSYS
- SIGTRAPControlExceptionSigTRAP
- SIGURG Undefined
- SIGVTALRM  ControlExceptionSigVTALRM
- SIGXCPUControlExceptionSigXCPU
- SIGXFSZControlExceptionSigXFSZ
- SIGEMT ControlExceptionSigEMT
- SIGSTKFLT  ControlExceptionSigSTKFLT
- SIGIO  ControlExceptionSigIO
- SIGPWR ControlExceptionSigPWR
- SIGLOSTControlExceptionSigLOST
- SIGWINCH   Undefined
-
-=head2 Signal exceptions
-
-A table below describes the exceptions.  
-
-Each of these has a default action as well.  The possible actions are:
-
- Term   Default action is to terminate the process.
-
- IgnDefault action is to ignore the signal ($signal.exception is undef by 
default)
-
- Core   Default action is to terminate the process and dump core (see core(5)).
-
- Stop   Default action is to stop the process.
-
- Cont   Default action is to continue the process if it is currently stopped.
-
-Some actions do the Resumeable role.  An exception listed in the table below 
that does the 
-Resumeable role is marked with a * in the R column.  
-
-The exceptions are:
-
- Signal   Action   R Comment
- --
- ControlExceptionSigHUPTerm? Hangup detected on controlling terminal 
or death of controlling process
- ControlExceptionSigINTTerm? Interrupt from keyboard
- ControlExceptionSigQUIT   Core? Quit from keyboard
- ControlExceptionSigILLCore? Illegal Instruction
- ControlExceptionSigABRT   Core? Abort signal from abort(3)
- ControlExceptionSigFPECore? Floating point exception
- ControlExceptionSigKILL   Term? Kill signal
- ControlExceptionSigSEGV   Core  Invalid memory reference
- ControlExceptionSigPIPE   Term? Broken pipe: write to pipe with no readers
- ControlExceptionSigALRM   Term? Timer signal from alarm(2)
- ControlExceptionSigTERM   Term? Termination signal
- ControlExceptionSigUSR1   Term? User-defined signal 1
- ControlExceptionSigUSR2   Term? User-defined signal 2
- ControlExceptionSigCHLD   Ign * Child stopped or terminated
- ControlExceptionSigCONT   Cont* Continue if stopped
- ControlExceptionSigSTOP   Stop? Stop process
- ControlExceptionSigTSTP   Stop? Stop typed at tty
- ControlExceptionSigTTIN   Stop? tty input for background process
- ControlExceptionSigTTOU   Stop? tty output for background process
- ControlExceptionSigBUSCore? Bus error (bad memory access)
- ControlExceptionSigPROF   Term? Profiling timer expired
- ControlExceptionSigSYSCore? Bad argument to routine (SVr4)
- ControlExceptionSigTRAP   Core? Tr

r25615 - docs/Perl6/Spec/S32-setting-library

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 10:33:12 +0100 (Fri, 27 Feb 2009)
New Revision: 25615

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
Typo, my bad.  wayland--  Incidentally, I can karma myself here, I think :)


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:19:30 UTC (rev 
25614)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:33:12 UTC (rev 
25615)
@@ -511,8 +511,6 @@
 
  method Str 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);



Re: Masak's S29 list

2009-02-27 Thread Timothy S. Nelson

On Fri, 27 Feb 2009, Moritz Lenz wrote:


# Code has a .sig

Seems (from what I can tell) to be synonymous with .signature, so I
standardised on .signature.


This leads me to another question - afaict we also have .arity on the
code object, but shouldn't that be method on the .signature instead? Do
we have any methods in Code that are not related to the signature?

[reorg]

# Block types have .next, .last, .redo and .leave on them. These are also
functions, and need to be specced as such.


Ah, that answers my previous question already ;-)


	No it doesn't.  Block and Code are different (see S02).  But have a 
look over the S32/Callable.pod document, and you may find that you have an 
answer.  Also, some of the things that I wasn't able to cope with on masak's 
list may be relevant here.



# .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?


If everything does Pattern, I see no good reason to have a role at all -
just stuff the thing into Object.


	Exactly, but I thought I'd better ask; I assumed it really went 
somewhere else, and I just hadn't understood.



# .match, .subst and .trans from S05.

Now in S32/Str.pod.  But I wasn't sure what subst() returns.


The modified string. (It doesn't do in-place substitution by default).


Spec modified.

:)


-
| 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-



r25614 - docs/Perl6/Spec/S32-setting-library

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 10:19:30 +0100 (Fri, 27 Feb 2009)
New Revision: 25614

Modified:
   docs/Perl6/Spec/S32-setting-library/Str.pod
Log:
Return type for subst


Modified: docs/Perl6/Spec/S32-setting-library/Str.pod
===
--- docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 08:29:42 UTC (rev 
25613)
+++ docs/Perl6/Spec/S32-setting-library/Str.pod 2009-02-27 09:19:30 UTC (rev 
25614)
@@ -509,7 +509,7 @@
 
 =item subst
 
- method subst(Str $self: Regex $search, Str $replacement);
+ method Str subst(Str $self: Regex $search, Str $replacement);
 
 XXX Does this return a Match?  A Str?  
 



Re: Range and continuous intervals

2009-02-27 Thread Darren Duncan
Jon, I like all of your stated ideas in general.  I also don't care about the 
postfix %; that was just a concept example pulled from the inexact comparison 
thread.  The idea of using zero is also appropriate conceptually with shades of 
how calculus works.  I actually prefer the existing Range constructor of .. 
visually, as long as it works unambiguously in both roles.  It does make a lot 
of sense for Range to do Set.  So we just need some way, probably a role, to 
distinguish whether this broader definition of a set is enumerable or not on a 
case by case basis.  When talking about any/all/etc this also means that 
junctions would have to work with the non-enumerable set. -- Darren Duncan


Jon Lang wrote:

Darren Duncan wrote:

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.


Note that smart-matching currently treats Range as an interval.  The
question is whether we need intervals for any other purpose.  If we
do, perhaps we could still press Range into service, but indicate that
there are no discrete consecutive values by saying something like
":step(0)" (where "0" is being used to mean "arbitrarily small" rather
than truly zero).  This would disable some uses (such as using it as a
looping mechanism or counting the number of items that it
encompasses), but might enable some others.


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.


(Not postfix:<%>, please; that should produce a single value by itself.)

Instead of saying "set-like operators", etc., why not just say that
Interval does Set?  The conceptual difference would be that it is a
set of continuous values rather than a set of discrete values... This
should also allow you to do things like "any($i)" (where $i is an
Interval).  Indeed, a Set membership test strikes me as being
equivalent to smart-matching an any-junction of the Set.

As for a constructor: as hinted above, ".." could probably pull
double-duty as a constructor for both Ranges and Intervals, based on
the spacing (or absence thereof) between members.  One _might_ even go
so far as to say that :step (or whatever it's called) defaults to 1
for discrete types (such as Int) and to 0 for continuous types (such
as Rat); so "0 .. 1" and "0.0 .. 1.0 :step(1)" would each create a
two-item Range, while "0 .. 1 :step(0)" and "0.0 .. 1.0" would each
create an Interval.





r25612 - in docs/Perl6/Spec: . S32-setting-library

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 09:28:45 +0100 (Fri, 27 Feb 2009)
New Revision: 25612

Modified:
   docs/Perl6/Spec/S28-special-names.pod
   docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
IO.pod/S28: Regularised %*PROTOCOLS


Modified: docs/Perl6/Spec/S28-special-names.pod
===
--- docs/Perl6/Spec/S28-special-names.pod   2009-02-27 08:26:45 UTC (rev 
25611)
+++ docs/Perl6/Spec/S28-special-names.pod   2009-02-27 08:28:45 UTC (rev 
25612)
@@ -106,6 +106,7 @@
  $*PID   Int  # system process id
  %=POD S02# (or some such)
  $*PROGRAM_NAME  Str  # name of the Perl program being executed
+ %*PROTOCOLS   S16   Hash of Method # Stores the methods needed for the 
uri() function
  ::?ROLE Str  # current role (as package or type name)
  $?ROLE  Role # current role
  &?ROUTINE S06   Routine  # current sub or method (itself)

Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2009-02-27 08:26:45 UTC (rev 
25611)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2009-02-27 08:28:45 UTC (rev 
25612)
@@ -74,7 +74,7 @@
 
 These can naturally be overridden or added to by other modules.  
 
-=item %PROTOCOLS global variable
+=item %*PROTOCOLS global variable
 
 For each protocol, stores a type name that should be instantiated by calling 
the .uri() 
 constructor on that type, and passing in the appropriate uri.  



r25610 - docs/Perl6/Spec/S32-setting-library

2009-02-27 Thread pugs-commits
Author: wayland
Date: 2009-02-27 09:16:28 +0100 (Fri, 27 Feb 2009)
New Revision: 25610

Modified:
   docs/Perl6/Spec/S32-setting-library/IO.pod
Log:
IO.pod: Got rid of code, replaced it with spec


Modified: docs/Perl6/Spec/S32-setting-library/IO.pod
===
--- docs/Perl6/Spec/S32-setting-library/IO.pod  2009-02-27 07:42:32 UTC (rev 
25609)
+++ docs/Perl6/Spec/S32-setting-library/IO.pod  2009-02-27 08:16:28 UTC (rev 
25610)
@@ -61,9 +61,10 @@
 =item uri
 
 IO::Streamable method uri(Str $uri);
+IO::Streamable sub uri(Str $uri);
 
 Returns an appropriate IO::Streamable descendant, with the type depending on 
the uri 
-passed in.  Here's the mapping:
+passed in.  Here are some example mappings:
 
  URI type IO type
   ===
@@ -71,15 +72,12 @@
  ftp: IO::Socket::TCP (data channel)
  http:IO::Socket::TCP
 
-IO::Streamable method uri(Str $uri) {
-   $uri.match(/^+\:/);
-   return(&$PROTOCOLS{$1}($uri));
-}
+These can naturally be overridden or added to by other modules.  
 
 =item %PROTOCOLS global variable
 
-For each protocol, stores a subroutine reference that returns the appropriate 
object when 
-the URI is passed in.  
+For each protocol, stores a type name that should be instantiated by calling 
the .uri() 
+constructor on that type, and passing in the appropriate uri.  
 
 =back
 



Re: Range and continuous intervals

2009-02-27 Thread Jon Lang
Darren Duncan wrote:
> 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.

Note that smart-matching currently treats Range as an interval.  The
question is whether we need intervals for any other purpose.  If we
do, perhaps we could still press Range into service, but indicate that
there are no discrete consecutive values by saying something like
":step(0)" (where "0" is being used to mean "arbitrarily small" rather
than truly zero).  This would disable some uses (such as using it as a
looping mechanism or counting the number of items that it
encompasses), but might enable some others.

> 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.

(Not postfix:<%>, please; that should produce a single value by itself.)

Instead of saying "set-like operators", etc., why not just say that
Interval does Set?  The conceptual difference would be that it is a
set of continuous values rather than a set of discrete values... This
should also allow you to do things like "any($i)" (where $i is an
Interval).  Indeed, a Set membership test strikes me as being
equivalent to smart-matching an any-junction of the Set.

As for a constructor: as hinted above, ".." could probably pull
double-duty as a constructor for both Ranges and Intervals, based on
the spacing (or absence thereof) between members.  One _might_ even go
so far as to say that :step (or whatever it's called) defaults to 1
for discrete types (such as Int) and to 0 for continuous types (such
as Rat); so "0 .. 1" and "0.0 .. 1.0 :step(1)" would each create a
two-item Range, while "0 .. 1 :step(0)" and "0.0 .. 1.0" would each
create an Interval.

-- 
Jonathan "Dataweaver" Lang