Message-ID: <261891353.301555.1369139974980.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_301554_188353233.1369139974980" ------=_Part_301554_188353233.1369139974980 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Boo.Lang.Useful - an assembly rife with things beautiful and use= ful yet not quite core to the Boo language. Welcome to this introductory gu= ide, where we will plumb its murky depths in search of adventure on the hig= h seas and delicious pirate treasures.
Boo.Lang.Useful is meant for user contributions to Boo in Boo= - sometimes you have a really good idea for a great addition to Boo, but i= t just isn't "core" for the language. Enter, Boo.Lang.Useful: an = assembly based primarily of user contributions for stuff that is extremely = helpful but not quite core. If you want to contribute, please go to JIRA and open a new issue in the "Boo.Lang.Useful" com= ponent, and attach a patch for your component. Please follow the Coding Conventions page for submissio= ns.
Here are some of the out-standing features already available ...<= /p>
This class is used as a quick and dirty to en= umerate through the lines in a text file as if it were any other object tha= t implemented the IEnumerable interface. It is useful for quickly grokking = information in newline-delimited (\n, or \r\n) formats. It is also useful f= or editing a file's contents with a short, sweet, and simple API.
The= static methods ReadFile() and WriteFile() are used to respectively read th= e entire contents of a file to a string, and write the contents of a string= to a file.
= eachFile accepts two parameters: a string containing a directory that will = act as root, and a function that will be executed for each file in the root= directory and all of the root directory's subdirectories. This function is= recursive.
listFile= s returns an enumerable object, a list of strings that represent filenames = in the root directory and every subdirectory specified by the parameter. It= is a recursive function.
walk returns an en= umerable object consisting of three elements: the current directory, an arr= ay of strings representing subdirectories within the current directory, and= an array of strings representing files within the current directory. It is= a recursive function.
The Single= ton attribute automates the implementation of the Singleton design pattern.= Attaching this attribute to a structure or a class generates code to prote= ct all constructors and and implements a single property, 'Instance,' that = points to an instance of your class.
If you want to initalize certain= objects, create a parameter-less constructor (this will be made protected = and will be called by the Singleton attribute).
For more information = about the singleton design pattern, check out this article.
/* Hey, hey, what do you say? */ import Useful.Attributes [Singleton] class SingletonExample: =09[property(Variable)] =09_var as string =09def constructor(): =09=09Variable =3D "Hey, hey, what do you say?" print SingletonExample.Instance.Variable=09=09
Applied to a metho=
d, the Once attribute will automatically cache the value returned by the me=
thod on it's first call. Following calls to the method will simply re-use t=
he cached value. This is usefull for methods that do long and / or expensiv=
e processing since the processing will be done only 'Once'.
A Set class for the math f= reaks. (stub, fill in later)------=_Part_301554_188353233.1369139974980--