develooper Front page | perl.bootstrap | Postings from July 2000

Re: perl 6 requirements

From:
Hildo Biersma
Date:
July 31, 2000 11:53
Subject:
Re: perl 6 requirements
Message ID:
3985CA98.D6A22952@msdw.com
Ted Ashton wrote:
> 
> Thus it was written in the epistle of Hildo Biersma,
> > > This leads down the road to the "pack/unpack" scenario: really the primary
> > > use for pack/unpack is to access/present data from/to type-checked,
> > > non-scalar interfaces (structs, objects, arrays of X, whatever).
> >
> > Why?  Let perl do the work for you.  I known that perl will always be
> > able to store an integer of any size in a normal untyped scalar.  If I
> > want to store an arbitrary scalar, the language could define that (a) an
> > out of range value is truncated or (b) an out of range value throws an
> > exception.  If I want to cast everything, I would be coding C++ in the
> > first place, you could in perl to get away from all that...
> 
> Hildo,
>   P'raps you've not run across it, but there are situations where one is given
> a datastructure created by another language (in my case, usually through being
> handed a file with records built by a certain structure).  I have to unpack
> those records, deal with the data, and likely pack up the data as a fixed-size
> record to ship on to the next (non-Perl) thing.  If I could define a data
> structure with fixed sizes and just say, "put the data in this space, here," it
> would save my unpack and pack.

This is a very convincing argument. And yes, I've dealt with this myself
- it hurts.

However, as to whether datatypes to support this should be the default,
or in a pariah module out there, that's another matter...

Hildo



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About