[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] what's it look like under the hood?



Joel--

> First, would anyone dare implement Perl in Perl? 

Actually, large parts of Perl ARE implemented in Perl.

Perl is exstensible using modules or packages, which are normally written 
in Perl.  The standard distribution comes with a common set of modules.  
These include packages known as "pragmas", which alter the behavior of 
the interpreter in useful ways.  Pragmas are generally given lowercase 
names, like 'strict' or 'vars' (to name a couple of the most commonly 
used pragmas). 

However, the interpreter isn't.  

Lots of information can be found in the POD "perlguts.pod".

> Second, does Perl optimize? How well? Can it reduce constant expressions?

Technically, perl is a three-pass compiling interpreter.  If I'm reading 
the POD correctly, the compiler performs up to four types of 
optimizations:  check routines, constant folding, context propagation, 
and peephole optimization.  However, my head gets all swimmy when I try 
to think on this level... ;-)

I think the answers are:  "Yes",  "Quite Well", and "Yes".

> Third, does Perl have multiple internal stacks, specifically splitting 
> the control data (return addresses) from the parameter data? (I am one of 
> those kinds of programmers with a bad habit of walking on my return 
> addresses in C.)

I suspect that this is largely a non-issue in Perl.  Perl is not C or 
Forth.  You don't have to allocate memory for your data before using it, 
or de-allocate it when you're done.  As an interpreted language, memory 
allocation and garbage-collection is done for you.  So you can't engage 
in your bad C or Forth habits in Perl.

Did I mention that discussing the internals of Perl makes my head all 
swimmy?...

--B


Brian McNett, Webmaster
*************************************************************
Mycoinfo. The world's first mycology e-journal.
http://www.mycoinfo.com/
*************************************************************


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org