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

Re: OT: Language War (Re: "C" Manual)



on Wed, 02 Jan 2002 12:43:56AM -0800, Erik Steffl insinuated:
> Richard Cobbe wrote:
> > 
> > Perl does have strong types, but they don't really correspond to the
> > types that most people are used to thinking of.  Perl's types are
> > 
> >     * scalars (no real distinction between strings, numbers, and the
> >       undefined value)
> >     * lists
> >     * hashes
> >     * filehandles
> > 
> > (I haven't really used Perl since Perl 4, so this list may not be
> > complete.)
> 
>   actually there is real distinction between string and number, it's
> just that it's internal only (perl stores numbers and strings
> differently, it also treats them differently).
> 
[...]
> 
>   the point was that it's not a strong type system - by which I mean
> that you can assign pretty much any value to any l-value, no questions
> asked. You don't get segfault but you still get non-working program
> (e.g. when you mistakenly assing array to scalar, you get size of array
> in scalar).

agreed -- and not only that, but you have to be careful to be aware of
which type you're using in order to compare scalars and have it mean
anything -- numerical operators being the standard ==, !=, &c.;
whereas the equivalent string operators are 'eq', 'ne', &c.  it still
doesn't segfault (which is beautiful, and was the point here, i know),
but it makes your program more non-functional than if it just treated
the values the same.

</nori>

<nori@sccs.swarthmore.edu>--------------------------------------------------
-------------------------http://www.sccs.swarthmore.edu/~nori/jnl/daily.html



Reply to: