Re[2]: Mutable Bytes
Lenard Lindstrom <[email protected]> Mon, 26 Jul 2004 12:02:55 -0700 (Pacific Daylight Time)
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <Mahogany-0.66.0-4294704199-20040726-132329.00@pop3.norton.antivirus> |
On Sun, 25 Jul 2004 11:40:31 -0700 Mark Hahn <[email protected]> wrote: > Martin Christensen wrote > > >I have almost no experience working directly with raw data, > >having almost exclusively dealt with data on a more abstract > >level, so I'm surely not the best judge. However, I tend to > >think of raw data very much as a mutable thing: manipulating > >bodies of raw data solely by means of cutting them up and > >putting them back together again afterwards doesn't match my > >mental model of what I'm doing very well. When working with > >text strings, this procedure makes much more sense, since > >usually strings are broken up into, and pieced together from, > >parts that make sense to a human, e.g. words and sentences. > > I haven't implemented it yet, but I have on the to-do list to implement > Bytes methods that mimic the struct type capabilities that Python has in a > module. This would allow you to treat the Bytes data in a bit more > high-level contstruct of C structs. It would also allow you to treat the > data as an array of structs. I'm open to more ideas in this area. > > I still haven't been able to wrap my mind around whether this means Bytes > should be mutable or not. I am too biased being that I am so focused on the > internals. I'll take your input as one vote for making Bytes mutable and > I'll abstain for now. > > Can I get some comments and votes from everyone else? > > ...<snip>... > > >If mine differs > >from everyone else's, then of course my ramblings should just > >be ignored. :-) > > I would think the opposite. Mainstream opinions are worth less than unique > ones. > I can only guess that in Python character strings were used for binary data to keep down the number of built-in types. Also a function's compiled byte code is stored as a string. Byte code is a low level feature that is not considered portable across versions. So it makes sense to discourage direct manipulation of the byte code. If Prothon binary data is made visible within the langauge as byte strings does it make sense to allow direct changes to them? Lenard Lindstrom <[email protected]>