October 2004
[ bamboo ] 03:16, Friday, 29 October 2004

After tweaking the EmitAssembly.EmitDebugInfo code a little I was able to get the debugger running.

Not for me but I know some people that just can't live without decent debugging capabilities... Now they can try boo and debug away.

Here's a shot of examples/fibonacci.boo being debugged:

[ bamboo ] 21:32, Sunday, 10 October 2004

The source code is here

[ bamboo ] 00:42, Friday, 8 October 2004
[ bamboo ] 20:49, Wednesday, 6 October 2004
$ booi extras/booish/booish.boo
>>> e = i*2 for i in range(3)
>>> print(join(e))
0 2 4
>>> a = 2**4
>>> print(a)
16
>>> ^Z
[ bamboo ] 16:37, Wednesday, 6 October 2004

Interactive language shells are cool. If you don't agree go read something else.

An interactive boo shell is probably the number one request I receive and finally the good news is that yesterday as I was leaving the elevator I had this very clear vision on how I could implement it. The great news is that it won't be too hard. In fact, if you compile boo from the subversion repository you can already take a look at the initial design of the InteractiveInterpreter class in the src/booish directory.

Sample code? ok. Here it goes:

interpreter = InteractiveInterpreter()
interpreter.SetValue("name", "boo")
interpreter.SetValue("age", 3)

interpreter.Eval("""
print(name)
print(age)
age += 1
""")

assert 4 == interpreter.GetValue("age")

interpreter.Eval("age = 42")
assert 42 == interpreter.GetValue("age")

interpreter.Eval("""
value = 3
print(value*2)
""")

assert 3 == interpreter.GetValue("value")

interpreter.Eval("x2 = { return value }")

x2 as callable = interpreter.GetValue("x2")
assert 3 == x2()

cool, eh?
Maybe you'll start using boo now, hammett? ;-)

[ bamboo ] 17:39, Tuesday, 5 October 2004

Webdesigning me? Nah... Just the old javascript/CSS/XHTML reality check every now and then.

So here it goes to Leonardo:

   1:<html>
   2:<head>
   3:<style>
   4:.body
   5:{
   6:    font-family: verdana;
   7:    font-size: 10pt;
   8:}
   9:
  10:.menuItem, .menuItemHover
  11:{    
  12:    background-color: blue;
  13:    font-weight: bold;
  14:    padding: 5px;
  15:    color: white;
  16:    display: inline;
  17:    cursor: pointer;
  18:}
  19:
  20:.menuItemHover
  21:{
  22:    background-color: lightblue;
  23:}
  24:</style>
  25:
  26:<script language="javascript">
  27:document.onmouseover = function(ev)
  28:{
  29:    var element = getEventTarget(ev);
  30:    if ("menuItem" == element.className)
  31:    {
  32:        element.className = "menuItemHover";
  33:    }
  34:}
  35:
  36:document.onmouseout = function(ev)
  37:{
  38:    var element = getEventTarget(ev);
  39:    if ("menuItemHover" == element.className)
  40:    {
  41:        element.className = "menuItem";
  42:    }
  43:}
  44:
  45:function getEventTarget(ev)
  46:{
  47:    return (ev && ev.target) || window.event.srcElement;
  48:}
  49:
  50:</script>
  51:</head>
  52:<body>
  53:
  54:<div id="menuBar">
  55:<div class="menuItem">
  56:<img src="images/arrow.gif" />
  57:About US
  58:</div>
  59:<div class="menuItem">
  60:<img src="images/arrow.gif" />
  61:Products
  62:</div>
  63:</div>
  64:
  65:
  66:</body>
  67:</html>


The same old few conclusions:
  • CSS has really nice features, how can be people not using it more?
  • tableless html is easier to read, easier to write, easier to change (at least if you are using jedit such as myself)
  • tableless html is easier to relayout (think skins)
so again, why do we still have deeply nested tables everywhere? Dreamweaver?

[ bamboo ] 17:24, Tuesday, 5 October 2004

Tough weekend but I've finally got generator methods to work.

Integrating generator methods with generator expressions with closures was a good challenge... Next! :)

And before I go I shall leave you with this amazing piece of cra... hmm... code:


b = 5
g = def ():
    a = 0
    yield { return a }
    yield { return ++a }
    yield { a = b; return { return (a+b)*i for i in range(3) } }
    assert 5 == a
    
    
for f in g():
    item = f()  
    if item isa callable:
        b = 3
        print(join(cast(callable, item)(), ", "))
    else:
        print(item)
which prints:
0
1
0, 8, 16
Understand why and you'll understand boo's main features.

[ bamboo ] 17:12, Tuesday, 5 October 2004

The Infinite Cat Project.

I'm still deciding on which of my cats will go first...