Labrador-0.0.1 pre alpha released

Hi list

the very diligent folks from RubyForge have approved my request early
so I can thankfully pronounce the first release of Labrador.

Strange name for a strange package :slight_smile: Here you go:

Labrador is a little bit like me, badly organized.
It is a quite unrelated collection of Ruby Code.
Maybe some day it will evolve into independant packages, maybe it will
not.

Right, what can Labrador do for you?

Propeties

First there is labrador/properties allowing to define properties
without instance variables
by means of closures. Check out the rdoc to learn more about it but a
very quick overview.

The technique I use comes from Tom Christiansans famous TOT, Tom’s
Object Tutorial.

  • Safe, nobody will change your const property there is just no way.
  • Instance variable safe subclassing, as long as you carefully check
    your properties
    in your inheritance chain and define your properties accordingly you
    can use
    instance variables internally without any danger of interference.
    Instance variable free classes are thus ideal for frameworks.
  • The approach allows for interesting enhancements like e.g.
    synchronisation mechanisms
    by properties, changing property traits dynamically and many more.
  • Slow, benchmarks show consistently that property access is about 4
    times slower than
    Instance variable accessors.
  • Complicated, although the complexity of the implementation is
    perfectly hidden enhancements
    can become difficult and might impose some more performance penalty.
    A very extensive test
    suit - provided as far as I know - is necessary.

Labrador Enums

Very condense enumerator notation for lazy people. Special Style I
want to share with
those who are interested.

labrador/enum/map is released
labrador/enum/reject is under development.

assert_equal %w{ b c d }, %w{ a b c }.map(:succ)
assert_equal %w{ b c d }, %w{ a b c }.map.succ

assert_equal [*2…4], Set.new( [*0…2] ).map(:+, 2).sort

Look into test/test-map.rb for more examples.

Enjoy
Robert

http://rubyforge.org/projects/labrador/
this might be useful :wink:

Robert