Re: RFC 289 (v1) Generate module dependencies easily

2001-08-31 Thread Steve Simmons

> Perl6 should ship with a simple utility that shows all modules a program
> uses, and all modules those modules use.

Presumably with the caveat that no usage list can be generated for any
missing modules.



Re: CLOS multiple dispatch

2001-08-31 Thread Me

> If the dispatcher is drop-in replacable, what does its
> interface look like?

I'm thinking this is either deep in mop territory, or a probably quite
straightforward set of decisions about dispatch tables, depending
on how you look at things.

I found just one relevant occurence of 'mop' in perl6-all archives:

http://www.mail-archive.com/perl6-all@perl.org/msg10432.html

And not a single reply...

I'd really like to see what Dan / lisp folks have to say about mops
and perl6...




Re: Multiple-dispatch on functions

2001-08-31 Thread Me

Dan, I don't immediately see how per object/class dispatch
control helps to make multimethods pluggable. Perhaps a
multimethod (a set of methods) is a class/object? Is there
a general mop for dispatch?

More generally:

> Yes. Ordinary subroutine overloading (like that offered by C++)
> certainly does fall out as a happy side-effect of multiple dispatch
> in dynamic languages.
> 
> For example, see:
> 
> http://dev.perl.org/rfc/256.html#Handling_built_in_types

How would you handle making (multimethod) dispatch pluggable
when built in types are involved?




Re: Source/Program metadata from within a program

2001-08-31 Thread John Porter

Brent Dax wrote:
> > use Fcntl qw(:seek);
> > seek DATA, 0, SEEK_SET;
> > @code = ;
> 
> IMHO, that's too hackish--just reading that doesn't make what you're
> doing obvious.

It also can only get the main program, not any of the modules it loads.

-- 
John Porter




Re: Source/Program metadata from within a program

2001-08-31 Thread John Porter

> > > Access to the source code.
> > 
> > Particularly comments and POD.
> 
> Cool--I'd suggest a special $*CODE filehandle, to match $*DATA 

First, take a look at RFC 79, which I think addresses the wants here.
My thoughts on how it should work are a little different now, but I
guess it's too late to bother updating the RFC.

Second, Larry made a pass at this issue in his discussion of RFC 5,
near the beginning of Apoc 2.

Third, Larry talked a bit more about it in the SOTO 5; see
  http://www.perl.com/pub/a/2001/07/25/onion.html?page=2
It's about 2/3 of the way down.

(Hm, do you think I care about this issue? ;-)

-- 
John Porter

A word spoken in the mind will reach its own level in the objective truth.




RE: Source/Program metadata from within a program

2001-08-31 Thread Garrett Goebel

From: Nicholas Clark [mailto:[EMAIL PROTECTED]]
> On Thu, Aug 30, 2001, Brent Dax wrote:
> > From: Michael G Schwern [mailto:[EMAIL PROTECTED]]
> > # On Fri, Aug 31, 2001, Bryan C. Warnock wrote:
> > # > Access to the source code.
> > #
> > # Already got that.
> > #
> > # use Fcntl qw(:seek);
> > # seek DATA, 0, SEEK_SET;
> > # @code = ;
> > 
> > IMHO, that's too hackish--just reading that doesn't make
> > what you're doing obvious.  An explicit $*CODE filehandle
> > would make more sense to the uninitiated.
> 
> perl -we 'print q(use Fcntl qw(:seek); seek DATA, 0, SEEK_SET 
> or warn $!; @code = ; print qq(Here is my source 
> code\n), @code;), "\n__DATA__\n"' | perl 
> Illegal seek at - line 1.
> Here is my source code
> 
> Who said that my source file handle was seekable?
> Particularly if it's coming in via an interesting PerlIO 
> layer (and not just a pipe as in my contrived example.)

This gets a little closer... but BEGIN, INIT, CHECK, END blocks are lost
except for subroutine definitions. Anyone know a way to get at them using
B::Deparse?

perl -we '$a++; BEGIN{$a=1} use B::Deparse; B::Deparse::compile()->(); my
$var=q{here}; sub hello {print qq{hello\n}}'




Re: Source/Program metadata from within a program

2001-08-31 Thread Michael G Schwern

On Fri, Aug 31, 2001 at 10:04:00AM -0400, John Porter wrote:
> Brent Dax wrote:
> > > use Fcntl qw(:seek);
> > > seek DATA, 0, SEEK_SET;
> > > @code = ;
> > 
> > IMHO, that's too hackish--just reading that doesn't make what you're
> > doing obvious.
> 
> It also can only get the main program, not any of the modules it loads.

use Some::Module;
use Fcntl qw(:seek);
seek Some::Module::DATA, 0, SEEK_SET;
@their_code = ;

which only works if Some::Module has an __END__ block... but that
shouldn't be hard to fix.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]>   Kwalitee Is Job One
Lord of Kwalitee!  Wearer of the CPANTS and Slayer of Pseudo-hashes!



Re: Source/Program metadata from within a program

2001-08-31 Thread Michael G Schwern

On Fri, Aug 31, 2001 at 11:25:17AM +0100, Nicholas Clark wrote:
> Who said that my source file handle was seekable?

The problem is, it appears DATA is only opened if there's an __END__
or __DATA__ tag.  I don't remember it working this way...

*shrug*  We can fix that easy. :)

-- 

Michael G. Schwern   <[EMAIL PROTECTED]>http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]>   Kwalitee Is Job One
 Hey, Schwern!  THERE IS A HUGE GAZORGANSPLATTEDFARTMONGERING-
LIGHTENINGBEASTASAURSOPOD BEHIND YOU!  RUN, BEFORE IT GAFLUMMOXES YOUR
INNARDLYBITS!