[contest] Is a Cow an animal ++
bearophile
bearophileHUGS at lycos.com
Thu Sep 30 10:48:31 PDT 2010
Norbert Nemec:
>In fact, I am beginning to see how a language could conceivably support the concept of killing a cow at runtime while ensuring at compile-time that it is not killed twice:<
Good :-)
> More generally: the whole concept of type-states that have been
> discussed only makes sense within a routine. The global name-space does
> not evolve in any ordered way, and without time evolution, the concept
> of changing state does not make sense.
I agree, in D global names don't have a true order, so a typestate can't be used (at best you may somehow manually set the initial global state of a type), you may use it inside functions.
In a language like C/Pascal where global definitions too define an order, the typestate may have sense for global variables too.
Bye,
bearophile
More information about the Digitalmars-d
mailing list