Re: r25182 - docs/Perl6/Spec

2009-02-06 Thread Daniel Ruoso
Em Sex, 2009-02-06 às 02:07 -0500, Brandon S. Allbery KF8NH escreveu:
  +=head2 IO::POSIX
  +
  +Indicates that this object can perform standard posix IO operations.
  I don't like that wording, but getting it right seems tricky. 
 Do we want/need to deal with POSIX conformance levels?

When I suggested the name IO::POSIX, it was certainly pointing in that
direction. Someone with a deeper understanding on that matter could
certainly help mapping that out.

In a pratical sense, we're probably going to see IO::Linux26 which might
does IO::POSIXsomelevel as well as does IO::BSDinpart and does
IO::SysVsomewhat. Additionally, we may have IO::Win32 which doesn't
seem to fit in any of those roles...

 I would think fcntl() is just the Unix version of a more general  
 concept, which is probably wider than POSIX.

Maybe this wider concepts can be expressed in their own roles, as
already been suggested here, as we have IO::Readable and IO::Writeable.
IO::Flock is something that looks right to me, where IO::Linux26 does
IO::Flock (even if IO::POSIX doesn't).

(I use flock as an example because I'm not sure how fcntl applies to a
non-posix OS, since that's the name of a POSIX function).

 Even given this, if we want compatibility we might provide stuff in  
 IO::POSIX (IO::VMS, IO::Windows, whatever) which translates to these  
 calls.

I think that's up to the more concrete roles IO::Linux26, IO::Win32
IO::Solaris etc

daniel






2 questions: Implementations and Roles

2009-02-06 Thread Timothy S. Nelson
	Quick question about implementing things like the DBI/DBD split in 
Perl6.  In Perl5, you have code in DBI that essentially says:


-
$driverpackage = DBD::$driver;

eval use $driverpackage; \$obj = $driverpackage-new(\%params);;
-

This has always seemed ugly to me.  Is there a better way to do it?

	Also, is there a simple way to know when I should be using a class vs. 
a role?


Thanks,


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



r25223 - docs/Perl6/Spec

2009-02-06 Thread pugs-commits
Author: lwall
Date: 2009-02-07 00:27:35 +0100 (Sat, 07 Feb 2009)
New Revision: 25223

Modified:
   docs/Perl6/Spec/S02-bits.pod
Log:
refactor pseudo-package names
clarify use of protoobjects as responder to subcall interface


Modified: docs/Perl6/Spec/S02-bits.pod
===
--- docs/Perl6/Spec/S02-bits.pod2009-02-06 23:25:26 UTC (rev 25222)
+++ docs/Perl6/Spec/S02-bits.pod2009-02-06 23:27:35 UTC (rev 25223)
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall la...@wall.org
   Date: 10 Aug 2004
-  Last Modified: 1 Feb 2009
+  Last Modified: 6 Feb 2009
   Number: 2
-  Version: 151
+  Version: 152
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -512,7 +512,7 @@
 # and is implemented by the MyScalar class
 my Int $x is MyScalar;
 
-Note that C$x is also initialized to C::Int.  See below for more on this.
+Note that C$x is also initialized to the CInt protoobject.  See below for 
more on this.
 
 =item *
 
@@ -525,12 +525,18 @@
 $spot.defined;  # False
 say $spot;  # Dog
 
-Any class name used as a value by itself is an undefined instance of
-that class's prototype, or Iprotoobject.  See S12 for more on that.
-(Any type name in rvalue context is parsed as a list operator
-indicating a typecast, but an argumentless one of these degenerates
-to a typecast of undef, producing the protoobject.)
+Any type name used as a value is an undefined instance of
+that type's prototype object, or Iprotoobject.  See S12 for more on that.
+Any type name in rvalue context is parsed as a single protoobject value and
+expects no arguments following it.  However, a protoobject responds to the 
function
+call interface, so you may use the name of a protoobject with parentheses as 
if it
+were a function, and any argument supplied to the call is coerced
+to the type indicated by the protoobject.  If there is no argument
+in the parentheses, the protoobject returns itself:
 
+my $type = Num; # protoobject as a value
+$num = $type($string)   # coerce to Num
+
 To get a real CDog object, call a constructor method such as Cnew:
 
 my Dog $spot .= new;
@@ -1760,37 +1766,51 @@
 
 The following pseudo-package names are reserved at the front of a name:
 
-MY  # Lexical symbols declared in the current scope
-OUR # Package symbols declared in the current package
-FILE# Lexical symbols in this file's outermost scope
-PERL# Lexical symbols in the standard setting
-LANG# Lexical symbols in current DSL (usually PERL)
-GLOBAL  # Interpreter-wide package symbols
-PROCESS # Process-related globals (superglobals)
-SUPER   # Package symbols declared in inherited classes
+MY  # Symbols in the current lexical scope (aka $?SCOPE)
+OUR # Symbols in the current package (aka $?PACKAGE)
+CORE# Outermost lexical scope, definition of standard Perl
+GLOBAL  # Interpreter-wide package symbols, really CORE::GLOBAL
+PROCESS # Process-related globals (superglobals), CORE::PROCESS
 COMPILING   # Lexical symbols in the scope being compiled
+CALLER  # Contextual symbols in the immediate caller's lexical scope
+CONTEXT # Contextual symbols in my or any caller's lexical scope
 
 The following relative names are also reserved but may be used
 anywhere in a name:
 
-OUTER   # Lexical symbols declared in the outer scope
-CALLER  # Contextual symbols in the immediate caller's scope
-CONTEXT # Contextual symbols in any context's scope
+OUTER   # Symbols in the next outer lexical scope
+UNIT# Symbols in the outermost lexical scope of compilation unit
+SETTING # Lexical symbols in the unit's DSL (usually CORE)
+PARENT  # Symbols in this package's parent package (or lexical scope)
 
+The following is reserved at the beginning of method names in method calls:
+
+SUPER   # Package symbols declared in inherited classes
+
 Other all-caps names are semi-reserved.  We may add more of them in
 the future, so you can protect yourself from future collisions by using
 mixed case on your top-level packages.  (We promise not to break
 any existing top-level CPAN package, of course.  Except maybe CACME,
 and then only for coyotes.)
 
-The CLANG scope is equivalent to CFILE::OUTER.  For a standard Perl
-program CLANG is the same as CPERL, but various startup options
-(such as C-n or C-p) can put you into a domain specific language,
-in which case CPERL remains the scope of the standard language,
-while CLANG represents the scope defining the DSL that functions
+The file's scope is known as CUNIT, but there are one or more
+lexical scopes outside of that corresponding to the linguistic setting
+(often known as the prelude in other cultures).  Hence, the 

Re: 2 questions: Implementations and Roles

2009-02-06 Thread Jon Lang
Timothy S. Nelson wrote:
Also, is there a simple way to know when I should be using a class
 vs. a role?

If you plan on creating objects with it, use a class.  If you plan on
creating classes with it, use a role.

-- 
Jonathan Dataweaver Lang


Re: r25182 - docs/Perl6/Spec

2009-02-06 Thread Brandon S. Allbery KF8NH

On 2009 Feb 6, at 6:24, Daniel Ruoso wrote:

Em Sex, 2009-02-06 às 02:07 -0500, Brandon S. Allbery KF8NH escreveu:

I would think fcntl() is just the Unix version of a more general

concept, which is probably wider than POSIX.


Maybe this wider concepts can be expressed in their own roles, as
already been suggested here, as we have IO::Readable and  
IO::Writeable.

IO::Flock is something that looks right to me, where IO::Linux26 does
IO::Flock (even if IO::POSIX doesn't).

(I use flock as an example because I'm not sure how fcntl applies to a
non-posix OS, since that's the name of a POSIX function).


fcntl = file descriptor control/configuration.  While the name itself  
is POSIX, the range of possible actions described by it is larger than  
that.


(Yes, one could just compose roles with individual actions, thus  
making fcntl() disappear altogether.  But you will not be thanked by  
someone who has to work out exactly which roles s/he needs to  
implement for a given IO-like object, nor by the unfortunate tasked  
with porting perl5 code.)


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