[Mono-list] ANN: Boo 0.9 is here!

Rodrigo B. de Oliveira rodrigobamboo at gmail.com
Tue Jan 27 09:35:11 EST 2009


Also known as the best boo programming language release ever its chief
weapons are:

* Generator macros [BOO-1077] - macros are no longer limited to
returning a single statement or block and instead are able to yield an
indefinite number of nodes:

	macro printLines:
		for arg in printLines.Arguments:
			yield [| System.Console.WriteLine($arg) |]

	printLines "silly", "silly", "silly"

* Nestable macros [BOO-1120] - macro definitions can be nested to
allow for context sensitive keywords:

	macro given:
		macro when:
			yield [| print "given.when" |]

		yield

	macro alert:
		macro when:
			yield [| print "alert.when" |]
		yield

	given:
		when // given.when

	alert:
		when // alert.when

* Type member macros [BOO-415] - macros can be used in class definition bodies:

	macro ThreadStatic:
		case [| ThreadStatic $name as $type |]:
			yield [|
				[System.ThreadStatic] static $name as $type
			|]

	class Environments:
		private ThreadStatic _current as Environment

* Pattern matching [BOO-1106] - simple but powerful object pattern
matching with the match/case/otherwise macros:

   import Boo.Lang.PatternMatching

	def Eval(e as Expression) as int:
		match e:
			case Const(Value):
				return Value

			case InfixExpression(Operator: "+", Left, Right):
				return Eval(Left) + Eval(Right)

			case InfixExpression(Operator: "-", Left, Right):
				return Eval(left) + Eval(Right)

* Support for generic extension methods [BOO-937] - LINQ style
extension methods:

	import System.Linq.Enumerable from System.Core

	[Extension]
	def MakeString[of T](source as T*):
		return join(source, ", ")

	evenDoubles = range(10).Where({ i as int | i % 2 == 0 }).Select({ i
as int | i * 2 })
	print evenDoubles.MakeString()

* Generic parameter constraints [BOO-935] and Generic parameter type
inference [BOO-1102]:

	def Using[of T(System.IDisposable)](value as T, block as System.Action[of T]):
		try:
			block(value)
		ensure:
			value.Dispose()

	Using(System.IO.File.OpenText("TFM.TXT"), { reader | print reader.ReadLine() })

* Strict mode [BOO-1115] - strict mode changes a few compiler rules:
default visibility for members is private, method parameter types and
return types must be explicitly declared among other things

* Asymmetric property accessor visibility [BOO-1094]

	class Song:
		Name as string:
			public get:
				return _name
			internal set:
				_name = value
		...

* String interpolation formatting (eg. "${val:x4}") [BOO-1006] - .net
formatting specifiers can now be used together with string
interpolation:

	def ToHex(n as int):
		return "0x${n:x4}"

	print ToHex(42)

* Support for SilverLight profile [BOO-1117] - and Vladimir Lazunin
kicked it off with Tetris.

This release is brought to you by Avishay Lavie, Cedric Vivier, Daniel
Grunwald, Marcus Griep and yours truly.

Full change log is here [http://tinyurl.com/by32ep].

Download it from here
[http://dist.codehaus.org/boo/distributions/?C=M;O=D] and have fun!


More information about the Mono-list mailing list