Child of an object

Is there an I7 equivalent to the I6 function, child(object), which returns the first object that is inside the given object?

To put this in context, I am setting up the I7 equivalent of something like this:

if (~~(noun provides friends)) rfalse;
f = child(second);
len = noun.#friends/WORDSIZE;
for (i=0:i<len:i++) {
	if (noun.&friends-->i == 0) {
		noun.&friends-->i = f;
		break;
	}
}
remove f;

The following seems to work:

	if the noun does not provide the property friends, stop; [Actually I want it to continue with the normal rule for this action.]
	add a random thing which is in the second noun to the friends of the noun;
	let F be a random thing in the second noun;
	remove F from play;

I just can’t accept that “random thing which is in the second noun” is the concisest way to get a child of the second.

And incidentally, does anyone know of an Inform 6 to Inform 7 comparison chart or something that shows the I7 equivalents of I6 stuff?

As far as I know, it’s the only way to do this at the moment. Occasionally someone on the newsgroups is tripped up by this and complains it’s unintuitive. I have a vague idea that it’s on Graham’s list of things to improve, but I doubt it’s a high priority.

There’s Emily Short’s I6 Entry Points, Translated. (It doesn’t include “child”, but I expect she’d be open to feedback.)

And it is; it’s in the new consultation document, Programming point 2.

Thank you very much. Emily Short’s article looks very useful.

I really hope that Programming point 2 is addressed. This also means that the order of children of an object is irrelevant in I7. That is, in I6, child(object) would return the object most recently put into the object, which also generally corresponded to the object that would be listed first in a room description.

It looks like I might have lots of Inform 7 questions (I’m sorry to say), the likes of which do seem to be flooding the conversation channels of IF!

Well, a major reason for the consultation document is to get people’s opinions on proposed changes (and rejected ideas). If this is important to you, go ahead and email Graham some feedback.

If you really want the last item put into the container, not just any item, you can do this:

let toylist be the list of things in the toybox; if the number of entries in toylist is not 0: let last item be entry 1 of toylist;
Have a look at chapter 20 of the manual, particularly sections 7 (Lists of values matching a description) and 9 (Accessing entries in a list).

Thanks for your help. The child feature isn’t desperately important to me; I just assumed there’d be a better solution. It seems generally that some things are more concise in I7 than in I6 and some things aren’t.