packages

DRY package description ... in Smalltalk

Tagged:  •    •  

So here we go again ... this time using native Smalltalk code to describe package contents in a DRY way:

Eval [
  PackageBuilder new
    name: 'MyPackage';
    namespace: 'MyNamespace';
    prereq: 'Package1';
    prereq: 'Package2';
    ...
    testsBelow: 'Tests' matching: '*.st';
    filein: 'File1.st';
    filein: 'File2.st';
    ...
    buildXml
]

DRY package description

Tagged:  •    •  

If you are used to having one class per file, package descriptions tend to get a bit unwieldy. Take a look at Iliad's Core/package.xml, as an example. What you see is a lot of typing, some of it, gasp, even repeated. Let's DRY this up a bit.

Intro to Packages and NameSpaces

Tagged:  •  

In GNU Smalltalk package loading and namespaces are separate.

If like me you've come from Java, it takes an example to see what this means in practice.

Here is a very simple example using sockets (found in TCP package up to 3.0.x, and Sockets package in 3.1). The example below is for 3.1 so the Sockets package is used. Sockets package documentation is at...

http://www.gnu.org/software/smalltalk/manual-libs/html_node/Sockets-pack...

What I tried to do first was this...

 #!/usr/local/bin/gst -f
       PackageLoader fileInPackage: 'Sockets'.

PackageDir

Tagged:  •    •  

I've become spoiled with Python's module and package system. So here I give
you a half baked (but mostly working) alternative package loader.

Syndicate content

User login