|
|
Warp wrote:
>> Haskell has "modules". The module is the unit of abstraction in Haskell.
>> When you write a module, you can define precisely what parts of it are
>> visible from the outside, and which parts aren't.
>
> So Haskell is really a two-paradigm language: Functional and modular?
>
> (To understand what the "modular programming paradigm" means, it's
> basically the same thing as the "object-oriented programming paradigm"
> minus inheritance and dynamic binding.)
If you consider "modular" to be a programming paradigm then... yes, I
guess. (Does Pascal count as "module" too?)
Did I mention that Haskell also has "classes"? (Though they don't work
quite the same as in OOP.)
> Anyways, my real question was: Given such a module (eg. "a pixel"),
> can you, for example, create an array of them so that each one takes
> only as much memory as the sum of the sizes of its member variables?
You can do this. However, it's sufficiently hard work given the present
library structure that you would only bother doing this if it was really
necessary for your particular application.
(In future they're supposed to be adding support for transparently
storing arbitrary types without pointer indirection. For the moment,
you'll have to implement it yourself by hand for any type you want an
array of.)
So it's not a language limitation, it's a library limitation. And I'm
not sure why nobody is out fixing it, actually...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|