Go to Google Groups Home    Boo Programming Language
Boo Examples Week (Boo needs YOU!)

Cedric Vivier <cedr...@neonux.com>

Hey everyone!

Our examples directory needs some love as it lags behind the new
features/syntax
available in more or less recent Boo versions.

As this task is both self-learning and has a low-barrier of entry, it would
be
nice to see the community involved in this effort.

Ideally new examples would all follow a common template header like this
updated
`ifdef.boo` example (much shorter thanks to new features/syntax since it was
originally written):

{code}
"""
Description:
    This example shows how to write a macro that behaves differently
    depending compilation parameters (here the presence of a 'BOO' define
symbol)

    Code below will display "Yeah! BOO is defined!" only if compiled with
    a BOO define symbol (e.g through `booc -d:BOO ifdef.boo`)

Exercise:
    Allow `ifdef BOO` instead of `ifdef "BOO"`
    (hint: ReferenceExpression)
"""
import Boo.Lang.PatternMatching

macro ifdef(symbol as string):
    if Context.Parameters.Defines.ContainsKey(symbol):
        yield

print "Is BOO defined?"
ifdef "BOO":
    print "Yeah! BOO is defined!"
{code}

A short `Description:` about the example would be required, `Exercise:`
would be
nice to have the more often the better.

I suggest we remove the big/noisy copyright header that does not really make
sense for (such simple) examples imo.
Adding an `Author: FirstName Name <email>` on the first line is acceptable
though.

Let's use this thread to post (both inline _and_ attached) updated (or new)
examples
featuring what Boo can do - nowadays.

We'll see how the thread went next Saturday (14th Feb. - Valentine day -
hence why
you'd better show your love to Boo! ;-) ) .. and then later merge back the -
hopefully numerous -
updated/new examples back in the repository.

Cheers,

  ifdef.boo
< 1K Download