[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Labrador-0.1 beta release (+ longish Release Note

Robert Dober

8/19/2007 9:38:00 AM

Hi list

I just released my first beta version of Labrador, renamed as
"The Lazy Programmer's Best Friend"
http://rubyforge.org/projects...
Enjoy.

------------------------------------ 8<
--------------------------------------------

#* Labrador, The Lazy Programmer's Best Friend.
#*
#* Distributed under the terms of the BSD License.
#* Copyright (c) 2007 Robert Dober
#* All rights reserved.


Release 0.1
===========

Labrador is a Ruby Extension Library orbiting around two centers of
gravity:
* The Lazy Programmer's Best Friend.
* Interesting Features I want to play with, which are in the
Experimental Package.

The Lazy Programmer's Best Friend tries to make the programmers life
as easy as possible, e.g.
hash.vselect.odd? get a selection of Hash were all values are
odd

or
ary.map.succ get an array with the successor of each original
element

or
ary.select(:>, 0) get only the positive elements of an array

These principles are extended to most enum methods.

Whenever such extensions break Backward Compatibility they are put
into the labrador/bark package to warn the user, that for example
allows you to do very powerfull things with Enumerable#grep and
String#edit.

Right now the features that interest me personally are in the
labrador/exp package which is experimental and might change or go
away. If mature and useful they might move into labrador/concepts
or something similar.

In this release there is only exp/ppp a primitive and slow,
but powerfull Prototype extension as described here:
http://ruby-smalltalk.blo...2007/08/and-this-week-prototypes-concl...


Backward Compatible Extensions in labrador/* and labrador/enum/*
----------------------------------------------------------------
* Hash unification Hash#hmap, returning a hash, #kmap and #vmap
returning a hash and changing keys/values only.
* Hash#hselect as select but returning a Hash.
* Hash#reject with Magic Dot and Symbol Send Semantics
* Hash#hgrep/vgrep/kgrep returning hashes and filtering on blocks
too
* String#edit a scan on stereoids allowing to
change the matched parts of the string.
e.g. s.edit(/\$(\w+)/){ |name| ENV[name] || true }
For shell variable substitution in a string.
* Operator form for Enumerable#inject
e.g. (1..100).inject(:+) --> 5050
* Introduction of the bark package, braking backward
compatibility.
* String#map as shortcut for #split(//).map(...).join
* True ( True === x --> true )
* False ( False === x --> false )
* Integer#even?, Integer#odd?, Integer#succ(n), Integer#pred(n)
* Enumerable/Array#imap/#ireject added, the block is instance evalled
on each element
* Hash operators +, & and - implemented symetrically to Array#+/&/-

Bark, the bark package introduces Backward Incompatibilities in
labrador/bark/*
---------------------------------------------------------------
* Putting Enumerable#grep on Steroids.
* Hash#grep reimplemented as to the above rules, but still
returning an Array.
* Hash#hgrep/vgrep/kgrep reimplemented (only difference to the
non-barking version is the usage of #__grep__ instead of #===)
It can grep on blocks and it does not use #===, anymore when
used in the parameter form, it uses #__grep__ instead.
#__grep__ is aliased to #=== for backward compatible default behavior.
* Sting#each as a shortcut to split(//).each
* String#grep as a shortcut to split(//).grep(...).join
* Symbols become comparable via to_s [:b,:a,:c].sort works!!!

experimental, features I am not sure about to be tested, they might
go away or change
-------------------------------------------------------------------
PPP (Prototype Programming Paradigm ) with a sample application,
open-proto.
I have (small)talekd about that a lot here:
http://ruby-smalltalk.blo...

Experimental features that might change or go away in labrador/exp/*
--------------------------------------------------------------------

Release 0.0.1
=============
* Map Magic Dot and Symbol to Method Call Delegation
for Enumerable/Array#map and Enumerable/Array#reject
e.g. map.succ, map(:+, 2)
- Creation of EmptyObject, EmptyProxy < EmptyObject and
Dispatcher < EmptyProxy
- Object#itself (def itself; self end)


--
I'm an atheist and that's it. I believe there's nothing we can know
except that we should be kind to each other and do what we can for
other people.
-- Katharine Hepburn