Gauche

I just discovered Gauche Scheme. I have been looking for a Lisp/Scheme dialect for my latest pet project, and it seems this is just what the doctor ordered.

  • It’s cross-platform (Unixoid systems and Windows)
  • Builds out of the box on Mac OS X, even on my old G3
  • Supports both hygienic and “dirty” macros
  • Comes with an object system
  • Comes with a bunch of libraries out of the box (like a HTTP library, which is one of the things I needed)
  • Works with SLIB; in fact, if SLIB is already installed, it will find it and integrate it
  • Supports a large number of SRFIs

Chicken has most of this too, except it lacks Windows binaries, and it recently got rid of unhygienic macros. Libraries can be installed as eggs, of course, so it might not need SLIB.

Anyway, said “pet project” involves making HTTP GET calls, and requires a powerful object system. (More about this later, if it ever becomes usable.) I wanted to use a Lisp/Scheme dialect for flexibility, and I wanted it to be cross-platform if at all possible, so users can run it on Windows as well. It turned out that it was remarkably hard to find a Scheme that matched all these requirements. I will not go into all the problems that I encountered, but suffice to say that Gambit, Scheme48, PLT and Petite Chez Scheme all had their own issues. (That is not to say that I won’t use them for other projects…)

That said, I might still change my mind and use Common Lisp instead… :-)

:: Comments (7)

Hmm…

When checking out recent Lisp books, I realized that one of the reasons that makes SICP palatable is the fact that it’s “old”. I mean that in a good way. It predates Java, Python, Ruby, etc, and as a result, it does not adopt a smug attitude like, “Lisp is so much better than all these imitators that stole features from it but lack the essence”. Modern Lisp texts often seem to have a hard time keeping this attitude at bay, which makes for unpleasant reading when you’re coming from a different language (which is almost always the case).

Then again, from what I have seen, this attitude is less prevalent in the Scheme community…

:: Comments (1)

Jolicloud on HP Mini 311

Jolicloud is an operating system based on Linux, optimized for netbooks. I was bored today, so I figured I’d try installing it on my HP Mini 311.

(Some of the notes below are specific to this netbook; maybe it will be useful to other 311 owners who want to try installing it as well.)

It appears that Jolicloud is basically Ubuntu with a friendly user interface. The “home screen” shows applications in various categories, and several locations (home directory, desktop, network, etc). It comes with a number of applications, many of them aimed at social networking, internet and “the cloud” in general.

Installing it is a breeze. I already had Windows XP on the netbook; I downloaded the installer and ran it (still from within Windows). Partitioning, installing etc happens automagically. (There’s also an ISO available, which, I assume, gives the user more control during the installation process.)

If you have a HP Mini 311 as well, note the following. Once Jolicloud has been installed, and the computer reboots, you’ll see a boot screen that lets you choose between Windows and Jolicloud. Counter-intuitively, you must choose “Windows” here; you will then see a similar screen, and there you select “Jolicloud”. (This may be because the 311 comes with a separate partition containing system restore data… I do hope that Jolicloud did not interfere with that.)

You will need to do some configuring to get the current version (which, as I write this, is pre-beta) to recognize the HP Mini’s Nvidia Ion. JC did use a widescreen resolution, but it didn’t offer much in the way of configuring the screen, and the home screen was REALLY slow. This turned out to be easy to fix; create a Jolicloud account, do a software update, and reboot. The software update will download proprietary software by Nvidia; RMS would frown upon that, but it made the home screen much more snappy, and offers a whole range of configuration options (much like on Windows).

The Jolicloud site offers a relatively small number of apps, although many of these are important and/or popular ones, like Firefox, Google Chrome, apps for Facebook and Twitter, etc. While you may choose to restrict yourself to these apps, you ALSO have access to other Linux software. Synaptic (Ubuntu’s package manager) is “hidden”, but it’s there, and it’s easy to add it to the main menu. I did so in order to install vim, Emacs and a few other things. A nice touch was that icons for these applications were added to the menu automatically.

(Oh, and Python 2.6 is already installed out of the box. How could it be otherwise? :-)

Anyway, so this is a nice little Linux… useful if you just want to browse the web and check your Facebook, but also if you want to use it for hacking. ^_^

:: Comments off

Scherprechter neemt poolshoogte

(I decided to limit myself to one rant a year. This is it.)

Just saw this blog post (via Hacker News): Dear Python. In it, the author lists a number of complaints he has about Python.

There is so much wrong with this article that it’s like shooting fish in a barrel.

First of all, the post seems to imply that Python started out great, but then added inferior copies of features found in other languages:

But then you got jealous of the big players. You saw that others had things you didn’t have and you wanted to compete in a game that you were never destined to play. And who could blame you? The megaliths in the crowd like Java and c++ were beginning to overshadow the small guys and were even starting to overtake some of the oldest and wisest players: c, Fortran, lisp. What did they have in common? Objects.

Objects have been around since the very first public release of Python (0.9.1). They were not added because of “object envy”. Hell, Java didn’t even exist when Python first came out.

But you weren’t ecstatic about objects. You didn’t really like them and you didn’t trust them. So you decided to only give them a little. You cut corners. You made objects but you made them hard to use. That was a mistake.

That’s another odd argument… IMHO, Python’s objects are *much* easier to use than, say, Java’s, or C++’s, where you have to micromanage access (public? private? protected?), write (often superfluous) getters and setters, and deal with such niceties as as “final” classes, checked exceptions, abstract classes, interfaces, etc. In Python, I can just write the class, stick in it whatever I want, *use* it however I want, and move on.

There is no encapsulation. There are three tiers to OO. One of them is encapsulation. Having OO without encapsulation is about as nice as sawing a leg off a three legged stool. I can hear you yelling, “That third leg is completely unnecessary. We’re all consenting adults here. Just balance, like this…” *crash*.

I am assuming that by “encapsulation” the author means “data hiding”. Python’s philosophy here is that in order to separate interface from implementation, data hiding is not necessary. That’s where the “consenting adults” idea comes from; you are *supposed* to talk to the object using its interface (methods or properties, usually), but if you really have to, you can easily access any attribute. There are ways to make this harder, but (again, IMHO) they are not very Pythonic.

Also, the notion of “three tiers to OO” really depend on which definition you go by. Java, C++, C# and their ilk are neither the first word in OO, nor the last. Languages like Smalltalk, Self and Io have (sometimes radically) different ideas about what objects are and how they are handled.

Then, libraries:

However, these libraries are inherently static. This means that if the library doesn’t do what you want it to, you are screwed. There is no diagnosing or fixing errors in the library. If they happen, pack up and try a different language.

I’m not sure in what sense Python’s standard library is “static”… there are a few built-in modules written in C, but most of them are in pure Python, and the source code is readily available. You could change them if you must, but a better approach would be to subclass them and replace the offending features/bugs. (Note that there are no “final” classes and private attributes to get in your way here. :-)

(The httplib problem mentioned looks like it can be solved by setting a proper timeout value, by the way. I’ve written several web crawlers in Python, and never encountered this issue.)

Then there’s the tired old “explicit self” argument again:

[...] But sadly, this is exactly how python is. It doesn’t really take care of anything for you. You have to have “this” as the first argument to every function in a class. Once in a function, you have to use “this” to access any variables or other functions.

I’ve written about this before (in 2003!) so I’ll just links to those posts here, rather than repeating it:

And here’s what Guido himself has to say about it: Why explicit self has to stay.

The Java way is better. The implied this is easy to understand. Some IDE’s even highlight the class variables with a different color than the local variables, allowing an easy distinction. In the end you save tons of characters by having an implied “this”.

The implied this (in a method’s argument list) may be easier, but Java gets away with this because it doesn’t have actual functions. Python, as a multi-paradigm (god I hate that word :) language, does, and in fact methods are really just functions that you stick in a class.

Also, the “tons of characters” you save don’t mean much, when a typical Java method definition starts with stuff like “public static final void …”!

To add insult to injury, python has no explicit support for member definition. A class’s members are created by setting them equal to something. There is no way to explicitly define them in the class definition. Anybody, anywhere, can add (or remove) members variables from a given object. Classes in Python are more like dictionary objects with functions attached than classes.

Um, yes, the lack of declarations is one of the factors that makes Python code shorter and more flexible. And indeed a class (or an object) is much like a dictionary with some special rules added. Hint: the same is true for languages like C++ and Java, except they hide that dictionary behind a ton of cruft, so you won’t notice it as much.

I agree that removing attributes from a class or object generally isn’t a good idea, but then again this doesn’t happen a lot, unless in special cases.

After much frustration at using your broken OO, I decided to give it a rest. Maybe python would make more sense if I just treated it as a flat procedural language. Then I noticed lambdas. [...] They can only be one line.

Agreed, Python’s lambda sucks compared to functional languages (and even Ruby). However, it was intended as a shorthand for simple functions, not as a full-fledged alternative to def.

Python, you are just like the little kid Peter. You see something others have, decide you must have it, and then you just stick it somewhere. To become a better language, you must outgrow this little kid copy cat phase.

If you want objects, implement objects all the way. This includes things like encapsulation and variable definitions. But if you don’t want objects, then don’t implement them at all. It is no help for anybody when you implement something that you don’t want people to use.

This really makes no sense. “Implement OO like Java, or don’t implement it at all”. Gee, go tell that to the authors of Smalltalk, Io, Self, CLOS, Simula, OCaml, even Ruby. Again, what “object oriented” means isn’t written in stone, and Java’s implementation of it certainly isn’t the gold standard. I don’t think the original inventors of OO intended the language to get in your way constantly, for starters.

~

Granted, Python has its problems. Over the years, these have become more clear to me. I am mostly infatuated with ultra-dynamic and/or functional languages at the moment (but that is a different story…). I don’t like the join method on strings, the fact that we have classmethods/staticmethods/etc now and all that drivel, and I would have liked the language to be more flexible, for example. But all of these criticisms are fairly minor. Python is still the language I am most comfortable with, and the language I reach for first in many cases.

So, yeah, I can understand people’s frustrations with the language, but this is just completely wrong. And what is this !@#$ about Python being a copycat language?! Yes, some features were borrowed from other languages — list comprehensions come to mind — but there aren’t that many examples of it, and it’s hardly the only language that does this. In fact, if I’m not mistaken, Java, C++ and C# all have grown features borrowed from dynamic languages… except such features tend to have limited use in a environment that is statically typed.

:: Comments (3)

iPad

Fortunately for all rumor mongers, it was indeed a tablet that was announced by Apple today. They would have looked quite silly if it had been something else. :-)

From what I’ve seen so far, I like it. As usual, there’s a large number of bloggers and commenters who disagree, sometimes with valid arguments, but most of them seem to be of the flavor “oh noes it has no camera” or “it’s just a large iPod Touch”. Whatevs. Most people won’t care, they will just use it for videos, music, web surfing, reading books and magazines, email, instant messaging, and much more, without a steep learning curve. Sure, it’s not a replacement for a “real” laptop or desktop computer, but I don’t think it was intended to be anyway.

Personally speaking, I do want one, but not immediately when it becomes available. Not only do I not have the funds for it at the moment (I was unemployed for ~5 months last year, remember), but also, from what I have seen, it’s better to wait when buying hot new Apple products. (Remember the iPhone price drop?) Chances are the price will go down, or the low-end model will be beefed up. They will likely also need time to iron out the wrinkles in the operating system, and developers would need time to start writing apps specifically for the iPad.

(When/if I have money to blow, I would probably sign up for the developer program and start writing apps. And in spite of the App Store restrictions, I might be able to use Scheme! :-)

One thing I am wondering is if the touch screen will work (or can be made to work) with a stylus… essentially you’d then have a Wacom drawing pad. Coupled with the right software, that could be a great tool for artists. (Or musicians… imagine a Kaossilator app…)

:: Comments off

Fun with Gentoo

So I installed Gentoo Linux the other day… I then spent most of Friday night and Saturday (I know, I am lame =) trying to set the console font to a size that I liked.

Backstory: Gentoo insists on booting up in a resolution of 1024×768 on the iMac, and then sets the console dimensions to 128×48, which leads to a font that is just a little too small for me to read comfortably on this screen. So I spent a lot of time trying to set the resolution to 800×600, hoping that this would lead to a larger font. Under OS X, that resolution works fine, but under Gentoo, the machine refuses to recognize it. Or rather, it ignores video settings that I pass, or the screen goes blank and the computer seems to hang. Pretty weird. At some point I even tracked down the driver in the kernel source, changed it to boot into 800×600, recompiled and reinstalled… which had the same effect as manually setting the resolution, i.e. the computer hangs.

So eventually I started looking for larger console fonts. There aren’t many… there’s the Sigma font, and Terminus… I am using that last one now, and I don’t like it too much, but at least I can read what I’m writing. :-) Fortunately, the sources of both fonts are available, which means I can change them to my liking, or create my own font (eventually). ^_^

Other than that, Gentoo works great on the iMac. Network worked right out of the box, which is essential as many packages can be downloaded using emerge.

Well, back to my hacking configuration hell… :-)

:: Comments (2)

The penguin has landed

So, I got my old/new iMac yesterday. I figured I’d try installing Gentoo on it, and if that didn’t work, try an easier install like Ubuntu or Yellow Dog. As it happens, the install worked fine. I did a minimal install, compiled the kernel, etc… and to my surprise, ended up with a working Linux system. :-) (I expected it to be crazy difficult, but it wasn’t so bad.)

I recommend trying this; it’s a great learning experience when you don’t know much about what makes Linux tick. I learned a lot, anyway.

Although the PPC version is not “official” (it’s supported by the community), it appears to be up-to-date and the installation went well. Granted, there were a few parts in the handbook that worked a bit differently in the newest version of Gentoo, but nothing I couldn’t figure out. Overall, the manual did an excellent job of guiding me through all the steps (many of which I had never done before, like setting up a file system from the command line, or preparing and compiling a kernel).

Now I just need to find a way to set the text mode to something lower than 128×48, and I’m golden… =)

:: Comments off

Dear lazyweb: Which Linux distro should I use?

So this week I will be getting my “new” iMac, and I want to install some version of Linux on it. However, the following restrictions apply:

  • This is actually an old iMac from around 2000-2001 or so. Specs: G3/450, 256 Mb of memory, 20 Gb hard drive, DVD-R. (Note that this is a PowerPC.)
  • Linux should run in text mode only. (For various reasons, e.g. to save space, because the machine isn’t really equipped to run GUIs smoothly, and because I actually LIKE text mode. :-)
  • I want to do as much as possible with this machine, so any distro that caters to text mode users (more so than usual), gets extra points.
  • Although I have a few years of experience with Unixoid systems, I am not all that familiar with Linux per se, so the distro should probably not require expert knowledge.

So far I am considering Ubuntu (server install), Debian, and maybe Gentoo. (Although I don’t know how difficult it is to use… the compilation part doesn’t scare me… and the Portage package management system is apparently written in Python, which is interesting.)

Are there any other distros that would be suitable for a PPC with limited hardware?

:: Comments (5)

Grrr

WordPress just ate my post. Don’t you just love web apps? It’s going to be even better when (as people predict) *everything* will be “in the cloud”, so I can spend all day typing in a cramped input field in a browser window, and then be unable to access my data OR my programs when my internet connection acts up. >=(

:: Comments (1)

Eeuwenoud

Sorry, maar dit moet ik even kwijt. Ik zie steeds meer artikelen die de uitdrukking “de jaren tachtig van de twintigste eeuw” gebruiken (of jaren negentig, enz). Wat is dat voor onzin? Waarom niet gewoon “de jaren tachtig”? Dat het niet over de jaren tachtig van deze eeuw gaat, snap ik ook wel. In plaats daarvan voegen we het volslagen nutteloze “van de twintigste eeuw” toe, alsof dit heel erg lang geleden is. Misschien zijn deze teksten geschreven door personen van 15 jaar oud of zo, die zich de twintigste eeuw niet kunnen herinneren?

:: Comments off

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »