You are hereblogs
blogs
Update on the wildcards issue.
Apparently, Martin has a bit too much time, since he gets around to reading my journal. He added a reference to my entry from yesterday to an existing issue for this particular problem, in the Stratego issue tracker.
In the issue, he also points out that Eelco (the language designer) made a note about this in the Stratego wiki more than three years ago. Which in a way only serves to emphasize the research nature of the language; you get cool stuff like scoped dynamic rules, grammar checkers and embeddable concrete syntax, but a few-line error report is too mundane to include;P
Then again, I guess I'd rather have scoped dynamic rules, grammar checkers and embeddable concrete syntax over this particular error report, if I really had to choose:)
Things to watch out for in Stratego
I have been programming nothing but Stratego almost all my waking hours for what on Sunday will be the last two weeks. I'll post later about the exact project I'm working on. In the meantime, I'd like to share some (re-)experiences with the language.
First off, Stratego is a domain-specific language for program transformation. The buzz is "[a] modular language for the specification of fully automatic program transformation systems based on the paradigm of rewriting strategies."
So what are rewriting strategies? The Stratego web site defines them a strategy to be "... an algorithm for transforming a term with respect to a set of rewrite rules. Some rewriting strategies are normalizing strategies, i.e., rewrite a term into normal form."
So, it's a rule-engine. So is Prolog, but Stratego is different in one crucial manner: The the order of rule application is user-definable, so that the user can specify how to reach a normal form, given a set of rules. As with any extra power, this too comes with increased responsibilities, but they are well worth it.
In my opinion, the problem Stratego tries to solve is important (at least to people like me who do program transformation [i.e. compiler implementation, domain-specific optimization, language implementation, optimizing pre-processors, all kinds of meta-programming on real programming languages]), and most of the language is well-suited for this task.
However, I keep being reminded that the implementation is indeed a research project. Nothing wrong with that, of course, but when you're the user and not the developer, you often find yourself cursing at the lack of polish.
I am going, for my own sake, to keep a record of the strange issues I encounter, and the solutions to them, so that I may refer back to them later when I'm stomped again.
The first issue for my collection is this cryptic bit of error log:
strc -i liar-projector.str
compiling build/protos/squery/src/liar-projector.str
not a strategy-expression: SRule(Rule(Wld,Wld,Id))
front-end succeeded: user 4.39 system 0.24
Not a strategy-expression: SRule(Rule(Wld,Wld,Id))
optimization succeeded: user 1.73 system 0.15
not a strategy-expression: SRule(Rule(Wld,Wld,Id))
No pp entry found for: (1,["SRule"])
** ERROR: cannot rewrite to box: SRule(Rule(Wld,Wld,Compound([],[])))
/usr/bin/ast2abox: rewriting failed
compilation failed (7.27 secs)
What does it say? It says that the pretty-printer (ast2abox) inside the Stratego compiler cannot make a .c file from the AST to give to gcc.
But what does it mean?
After a bit of thinking and prodding, it turned out to mean this:
Given the rule
foo: Plus(_, _) -> _
which means, if you see Plus(<any>, <any>) then transform it into <any>. The underline (_) is the Stratego way of saying <any>. In Stratego this is called a wildcard. Of course, the wildcards on the left hand side are disjoint from each other, and the right-hand side; you cannot use wildcards to transfer data from the left to the right. To do that, you use variables, say Plus(x, y) -> x.
The thing is that Stratego does not allow you to have wildcards on the right-hand side of a rule. A rule must always result in something particular, such as the x, above. A wildcard is not good enough.
The above error message is the compiler's way of making this perfectly clear to you, the programmer.
Gentoo Java progress: New commit slaves!
Finally, Saleem Abdulrasool and Jan Brinkmann were accepted as official Gentoo Developers, bringing the total active Gentoo Java developers to the grand total of five (me, Thomas, Jochen, Jan and Saleem). In the curtains, we have Chris lurking.
With the recent onslaught by Vibhav Garg, I need somebody to help out with committing incoming ebuilds.
Also, David Bélanger, one of the SableVM developers, accepted a position as maintainer of all things SableVM in Gentoo. Since SableVM is getting pretty slick as of late (it can even run Eclipse!) and written in "portable" ANSI C, we can hope it can take over as default 1.4 (and possibly 1.5) VM on the architectures with little support from the commercial VM vendors, such as alpha, hppa and superh.
While it certainly won't be screamingly fast, it will hopefully allow users on these arches to run Ant and a Java compiler (we plan on packaging the Eclipse 1.5 compiler as a separate package).
Also, I must take the time to pat ourselves on the back for finishing seventh in last year's bug race, ahead of the esteemed Portage herd (of which I'm incidentally also a member:). Apart from myself, there's been a complete turnover in the Java Team during 2004, and for months at a time, I was the only semi-active member. Poor users;P Luckily, Chris had an insane bug closing spree in the spring, on which we floated throughout the summer.
From Autumn on, I've been pushing hard to recruit new members, but the internal Gentoo bureaucracy has been difficult and time-consuming. It took about three months to get an ad into Gentoo Weekly News, for instance. Much of this had to do with recruiters suffering a total breakdown, which is not to be blamed on any particular individual of course. It's just annoying when it happens:)
Fortunately, all that is past us, and we're now in a position to aim for a much better spot in this year's bug parade.
Dropping Gentoo for FreeBSD
I've been running storm as a Gentoo server for some years now. It was installed before Gentoo 1.4 was released. I guess it's been no worse than what RedHat used to be, but as long-term maintenance goes, Gentoo still has lightyears left before it's commercially viable.
Let me qualify that a bit more: If one is maintaining an evolving system which would be high-maintenance in any circumstance, I find Gentoo to be a good choice: it is usually up-to-date, and tweaking the system to fit your needs is unlike any other system I know. But for the odd never-turn-off printer or mail server, it's turned out to be less than ideal.
The main problem I experienced (and have pointed out for years to whoever bothers to hear me) was that while Gentoo works nicely when you can do semi-regular upgrades (preferrably monthly or more often), it's a real chore when your upgrades happen only once every six months.
In the interim period, big changes may have happened, forcing your system to be completely rebuilt from scratch. Case in point: the bumpy MySQL transition in '03, which required all programs supporting MySQL to be rebuild. That was a real pain.
A few kernel booboos also added to the frustration: gentoo-sources 2.4.20 through 2.4.24 reliably corrupted our root file system (XFS) under semi-high load. It took us months of hardware replacement to realise it was a fatal software flaw.
When the system unexpectedly started to refuse incoming ssh connections and just hang after an innocent upgrade of a few packages, the last straw was declared, and I stepped down as main system administrator.
My successors were given a choice of a Gentoo reinstall or any other open/free OS except Hurd. They chose FreeBSD, I guess a lot out of curiousity, but also a fascination for the tweakability we have experienced with Gentoo. FreeBSD has a much better reputation as a server OS, and even only a few weeks down the road from the Big Shift, I'm beginning to see why.
Ready-made packages for everything in the ports collection is a huge improvement. I only want to tweak 5-10 packages on my entire system, and I certainly don't want to pay for this adaptibility by compiling all my software from sources every time. There is no practical speed-gain to be had, that is a myth.
My only big gripe with the FreeBSD system for now, is how messy their directory hierarchy is, compared to Gentoo. I really enjoy the idea of having /usr/local all to myself. And I do want all files that are changed at runtime on /var. I don't want to prefix every bloody config-file or script invocation with /usr/local, that's just plain silly.
But as long as I don't have to maintain this beast anymore, I'll suffer this gladly.
On the flammable topic of GUI toolkits
In the course of doing some testing of how Eclipse 3.0.1 behaves with and without Mozilla present (3.0.0 used to crash if it couldn't find the mozilla executable, fortunately 3.0.1 handles this better), I came across notable speed differences between the Motif and the gtk+ frontends used for Eclipse.
I didn't put more thought into it until Billy Biggs, one of the Eclipse engineers working on SWT queried me (albeit initially on a different matter).
Snowball fight at the cemetery
Today we had the compulsory snowball fight at the cemetery to celebrate that the snow is finally here. I'll upload pictures once I get IrDA working again.
For all the hype and press, Linux is still severly lacking in even the most basic functionality one would expect from a regular desktop operating system. You'd think it would be possible to put together a system which supported infrared devices in stable fashion in the course of ~13 years (the kernel was released in '91).
Ah, well, at least I have the source that I print out and curse at.
In Bergen, saw some Gentoos
Came to Bergen yesterday, will be here all week. Even done an evening of roleplaying already;)
I went with Lisa, Anne and Silje to the Aquarium and saw some gentoos.
A blast from the past
I dug around on my university account, and accidentally stumbled across some web pages that had been backed up from way back. One of the survivors was my old journal, with all of six entries;)
My excuse at the time:
I'm a cursed real-world traveller. Anybody who knows me knows that. Perhaps I have more luck when it comes to travels in the computerized world. Anyhow, these pages are just for reminding myself in retrospect what has been worthwhile lately. And since harddisks fail, I though[t] putting it all on the web would be just as silly.
I've restored them into my current journal. You're now free to take a peek at what I did in the previous millennium (left backlog, 1999 and 1998).
Exim + CRAM MD5 + TLS
Given my recent traveling spree, I found it worthwhile to set up an SMTP server I can use on the road. Reverting back to old sins, I decided to set up Exim with CRAM MD5 after TLS.
It was more painful than I had imagined. Here are the basic steps:
1) USE="ssl sasl" emerge exim (on gentoo).
2) openssl genrsa -out /etc/exim/exim.key 2048
3) openssl req -new -x509 -days 1000 -key /etc/exim/exim.key -out /etc/exim/exim.cert
4) Add
tls_advertise_hosts = *
tls_certificate = /etc/exim/exim.cert
tls_privatekey = /etc/exim/exim.key
to /etc/exim/exim.conf, typically near the beginning
5) Add
cram:
driver = cram_md5
public_name = CRAM-MD5
server_secret = "${if eq{$1}{$1} \
{${lookup{$1}lsearch{/etc/exim/cram-passwords}{$value}{*:*}}}fail}"
server_set_id = $1
to the bottom of /etc/exim/exim.conf under begin authenticators.
In /etc/exim/cram-passwords, each line looks like
name:password
where both are in plaintext (so don't use a valuable password here;).
I also made sure that my acl (the suitable entry in begin acl, my case
called acl_check_rcpt) had a line reading accept authenticated = *).
I found this part to be rather easy.
The not-so-easy part was realising why I could not relay using the above setup. It turned out that my acl for spam detection (acl_check_rcpt) was configured to use a variable called relay_from_hosts, but I had not defined this variable to be of type hostlist (but rather of type domainlist). My old error logs showed this to be a long standing problem, but I have obviously been sloppy and not noticed.
As the acl would check for relay_from_hosts before authenticated, and fail with a "unknown named host list "+relay_from_hosts", it never got around to accepting authenticated hosts.
Just declaring relay_from_hosts to be of the right type made it all work. Yippee!