Quote:
Originally Posted by algernong
Yet it is practical to write code in C that is object oriented. It is not practical to do the same in SQL or your other analogies.
|
I still don't know what you mean with object oriented code in C.
The typical procedural coding style since user defined types (so since Algol) is something like this:
Code:
typedef struct { ... } Datastruct;
typedef Datastruct* PDatastruct;
int foo(const PDatastruct dataRef, otherparams) {
if (!dataRef) return -1; // invalid dataset
// Do something with dataRef as dataset
}
And inheritance was realized using prefixes in structs:
Code:
typedef struct { ... } ParentStruct;
typedef { ParentStruct prefix; ... } MyStruct;
or using unions:
Code:
typedef struct { ...; union { ... } childElements } MyStruct
This was long before the idea of OOP even existed. Than some day, some developer thought: It's pretty stupid to always need to add an extra param for a data reference, and the need to check if it's nil. Also inheritance using prefixes or unions is pretty confusing, and increases the chances of errors. So why not letting the compiler do it for you.
And with this the idea of OOP was born, which got first really implemented in Smalltalk.
So calling the old procedural style OOP is like calling a caterpillar a butterfly, as the essential development, which is the least required minimum to be called that, is missing.
Otherwise, what is the point in discriminating between procedural and OOP style, as, if you can call the old style OOP, this would be the same.
Quote:
Originally Posted by rokkialo23
The alphabet of a turing machine is a single set I agree.
But in a set you can include other sets. {{..},{--}} See this is only one set, including two sets.
|
Yeah but than you still have only one type, the type of the Set. The big point of types is, that many different types are just a substitution for different types. Take for example char and bytes. 'A' == 65. This is in a Turing machine not directly possible, as a Set can't hold 2 equal values (by definition). This can be simulated, using a substitution rule, but than it's still the equality <> equivalence problem