On 03/20/2013 07:25 AM, Axel Friedrich wrote:
> https://github.com/Axel2/fixedpnt.rb
> Allows simulating binary fixed point calculations done in hardware.

A random api suggestion... consider using #[]= as an alias for #assign, 
following this example:

 >> class A; def []=(v); @x = v; end; def []; @x; end; end
=> nil
 >> a = A.new
=> #<A:0x007fdf9c617438>
 >> a[] = 3
=> 3
 >> a[]
=> 3
 >> a
=> #<A:0x007fdf9c617438 @x=3>

You can think of [] as a "dereference operator" for boxed values.

As a bonus, ruby gives these operators some basic assignment semantics:

 >> y = a[] = 4
=> 4
 >> y
=> 4

This works regardless of the actual return value of #[]=.

And:

 >> b = A.new
=> #<A:0x007fdf9c6dee70>
 >> b[] ||= 42
=> 42
 >> b[]
=> 42

The line

   b[] ||= 42

is roughly the same as

   b[] = b[] || 42

and causes a call to #[] followed by #[]=.