I7 : definitions to add new names?

Normally we use definitions to add descriptive words to the things name: A starving wolf, a ghostly stone.

But what if I wanted the definition to replace the things name?

Pete is already a ‘man’ and a ‘person’ at the same time. Can he be a ‘cyborg’ too?

[code]A person can be part machine. A person is usually not part machine.
Definition: a person is a cyborg if he is part machine.

Lab is a room.
Pete is a man in the lab. Pete is part machine.[/code]
The code doesn’t report any errors, but ‘cyborg’ doesn’t turn up with ‘showme pete’, either … Is this supposed to work?

Stupid question - have you tried, for testing purposes and just to make sure whether it’s working or not, something like…

Instead of examining Pete, say “This is Pete.[if Pete is a cyborg] He is a cyborg!”.

…at least then you’ll know whether the issue is in your code not being recognised or in SHOWME not showing what you want to see.

I could be wrong, but I wouldn’t expect that definition to show up in SHOWME anyway. Aren’t those definitions mostly for the author to do fancy stuff, like count all the cyborgs in the room?

Yeah, as I said in the other thread, I think those Definitions aren’t stored in the representation of the object the way properties like “part machine” are, so they don’t show up in SHOWME. The definition is working so you can catch Pete as “a cyborg”:

[code]A person can be part machine. A person is usually not part machine.
Definition: a person is a cyborg if he is part machine.

Lab is a room.
Pete is a man in the lab. Pete is part machine.

Instead of attacking a cyborg: say “The Cyborg Rights League would not approve.”[/code]

…HIT PETE will give us the new message.

Oh, you’re right - showme never shows definitions. Looks like this works! or …

I tried adding The plural of cyborg is cyborgs. but it still goes awry when I refer to cyborgs

Index => Phrasebook=> Lexicon
a cyborg … adjective: (of person) a person is a cyborg if he is part machine

I think Inform just assume that I mean ‘cyborg person’ when I say ‘cyborg’ (‘cyborg person’ is accepted in the code, too)

The way I understand it, a “Definition” is basically a short true/false function call that can be conveniently used as though it were an either/or property. This means that it can be tested (“if John is a cyborg then…”), but it can’t be assigned or declared (“now John is a cyborg”).

A cyborg is a kind of person. Understand “cyborg/mechanical” as a cyborg.

Pete is a cyborg.

The printed name of a cyborg is usually “a mechanical person”.

Yes, “cyborg” is assumed to mean “cyborg person” when you define it as an adjective like that.

People have already answered your question, but I want to focus on this bit.

Person and man are kinds. Kinds are user-defined types, called classes in many languages. Kinds are arranged in a hierarchy, a tree with the most general type (object) at the root and the more specialized types at the leaves. You can see this tree by looking at the kinds tab of the index panel in I7.

When we define an object to be of a certain kind with a statement like “Pete is a man.”, the result is not only that Pete is a member of the kind man but also that Pete is a member of every ancestor of man in the kind hierarchy (that is, every more general kind of which man is a subkind). So Pete is a man, Pete is a person, Pete is a thing, and Pete is an object. (That an object can be of multiple types at once is a key aspect of polymorphism in object-oriented programming languages, reflected in the meaning of the word itself.)

So, if we want Pete to be a cyborg in the way that he’s a man or a person, we’d need to add cyborg to the kind hierarchy and then define Peter to be either a cyborg or a subkind of cyborg. This is what HanonO’s example does. “A cyborg is a kind of person.” and so on.

In contrast, saying “a person can be part machine” does not define a new kind but instead defines an either-or property for all members of person and its subkinds (people, men, women, and animals). That is, each person is either part machine or not part machine. A statement like “A person is usually not part machine” tells us what the default is and whether or not it can be overridden for specific objects (usually vs. always, seldom vs. never).

The other posters have covered defining new adjectives of a kind (“Definition: a person is a cyborg if…”). See §6.4 for more on that.

vlaviano, thanks for nailing it all down! I had a feeling there were some hierachy thing at play, but my knowledge is a bit fuzzy at times.