Subject: Re: VARS in listing/1

From: Jan Wielemaker <[email-masked]>
Date: Sat, 25 Sep 1999 19:26:10 +0200

> i have been working on a chatroom irc program for SWI prolog for many
> months.. i use the tcp extension saved in the alpha dirrectory. but before
> this i was limited to BinProlog because SWI has no native tcp/ip support...
> Hopefully soon i can contribute to such a project.. Currectly I am higher up
> the OSI model at the level of IRC chat protocol.  It was a slow climb.. and
> still is rough... 
> today i am having a problem that when i save ...
> save_myfile:-told(myfile),
> 	listing(mypred),
> 	told.
> 
> It fills in my variable names.. but sometime i have "_" in my variables...
> so when i reconsult it i get the singleton variable warnings... this is not
> too bad.. but my database is 30MB.. so i get a lot of 
> [WARNING: (/usr/local/lib/pl-3.2.8/library/allwn.pl:195955)
>         Singleton variables: A, B]
> [WARNING: (/usr/local/lib/pl-3.2.8/library/allwn.pl:195956)
>         Singleton variables: A, B]
> [WARNING: (/usr/local/lib/pl-3.2.8/library/allwn.pl:195957)
>         Singleton variables: A, B]
> [WARNING: (/usr/local/lib/pl-3.2.8/library/allwn.pl:195958)
>         Singleton variables: A, B]
> 
> this file has a normal 45 second consult time :)
> -rw-rw-r--   1 nobody   nobody   10480609 Sep 24 06:44 allwn.pl
> 
> this is what my data looks like after the listing...
> wn(ent, 201045069, A, 201073112, B).
> wn(ent, 201045661, A, 200915832, B).
> wn(ent, 201046021, A, 201301287, B).
> wn(ent, 201052666, A, 201249365, B).
> 
> its simple my question then....
> 
> how do I in a lising to make it...
> prefix my vars with _ .. like _A, _B ?

You can define rules for portray/1 (see documentation).

Maybe it is a good idea to add an option like that that write_term/2.  

Simpler is to do:

	style_check(-singletons),
	<read the file>
	style_check(+singletons).

to supress the warnings.

> also is there any plans to make a native tcp/ip bultin library?
> if so i would like to help out a bit :)

In the `packages' page of the SWI-Prolog home page is a new version
of the TCP/IP library.  There are no plans to put it into the kernel
(actually, if there are plans it is more to throw things out of the
kernel and put them into library modules to improve modularity and
reduce the footprint).

	Regards --- Jan