the Parser

2001-08-01 Thread raptor

hi,

I see nobody is talking here ... so !
Anyone to have idea how the Parser will work... I mean mostly at the
language-developer side (not the internals).
It will be written in Perl, right ?! some striped-version of Perl ?! i.e.
what will be allowed and will not ?
Will it support lookahead, lookbehind and backtrack ?
Some samples ? How we will hack on it ?
As far as I remember it will be compiled to bytecode.
I saw on Damian site that Perl5/6 parser based on Fast::RecDescent is
pending ?! As the Fast::RecDescent itself  :")
At all what do U think !

=
iVAN
[EMAIL PROTECTED]
=





Circular references

2001-08-01 Thread Sterin, Ilya

I was just wondering if there will be any solution for the circular
refernece memory leak (I guess you can call it a problem).  Can't we keep
information on the number of circular references in the SV structure and
then decrement the references count by one + the circular reference count at
the end of scope?

Ilya



Re: Circular references

2001-08-01 Thread Dan Sugalski

At 01:01 PM 8/1/2001 -0600, Sterin, Ilya wrote:
>I was just wondering if there will be any solution for the circular
>refernece memory leak (I guess you can call it a problem).  Can't we keep
>information on the number of circular references in the SV structure and
>then decrement the references count by one + the circular reference count at
>the end of scope?

The dead object detection sweeps that are part of perl 6's garbage 
collection scheme will deal with these. Don't sweat 'em.


Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk




Re: Circular references

2001-08-01 Thread Buddha Buck

At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
>I was just wondering if there will be any solution for the circular
>refernece memory leak (I guess you can call it a problem).  Can't we keep
>information on the number of circular references in the SV structure and
>then decrement the references count by one + the circular reference count at
>the end of scope?

Dan has already answered (dead-object detection sweeps by the GC will take 
care of it), but I'm curious?

How do you detect a circular reference so you can update the circular 
reference count?

>Ilya




RE: Circular references

2001-08-01 Thread Sterin, Ilya

Did really think about that:)
But off the top of my head...

This is only a guess, but 

my $a;
$a = \$a;

A match of two addresses.  Though we are assigning on reference to a scalar,
we can match both addresses?


package CircRef; 

sub new { 
  my $self = []; 
  bless $self, shift; 

  $self->[0] = $self;  # <-- circular reference. 
  return $self; 
}

The match of both object would genereate a circular reference.

I guess by doing some extra checking this can be accomplished, just don't
know if 100%, since can't think of other scenerious right now and the above
suggestion might be wrong too:)

But as Dan said, GC will take care of that.  I know that I've read somewhere
before that Python keeps track of it's circular references, so I was sure
there was a way of doing this, just not exactly sure how it was implemented.

Ilya


-Original Message-
From: Buddha Buck
To: Sterin, Ilya; '[EMAIL PROTECTED]'
Sent: 08/01/2001 1:18 PM
Subject: Re: Circular references

At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
>I was just wondering if there will be any solution for the circular
>refernece memory leak (I guess you can call it a problem).  Can't we
keep
>information on the number of circular references in the SV structure
and
>then decrement the references count by one + the circular reference
count at
>the end of scope?

Dan has already answered (dead-object detection sweeps by the GC will
take 
care of it), but I'm curious?

How do you detect a circular reference so you can update the circular 
reference count?

>Ilya



RE: Circular references

2001-08-01 Thread Sterin, Ilya

 

-Original Message-
From: David L. Nicol
To: Buddha Buck
Cc: Sterin, Ilya; '[EMAIL PROTECTED]'
Sent: 08/01/2001 1:12 PM
Subject: Re: Circular references

Buddha Buck wrote:
> 
> At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
> > Can't we keep
> >information on the number of circular references in the SV structure
and
> >then decrement the references count by one + the circular reference
count at
> >the end of scope?
> 
> How do you detect a circular reference so you can update the circular
> reference count?
> 
> >Ilya

>Perl6 will only run on quantum computers, didn't you know that?

Then we have all the time in the world:)

I definitelly didn't imply inefficiency by doing the above, which was just
off the top of my head, there are of course better way of eliminating that
problem as with Dan's GC mention.  I never saw circular references leak as a
problem, since I'm used to cleaning up my mess, but it definitelly would be
a problem for others that are only used to programming in interpreted
languages (and then Java).

But no need to further discuss, since that will be taken care off :))

Ilya



-- 
   David Nicol 816.235.1187
 "Straight from the docs" doesn't mean "you can cut-and-paste" - it
  just means you find the principle explained clearly - without
 having to construct it from smaller blocks. -- Abigail



RE: Circular references

2001-08-01 Thread Sterin, Ilya

Well guess not, since something like this...

{
  my ($a, $b, $c);

  $a = \$b;
  $b = \$c;
  $c = \$a;
}

would definitelly be hard, resource consuming to implement a circular
reference count.

Ilya

> -Original Message-
> From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 01, 2001 3:39 PM
> To: 'Buddha Buck '; ''[EMAIL PROTECTED]' '
> Subject: RE: Circular references
>
>
> Did really think about that:)
> But off the top of my head...
>
> This is only a guess, but
>
> my $a;
> $a = \$a;
>
> A match of two addresses.  Though we are assigning on reference
> to a scalar,
> we can match both addresses?
>
>
> package CircRef;
>
> sub new {
>   my $self = [];
>   bless $self, shift;
>
>   $self->[0] = $self;  # <-- circular reference.
>   return $self;
> }
>
> The match of both object would genereate a circular reference.
>
> I guess by doing some extra checking this can be accomplished, just don't
> know if 100%, since can't think of other scenerious right now and
> the above
> suggestion might be wrong too:)
>
> But as Dan said, GC will take care of that.  I know that I've
> read somewhere
> before that Python keeps track of it's circular references, so I was sure
> there was a way of doing this, just not exactly sure how it was
> implemented.
>
> Ilya
>
>
> -Original Message-
> From: Buddha Buck
> To: Sterin, Ilya; '[EMAIL PROTECTED]'
> Sent: 08/01/2001 1:18 PM
> Subject: Re: Circular references
>
> At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
> >I was just wondering if there will be any solution for the circular
> >refernece memory leak (I guess you can call it a problem).  Can't we
> keep
> >information on the number of circular references in the SV structure
> and
> >then decrement the references count by one + the circular reference
> count at
> >the end of scope?
>
> Dan has already answered (dead-object detection sweeps by the GC will
> take
> care of it), but I'm curious?
>
> How do you detect a circular reference so you can update the circular
> reference count?
>
> >Ilya



Re: Circular references

2001-08-01 Thread Dan Sugalski

At 03:18 PM 8/1/2001 -0400, Buddha Buck wrote:
>At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
>>I was just wondering if there will be any solution for the circular
>>refernece memory leak (I guess you can call it a problem).  Can't we keep
>>information on the number of circular references in the SV structure and
>>then decrement the references count by one + the circular reference count at
>>the end of scope?
>
>Dan has already answered (dead-object detection sweeps by the GC will take 
>care of it), but I'm curious?
>
>How do you detect a circular reference so you can update the circular 
>reference count?

There's no good general way to do it that's not essentially brute force. If 
you've knowledge of your data structures you can do it by hand, but that 
can always be a bit dicey.

Automated sweeps are the only way to fly... :)

Dan

--"it's like this"---
Dan Sugalski  even samurai
[EMAIL PROTECTED] have teddy bears and even
  teddy bears get drunk




Extending POD (was (indented tables))

2001-08-01 Thread Bryan C . Warnock

(migrated from perl-qa)

On Wednesday 01 August 2001 03:10 pm, David L. Nicol wrote:
> "Bryan C. Warnock" wrote:
> > I didn't have a good solution for tables, mainly because I didn't like a
> > tab, comma, or pipe separated solution.  (Which isn't intended as
> > commentary on Ziggy.)
>
> Here's a possibility -- new rows are indicated by a flush-left line,
> each column has a line.  (this happens to be how I like to lay out
> my data data.)
>
> Table of Students:
>
> Last Name
>   First Name
>   Exam Grade
>   Semester Grade
>   Cup Size
> Aardvark
>   Chris
>   D
>   B
>   A
>
>
> The thing might end at the first blank line.

It's too awkward to read and write, particular if you have a lot of columns.

I toyed with automatic column detection for a while - (convert any tabs to 
spaces, convert whitespace to 1s, non-whitespace to 0s, and & all the lines 
together.  Splitting on /(1+)/ allows determination on each individual 
column width, as well as the space between columns.  Then generate the 
appropriate format on the fly, and fill it in with the heavy use of substrs. 
It was supposed to allow table creation in the same vein as "I'll figure out 
what you're trying to do, just do it.", and it worked fairly well for me.  
Couldn't handle multiline entries, was my biggest problem.  Then I realized 
that I was doing it all in a fixed width font, and the whole thing was 
worthless in the customer's WYSIWYG environment.  But I digress...)

I basically came to the conclusion that there was no real easy way to 
produce a table without resorting to input that makes you focus more on the
table itself than the data you're putting in.  And when it comes to 
documentation, the latter is much more important than the former.

Unlike Ziggy, however, we didn't have a lot of tables to produce, so the 
customer was content with table production in a spreadsheet, which I could 
then process during page generation.

Obviously, that won't work for POD, and I do feel that POD needs table 
support.

-- 
Bryan C. Warnock
[EMAIL PROTECTED]



Re: stealing something from plan9 os

2001-08-01 Thread Bryan C . Warnock

On Wednesday 01 August 2001 10:04 pm, David L. Nicol wrote:
> I hope this isn't too stale to talk about.
>

This is perl6-language.  Nothing, it seems, is too stale to talk about.
We're still brainstorming, even though the RFC period ended 10 months ago.

> Please restrain from telling me that the discussion is over
> and the "." decision is made ond over, for the moment.

Okay, but.

>
> James Mastros wrote: (on June 21)
>
> > I still fail to see why "." is such an advantage over ->.
> > The only real benifit I see is typing ease, and -> isn't that
> > hard to type.  That's what editor macros are for.
>
> What about replacing "->" with "/" ?

Your idea aside, I think the substitution was more to gain the '.' than to 
replace the '->'.

-- 
Bryan C. Warnock
[EMAIL PROTECTED]



properties, revisited

2001-08-01 Thread Bryan C . Warnock

If I've got a set of matching properties, do I get to build hotels on my 
hashes?

There are a number of properties "built into" Perl 6.   Nearly all of these 
properties don't make sense across the board - eg, a scalar won't have a 
dimension, a hash won't prompt, etc.

So given the two different sets that you must consider (variable versus 
value, and hash versus array versus scalar versus filehandle), are 
properties that are meaningless for some section usable by the user?

(Realizing that there was talk about distinguishing between value and 
variable properties...)

# scalar variable property doesn't allow $foo to be changed
$foo is constant = 3;  

# But this doesn't make sense, as 3 is already constant. 
$foo = 3 is constant;
# Error?  Or simply user-defined?

Example 2:

$*ARGS is chomped;  # Fine, but

%hash is chomped;
# Is this legal?  An error?
# (The chomp character is defined by the IRS attribute of a filehandle.)
# Can I define something that says to chomp the values entered
# into the hash?  The keys?  
# What if the hash is tied to a filehandle?  

-- 
Bryan C. Warnock
[EMAIL PROTECTED]



Re: Circular references

2001-08-01 Thread Buddha Buck

As a necrohipposadist (beater of dead horses), I'll add...

"Sterin, Ilya" <[EMAIL PROTECTED]> writes:

> Well guess not, since something like this...
> 
> {
>   my ($a, $b, $c);
> 
>   $a = \$b;
>   $b = \$c;
>   $c = \$a;
> }
> 
> would definitelly be hard, resource consuming to implement a circular
> reference count.

Even that's not that difficult.  There's just one loop.  How about:

sub newgraph {
  my $noderef = shift;
  my @nodes = @$noderef;
  my $edgesref = shift;
  my @edges = @$edgesref;

  my %graph;

  foreach (@nodes) { $graph{$_} = [] }
  while (@edges) {
my $source = shift @edges;
my $dest   = shift @edges;
push @$graph{$source},$graph{$dest};
  }
}

In this horrid little data structure, every reference of interest is a
reference to arrays of references, all of which are parts of circular
references.  This is not necessarily a good way to store a directed
graph, but it works (and some would think it has some benefits in some
cases).  But each push could introduce lots and lots of new loops that
would have to be accounted for.

However, more realistically, I could imagine someone coding a tree
where each node had pointers to its parent, its children, its
siblings, its "next" and "previous" nodes, etc.  All of which would
lead to numerous circuits.  Again, each addition to the tree would
introduce numerous, potentially hundreds or thousands, of circuits.
The same would happen on every delete, too.



> 
> Ilya
>