Re: strong/weak typing and pointers

From: Steven Bethard (steven.bethard_at_gmail.com)
Date: 11/04/04


To: python-list@python.org
Date: Thu, 4 Nov 2004 16:55:48 +0000 (UTC)

Alex Martelli <aleaxit <at> yahoo.com> writes:
>
> Suppose for example that you would like your OS to be able to load
> executable code from disk into memory and execute it. Suppose you would
> like it to be able to read some configuration parameters from disk and
> set its own internal data structures accordingly. At one level, as it
> goes to disk or comes back from there, you have arrays of bytes. But in
> memory, you want functions that can be called appropriately (a device
> driver residing in a module) or data structures which, differently from
> an array of byte, DO have structure -- for example, a partition table
> for a disk, with information to specific filesystem drivers as to what
> partition is to be treated in what way.

I'm sorry, I guess I still don't understand this example. It sounds like you're
just going between untyped (array of bytes) and typed (functions, data
structures, etc.) I'm not seeing how you're, for example, casting a function to
a data structure, or a data structure of one type to a data structure of another
type.

Anything can (and sometimes should) be treated just as an array of bytes, in an
analogous method to how in an OO language with a base class Object, sometimes
it's appropriate to treat a given instance of a class as an Object, rather than
it's particular subclass of Object. I wouldn't consider treating function, data
structures, etc. as arrays of bytes (or vice versa) as something that takes
advantage of "weak-typing", but rather something that takes advantage of the
ability to treat data as untyped.

Hopefully this clarified my confusion and when you get a chance, you can try to
explain it to me again? Thanks,

Steve



Relevant Pages

  • Re: Looking for a collection that uses hard disk as storage
    ... to operate off the disk, as soon as you do any kind of search on it. ... There's no a priori reason to believe this is true, even though it's true that _some_ in-memory collections may not be as effecient as a disk-based database. ... indexing mechanism. ... It seems to me that if all you know is that one implementation is a disk-based database and another is an in-memory data structure, that that is not nearly enough information to tell you which will perform better. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: non-abstract extension of
    ... => at times and at other times read it back from disk. ... I should be able to take an arbitrary data structure (in my particular ... case a complicated hash table), convert it to a <ByteBuffer>, and then ...
    (comp.lang.java.programmer)
  • Re: Creating a byte[] of long size
    ... it is unlikely your system will run well if this one data structure ... consumes 2G of memory. ... that pre-fetches items into the cache. ... likely end up swapped to disk anyway. ...
    (comp.lang.java.programmer)
  • Re: How to prevent duplicated entry in array of the hash-Help PLEASE PLEASE
    ... That will give you a data structure that looks like this: ... Thank you so much Sherm, I will use the above per your request as one ... I access disk, ... Web Hosting by West Virginians, ...
    (comp.lang.perl.misc)
  • Re: Dodgy PSU?
    ... on all partitions except the OS partition (which was ... recovery rather than file structure fault recovery. ... plus the normal data structure scan. ... it's to recover from going-bad disk ...
    (uk.comp.homebuilt)