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

Re: perl 6 requirements

From:
Ted Ashton
Date:
July 31, 2000 12:32
Subject:
Re: perl 6 requirements
Message ID:
20000731153156.Y8214@ns.southern.edu
Well, if this weren't completely off-topic, I'd reply something like the 
following:

Thus it was written in the epistle of Buddha Buck,
> 
> The pack/unpack has to happen at sometime.

I think I disagree with this.  In HP Pascal, for one, I have a thing called 
a variant record.  With that, I can take a chunk of memory and define it 
multiple ways.  If, for example, I define it as 48 characters and also as
4 bytes of id number followed by 44 characters of name, when I read the file
using the 48 character format, I can immediately use the id number as a 32-byte
integer and display the name without any data transfer having happened.

>                                             Perhaps what would work would 
> be to create a module or core type that would remember its pack 
> format.  Ideally, when used in a scalar context, it would look like its 
> packed representation; when in a hash context, like its unpacked 
> representation.  Something like:
> 
> # game message data consists of objectID; position x,y,z; orientation
> # ux,uy,uz (up direction) and nx,ny,nz (nose direction), velocity
> # vx,vy,vz, and acceleration ax,ay,az all as 32-bit integers in network
> # byte order (packet size: 512B).  Object ID of 0 means update complete.
> #
> # $packet pre-defined to have a pack format of "NNNNNNNNNNNNNNNN"
> {
>    sysread SERVER, $packet, 512;
>    last if $packet{'objectID'} == 0;
>    $remoteobject[$packet{'objectID'}] = { %packet };
> }
> 
> Is that sort of what you'd like?

At first glance, it looks good.  Any such variable would be rigid.  Trying to 
extend it beyond it's boundaries or shrink it under its defined width would
either result in a warning/error or else in some corrective action.  Anywho.
As the whole subject is off-topic, I suppose I'll have to wait to say such
things until there is an appropriate list :-).

Ted
-- 
Ted Ashton (ashted@southern.edu), Info Sys, Southern Adventist University
          ==========================================================           
Throughout the 1960s and 1970s devoted Beckett readers greeted each
successively shorter volume from the master with a mixture of awe and
apprehensiveness; it was like watching a great mathematician wielding an
infinitesimal calculus, his equations approaching nearer and still nearer to
the null point.
                                      -- Banville, John
          ==========================================================           
         Deep thoughts to be found at http://www.southern.edu/~ashted



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