home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / prolog / 1544 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.9 KB  |  66 lines

  1. Newsgroups: comp.lang.prolog
  2. Path: sparky!uunet!van-bc!ubc-cs!newsserver.sfu.ca!dsouza
  3. From: dsouza@fraser.sfu.ca (Keith D'Souza)
  4. Subject: Quintus' Prolog++ -- Some help needed
  5. Message-ID: <1992Aug17.191907.14906@sfu.ca>
  6. Sender: news@sfu.ca
  7. Organization: Simon Fraser University, Burnaby, B.C., Canada
  8. Distribution: World
  9. Date: Mon, 17 Aug 1992 19:19:07 GMT
  10. Lines: 54
  11.  
  12. Hi!
  13.  
  14. I have recently begun working with Quintus' PROLOG++ 
  15. and need help with a problem I am facing.
  16.  
  17. In the problem I am exploring, I use the predicate
  18.  
  19. newgraph(X,Y,Z):-
  20.                  instance <- new(Y,X),
  21.                  X <- graphtype := Z.
  22.  
  23. to create a new instance X of the object Y, and assign 
  24. the value Z to the attribute 'graphtype' of X.
  25.  
  26. So, I can create an instance 'vrp1', of an 'instancegraph' object, 
  27. and assign the value 'vr' to the 'graphtype' attribute of vrp1.
  28.  
  29. While this predicate succeeds when called, if I attempt to trace 
  30. the call, it returns the following:
  31.  
  32. call  newgraph(vrp1, instancegraph, vr)
  33. UNIFY 1 []
  34.  call  SEND new(instancegraph, vrp1) FROM prolog TO instance
  35.  EXPAND []
  36.  exit  SEND new(instancegraph, vrp1) FROM prolog TO instance
  37.  call  SEND graphtype:=vr FROM prolog TO vrp1
  38.  EXPAND []
  39.   call  SEND graphtype:=vr FROM prolog TO vrp1 ONTO instancegraph
  40.   UNIFY 2 []
  41.    call  INHERIT := /2 FOR instancegraph ?
  42.    fail  INHERIT := /2 FOR instancegraph ?
  43.   fail  SEND graphtype:=vr FROM prolog TO vrp1 ONTO instancegraph
  44.  fail  SEND graphtype:=vr FROM prolog TO vrp1
  45.  redo  SEND new(instancegraph, vrp1) FROM prolog TO instance
  46.  fail  SEND new(instancegraph, vrp1) FROM prolog TO instance
  47. fail  newgraph(vrp1, instancegraph, vr)
  48.  
  49. I.e., the call fails!
  50.  
  51. Obviously, the problem originates around the statements
  52.  
  53.    call  INHERIT := /2 FOR instancegraph ?
  54.    fail  INHERIT := /2 FOR instancegraph ?
  55.  
  56. My problem is, being a novice, I do not know why this happens.
  57.  
  58. Any help in this matter is appreciated!
  59.  
  60. Thanx
  61.  
  62. Keith
  63.  
  64. dsouza@sfu.ca
  65.  
  66.