Re: strong/weak typing and pointers
From: Steven Bethard (steven.bethard_at_gmail.com)
Date: 11/04/04
- Next message: Steven Bethard: "Re: Summary: strong/weak typing and pointers"
- Previous message: Ricardo Batista: "RE: dijkstra algorithm by object oriented"
- In reply to: Alex Martelli: "Re: strong/weak typing and pointers"
- Next in thread: Diez B. Roggisch: "Re: strong/weak typing and pointers"
- Reply: Diez B. Roggisch: "Re: strong/weak typing and pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Steven Bethard: "Re: Summary: strong/weak typing and pointers"
- Previous message: Ricardo Batista: "RE: dijkstra algorithm by object oriented"
- In reply to: Alex Martelli: "Re: strong/weak typing and pointers"
- Next in thread: Diez B. Roggisch: "Re: strong/weak typing and pointers"
- Reply: Diez B. Roggisch: "Re: strong/weak typing and pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|