Re: Entity and Identity
Date: Mon, 10 Aug 2009 15:39:31 -0700 (PDT)
On Aug 10, 11:31 pm, rp_at_raampje.(none) (Reinier Post) wrote:
> Nilone wrote:
> >On Aug 8, 12:31 am, rp_at_raampje.(none) (Reinier Post) wrote:
> >> Nilone wrote:
> >> >Types define values. Values aren't mutable, since mutability implies
> >> >a persistent identity beyond the value itself. As soon as you have
> >> >mutability, you have a state machine, and subtyping state machines is
> >> >a problem. Subtyping an interface and creating a new state machine
> >> >for it is fine.
> What you're describing I might call 'abstract data type'
> but not just 'type'.
I was contrasting (data) types with state machines, among which ADTs can be counted. Abstract data types are models of behavior, for example stacks and queues. Compare "data type" with "abstract data type" in Wikipedia.
> >> You are using the term 'type' in a different sense than OO languages
> >> such as Java and C# do.
> >That's not surprising. Most OO documentation and tutorials use the
> >term to indicate arbitrary classification or similarity.
> You're reading different documentation and tutorials than I have seen.
> I don't think I've ever seen the term 'type' used in that way.
> Aren't you referring to 'class'?
Perhaps in the philosophical sense, but not in the programming sense. I'm claiming that OO classes conflate different concepts, and that by separating and understanding these concepts, the problems in OO can be overcome.
> > I use the
> >term to indicate a domain of values with defined semantics, and to the
> >construction of such a domain in a programming language. I'll stand
> >by my definition until I see a better one.
> Try Luca Cardelli's:
Cardelli seems to agree with me:
"A program variable can assume a range of values during the execution
of a program. An upper
bound of such a range is called a type of the variable. For example, a variable x of type Boolean
is supposed to assume only boolean values during every run of a program. If x has type Boolean,
then the boolean expression not(x) has a sensible meaning in every run of the program."
And from the definition of terms:
"Type: A collection of values. ..."
> >> But what if you need equivalent, but differently implemented functions?
> >> That's what polymorphism is for.
> >Take a look at my other post. I believe the type system I described
> >there is properly polymorphic. If you give an example, I'll describe
> >it in terms of that system.
Received on Mon Aug 10 2009 - 17:39:31 CDT