Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!rochester!bbn.com!nic!bunny!bs30 From: bs30@GTE.COM (Bernard Silver) Newsgroups: comp.lang.prolog Subject: Standards question: behavior of arg/3 Keywords: ANSI, standard Message-ID: <9888@bunny.GTE.COM> Date: 16 Oct 90 11:04:17 GMT Organization: GTE Laboratories, Waltham MA Lines: 55 The latest draft of the ISO Prolog standard has recently come out. One thing that caught my attention is the specified error behaviour for the predicate arg/3. We (the ANSI group) are interested in finding out how people use this predicate. The ISO draft specifies that arg(N,Term,Arg) (with N and Term instantiated) reports a range error if N is greater than the arity of Term. In contrast, many existing Prologs just quietly fail in this situation. Which do you prefer? In particular, do your programs ever rely on the quiet failure to end a recursion? Some Prologs ``extend'' arg/3 so that arg(0,Term,Arg) (attempts to) unifies Arg with the functor of Term. (Quintus provides a library predicate to support this use). Do people use this feature? The ISO standard specifies that this use should raise an error, many existing Prologs either fail quietly or behave as above. If you believe in quiet failure, when should arg/3 raise an error? Is arg(-3,Term,Arg) ok? What about arg(a,Term,Arg)? We would appreciate any comments! Newsgroups: comp.lang.prolog Subject: Standards question: behavior of arg/3 Summary: Expires: Sender: bsilver@gte.com (Bernard Silver) Followup-To: Distribution: Organization: GTE Laboratories, Waltham MA Keywords: ANSI, standard The latest draft of the ISO Prolog standard has recently come out. One thing that caught my attention is the specified error behaviour for the predicate arg/3. We (the ANSI group) are interested in finding out how people use this predicate. The ISO draft specifies that arg(N,Term,Arg) (with N and Term instantiated) reports a range error if N is greater than the arity of Term. In contrast, many existing Prologs just quietly fail in this situation. Which do you prefer? In particular, do your programs ever rely on the quiet failure to end a recursion? Some Prologs ``extend'' arg/3 so that arg(0,Term,Arg) (attempts to) unifies Arg with the functor of Term. (Quintus provides a library predicate to support this use). Do people use this feature? The ISO standard specifies that this use should raise an error, many existing Prologs either fail quietly or behave as above. If you believe in quiet failure, when should arg/3 raise an error? Is arg(-3,Term,Arg) ok? What about arg(a,Term,Arg)? We would appreciate any comments!