Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.gtn.com!osn.de!noris.net!blackbush.xlink.net!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: Why you must use Prolog
Message-ID: <erkyrathDzp0uG.44s@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <54g91v$j2q@prometheus.acsu.buffalo.edu> <baf.845936561@max.tiac.net> <erkyrathDznnEK.D1L@netcom.com> <DzoCLq.8A@ladle.demon.co.uk> <54j5l8$c1@prometheus.acsu.buffalo.edu>
Date: Tue, 22 Oct 1996 19:59:03 GMT
Lines: 44
Sender: erkyrath@netcom.netcom.com

Phil Goetz (goetz@cs.buffalo.edu) wrote:
> In article <DzoCLq.8A@ladle.demon.co.uk>,
> John Hartnup  <slim@ladle.demon.co.uk> wrote:
> >Another thing to bear in mind: when would NPCs be allowed to "think",
> >"plan" etc... do these goal-analysis computations occur in normal
> >game computation time (i.e. between when you press "enter" and when
> >the game's response appears), or should they occur in the background,
> >calculating while the prompt is waiting for input?

> This is an excellent idea.  It would be impossible to implement without
> using operating-system-specific calls, I think.  Prolog doesn't have
> (at least not that I've seen) any way to check the keyboard for input,
> and then return if nothing has been typed.  Once you ask to read
> the keyboard, you have to wait until someone types something.
> How does Inform handle this?  It must, because I saw Tetris in Inform.
> Does it use machine-specific opsys calls?

No, it's portable. There's a variant of the "input" opcode which 
basically says "input a line, but while you wait, call routine X every Y 
milliseconds." (X can return a value which aborts the input process, too.)

> RANT ON
> This really annoys me -- I have never seen a programming language that
> had a primitive for checking for keyboard input but not waiting for it.
> This is an important operation, but language designers never put it in,
> so it makes all realtime code un-portable because it has to use OS calls
> to read the keyboard.  X-Windows can do it, and I think curses (the C
> library, not the game) can, but they don't count.
> RANT OFF

Well, if you're going to check for key events, you might as well have a 
general model for events, and that's better handled as a library than as 
a language primitive. If you want it to be portable, make it a standard 
library. That's exactly what X windows is, and why doesn't it count?

(Sometimes you get a general model for blocking and non-blocking streams, 
instead of a interface event system. But it's still better handled as a 
library.)

--Z
-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
