Article View: news.software.readers
Article #36616Re: [slrn] Variables in scorefile?
From: Lloyd Zusman
Date: Mon, 13 Oct 1997 00:00
Date: Mon, 13 Oct 1997 00:00
103 lines
5009 bytes
5009 bytes
On 13 Oct 1997 03:15:32 GMT, J.B. Nicholson-Owens <jbn@pop-a-wheelie.midwest.net> wrote:
> Lloyd Zusman <ljz@asfast.com> wrote:
> > Perhaps most of the infrastructure for something like this is already
> > in place in slrn ... ???
>
> [ ... ]
>
> But getting back to the functional solution you've suggested, if we assume
> that the functions are evaluated in the order they were set, converting
> one's flatfile to a functional equivalent is a considerable job for people
> with large scorefiles. [ ... ]
A script to convert a conventional scorefile to a slang script containing
its functional equivalant would be very easy to write, and this script
could be supplied with the distribution of slrn.
> [ ... ] Also, it's not clear how this would handle complex
> logical statements any differently than the current scorefile -- I think one
> might want a language with S-Lang's capabilities to handle complex
> arrangements of tests to determine a score. [ ... ]
Something like this would do that just fine:
variable score = 1000;
if (header("Subject") == "Free Money!" ||
header("Subject") == "Ponzi scheme!") {
score = -9999;
}
else if (lines() < 50000) {
score = 100;
}
else if (matches(newsgroup(), "alt.spam.*")) {
score = -100;
}
if (matches(newsgroup(), "alt.sex.*") {
score = get_score("alt.animals.hippopotamuses");
score -= 2000;
}
set_score(score);
... where header(), lines(), newsgroup(), matches(), get_score(), and
set_score() are new functions that would be supplied with slrn. I'm
sure that there would be a number of other new functions, as well.
> [ ... ] But most importantly, such
> functions add static data, not references to things that can change easily
> between entering groups.
The functions that I specified above would not add static data. They
would invoked automatically and dynamically for each newsgroup, and
the resulting score would be applied to each of these newsgroups.
> [ ... ] Even if API were added to remove or replace some
> scores with other scores, I think defining a variable to a certain string is
> easier to process and easier for the user to use than writing loops to find
> the score to replace and replacing it.
It would not be necessary (or even meaningful) to write a loop given
the constructs I outlined above.
> Flatfiles also have the advantage of being easy to read and edit. Depending
> on a memory-bound system precludes using other external tools like
> preparsers (perl, m4, cpp, etc). Finally, I don't think we'd want users to
> have to switch from one system to another entirely different looking system
> just to get a few more features.
It's true that this new system would have to be used if any new
features are desired. However, I find this preferable to adding a few
features to the current method for handling scorefiles. Once a few
features are added, someone would want another feature, and another,
etc. If this was script-able, then each person who wants new features
would be able to mix and match and pick and choose the features he or
she wants to use.
> With preprocessing built into slrn (or enhancing the current scorefile
> parser, whichever way you want to look at it), expanding S-Lang constructs
> just before processing by the current score processor still strikes me as
> the right balance of keeping what we've got now and adding a few more
> features.
I understand your point. Exactly which features are you looking for,
again? Only variable substitution? Anything else? If the majority
of users who want new scorefile functionality agree with your
preferred set of features, then I would concur with you. However, if
there is significant disagreement about the feature set among those
who want extra scorefile functions, I would then vote for slang
scripting capability in this area.
--
Lloyd Zusman
ljz@asfast.com
Technical Details
Message-ID:
<slrn643cih.puh.ljz@ljz.asfast.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailReferences:
<slrn63gm05.ad.jbn@pop-a-wheelie.midwest.net> <slrn63gr84.13h.sp_robi@Elvira.home> <slrn63h1ti.ad.jbn@pop-a-wheelie.midwest.net> <slrn63rfmg.bnv.sp_robi@Elvira.home> <slrn63rp0b.411.jbn@pop-a-wheelie.midwest.net> <slrn63sjme.44k.Hubert.Canon@guenievre.irisa.fr> <slrn6429lb.65s.jbn@pop-a-wheelie.midwest.net> <slrn642k1i.fj9.ljz@ljz.asfast.net> <slrn6434a0.6ms.jbn@pop-a-wheelie.midwest.net>Show Full Headers
Complete Article Headers
Message-ID: <slrn643cih.puh.ljz@ljz.asfast.net> Subject: Re: [slrn] Variables in scorefile? Date: Mon, 13 Oct 1997 00:00:00 +0000 From: ljz@asfast.com (Lloyd Zusman) References: <slrn63gm05.ad.jbn@pop-a-wheelie.midwest.net> <slrn63gr84.13h.sp_robi@Elvira.home> <slrn63h1ti.ad.jbn@pop-a-wheelie.midwest.net> <slrn63rfmg.bnv.sp_robi@Elvira.home> <slrn63rp0b.411.jbn@pop-a-wheelie.midwest.net> <slrn63sjme.44k.Hubert.Canon@guenievre.irisa.fr> <slrn6429lb.65s.jbn@pop-a-wheelie.midwest.net> <slrn642k1i.fj9.ljz@ljz.asfast.net> <slrn6434a0.6ms.jbn@pop-a-wheelie.midwest.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 279997211 X-Newsgroup: news.software.readers Reply-To: ljz@asfast.com (Lloyd Zusman) Organization: As Fast Newsgroups: news.software.readers