I am making available my boo presentation source code and slide deck in case anyone would like to take a look at it. It has many examples of the various features of boo. The way the presentation starts out is by quickly running through the boo slides and answering any preliminary questions as they come up then by going project by project down the list in the solution.
Tag: Boo2
Specter – A Specification DSL for Boo
Specification frameworks are a great way to enable a smooth approach to test driven development. A nice and simple specification framework called Specter has been created specifically for Boo, which includes a simple and elegant internal Specification DSL. If you’re curious to learn about specification frameworks, Boo or DSLs you should check out Specter for an elegant and useful example of all 3.
Here is a really great video of the step-by-step process:
Space Ship Operator
This is a pretty neat idea:
http://blogs.msdn.com/abhinaba/archive/2005/10/11/479537.aspx
This gist of the post is that instead of overloading <, <=, ==, !=, >= and > operators you can just overload an <=> operator which will behave similar to what you would do to implement IComparable and the compiler will take care of the rest.
Of course this isn’t implemented in C# or VB currently but it is in Boo!
Boo Shirts
I think I am going to order some boo shirts, I want one for myself and I’ll probably give a few away at my upcoming boo presentations so I’ll order in bulk. Here’s the shirt:
If anyone wants one let me know because I can get them a little bit cheaper since there is a discount for bulk ordering. Send me an email directly with the following information:
- Your name
- Your mailing address
- Shirt size
We’ll work out payments be it through pay pal or some-other means. The price of the shirt will be exactly what I paid to have them made plus shipping. The more people who want one the cheaper they will be. If you’re willing to pay for international shipping than I’m willing to send it!
[EDIT] The cafe press widget I was linking to was broken so I just swapped it out with a picture of the actual shirt. See representing boo for more. I can still order more if you want.
Creating Attribute Macros in Boo
|
namespace MacroExample
import System
import Macros
class Example:
[Ensure(example)]
def DoSomething(example as string):
print example.ToUpper()
e = Example()
e.DoSomething(“testing!”)
e.DoSomething(null)
print “Press any key to continue . . . “
Console.ReadKey(true)
|
|
namespace Macros
import System
import Boo.Lang.Compiler.Ast
[AttributeUsage(AttributeTargets.Method)]
class EnsureAttribute(Boo.Lang.Compiler.AbstractAstAttribute):
private _parameter as ReferenceExpression
public Parameter as ReferenceExpression:
get:
return _parameter
def constructor(parameter as ReferenceExpression):
_parameter = parameter
override def Apply(node as Node):
target = cast(Boo.Lang.Compiler.Ast.Method, node)
parameter as ParameterDeclaration
for p in target.Parameters:
if p.Name == _parameter.Name:
parameter = p
break
code = [|
if $(parameter) is null:
raise ArgumentNullException($(parameter.Name))
|]
target.Body.Insert(0, code)
|

You must be logged in to post a comment.