|Do you know where your variables are?|
Truly reusable software componentsby vrk (Chaplain)
|on Oct 17, 2007 at 17:04 UTC||Need Help??|
Perl programmers have CPAN. It's a repository of modules for all sorts of problems and solutions, interfacing with various technologies, network protocols, and file formats, adding features to the language, and a very long list of other ready components. In a way, it fulfills the dream of object-oriented programming people, and really any programmer, of having a generic and complete library of all written modules so far that can then be used in solving new problems.
This is an ideal situation. How many Perl progammers realize it? It's not only about saving time and effort, or enabling you to use technologies that you don't have time or interest to learn, or the ability to create well-nigh trivial solutions with just the right choice of modules, or having the largest repository of modules to brag about. It's all this and a realization of an old ideal. With sugar on top.
There's only one problem with it: it's Perl only.
Other programming languages do have "comprehensive archive networks" -- frequently modelled after CPAN itself (which, in turn, was modelled after CTAN). With some googling, I was able to locate the following archives of reusable modules for different programming languages:
(Well, Open Knowledge Definition is not a programming language. TeX is, in a way. Is it Turing complete?)
The main problem is duplication of effort, something these archives try, by definition, to reduce! But there doesn't seem to way a out of the dilemma: how do we create a repository of generic, truly reusable software modules that are language-agnostic? There is no inclination of the world converging to one single programming language, so picking one "universal" programming language is not an option.
Perhaps there could be an archive targeting a universal virtual machine. Although there would have to be consensus on the machine architecture first (I propose the SECD machine), imagine that all programming languages had compilers that could target the virtual machine. The packages in this imaginary archive would have two versions: the source code and binary machine code for the virtual machine. Then, depending on if you have the compiler, or the language runtime environment, installed or not, an automatic install tool would pick either the source code of the program or the binary version compiled to the virtual machine.
Benefits: as long as source languages had compilers, modules could be written in any language, in principle. Even if you had never heard of the language before, you could still use the virtual machine code bundled with the module.
The obvious drawbacks are having to rely on machine language again, even if it is for a virtual machine. Another is the complexity involved, and duplication of effort in terms of compilers.
Any other ideas? I don't really accept "but Perl is a universal language!" as an answer, at least not until Perl 6 exists.
Update: omouse pointed out more Scheme and Common Lisp archives, which were added to the table: PlaneT and ASDF-Install. The latter seems to even be hosted at CLiki, which is where cCLan can be found too... Sorry for the oversight.