Rec.arts... examples don't work. Has I7 had major revision?

I keep finding examples on rec.arts that refse to compile on my machine. I am using version 1.2 6.31/6H98

I found the following:
(http://groups.google.com/group/rec.arts.int-fiction/browse_thread/thread/04d1074b45c2082b)

and adapted it to:

There are five rocks. When play begins: move a random off-stage rock to the garden.
but I get the compile error:

Am I missing something obvious or is the code incompatible with my version of Inform?

Yep! Try this.

[code]The Testing Room is A Room. A rock is a kind of thing. There are five rocks.

When play begins: move a random off-stage rock to the garden.[/code]

It seems you forgot to (or didn’t know you had to) define a rock as a kind of thing.

Hope this helps.

You need to tell Inform that

A rock is a kind of thing.

If you don’t, it will create one thing called “five rocks”!

I think.

To answer the direct question: the post you refer to is April 2011. I7 has not had a major update since December 2010. (That’s version 6G60. You’re using 6H98, which is identical except for MacOS 10.7 compatibility fixes.)

Any code you find from 2011 or later should work. However, as you see, a code sample online isn’t always a complete code sample.

Indeed it does! It’s also proper named.

I generally consider this bad practice, especially when giving examples that are to be copied and pasted. However, I believe that programmers often deliberately post code that doesn’t work without tweaking in order to deter script kiddies from using it straight off.

I’m pretty sure that’s not the motivation here. :slight_smile:

I can’t imagine a rational thought process by which anyone could come to the conclusion that it makes any sense to post code for others to use and then intentionally try to ‘deter’ them from using it “straight off”. That doesn’t mean that I don’t believe you; I’m just saying, it’s a stupid plan.

Paul.

If you’ll forgive my playing devil’s advocate, I can think of several reasons – none of which apply to the word “deter,” but setting that detail aside:

First, full-length working code blocks are sometimes quite long. Second, the person who responds with a suggestion or explanation may be in a hurry, and may only have time to point the questioner in the right direction, but may not have time to write out a long example. Third, the experts who respond to questions are sometimes torn between a desire to help and feeling annoyed at questioners who never seem to learn what they’re doing; thus, being very brief can be a way of giving the questioner a gentle kick in the seat of the pants. Fourth, it’s at least arguable that people learn more by typing their own code than by block-copying code they’ve been given. Fifth, the basic principles being pointed out in a reply may not be directly applicable to the questioner’s intended application, in which case spending time on a full-length block of code would be wasted effort. Sixth, the responder may assume that the questioner (or other readers) knows more than he or she actually knows.

Okay, I see this discussion is about to go down a rat-hole.

There are many possible reasons to post incomplete code on a forum. That’s what Jim is getting at. The originally-linked RAIF post was a question about a few lines of code; there was no reason to include the whole project there.

There is no sensible reason to post IF code and obfuscate it to deter anybody. Furthermore, I’m pretty sure that’s never happened. So, yay, completely hypothetical case, we can drop it.

I wouldn’t assume that the motivation behind an “incomplete” example – in the sense that it requires additional code in order to operate as a stand-alone program – is necessarily to deter kids from using it verbatim. Rather, I would think that if an example is posted to demonstrate a particular point, it might well be limited to the code that is specific to that point. The reader would be assumed to have enough of a general sense of how to do things to know that everything else has to operate correctly as well.

If somebody with expertise as an auto mechanic is asked a question as to how to install a set of brakes, he could be expected to answer the question without also descirbing everything that need be done to make the engine work – even though, without a working engine as well as brakes, you can’t drive the car.

Robert Rothman

Of course. 8)

Not many of these points bely an intentional deterrence. Perhaps only points three and four – being partially unhelpful to try to make someone self-reliant (a bit dickish, that), and preventing block-copying so that they will learn more (a bit patronising, that). So yeah, I can see that there are reasons that perhaps I overlooked. They still don’t seem like particularly great reasons. Reason #3 particularly sounds like an excuse to do less and help less because you’re sick of helping, in which case there’s a much more rational solution available – don’t help! Don’t worry, someone else will do it. 8)

So did you have some kind of master plan for this thread that I’ve disrupted? I didn’t see it headed anywhere scintillating. The opening question was already answered, anyway, and I was curious whether this code deterrence thing could really be a thing. What’s the big deal? Apparently you agree with me on this issue, but I don’t get the source of all the attitude regarding the fact that we pursued it.

Best explanation yet. That’s kind of how I suspect maybe this idea got created that people intentionally obfuscate code examples, that this goes on a lot. More plausible to me is that teachers left things out and then paranoid students started rumours… I’ll buy it.

Paul.

To my surprise I find that I was the author of that post on the raif!

Obviously, I can’t remember how I reasoned (if I did reason) about it at the time. But a good guess is that, since the OP obviously knew to create those rocks as samples of a custom rock kind in the first place,

I omitted that part of the code in the question, too.

I suppose that’s an example of a seventh reason not to post a full, compilable micro-game.