[svn:perl6-synopsis] r14477 - doc/trunk/design/syn

2008-01-01 Thread larry
Author: larry
Date: Tue Jan  1 17:01:32 2008
New Revision: 14477

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Clarification of off-the-end semantics of KeySet and KeyBag requested by 
Limbic~Region++.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue Jan  1 17:01:32 2008
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 1 Jan 2008
   Number: 2
-  Version: 122
+  Version: 123
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -896,7 +896,9 @@
 If you use the C interface and increment an element of a
 C its value becomes true (creating the element if it doesn't
 exist already).  If you decrement the element it becomes false and
-is automatically deleted.  When not used as a C (that is,
+is automatically deleted.  Decrementing a non-existing value results
+in a C value.  Incrementing an existing value results in C.
+When not used as a C (that is,
 when used as an C or list or C object) a C
 behaves as a C of its keys.  (Since the only possible value of
 a C is the C value, it need not be represented in
@@ -906,7 +908,8 @@
 use the C interface and increment an element of a C
 its value is increased by one (creating the element if it doesn't exist
 already).  If you decrement the element the value is decreased by one;
-if the value goes to 0 the element is automatically deleted.  When not
+if the value goes to 0 the element is automatically deleted.  An attempt
+to decrement a non-existing value results in a C value.  When not
 used as a C (that is, when used as an C or list or C
 object) a C behaves as a C of its keys, with each key
 replicated the number of times specified by its corresponding value.


Re: calling parrot from perl6

2008-01-01 Thread Patrick R. Michaud
On Mon, Dec 31, 2007 at 11:17:53PM +0300, Richard Hainsworth wrote:
> Not sure whether this should be p6-lan or p6-users. Posted to p6l only.

Since the question is specific to perl6 and Parrot, it probably
belongs on perl6-compiler.  But I'll answer it here for now,
as it may spark a language related discussion.

> Given a function implemented in parrot, how can it be called from a 
> perl6 program?
> 
> Suppose I have a file (in current path) 'myfun.pir' which contains
> 
> .sub myfun
>.param pmc passed_variable
>.local int an_int
>an_int = passed_variable[1]
>.local string string_var
> #code
>.return (string_var)
>   end# is this necessary?
> .end
> 
> how do I create a mymodule.pm so that I can in a perl6 program do
> 
> use mymodule;
> 
> my $parameter = 30;
> my $string_var = myfun($parameter);
> 
> ???
> 
> If this is documented, please just send a pointer.

It's not document yet.  As far as calling the function is concerned,
that part already exists -- perl6 will correctly locate the
'myfun' sub written in PIR and call it with the appropriate 
arguments.

The part we don't have yet is dynamic loading of pir files from
perl6.  In other words, perl6 currently treats the statement
"use mymodule;" as being a request for "mymodule.pm", which it
expects to be a Perl 6 source file.

My best guess at this point is that we could have something like:

use Parrot;
Parrot::load_bytecode('myfun.pir');

For the time being we could make the "use Parrot;" step automatic
to the perl6 compiler, such that one could do:

Parrot::load_bytecode('myfun.pir');
my $parameter = 30;
my $string_var = myfun($parameter);

Then it's just a matter of deciding what sort of functions/interface
we expect the Parrot module to have.

Pm


Re: calling parrot from perl6

2008-01-01 Thread Jonathan Worthington

Richard Hainsworth wrote:
Given a function implemented in parrot, how can it be called from a 
perl6 program?
To use functions from a class or module in a different language, you 
will be able to use "use" to include the module, but with the language 
name out the front. So:


use parrot:SomeModule;

There'll be some way to import symbols too, I imagine.

I'm sure someone with a more encycopedic knowledge of the synopses will 
be able to tell you whether/where that is mentioned in those, but I 
think this is fairly settled on. :-)


Jonathan


[svn:perl6-synopsis] r14476 - doc/trunk/design/syn

2008-01-01 Thread larry
Author: larry
Date: Tue Jan  1 00:22:25 2008
New Revision: 14476

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Infelicities noticed by Limbic_Region++


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podTue Jan  1 00:22:25 2008
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 5 Dec 2007
+  Last Modified: 1 Jan 2008
   Number: 2
-  Version: 121
+  Version: 122
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -198,7 +198,7 @@
 =item *
 
 For all quoting constructs that use user-selected brackets, you can open
-with multiple identical bracket characters, which must by closed by the
+with multiple identical bracket characters, which must be closed by the
 same number of closing brackets.  Counting of nested brackets applies only
 to pairs of brackets of the same length as the opening brackets:
 
@@ -790,7 +790,8 @@
 default to NaN, while integer types (including C) default to 0.
 The complex type defaults to NaN + NaN.i.  A buf type of known size
 defaults to a sequence of 0 values.  If any native type is explicitly
-initialized to C<*> (the C type), it is left uninitialized.
+initialized to C<*> (the C type), no initialization is attempted
+and you'll get whatever was already there when the memory was allocated.
 
 If a buf type is initialized with a Unicode string value, the string
 is decomposed into Unicode codepoints, and each codepoint shoved into