Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

An alphabetical listing of all pages in the Wiki.

Space Index

0-9 ... 0 A ... 11 B ... 23 C ... 14 D ... 14 E ... 5
F ... 6 G ... 14 H ... 9 I ... 12 J ... 1 K ... 1
L ... 7 M ... 7 N ... 8 O ... 6 P ... 32 Q ... 1
R ... 5 S ... 18 T ... 8 U ... 5 V ... 0 W ... 5
X ... 1 Y ... 0 Z ... 0 !@#$ ... 0    



Page: About this Site is the home and authority for the boo project. The site runs on Atlassians EnterPrise Wiki which includes JIRA for bug tracking and project managemnt and the Confluence Wiki for collaborating and sharing knowledge. Our wiki pages are orga
Page: Abstract Syntax Tree
The AST structure used by the Boo Compiler is described in the file included with boo. That file is in turn used by scripts/
Page: Adding Boo to your System Path
Windows Windows makes this task anything but intuitive for beginners. Basically, the system path allows you and other executables to access programs when they aren't in the same directory as the command-line is. This allows you to access a program without
Some resources for learning how to use the standard ADO.NET API for interacting with databases from .NET and Mono: ADO.NET Quickstart samples Overview of ADO.NET http://msdn.mi
Page: Advanced Tutorial, Learning Boo Kung-Fu
Now that you've got the basics down (you did read my first tutorial and studied up using the Language Guide right?) its time to witness the sleek, rumbling power of Boo Kung-Fu, but first, the requisite backstory: Just a few days ago I was wrestling with
Page: Applications
Applications created with Boo This page itemizes free and commerical applications written in boo. For information about which development environment to use with boo, refer to the General Help. Free / Open Source db4o boo browser http://db4oboobrowser.sou
Page: Archive
Page: Array access - Property vs field vs indexer
This benchmark shows the relative speed of a large property array vs field array vs indexer array. The benchmark uses this "timer" macro The benchmark has since been updated to include tests of lists as well as raw
Tutorials and resources on using ASP.NET and boo to develop web-based applications. It is possible to run ASP web applications that are coded with boo, either inline in the aspx page, or as a separate boo file which the aspx page inherits. We don't have m
Page: Asynchronous Design Pattern
This example shows the benefits of having first class functions . For a good overview of the .net framework asynchronous design pattern take a look at this article
Page: AsyncMethodAttribute
See the Async attribute in the examples folder included with boo. Below is an updated version of this attribute that could be included with Boo.Lang.Useful: #region license // Copyright (c)


Page: Bamboo Prevalence
In Bamboo Prevalence, all the data is stored in RAM for must faster access. It was created by Rodrigo B. de Oliveira, author of the boo programming language itself. See the example included with boo. Other resources:
Page: BindAndApplyAttributes
The step processes AST attributes (such as [Required] or [Property(Name)]), just like the next step ExpandMacros processes AST macros. Attributes can be used where macros cannot - to process classes, methods, parameters, fields, properties and other thing
Page: BindBaseTypes
Scans the AST for type definitions, and binds each type reference used as a base type to its corresponding type system object. This must be done after the BindTypeDefinitions step, since type definitions can use other type definitions as base types. After
Page: BindTypeDefinitions
This step scans the AST looking for class, interface, struct and enum definitions and creates corresponding type system objects (InternalClass, InternalInterface etc.), binding each type definition to an IType instance. After this step, the Entity propert
Page: BindTypeMembers
Scans the AST for type member definitions - methods, constructors, properties, fields and events - and creates the corresponding type system objects to represent them, binding the two together. After this step is run, every TypeMember node in the AST is b
Page: Boo AddIn For SharpDevelop
The boo language binding for the free SharpDevelop IDE was created by Daniel Grunwald. SharpDevelop 4 and .NET 4.0 SharpDevelop for .NET 4 is a stable and excellent open s
Page: Boo And Java
You can use IKVM to access your boo assemblies from java or access java classes from boo. IKVM is an open source java runtime for .NET and Mono. It has tools to create .NET dlls that wrap java classes and librarie
Page: Boo as an embedded scripting language
Scripting support in a hurry. Occasionally, we developers need to do something zany like expose a part of our program or library via easy to understand "scripting" for regular users--for the user, there's no compiler, IDE; just a plain text file with "cod
Page: Boo benchmarks
Boo is fast! Running as fast as C# running on .Net 1.1, much faster than Python, and somewhat faster than Java. And running as fast as C# 2.0 when using .Net 2.0 See:
Page: Boo Compiler
Some initial notes about the extensible compiler architecture used by Boo: See also the pages on Type Inference, Syntactic Macros, and Duck Typing. The boo compiler and platform was created by Rodrigo B. de Oliveira, so please contact him if you have any
Page: Boo double precision benchmark
This is a comparative double precision benchmark in C#, C++, Java, Python, and Boo. It computes a piece of the Mandelbrot set. The times to complete the benchmark on a 1.7GHz Pentium M IBM T41p running Windows XP Professional SP1: Language / runtime Norma
Page: Boo Explorer
In the extras directory you're going to find this neat little utility that allows you not only to edit boo scripts with a nice syntax highlighting but also to run them (F5) and/or see their expanded form (CTRL+E). For Windows Users booxw can be found in b
Page: Boo generator method benchmark
This is a comparative generator method benchmark in C# 2.0, Python, and Boo. It implements the simple weightless cooperating threads as described in Charming Python: Implementing "weightless threads" with Python generators
Page: Boo Kudos
Just a place to share what people like about boo. External Reviews Boo Scares Up Open-Source Developers,1895,1928387,00.asp - eWeek Dynamic .NET Scripting with Boo
Page: Boo Manifesto
Boo Manifesto A must read for those interested in boo. This document contains the foundinnng principals that drive the language development.
Page: Boo on Ubuntu
NOTE: This information is very much out of date. Ubuntu now has packages for everything you need - the "boo" package takes care of core installation, and the "monodevelop-boo" package will allow you to develop boo files on mono. Note, however, that the ve
Page: Boo Optimizations
Some things that could be optimized by the boo compiler. See also the Boo Style Checker ideas. (this is done, see Convert "for i in range(x)" to an optimized while loop, inst
Page: Boo Parser
Boo uses the ANTLR parser generator to create the parser for boo source code. The parsing rules are defined in the boo.g grammar file included with the boo sou
Page: Boo Primer
Boo Primer by Cameron Kenneth Knight A version is also available in Portuguese, translated by Cássio Rogério Eskelsen. A version is also available in Traditional Chinese
Page: Boo Style Checker
These are ideas for things the boo compiler could check, using a special compiler step. It is similar to pychecker or pylint. See also the Boo Optimizations page. All class/enum/struct/property/method names should begin with a capital letter and ideally b
Page: Boo.Lang.Useful
A todo/wish list for stuff to include in Boo.Lang.Useful.dll - a library of helper classes and functions for boo users. All the code in Boo.Lang.Useful would be in boo, not C#. Useful things about Boo contains documentation on members present in the assem
Page: Builtin Functions Summary
Here is a summary of boo's built-in functions. The actual source code underlying these functions is in Boo/Lang/Builtins.cs array array is a function used to create empty arrays or
Page: Builtin Literals
Array literals Arrays are statically sized homogeneous data structures. l = (,) // empty array (typed (object)) l = (1, 2, 3) // integer array with three elements l = ("Eric", ) // string array with a single element List literals Lists are dynamically siz


Page: Callable Types
Callable types are a generalization of the concept of a delegate in the CLI. In boo, not only delegates and methods can be called as functions but also any object references of type System.Type or any Boo.Lang.ICallable implementing type. In the case of S
Page: Camel case
First letter lowercase with all words capitalized and run together after. Ex: assemblyReference, customerName, veryLongName.
Page: Casting Types
Type casting in boo works the same as in C# (see this article The only difference is that with explicit casts in boo you use the "cast" operator (see below). You can try to cast one type to anot
Page: Classes
Here's an example illustrating some of the basics about classes. Until more documentation is here, for examples of using classes, see the files under tests/testcases/integration
Page: Closures
Introduction Martin Fowler has a good introduction to closures on his bliki. Syntax There are two syntaxes for closures: a block based syntax with syntactically significant whitespace and a braces based that
Page: Coding Conventions
For a good discussion on coding conventions in general take a look at this page The following conventions must be followed by any code committed to our repository (which also means that the source files already in
Page: Command line
To open up a command line either do Start -> Run... -> "cmd" or do Ctrl-Alt-Delete -> File -> New Task -> "cmd". The command line (emulated DOS on 2000/XP) allows basic access to the file system, and, more importantly, allows you to call programs with mor
Page: Comments
Single Line Comments Everything that comes after a hash character (#) or a double backslace (//) is ignored until the end of the line. # this is a comment // This is also a comment print("Hello, world!") // A comment can start anywhere in the line Multili
Page: Common Language Infrastructure
(image borrowed from the Wikipedia article on the Common Language Infrastructure Overview_of_the_Common_Language_Infrastructure.png See the ECMA-355 standard
Page: Compatibility
Some basic compatibility: namespace Boo.Compatibility.Python class Dict(Hash): def constructor(): super() def constructor(h as Hash): super() Update(h) def Update(h as Hash): for key in h.Keys: self[key] = h[key] def Get(key, default): return self[key] or
Page: Compiler Options
Options when compiling boo scripts. Right now this is just a list of potential options for the boo compiler, some of which do not exist yet and may never exist. For those options that can be on or off, this list suggests two names for each option, specify
Page: Compiler Steps
Pipelines consist of a set of steps that the compiler passes the code through. The source code for all the steps is here The order of steps when you compile a script is like this: First t
Page: Contributors
There are many ways you can make boo better. As an user you can contribute by reporting any issues you find, by adding, commenting on and/or fixing the documentation on this website (see that little edit link down the page?), by helping other users throug
Page: Cookbook
Thr boo Cookbook is filled with recipes on how to do interesting things in boo


Page: Data Structures and Algorithms
Attached to this page is a zip file ( containing some code converted from the online book Data Structures and Algorithms with Object-Oriented Design Patterns, by Bruno R. Preiss. He ha
Page: Data types
Just a note that we could use some docs on: reference types value types (see also User-defined value types aka structs and I assume a struct keyword will be added too) null = vs. == == vs. is is vs. isa typeof x.GetType() == vs is vs isa The "==" operatio
Page: Database Design
Some tutorials and resources on designing relational databases. Practical Database Design, part 1: Keys and datatypes Practical Database Design, part 2: Normalization, history, and event lo
Page: Database Recipes
Examples of working with databases from boo. For general information about learning to use relational databases in .NET and Mono, see the ADO.NET page here. There also is a page with links to tips about Database Design. You can also store objects to a fil
Page: Datatype Recipes
An assortment of recipes for working with data types.
Page: db4objects
db4objects (db4o) is a GPL-licensed native object database. You can store complex objects without using SQL syntax. There is a db4o example included with boo. See the db4o object br
Page: Design by Contract
Boo has some support for Design by Contract with the Required attribute. def doit([required(x >= 0)] x as int): print x doit(10) doit(0) doit(-1) //raises a System.ArgumentException Since boo has an extensible compiler architecture (unlike for example C#
Page: Differences with Csharp
This page notes some differences between C# and boo. C# to Boo Converter The easiest way to see how code in boo differs from C# is to use the C# to boo converter included in the Boo AddIn For SharpDevelop. The converter is also accessible online via a web
Page: DirectX Samples
DirectX Samples in Boo These are examples that use the Managed DirectX API for .NET. They require the DirectX SDK from Microsoft. And of course these run on Windows only. For a cross-platform alternative
Page: DisposableAttribute
#region license // Copyright (c) 2005, Sorin Ionescu // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of
Page: Download
Stable Releases You can always download the latest distribution from here;O=D. Debian and Ubuntu users, for your convenience, there is deb packages available on boo's google group files
Page: Duck Typing
Duck Typing Boo is a statically typed language, like Java or C#. This means your boo applications will run about as fast as those coded in other statically typed languages for .NET or Mono. But using a statically typed language sometimes constrains you to
Page: Duck Typing Benchmark
This benchmark compares a duck typed call to a normal call. Duck Typing calls are about 160 times slower. [Module] class DuckBM: pass def add(a as int, b as int): return a + b def add(a as int, b as string): return a + int.Parse(b) def add(a as string, b
Page: Dynamic Inheritance - fun with IQuackFu
Boo's IQuackFu interface enables adding behavior to a class at runtime. This example shows how to add dynamic inheritance to boo, also called mixin programming or delegatio


Page: Encrypt a String
An example showing how to encrypt and decrypt a string using a password. // import System.Security.Cryptography import System.Text import System.IO import System def encrypt(s as string) as string: return encrypt(s, "d!&%#@?,:") def decrypt(s a
Page: Enums
The keyword enum introduces an enumerated type, a set of name to integer value associations. enum Python: Eric John TerryG TerryJ Graham Michael which is equivalent to: enum Python: Eric = 0 John = 1 TerryG = 2 TerryJ = 3 Graham = 4 Michael = 5 Extracting
Page: Events
Creating an event What's that timmy? You're exposing your API to someone else, and they want convient handy-dandy events?! No problem! As with everything in Boo, its dead simple to get up and running within moments with the event keyword. import System cl
Page: Exception Handling
To handle exceptions in Boo you use the try - except block, and an optional ensure keyword, which may be used to have some code executed no matter the exception was raised or not. Just for a comparative, it is equivalent to try - catch - finally block fro
Page: ExpandMacros
Calls an AbstractAstMacro's Expand method. For example the print macro transforms this code: print item into this: System.Console.WriteLine(item)


Page: FAQ
Frequently asked questions. Have a question? Post it here or to one of our Mailing Lists. License boo is licensed under a MIT/BSD style license. The current license is always available here How complete i
Page: Fields And Properties
Fields and properties are used to store and control access to data (integers, strings, etc.) inside a class. Fields store the values, and by default are "protected", they can only be accessed from methods inside the class (or a subclass). You can declare
Page: fireAndForget
The fireAndForget macro automatically calls the appropriate EndMethod of an asychronous call. Example: class Foo: [AsyncMethod] def PrintMessage(message): print message def Main(): foo = Foo() fireAndForget foo.BeginPrintMessage("Hello World!") #region li
Page: Firebird Database
Under Construction Firebird, formerly known as Interbase. An alternative to MySQL. Can be run as a standalone server, or embedded with your app. http://www.dotnetf
Page: Functions
Functions do not necessarily have to be created inside of classes in Boo. This is valid code: def doWickedAndNaughtyThings(): print "I'm doing evil, wicked things to you." print "No, don't call the police!" print "...crap." doWickedAndNaughtyThings() So i
Page: Functions As Objects
Functions and methods in boo are first class objects whose type exposes some very useful methods: Invoke(<function args>) as <function return type>: invokes the function synchronously (pretty much the same as using () in front of the function name) BeginI


Page: Gecko and Glade mini-browser
Mini browser in less than 100 lines Mini browser in less than 100 lines In this example we'll use Glade# to construct the GUI of the application, and then use Gecko# to add the actual browser component. To make Gecko# application run and detect Mozilla's
Page: General
Page: General Help
These are pages with general help on developing applications for .NET and Mono, and other topics not specific to boo itself but useful for a boo developer. General Info about .NET and Mono .NET is Microsoft's application framework and runtime engine. Most
Page: Generator Breakdown
Still having problems understanding generators, huh? Don't worry - its easy stuff. The basic syntax is: <expression> for <declarations> in <iterator> <conditional expression> In practice, it generally looks like this: <local variable> = <expression> for <
Page: Generator Expressions
Note: If you are not familiar with the generator concept, this Generator Breakdown page should be read before continuning. Generator expressions are defined through the pattern: <expression> for <declarations> in <iterator> [if|unless <condition>] Generat
Page: Generator Methods
Generator methods are defined by the use of the yield keyword: def fibonacci(): a, b = 0, 1 while true: yield b a, b = b, a+b Given the definition above the following program would print the first five elements of the Fibonacci series: for index as int, e
Page: Generators
From time to time there is the need to represent closed sets such as customers in Brazil or open sets like the numbers in the Fibonacci series in a succinct and memory conservative way. Enter generators. Generators are language constructs capable of produ
Page: Generics
part of the Boo Language Guide Using .NET Generics in Boo Declaring references to generic types include foo* for IEnumerable<foo> Generic method invocation Defining generic types Generic classes Generic methods H5. Generic constraints
Page: Gentle.NET ORM
Gentle.NET lets you work with relational databases without using SQL directly. See this basic example from the Gentle.NET user guide. I
Page: Getting Boo Version
Here is a way to check what version of boo your script is running in . Boo now has a BooVersion builtin: print BooVersion //-> The old way to do that is to check the version of the Boo.Lang.dll assembly. We find the assembly by getting the Asse
Page: Getting Started
Warm up by reading the boo manifesto Download the latest distro or get the latest sources Check out some cool language features and the language reference. Learn how to e
Page: Git
Using Git with the Boo Subversion repository Everything you need to track the Source can be found on the Git SVN tutorial It can take a while to import the full Boo history into Git. To speed up the process, we have set u
Page: Gotchas for Python Users
Learning boo if you are familiar with Python It might come as no surprise to anyone but I'd better state it here anyway: boo is not python. It looks a lot like python and there's a reason for that: we love python! Specially The dirty hungarian phrasebook
Page: Graphic Recipes
Recipes for working the forms and 3D API's such as Direct X, OpenGL, and wx.Net


Page: Hashtables
Hashtables (also called dictionaries, maps, or associative arrays) are data structures that allow you to store named items. They are similar to Python's dictionaries. For example: d = {"foo" : "bar", "spam" : "eggs"} print d["foo"] //prints "bar" emptydic
Page: Hello Boo - a beginner tutorial
"Hello, Boo!" This tutorial assumes you have basic computing knowledge and are comfortable with the command line interface of your operating system. If you're familiar with programming in general, you might just want to browse the code snippets and ignore
Page: Hello World Recipes
How many ways can you say Hello World? This example shows console, WinForms and Gtk versions of "Hello, world!". Console print "Hello, world!" WinForms import System.Windows.Forms f = Form(Text: "Hello, boo!") f.Controls.Add(Button(Text: "Click Me!", Dock
Page: High-precision math with decimal datatype
This example shows how to generate the "golden ratio" to 28 digits of precision using the decimal datatype and a Fibonacci Sequence generator function . // shows use of infinite fibonacci sequence with decimal datatype to generate golden ratio to 28 digit
Home page: Home
Boo is a stablished object oriented statically typed programming language for .NET and Mono (JVM support coming soon) with a python inspired syntax and a special focus on metaprogramming through language and compiler extensibility fe
Page: How To Build
Boo always come PRE-BUILT There's always an up to date build in the bin/ directory of the distribution. Pre-requisites In order to (re)build boo you are going to need to have the following tools already installed: An up to date version of the Nant http://
Page: How To Compile
There are basically three ways to compile your boo code: through the booc utility; through the booc task (one of the nant tasks); through the Boo.Lang.Compiler API; booc utility booc -r:System.Windows.Forms -out:build/HelloForms.exe examples/
Page: How To Edit
You can use any text editor to create and edit boo source files. The important thing is to configure your editor to generate utf-8 files. I spend most of my time with Boo Explorer and JEdit. There is also now an add-in for the SharpDevelop http://www.icsh
Page: How To Run
Of course you can always compile your code to an .exe and run it as any other CLI program. But this section is all about running boo programs directly from memory. booi utility booi examples/ To execute a script read directly from stdin: boo


Page: Identify web server
Find out which webserver is behind a url import System.Net using response=WebRequest.Create("").GetResponse(): print(response.Headers["Server"]) If you are behind a non-transparent firewall/proxy you may need to set the proxy credentia
Page: Import
import TARGET (from ASSEMBLY)? (as ALIAS)? The import construct makes all the members of the imported target available to the current module. So instead of writing: System.Console.WriteLine("and now for something completely different... ") System.Console.
Page: InitializeNameResolutionService
Inicializes the NameResolution service object by loading up all the references and populating the list of imports. The NameResolution object handles converting lazy naming such as "Console.WriteLine" to things like "[mscorlib]System.Console::WriteLine(str
Page: InitializeTypeSystemServices
In this compier step, a TypeSystemService object is instantiated, which keeps track of the program's variables and their types.
Page: InjectCallableConversions
See the previous example as it has been processed in the steps ProcessMethodBodiesWithDuckTyping, ProcessSharedLocals, and ProcessClosures. An adapter class is created for event handlers. This allows us to say for example "button.Click += MyMethod" withou
Page: Interactive Interpreter
Boo has an interactive interpreter that is useful for testing out snippets of boo code. To use it, run the booish.exe command line tool. You can also edit, compile, and debug if you install the Boo AddIn For SharpDevelop. Default Built-in Commands describ
Page: Interfaces
Interfaces are introduced thru the interface keyword: interface IFoo: pass Interface methods don't need to have a body: interface IUnknown: def QueryInterface(id as System.Guid) as object But if they do it must be empty: interface IFoodMachine: def Spam()
Page: Internet Recipes
Various recipes for the Net.
Page: IntroduceGlobalNamespaces
Adds Boo.Lang and the builtins to the namespaces of the TypeSystemService
Page: IntroduceModuleClasses
Creates a module-wide class to hold your code. Moves all the def statements (methods) into this cass, and moves the code that should be executed when a script is run into its own Main method inside the module class. For example this code: myarray = (1, 2,
Page: Invoke Native Methods with DllImport
Here are some samples: import System.Runtime.InteropServices [DllImport("user32.dll")] def MessageBeep(n as uint) as int: pass def beep(): MessageBeep(0) beep() Actually, a more cross-platform way to make a beep sound is to call Microsoft.VisualBasic.Inte
Page: IRC Channel
You can see if people are hanging out in the #boo channels: GimpNet network: irc:// irc:// Codehaus server: irc:// irc:// If no one is there, please try the Mailing Lists. Related cha


Page: JEdit
Yes, JEdit! What's wrong with that? extras/boo.xml is the syntax mode, just copy it to your <JEdit installation folder>/modes directory and include the following line in your CATALOG file: <MODE NAME="boo" FILE="boo.xml" FILE_NAME_GL


Page: Keywords with examples
Boo Keywords Index #abstract #and #as #AST #break #callable #cast #char #class #constructor #continue #def #destructor #do #elif #else #ensure #enum #event #except #failure #final #from #for #false #get #given #goto #if #import #in #interface #internal #i


Page: Language Features
Type Inference Builtin Literals for lists, hashes, arrays, regular expressions and timespans Slicing String Interpolation Statement Modifiers Syntactic Attributes Syntactic Macros Generators Generator Expressions List Generators Array Generators Generator
Page: Language Guide
Welcome to the boo user guide. Contents Basic Features of Boo Structure of a Boo Script Import Comments Builtin Functions Summary Using .NET's Standard Class Library General .NET Help String Operations
Page: Language Summary
Basic Features of Boo Structure of a Boo Script """module docstring""" namespace My.NameSpace import Assembly.Reference class MyClass: pass def domyfunction(it): print(it) domyfunction(3) [assembly: AssemblyTitle('foo')] // [Module] attribute defines "glo
Page: LeftHeader
Page: List Generators
List generators aka list comprehensions and list displays provide a quick way to create a list with selected elements from any enumerable object. List generators are defined through the following syntaxes: [element for item in enumerable] [element for ite
Page: Lists And Arrays
Lists Lists are mutable sequences of items. They are similar to lists in Python. Lists are surrounded by brackets, just like python: [1,2,3] Here is some sample code demonstrating different operations you can do on lists: //the "as List" is optional: myli
Page: Loops
The for loop The for loop sintax is: for var in range: // action where range can be any type of collection. Examples: // print numbers from 0 until 9 for i in range(0, 10): print(i) it is equivalent to for (int i = 0; i < 10; i++) // print from C# or Java


Page: Macros
print print System.Console.WriteLine() print <expr> System.Console.WriteLine(<expr>) print <expr>, [... ,] <exprN> System.Console.Write(<expr>) System.Console.Write(' ') ... System.Console.WriteLine(<exprN>) assert assert <expr> unless (<expr>): raise Boo
Page: Mailing Lists
Boo Google Group We have started a mailing list for boo users at Google groups: See that page for instructions on subscribing and to view the archives. Other Mailing L
Page: Martin Fowler's closure examples in boo
Below are boo versions of the examples in Martin Fowler's blog on closures : class emp: public isManager = false public name = "" public salary = 100 def ToString(): return name def manage
Page: Mathematics Recipes
An assortment of recipes that bring boo and math together in science and in the classroom.
Page: Merge Boo.Lang.dll into your exe or dll
How to combine Boo.Lang.dll into your own app using ILMerge Anytime you create an application or library using Boo, you have to distribute the Bo
Page: Multidimensional Arrays
Multidimensional arrays in Boo When declaring a variable or a field as a multidimensional array, use this syntax: foo as (int, 3) //declare a 3 dimensional array of integers. When creating a brand spanking new multidimensional array, use this syntax: foo
Page: Multimethods in boo
These examples demonstrate the use of duck typing to implement multimethods (also called multiple dispatch With multimethods, the decision about which method to cal


Page: Nant Scripting Language
This example shows how to use boo to enrich your nant build files . boo includes some nant taks, more specifically, the boo task allows you to embed boo code directly into your nant build files. The nice thing is that the code has access to the entire nan
Page: Nant Tasks
<booc> Compiles boo programs. Parameters target Output type, one of library, exe, winexe. Optional. Default: exe. output The output assembly. Required. pipeline AssemblyQualifiedName for the CompilerPipeline type to use. Optional. tracelevel Enables compi
Page: Navigation
Boo Home News FAQ Manifesto Documentation Getting Started Boo Primer
Page: News
Syndicate this site via RSS
Page: NHibernate
Object-Relational Mapper NHibernate is a port of the Java Hibernate object relational mapper (ORM). ORMs translate your classes and objects into SQL commands for storing those objects and retrieving them from a relationa
Page: Ninety-Nine Bottles of Beer
See Simple version: import System.Threading def getbottle(n as int): return "no more bottles of beer" if n==0 return "1 bottle of beer" if n==1 return "$n bottles of beer" b = getbottle
Page: NormalizeIterationStatements
Converts things such as for loops. For example, this code: for item as System.Int32 in myarray: System.Console.WriteLine(item) is transformed into this: ___iterator1 = myarray.GetEnumerator() while ___iterator1.MoveNext(): item = ___iterator1.get_Current(
Page: NormalizeStatementModifiers
In this compiler step, the default modifiers for classes, methods, properties, and fields are added where appropriate. Classes and other types are by default public, properties, methods, and events are made public by default, and fields are by default pro


Page: Odds and Ends
Those recipes that didn't have a home in one of the cookbook collections.
Page: Opengl 3D Samples
OpenGL 3D samples These samples use the Tao Framework for OpenGL on .NET and Mono. Tao is constantly changing (and moving), so these samples may be out of date. Redbook.Cube example in boo // //when compiling with b
Page: Operator overloading
Boo has operator overloading. Overloaded operators must be defined as static. For example: struct myNum: i as double def constructor(j as int): i = j static def op_Multiply(x as myNum, j as int): x.i = x.i * j return x static def op_Multiply(x as myNum, y
Page: Operator overloading benchmarks
This is a benchmark of operator overloading in boo. Benchmarks are shown for boo without operator overloading, boo with function calls in place of arithmetic operators, boo with operator overloading using a simple struct called "myNum", boo with operator
Page: Oracle
by Marcos Sanchez Provencio (see this note import System.Data.OracleClient connectionString ="Data Source=rioja;User ID=system;Password=xxxx;" dbcon = OracleConnection(connec
Page: Other Languages
Recipes for integrating boo with other languages. In addition to these recipes, information on differences between Boo and other languages can found at the following: Differences with Python Differences with C


Page: Packaging Boo
Preamble This page will attempt to summarize the generalities involving creating binary packages (.rpm, .deb, what have you) of boo. The specifics of each packaging system are beyond the scope of this document. Please refer to the documention for whatever
Page: Parameters
Parameters are the objects you can pass to Functions, Closures, or Callable Types which handle Events. A parameter is declared with a name, followed by "as", followed by the type: paramname as type. If there is no "as type", then the type is assumed to be
Page: Part 01 - Starting Out
Part 01 - Starting Out Boo is an amazing language that combines the syntactic sugar of Python, the features of Ruby, and the speed and safety of C# Like C#, Boo is a stat
Page: Part 02 - Variables
Part 02 - Variables Using Booish as a Calculator There are four basic mathematical operators: addition +, subtraction -, multiplication *, and division /. There are more than just these, but that's what will be covered now. $ booish >>> 2 + 4 // This is a
Page: Part 03 - Flow Control - Conditionals
Part 03 - Flow Control - Conditionals If Statement A control statement that contains one or more Boolean expressions whose results determine whether to execute other statements within the If statement. An if statemnt allows you to travel down multiple log
Page: Part 04 - Flow Control - Loops
Part 04 - Flow Control - Loops For Loop A loop whose body gets obeyed once for each item in a sequence. A for loop in Boo is not like the for loop in languages like C and C#. It is more similar to a foreach. The most common usage for a for loop is in conj
Page: Part 05 - Containers and Casting
Part 05 - Containers and Casting Lists A linked list that can hold a variable amount of objects. Lists are mutable, which means that the List can be changed, as well as its children. print([0, 'alpha', 4.5, char('d')]) print List('abcdefghij') l = List(ra
Page: Part 06 - Operators
Part 06 - Operators Mathematical Name Syntax example Comments Multiplication a * b Division a / b Remainder a % b Often called mod or modulus Addition a + b Subtraction a - b Exponent a ** b Do not confuse this with Bitwise Xor ^ Bitshift Right a >> b Bit
Page: Part 07 - Functions
Functions A sequence of code which performs a specific task, as part of a larger program, and is grouped as one, or more, statement blocks Builtin Functions You have already seen a few functions. range(), print(), and join(). These are functions built int
Page: Part 08 - Classes
Part 08 - Classes A cohesive package that consists of a particular kind of compile-time metadata. A class describes the rules by which objects behave. A class specifies the structure of data which each instance contains as well as the methods (functions)
Page: Part 09 - Methods
Part 09 - Methods A function exclusively associated with a class Defining a Method Methods must be defined in classes. They are declared just like functions are. class Cat: def Roar(): print "Meow!" cat = Cat() cat.Roar() Meow! An object of Cat must be in
Page: Part 10 - Polymorphism, or Inherited Methods
Part 10 - Polymorphism, or Inherited Methods The ability for a new object to implement the base functionality of a parent object in a new way. Two keywords are used to make Polymorphism happen: virtual and override. You need to describe a method as virtua
Page: Part 11 - Structs
Part 11 - Structs Short for structure, a term meaning a data group made of related variables. The main way structs are different than classes is that they are value types instead of a reference types. This means that whenever you return this value, or set
Page: Part 12 - Namespaces
Part 12 - Namespaces A name that uniquely identifies a set of objects so there is no ambiguity when objects from different sources are used together. Namespaces are useful because if you have, for example, a Dog namespace and a Furniture namespace, and th
Page: Part 13 - Enumerations
Part 13 - Enumerations A set of name to integer value associations. Declaring an Enumeration Enumerations are handy to use as fields and properties in classes. enum Day: Sunday Monday Tuesday Wednesday Thursday Friday Saturday class Action: [Property(Day)
Page: Part 14 - Exceptions
Part 14 - Exceptions A mechanism designed to handle runtime errors or other problems (exceptions) inside a computer program. Exceptions are very important, as they are raised whenever an error occurs in the system. (Or at least they should be.) Catching E
Page: Part 15 - Functions as Objects and Multithreading
Part 15 - Functions as Objects and Multithreading Having Functions act as objects exposes three very useful methods: function.Invoke(<arguments>) as <return type> function.BeginInvoke(<arguments>) as IAsyncResult function.EndInvoke(IAsyncResult) as <retur
Page: Part 16 - Generators
Part 16 - Generators Generator Expressions A phrase that creates a generator based on the syntax: <expression> for <declarations> [as <type>] in <iterator> [if|unless <condition>] Generator Expressions have similar syntax to the for loops that we have cov
Page: Part 17 - Macros
Part 17 - Macros print Macro The print Macro will display one or more objects to the screen. There are two ways to call the print macro. With only one argument With two or more arguments print "Hello there" print "Hello", "there" Hello there Hello there I
Page: Part 18 - Duck typing
Part 18 - Duck Typing Duck typing is a humorous way of describing the type non-checking system. Initially coined by Dave Thomas in the Ruby community, its premise is that (referring to a value) "if it walks like a duck, and talks like a duck, then it is a
Page: Part 19 - Using the Boo Compiler
Part 19 - Using the Boo Compiler The Boo Compiler is typically called in this fashion: booc <options> <files> Command-line Options Option Description -v Verbose -vv More Verbose -vvv Most Verbose -r:<reference_name> Add a reference to your project -t:<typ
Page: Part 20 - Structure of a Boo Project
Part 20 - Structure of a Boo Project On the Project-level Here I'll use the example of the IRC bot I write: Goomba + Goomba (Goomba namespace) |+ Configuration (Goomba.Configuration namespace) | |- | |# class Config |+ Data (Goomba.Data namespa
Page: Part 21 - Documentation
Part 21 - Documentation A communicable material used to explain some attributes of an object, system or procedure. I've saved the most important for last, as documentation is itself, just as important as the code which it describes. When documenting your
Page: Part 22 - Useful Links
Part 22 - Useful Links Boo Download Boo MSDN Search - Very handy if you want to look up something in the standard librar
Page: Pascal case
All words capitalized and run together. First letter is capitalized. Ex: CompilerParameters, AddRange.
Page: Patterns
Have a design pattern to contribute to the Boo community? Add it here.
Page: PostgreSQL
by Marcos Sanchez Provencio (see this note You need the Npgsql data provider (included with Mono). import Npgsql co
Page: PreErrorChecking
In this compiler step, basic syntax errors are checked. It checks that: *Fields And Properties, Fields And Properties, Methods, Functions, Events, Interfaces, Callables, and Classes don't begin with "__", ""get", "set_", "add_", "remove_", or "raise_". Th
Page: ProcessClosures
See the previous example from the ProcessMethodBodiesWithDuckTyping and ProcessSharedLocals steps. Now a callable class is created for closures. More processing will occur in later steps. import System.Windows.Forms from System.Windows.Forms [Boo.Lang.Mod
Page: ProcessGenerators
For example this code: list = ("one", "two", "three") newlist = [item.ToUpper() for item as string in list] is transformed into this: [Boo.Lang.ModuleAttribute] public final transient class TempModule(System.Object): private static def Main(argv as (Syste
Page: ProcessMethodBodiesWithDuckTyping
The ProcessMethodBodies step does a tremendous amount of work. One of the things it does is handle when you set properties by passing them to the constructor, using the builtin __eval__ function. Also adding an event handler (Click += OnClick) is transfor
Page: ProcessSharedLocals
The previous example from the ProcessMethodBodiesWithDuckTyping step had a closure that accessed (and modified) an outside variable (clickcount). Here a class is created to share that object. import System.Windows.Forms from System.Windows.Forms [Boo.Lang


Page: QuickLinks
Download :: Wiki :: Source :: Mailing Lists :: IRC :: Roadmap :: Issue Tracker


Page: Regular Expressions
Boo has built-in support for regular expression literals. You surround the regular expression with / /,   or @/ / for more complex expressions that contain whitespace.  Boo even has an =~ operator like Perl. Here are some samples of using regular expressi
Page: Relationship Manager in Boo
Relationship Manager is a design pattern I wrote a few years ago that I have used in many projects. I have ported it to Boo. See for a web page dedicated t
Page: Release Schedule
Release Schedule Starting with release 0.5, and for all following major releases (e.g. 0.6) a new sub-release is done every month that rolls out the latest bug fixes + features added. These are the advantages to this approach: It confirms that the develop
Page: ResolveTypeReferences
Scans the AST for TypeReference nodes, and binds them using NameResolutionService. After this step is run, any TypeReference nodes in the AST are bound to either the corresponding IType object, or to the Error entity. 
Page: Roundtrip Form
boo code as printed by the BooPrinterVisitor class used by the roundtrip compilation pipeline. Try, for instance: booc -p:roundtrip examples/


Page: Sample GTK-SHARP application.
Summary The following is a sample GTK# application written in Boo. Unlike some applications, this one actually does something useful - its an image (porn?) browser, and its cross platform to boot! The code, with comments, comes in just over 100 lines. You
Page: Scripting with the Boo.Lang.Compiler API
This is actually relatively simple; we only need a few of the Boo.Lang.Compiler classes to make it happen. The classes most important to us are: Boo.Lang.Compiler.BooCompiler - the class that handles compilation of Boo code. Boo.Lang.Compiler.Pipelines.Co
Page: Scripting with the Boo.Lang.Interpreter API
Using the Boo.Lang.Interpreter API is quite straightforward. You can expose values to the scripting environment through the SetValue call and you can read values from the scripting environment with the GetValue call. The Eval call allows you to execute ar
Page: Searching and Sorting Recipes
A list of needed recipes for searcing and sorting in Boo. Recipe 2.1 - Sorting a Dictionary Recipe 2.2 - Processing Selected Pairs of Structured Data Efficiently Recipe 2.3 - Sorting While Guaranteeing Sort Stability Recipe 2.4 - Sorting by One Field, The
Page: Self-reference a callable constructor argument
Sometimes its useful to allow a self reference (to an object being created) in a callable constructor argument. If you try this you will get an "Unknown identifier" error; so declare the object before instantiating it: class X: public f as callable() as s
Page: Shortcuts
Dessert recipes that make you boo coding life sweeter.
Page: SingletonAttribute
#region license // Copyright (c) 2005, Sorin Ionescu // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of
Page: Site Framework
These pages provide the components for the overall layout of WARNING: Do not edit casually.
Page: Site Index
An alphabetical listing of all pages in the Wiki. {index:SpaceIndex}{index}
Page: Slicing
A slicing operation is a simple way to extract a range of elements from a container. The boo compiler supports native slicing operations on lists, arrays and strings. Support for user defined slicing operations is planned but currently not implemented. Ge
Page: Source
Web Access provides a web interface for browsing the source code currently in GIT. Anonymous Git Access The code of the project can be checked out by anyone through anonymous git server access with
Page: SQLite Database
SQLite is a small database engine that has become very popular. The database is stored as a local file, and you can embed the SQLite engine with your app using one of the libraries below. Here are three different libraries you can u
Page: Still Need Help
Have a question about Boo, but can't find the answer anywhere on the website? Don't worry, we've got a very friendly community waiting for you at the Boo Newsgroups Before you post any Boo specific questions, it mig
Page: String Interpolation
String interpolation allows you to insert the value of almost any valid boo expression inside a string by quoting the expression with $(). The parentheses are unnecessary if the expression is just a variable: now = "IMPORTANT" print("Tomorrow will be $now
Page: String Operations
String Formatting See String Interpolation. Here's a quick example: firstname = "First" lastname = "Last" print "Your name is $firstname $lastname." print "Now is $(date.Now)." ToString() method To convert a class or a type to a string, call the ToString(
Page: String Recipes
Helpful recipes for string manipulation in boo.
Page: Structure of a Boo Script
Boo scripts have a set structure you need to follow to avoid errors when compiling. All of the items are optional, but order of the items is not: The structure is like: module docstring namespace declaration import statements module members: class/enum/de
Page: Syntactic Macros
by Toby Miller Syntactic macros allow new language constructs to be created.  See Macros for a list of existing ones in boo. We could, for example, mimic VisualBasic's with statement. Given the following code: fooInstanceWithReallyLongName = Foo() fooInst


Page: timeIt
The timeBlock macro times how long it takes to execute a block of code. See the Boo benchmarks page for examples using this macro. The original JIRA issue has the C# source for this macro. It has been converted to t
Page: TimerMacro
The timer macro times how long it takes to execute a block of code. See the Boo benchmarks page for examples using this macro. The original JIRA issue has the C# source for this macro. It has been converted to the b
Page: TransformCallableDefinitions
Scans the AST for callable definitions and converts them to class definitions which inherit from System.MulticastDelegate, and adds the definition of the Invoke and BeginInvoke methods. These are later filled in by the CLR. That is, if the code before the
Page: Treat Parameter as Sequence
Sometimes you may want to handle one or more items passed to a method. Usually method overloading to handle each specific case is sufficient. But here is an example for treating a parameter as a sequence of items, even if only one item was passed . import
Page: Triple Quoted Strings
Triple quoted strings in Boo are used to preserve spacing and linebreaks without a thick slathering of \n's all over your precious code. It is good for visually representing XML, for instance: xml = """ <xml> <randomElement> </randomElement> </xml> """ It
Page: Tutorials
Here are some tutorials and other introductions to using boo: Tutorials on this site The boo manifesto (pdf) by its creator, Rodrigo B. de Oliveira The boo Language Guide - list of pages covering stuff not yet cove
Page: Type Inference
Boo is a statically typed language. Static typing is about the ability to type check a program for type correctness. Static typing is about being able to deliver better runtime performance. Static typing is not about putting the burden of declaring types
Page: Type System
You should explore the rest of the Boo Compiler so this is more understandable, especially the Compiler Steps, the Abstract Syntax Tree structures, and the Boo Parser. Say you have a line of code like: m = x.something() What is m? What is x? What does som


Page: Unit Testing and You, a guide
Unit tests are a way of ensuring the "correctness" of a program's behavior along side making sure that particular chunks of the program do not "regress" and cease functioning as expected. In a complex application where many functions depend on the bug-fre
Page: Useful things about Boo
Boo.Lang.Useful - an assembly rife with things beautiful and useful yet not quite core to the Boo language. Welcome to this introductory guide, where we will plumb its murky depths in search of adventure on the high seas and delicious pirate treasures. Wh
Page: User-defined value types aka structs
Value types in boo are like value types in C# and include int, double, and other basic types. User-defined value types can be created in boo by defining a struct or inheriting from System.ValueType. Value types are constructed on the stack rather than the
Page: Users
Page: Using IronPython From Boo
If you are more familiar with the python standard classes and objects, such as strings and dictionaries, you can use them via IronPython. In your boo project, add a reference to the IronPython.dll included with IronPython, and then you can use code like t



Page: Wanted Pages
Some pages that might be nice to have, based on questions seen on the list and irc. It seems like a lot of times there are good examples in the test/testcases/integration/ folder. We just need
Page: without duck typing
import System.Threading import System.Reflection def CreateInstance(progid): type = System.Type.GetTypeFromProgID(progid) return type() def SetProperty(target, name, value): target.GetType().InvokeMember(name, BindingFlags.SetProperty, null, target, (valu
Page: Working with Files
Here are some samples of working with files in boo and .NET/Mono. import System.IO import System.Reflection testfile = "newtestfile.txt" try: if File.Exists(testfile): File.Delete(testfile) //"using" will dispose of (and close) the file stream for you usi
Page: Writing Tests
In a project like boo there are a lot of components and areas of functionality that need to be individually tested: the classes in the class library, the parser, the error checking code, the code emitter just to cite a few. The integration among these var
Page: wx.NET Sample
Here is sample boo code for using the wx.NET GUI framework . By Angel Ignacio Colmenares. It requires wx-cc.dll and wx.NET.dll. (Please check the indenting on this code if you run or alter it, it was just copied and pasted fr


Page: XML Serialization
Here is an example based on the Advanced Tutorial, Learning Boo Kung-Fu. Note, you have to compile this to an exe and then run it. It won't work in booi, because types in dynamically generated assemblies can't be serialized apparently. import System.Xml f




  • No labels