git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1580 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
		
			
				
	
	
		
			61 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
=================================================================
 | 
						|
Logtalk - Object oriented extension to Prolog
 | 
						|
Release 2.27.1
 | 
						|
 | 
						|
Copyright (c) 1998-2006 Paulo Moura.  All Rights Reserved.
 | 
						|
=================================================================
 | 
						|
 | 
						|
 | 
						|
% start by compiling and loading the Prolog module files as objects:
 | 
						|
 | 
						|
| ?- logtalk_load(modules(loader)).
 | 
						|
...
 | 
						|
 | 
						|
 | 
						|
% call one of the module exported predicates using message sending:
 | 
						|
 | 
						|
| ?- test::names.
 | 
						|
 | 
						|
paulo
 | 
						|
carlos
 | 
						|
helena
 | 
						|
yes
 | 
						|
 | 
						|
 | 
						|
% same goal as above but the call is made using a meta-predicate
 | 
						|
% imported from other module:
 | 
						|
 | 
						|
| ?- test::test.
 | 
						|
 | 
						|
paulo
 | 
						|
carlos
 | 
						|
helena
 | 
						|
yes
 | 
						|
 | 
						|
 | 
						|
% test the compilation of the module export/1 directive; module 
 | 
						|
% exported predicates become public predicates:
 | 
						|
 | 
						|
| ?- exports::current_predicate(Pred).
 | 
						|
 | 
						|
Pred = p/1
 | 
						|
yes
 | 
						|
 | 
						|
| ?- exports::predicate_property(p(_), Prop).
 | 
						|
 | 
						|
Prop = public ;
 | 
						|
Prop = static ;
 | 
						|
Prop = declared_in(exports) ;
 | 
						|
Prop = defined_in(exports)
 | 
						|
yes
 | 
						|
 | 
						|
 | 
						|
% call the module exported/public predicate using message sending:
 | 
						|
 | 
						|
| ?- exports::p(N).
 | 
						|
 | 
						|
N = 1 ;
 | 
						|
N = 2 ;
 | 
						|
N = 3
 | 
						|
yes
 |