On Fri, 17 Dec 2004, Jonathan Paton wrote:

> On Fri, 17 Dec 2004 09:17:05 -0500 (EST), Chris Devers wrote:
> 
> And what programming language were you learning? 

C/C++, Java, Visual Basic, Cobol.

> In some other languages, like C, C++ and Java you must specify the 
> exact type of each variable.  This information is useful to gather in 
> to one place, out of the way of the actual code.
> 
> In perl, you have signals ($%@&* etc) to specify the type, and my to 
> declare that it is a new lexical variable.  You don't have to specify 
> if you have a char etc.

I always thought of grouping typing as incidental to the real point of 
pre-declaring variables. The real point, it seemed to me, was built in 
to the phrase "data dictionary": it's a segment of code that maps out 
what pieces of information the following section of code will deal with.
 

> Also in perl, each block is a new lexical scope - where all is fair to
> introduce new variables.  E.g.
> 
> for my $index (0 .. $last_index) {
>     my $computed = ...;
> 
>     ...
> }
> 
> where $index and $computed wouldn't exist outside of the loop.  This
> is easier to read than:
> 
> my $index;
> my $computed;
> 
> for $index (0 .. $last_index) {
>     $computed = ...;
> 
>     ...
> }
> 
> Where $index and $computed live on, but may never be used again.

*shrug*

I see little readibility difference there.
 
> Generally, fewer lines of code are easier to manage.  

Well, of course. But sometimes spelling things out can be useful too.



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to