root/trunk/examples/complements/SCRIPT.txt

Revision 4662, 1.4 KB (checked in by pmoura, 6 days ago)

Updated copyright notice.

  • Property svn:eol-style set to native
Line 
1================================================================
2Logtalk - Open source object-oriented logic programming language
3Release 2.35.0
4
5Copyright (c) 1998-2009 Paulo Moura.        All Rights Reserved.
6Logtalk is free software.  You can redistribute it and/or modify
7it under the terms of the "Artistic License 2.0" as published by
8The Perl Foundation. Consult the "LICENSE.txt" file for details.
9================================================================
10
11
12% start by loading the example:
13
14| ?- logtalk_load(complements(loader)).
15...
16
17
18% find categories that complement objects:
19
20| ?- complements_object(Category, Object).
21Category = logging,
22Object = employee.
23yes
24
25
26% turn event support on for messages sent at the command-line
27% (i.e. for messages sent from the pseudo-object "user"):
28
29| ?- set_logtalk_flag(events, on).
30
31yes
32
33
34% use the event handler defined in the "logging" category for the object "employee":
35
36| ?- employee::name(Name).
37Received message name(_16) from user
38
39Name = john
40yes
41
42
43% check the protocol of the object "employee":
44
45| ?- employee::predicates(Predicates).
46Received message predicates(_G180) from user
47
48Predicates = [after/3, age/1, before/3, name/1, predicates/1, salary/1]
49yes
50
51| ?- employee::predicate_property(predicates(_), Property).
52
53Property = public ;
54Property = static ;
55Property = declared_in(logging) ;
56Property = defined_in(logging)
57yes
58
59
60% turn event support off:
61
62| ?- set_logtalk_flag(events, off).
63
64yes
Note: See TracBrowser for help on using the browser.