| |
Boo Programming Language |
Hey everyone! Our examples directory needs some love as it lags behind the new As this task is both self-learning and has a low-barrier of entry, it would Ideally new examples would all follow a common template header like this {code} Code below will display "Yeah! BOO is defined!" only if compiled with Exercise: macro ifdef(symbol as string): print "Is BOO defined?" A short `Description:` about the example would be required, `Exercise:` I suggest we remove the big/noisy copyright header that does not really make Let's use this thread to post (both inline _and_ attached) updated (or new) We'll see how the thread went next Saturday (14th Feb. - Valentine day - Cheers,
features/syntax
available in more or less recent Boo versions.
be
nice to see the community involved in this effort.
updated
`ifdef.boo` example (much shorter thanks to new features/syntax since it was
originally written):
"""
Description:
This example shows how to write a macro that behaves differently
depending compilation parameters (here the presence of a 'BOO' define
symbol)
a BOO define symbol (e.g through `booc -d:BOO ifdef.boo`)
Allow `ifdef BOO` instead of `ifdef "BOO"`
(hint: ReferenceExpression)
"""
import Boo.Lang.PatternMatching
if Context.Parameters.Defines.ContainsKey(symbol):
yield
ifdef "BOO":
print "Yeah! BOO is defined!"
{code}
would be
nice to have the more often the better.
sense for (such simple) examples imo.
Adding an `Author: FirstName Name <email>` on the first line is acceptable
though.
examples
featuring what Boo can do - nowadays.
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.
|
|
ifdef.boo < 1K Download |