Daniel Berger | 1 Jul 01:07 2006

Re: [ANN] mkrf 0.1.0 released

Kevin Clark wrote:
> I'm pleased to announce that tonight marks the first release of mkrf,
> a library which generates Rakefiles to build C extensions to Ruby and
> is aimed at a replacement for mkmf. This is a Ruby Summer of Code
> project (http://code.google.com/soc/ruby/about.html).
> 
> Though the gem doesn't seem to have propogated yet, it should be
> availble through rubygems, and until then you can download the gem
> directly at http://rubyforge.org/frs/download.php/11283/mkrf-0.1.0.gem
> 
> The code does have RDoc included which I hope explains things well
> enough. Please do send questions and bug reports my way. I'll have a
> project setup at advisr.org where you can submit bug reports as soon
> as I tweak its source to properly scope accounts, but until then email
> is fine.
> 
> **Please do try mkrf with your extensions. Please do send feedback.**
> 
> As for syntax, it can be as simple as:
> 
>  Mkrf::Generator.new('libtrivial_so.bundle')
> 
> or more complex:
> 
>  Mkrf::Generator.new('libxml_so.bundle', '*.c') do |g|
>    g.include_library('socket','socket')
>    g.include_header('libxml/xmlversion.h',
>                     '/opt/include/libxml2',
>                     '/usr/local/include/libxml2',
>                     '/usr/include/libxml2')
(Continue reading)

Matthew Moss | 1 Jul 01:19 2006
Picon

Re: Order of precedence

> Just checking
>
> if I have
>
> a = a - b*c
>
> b*c gets calculated first then that result is subtracted from a ?
> In other words, parantheses, in Ruby, is not necessary to make that
> calculation ?

Table of ruby operators and their precedence:
http://phrogz.net/ProgrammingRuby/language.html#table_18.4

Brian Moelk | 1 Jul 01:28 2006

Re: Time To Pick the Mongrel BUGS Mascot!

Zed Shaw wrote:
> Pick the dog you think best represents a lovable but defective pooch and
> reply to this with your +1.

+1 Tator Tot

She looks mischievous but not as repulsive as some of the others.
Besides a girl dog with a faux-hawk rules. ;)

-Brian

Berger, Daniel | 1 Jul 02:15 2006

Re: Reflection brakes encapsulation

<stuff that should be up here snipped>

> -----Original Message-----
> From: David Pollak [mailto:pollak <at> gmail.com] 
> Sent: Friday, June 30, 2006 11:57 AM
> To: ruby-talk ML
> Subject: Re: Reflection brakes encapsulation
> 
> 
> The same reflection issues are present in Java and C#.  I 
> know of no language and/or runtime that completely enforces 
> protection of private methods.

Besides, how would we test our private methods if we couldn't break the
rules. :)

- Dan

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Dark Ambient | 1 Jul 02:26 2006
Picon

Re: Order of precedence

wow, while I've been using irb for some things, I am now a true believer.

I have been struggling to understand a calculation in some code .
Checking the calc in my head.

It made me forget an important Ruby and probably all programming languages rule.

Here is the code:

left = 22
write = left/10  # I'm was thinking should return 2.2, but no it
returns just 2 (no modulus)
left = left - write*10 # based on the wrong head calculation above it
was not allowing me to
                            # what this value truly is.

Well, lesson learned.

Stuart

On 6/30/06, Austin Ziegler <halostatue <at> gmail.com> wrote:
> On 6/30/06, Dark Ambient <sambient <at> gmail.com> wrote:
> > Just checking
> >
> > if I have
> >
> > a = a - b*c
> >
> > b*c gets calculated first then that result is subtracted from a ?
> > In other words, parantheses, in Ruby, is not necessary to make that
(Continue reading)

Matt Sullivan | 1 Jul 02:26 2006
Picon

Re: Order of precedence


----- Original Message ----
From: ara.t.howard <at> noaa.gov
To: ruby-talk ML <ruby-talk <at> ruby-lang.org>
Sent: Friday, June 30, 2006 3:23:35 PM
Subject: Re: Order of precedence

On Sat, 1 Jul 2006, Dark Ambient wrote:

> Just checking
>
> if I have
>
> a = a - b*c
>
> b*c gets calculated first then that result is subtracted from a ?
> In other words, parantheses, in Ruby, is not necessary to make that
> calculation ?
>
> TIA
> Stuart

My Dear Aunt Sally

1 - multiply
2 - divide
3 - add
4 - substract

regards.
(Continue reading)

John Baylor | 1 Jul 02:27 2006
Picon

Re: [QUIZ] C-Style Ints (#85) - not a spoiler, a test harness

Given the number of edge conditions for this quiz it seemed like a good
place for a test harness.  Here is the irb session in the quiz translated to
a test harness.  It is my first use of the test framework so hopefully I
haven't made any horrible errors.  Just put this in the file quiz85.rb and
then use "ruby quiz85.rb" to test for correctness (it works better from the
command line than from irb - I don't know why but someone here does).  Have
fun!

# test harness for ruby quiz 85
# see it at:
# http://www.rubyquiz.com/quiz85.html

require 'test/unit'
require 'UnsignedFixedWidthInt.rb'
require 'SignedFixedWidthInt.rb'

class TestUnsignedFixedWidthInt < Test::Unit::TestCase
  def test_quiz_example_unsigned
    n = UnsignedFixedWidthInt.new(0xFF, 8)
    assert_equal( n, 255 )
    n += 2
    assert_equal( n, 1 )
    n = n << 1
    assert_equal( n, 2 )
    n = n >> 1
    assert_equal( n, 1 )
    assert_equal( ~n, 254 )
    n += 12
    assert_equal( n, 13 )
    n = n & 0x0E
(Continue reading)

Nicholas Seckar | 1 Jul 02:27 2006
Picon

Re: Order of precedence

On 6/30/06, Rob Biedenharn <Rob <at> agileconsultingllc.com> wrote:
>
>
> >> a = %w(h t h h h t t t h h t h)
> => ["h", "t", "h", "h", "h", "t", "t", "t", "h", "h", "t", "h"]
> >> b = [ "h" ]
> => ["h"]
> >> c = 7
> => 7
> >> a = a - b*c
> => ["t", "t", "t", "t", "t"]

Keep in mind that Array#- does setlike operations:

[:h] * 1000 - [:h] #=> []

So the number of h's above Just Doesn't Matter.
gene.tani@gmail.com | 1 Jul 02:34 2006
Picon

Re: Where to find Ruby code idiom, is there a style guideline


Alexandru Popescu wrote:
> For me The Ruby Way represented this idion introduction. And afaik a
> 2nd version is in preparings.
> 

and Ruby Cookbook
http://www.oreilly.com/catalog/rubyckbk

gene.tani@gmail.com | 1 Jul 02:50 2006
Picon

Re: Reflection brakes encapsulation


Valentin Samareanu wrote:
> Ok. I'll take it as it is and try to do nice and unharmful thinks with it.
>

Ruby 1.9 doesn't radically change the model, e.g.

http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l18


Gmane