Hi folks, 2 bugs here. The first is that in 5.5 and later the portray of hash tables has not been updated to cope with the fact that the implementing struct has two extra arguments. -------- ECLiPSe Constraint Logic Programming System [kernel] Copyright Imperial College London and ICL Certain libraries copyright Parc Technologies Ltd GMP library copyright Free Software Foundation Version 5.4 #41, Tue Jul 16 00:14 2002 [eclipse 1]: lib(hash). hash.eco loaded traceable 0 bytes in 0.01 seconds Yes (0.01s cpu) [eclipse 2]: hash_create(H). H = hash(4, 0, []) Yes (0.00s cpu) [eclipse 3]: bye testserver1: /usr/local/eclipse/5.5/bin/i386_linux/eclipse ECLiPSe Constraint Logic Programming System [kernel] Copyright Imperial College London and ICL Certain libraries copyright Parc Technologies Ltd GMP library copyright Free Software Foundation Version 5.5 #63, Tue Feb 11 00:22 2003 [eclipse 1]: lib(hash). hash.eco loaded traceable 0 bytes in 0.02 seconds Yes (0.02s cpu) [eclipse 2]: hash_create(H). H = hash_table(4, 0, []([], [], [], []), [], []) Yes (0.00s cpu) [eclipse 3]: -------- I've run into the same kind of problem when I've defined my own portrays. You add arguments to the implementing structure, but forget to update the arity in the :- export(portray ... line. It would be nice if at compile time this line could look up the arity of the struct just given the functor. The second bug is that it is unpredictable in the TTY debugger whether compound terms get displayed using their portray predicate definitions or not. This seems to be an interaction between the TTY debugger, the module system and the portray mechanism. Here's an example. -------- Suppose I have two modules, test_module defined as: %%%%%%%%%% :- module(test_module). :- export test_length/2. test_length(List, Length):- length(List, Length). %%%%%%%%%%%% And secondly test_module_b, defined as: %%%%%%%%%%% :- module(test_module_b). :- local struct(test_struct_impl( arg1, arg2, arg3 ) ). :- export(portray(test_struct_impl/3, test_portray/2, [])). :- export(test_portray/2). test_portray(test_struct_impl with [arg1:X], test(X)). :- export(test_create/4). test_create(X,Y,Z, test_struct_impl with [arg1:X, arg2:Y, arg3:Z]). %%%%%%%%%%%%% Then you would expect that whenever a test_struct_impl/3 crops up in a trace, we only see test/1. But what actually happens (on 5.6 prerelease) is as follows: testserver1: /usr/local/eclipse/5.6/bin/i386_linux/eclipse ECLiPSe Constraint Logic Programming System [kernel] Copyright Imperial College London and ICL Certain libraries copyright Parc Technologies Ltd GMP library copyright Free Software Foundation Version 5.6 #28, Mon Apr 21 00:13 2003 [eclipse 1]: use_module(test_module). test_module.ecl compiled traceable 124 bytes in 0.01 seconds Yes (0.01s cpu) [eclipse 2]: use_module(test_module_b). test_module_b.ecl compiled traceable 196 bytes in 0.01 seconds Yes (0.01s cpu) [eclipse 3]: test_create(1, 2, 3, T). T = test(1) Yes (0.00s cpu) [eclipse 4]: trace. Debugger switched on - creep mode [eclipse 5]: test_create(1, 2, 3, T). (1) 1 CALL test_create(1, 2, 3, T) %> skip (1) 1 EXIT test_create(1, 2, 3, test(1)) %> creep T = test(1) Yes (0.00s cpu) [eclipse 6]: test_create(1, 2, 3, T), test_length([T], X). (1) 1 CALL test_create(1, 2, 3, T) %> creep (1) 1 EXIT test_create(1, 2, 3, test(1)) %> creep (2) 1 CALL test_length([test(1)], X) %> creep (3) 2 CALL length([test_struct_impl(1, 2, 3)], X) %> skip (3) 2 EXIT length([test_struct_impl(1, 2, 3)], 1) %> creep (2) 1 EXIT test_length([test(1)], 1) %> creep T = test(1) X = 1 Yes (0.00s cpu) [eclipse 7]: ----------- notice how when tracing the length goal the portray does not get applied. But if you just do a normal length call, it works: ---------- [eclipse 7]: test_create(1, 2, 3, T), length([T], X). (1) 1 CALL test_create(1, 2, 3, T) %> creep (1) 1 EXIT test_create(1, 2, 3, test(1)) %> skip (2) 1 CALL length([test(1)], X) %> skip (2) 1 EXIT length([test(1)], 1) %> creep T = test(1) X = 1 Yes (0.00s cpu) [eclipse 8]: ---------- Maybe this is because the portray exported by test_module_b is not visible in test_module. But this is to be expected, since test_module is often a low-level utility, which wouldn't be expected to know about the peculiarities of some application-specific data module (test_module_b). cheers, josh Josh Singer Software Developer, Parc Technologies Limited Tel. +44 (0)207 261 4067 josh.singer@parc-technologies.com http://www.parc-technologies.com This e-mail message is for the sole use of the intended recipient(s) -its contents are the property of Parc Technologies Limited (or its licensors) and are confidential. Please do not copy, review, use (except for the intended purposes), disclose or distribute the e-mail or its contents (or allow anyone else to do so) without our prior permission. Parc Technologies Limited does not guarantee that this e-mail has not been intercepted and amended nor that it is virus-free. You should carry out your own virus checks before opening any attachment. Any opinions expressed in this e-mail message are those of the author and not necessarily Parc Technologies Limited.Received on Wed May 14 13:42:34 2003
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:21 PM GMT GMT