Re: Idea for making @, %, $ optional

2005-06-04 Thread Millsa Erlas

Millsa Erlas wrote:

I have thought of an interesting idea that may allow Perl 6 to make the
$, @, and % optional on many uses of variables. This involves simply 
extending the function namespace to include all kinds of structures, and 
thus the function namespace does not require symbols, they are optional.


The intention here is not to eliminate $, @, % and friends, just make 
them optional! I believe people should be able to make the choice as to 
which way to do things, we should give the programmer as much freedom 
and as any many ways to do things as possible, not constrain them but 
empower and free them from restrictions.


Also, a goal I have tried to follow here is to implement this feature 
without affecting the existing usage grammar and rules of the Perl 6 
language at all. This is a good goal i believe, my intention is just for 
this to be an additional extension to Perl 6, not change its existing 
grammar and parsing rules at all, just expand upon it. Perl 6 is a great 
language and I like what has done so far. This is not an attempt to 
change what has already been defined, but rather provide an additional 
usage.


These are just some initial ideas, they may be able to be improved upon, 
or benefit from refinement.


**Subroutines

sub hello {
print "hello!\n";
}

#**Arrays
#Define
array hello=("1", "2", 3");

#in Array context:
@array=&array; #or
@array=array array;

#in Scalar context:
$element=array[1]; #or
$element=scalar array[1];

#**Hashs
#Define
hash hash1=(hello=>"hello1", hello2=>"hello2");

#In hash context=
%hash2=&hash1; # or
%hash2=hash hash1;

#scalar context
$hello=hash{hello}; # or
$hello=scalar hello{hello};

#**Scalars

#Define
scalar hello="hello";

#Scalar context

$hello=hello; # or
$hello=scalar hello;

#**References
#Make reference
scalar ref=\&hash; #or
scalar ref=mkref &hash; #or
scalar ref=mkref hash hash;

#Dereference:

#Every ampersand after the initial one attempts to deference the
# one level of referncing:
%hash=&&ref;
# THis would unwrap a reference in a reference
%hash=&&&ref;

# Dereference a reference in a hash
%hash=&&hash{ref};

#or
# A deref keyword for convenience:
%hash=deref ref; #or
%hash=hash scalar ref; #or
%hash=hash hash ref;

This is just an initial sketch, it may need or benefit from refinement.


I think that implementing the features I have described above as a 
module of some sort rather than include it in core would be very 
reasonable and acceptable, I am in fact looking into ways of doing this. 

@, $, and % does indeed have its advantages and I should continue to 
remain avialable. I think some sort of module is a good route to go for 
offering alternative grammer, so I am happy with this solution.


Re: Parrot 0.2.1 "APW" Released!

2005-06-04 Thread Thomas Klausner
Hi!

On Sat, Jun 04, 2005 at 12:36:57PM +0200, Leopold Toetsch wrote:

> The release name stands for "Austrian Perl Workshop", which will take
> place on 9th and 10th of June in Vienna. It will have a french
> connection that is a live video stream to the French Perl Workshop
> happening at the same time.

Which prompts me for an last-minute plug:

You're still welcome to join us in Vienna!

We've got two days with a lot of interesting talks and Parrot/Pugs/Perl6
hacking (with, among others, Autrijus Tang and Chip Salzenberg), followed by
some more days of Parrot/Pugs/Perl6 hacking at Leo's place.

More info, schedule, etc here:

  http://conferences.yapceurope.org/apw2005/

Hope to see you in Vienna, 
Thomas Klausner

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}


Parrot 0.2.1 "APW" Released!

2005-06-04 Thread Leopold Toetsch

Parrot 0.2.1 "APW" Released!

On behalf of the Parrot team I'm proud to announce another monthly
release of Parrot and I'd like to thank all involved people as well as
our sponsors for supporting us.

The release name stands for "Austrian Perl Workshop", which will take
place on 9th and 10th of June in Vienna. It will have a french
connection that is a live video stream to the French Perl Workshop
happening at the same time.

What is Parrot?

Parrot is a virtual machine aimed at running Perl6 and other dynamic
languages.

Parrot 0.2.1 changes and news

- better HLL support (short names for object attributes, and
  .HLL and n_operators pragmas)
- string encoding and charset can now be set independently
- experimental mmap IO layer for slurping files
- distinct debug and trace flag settings
- glob support in PGE
- new character classification opcodes and interfaces

After some pause you can grab it from
.

As parrot is still in steady development we recommend that you
just get the latest and best from SVN by following the directions at


Turn your web browser towards  for more
information about Parrot, get involved, and:

Have fun!
leo



Re: (multi)subroutine names

2005-06-04 Thread dakkar
Rod Adams wrote:
> It used to be
>
>&foo
>&foo
>
> but I seem to recall that there was a mild change that occurred. Or
> maybe I'm thinking about the adding of the colon for operators. I'm not
> certain, but it's something very close to the above.
Well, it doesn't seem ambiguous to me. Operators would be in the form
&infix:<-> . But then, I don't design grammars... If enough
people think this syntax could work, I'll add "unspecced" tests to pugs
for it.

> In my mind, the more interesting question is what does &foo without the
> <> specifiers return when foo is multi? I see the following three options:
>
> 1) undef/error, since there's no single sub called foo, and multi's need
> a postfix <>.
At first I thought this was the right way, but then...

> 2) the name 'foo', and then performs in effect call by name when
> deferenced, using the dereferencing scope to determine which flavors of
> foo are available at this time, and dispatching accordingly.
>
> 3) a dispatch table of all the foo's currently in scope at the time the
> reference is made.
...one of these is actually necessary. Example:
- I write a module that exports a 'foo' (a sub)
- You use my module, and use that '&foo' to get a ref, which you
subsequently use as you please
- I then change my module so that 'foo' is a multi-sub (this is an
implementation detail, not an API change)
- Your code *must not* break

so we can't return undef. Your #3 seem useful (for introspection, at
least), but what about:

 multi sub foo(Array $a) {return 1}
 multi sub foo(Hash $a) {return 2}

 my $foo_A_H=&foo;

 multi sub foo(Str $a) {return 3}

 print $foo_A_H.('a');

should that print 3? Or coerce 'a' into ['a'] and print 1?

What about (thinking aloud):

 my $foo_static=&foo;
 my $foo_dynamic:=&foo;

where the first one has "snapshot" semantic, as in your #3, and the
second one has 'name' semantic, as in your #2, in the same way that:

 my $a=1;
 my $b=$a;
 my $c:=$a;
 $a=2;
 print $b,$c;

prints 1 2 ?

--
Dakkar - 
GPG public key fingerprint = A071 E618 DD2C 5901 9574
 6FE2 40EA 9883 7519 3F88
key id = 0x75193F88


signature.asc
Description: OpenPGP digital signature