|
![](/i/fill.gif) |
Orchid XP v8 wrote:
>> An abstract data type has to define the operators also.
>
> Yeah, I was talking about *algebraic* data type when I said "all Haskell
> types are ADTs". ;-)
Sorry. I get them mixed up, since the definitions changed since I studied
them. I don't hold that "objects" or "classes" are "abstract data types" at
all, so the two terms mean the same for me.
>>> As for "like say a stack", I'm not really sure what you mean.
>>
>> Well, an ADT has to define the type in terms of the operations on that
>> type, not in terms of a list of values/literals.
>
> I think we're still talking about two different meanings of ADT. ;-)
Possibly.
> I always wandered what a abstract data type actually is...
That's what it is. There's even a programming language called "ACT.ONE" (or
maybe "ACT.1", I forget which) that really has abstract/algebraic data
types, in that you (for example) don't give actual sequential steps for
pushing and popping, but you actually wrote the kind of thing that I wrote.
> The Eiffel guy had a chapter implementing a stack and "proving" that it
> matches the spec.
That's actually impossible to do, since Eiffel isn't a formal language.
There's no definition for what "X = Y" means in the language (as in
assignment operator) so he can't mathematically prove it matches the spec.
> (He attempted to claim that the code *is* the spec.)
Well, it's the spec for what his code does, but that's trivially true of any
safe language.
> I think he was trying to counter the old "there is no mathematical theory
> to OOP".
And for the most part there isn't. There's hand-waving mathematics, but not
something precise enough you can automate it.
> At the time, I believed him. Having seen Haskell, and its evil twin the
> Lambda Calculus, I now understand what they mean by "no theory of OOP"...!
Yep, exactly. ADTs are the sorts of high-level data types you build out of
lambda-calculus type rewrite rules. LOTOS is the only actual programming
language I know of that goes all the way down to that level of mathematical
detail.
--
Darren New, San Diego CA, USA (PST)
Why is there a chainsaw in DOOM?
There aren't any trees on Mars.
Post a reply to this message
|
![](/i/fill.gif) |