The Nile release introduces ANSI-conformant streams into Essence#. It also fixes some significant bugs, and provides new utility scripts for use in developing Essence# code.
The name Nile was chosen because it’s the name of a rather big stream that’s mentioned in the Bible–and we’ve been using a Biblical naming scheme for the Alpha releases. Recall that Moses as a babe was found among reeds along the banks of the Nile. So the Nile is a reed stream…
FileStream Usage Examples
Two new example scripts have been added which illustrate how to write to a file and how to read from a file using classes and messages that conform to the ANSI Smalltalk standard.
The AppendToFile.es script requires a command-line argument that specifies the pathname of the file to which to write. The script writes out the name of all root classes to the specified file. Note that it actually appends to the named file, and does not overwrite or truncate it:
:pathname | | stream | stream := [FileStream write: pathname mode: #append check: false type: #text] on: System.IO.IOException do: [:ex | Transcript show: 'File could not be opened: ', pathname. ^nil]. [Transcript show: 'Writing out all root classes to ', pathname; cr. Class subclassesDo: [:rootMetaclass | | rootClass | rootClass := rootMetaclass soleInstance. stream nextPutAll: rootClass qualifiedName; cr. Transcript show: rootClass qualifiedName; cr. ]] ensure: [stream close]
To invoke the AppendToFile script so that it writes the names of the root classes to the local file ‘rootClasses.txt’, run the ES command with the following command line arguments:
es AppendToFile -a 'rootClasses.txt'
The ReadFromFile.es script also requires a command-line argument that specifies the pathname of the file from which to read. The script reads each line of the input file and writes it to the Transcript:
:pathname | | stream line | stream := [FileStream read: pathname] on: System.IO.FileNotFoundException do: [:ex | Transcript show: 'File not found: ', pathname. ^nil]. [[stream atEnd] whileFalse: [line := stream nextLine. Transcript nextPutAll: line; cr]] ensure: [stream close]
To invoke the ReadFromFile script so that it reads all the lines from a specified file and writes them to the Transcript, run the ES command with the following command line arguments:
es ReadFromFile -a 'rootClasses.txt'
Download Nile (Alpha Build 20)
The best way to download the latest version is by going to the Essence# site on CodePlex.
From the Essence# home page on CodePlex, you can download the latest version by clicking on the big purple button labeled DOWNLOAD on the upper right-hand side of the page. Or, if you’d like to read the release notes (recommended,) you can navigate to the tab labeled DOWNLOADS on the tabs bar (near the top of the page; the leftmost tab is labeled HOME.) Both options will get you a program that installs all of Essence#, including the Essence# Standard Library and the Microsoft Visual Studio project folder used to develop the C# code that implements Essence# (the compiler and the run time system.)
You can also obtain components of Essence# on an ad-hoc (“a la carte”) basis:
The SOURCE CODE tab (immediately to the left of the HOME tab on the Essence# home page on CodePlex) will let you either download just the Visual Studio project or else make a local clone of the Git repository for it–but neither of those options will get you the Essence# Standard Library, which is required to actually use Essence#.
Other components of Essence# are available individually from the Essence# site on GitHub:
The Essence# tools repository on GitHub: Contains useful tools for coding in Essence#
Final note: If you have a version of Essence# prior to Alpha Build 17 (Philemon) and have also written your own Essence# code using that release that you would like to keep using with this release, then please be sure to also read the release notes for Alpha Build 17. There have been significant changes to the format of the Essence# Standard Library => Philemon (Alpha Build 17).