Slashdot Mirror


User: LatinRoots

LatinRoots's activity in the archive.

Stories
0
Comments
1
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 1

  1. Re:Perl vs. Ruby: sigils on What's the Secret Sauce in Ruby on Rails? · · Score: 1

    I have no problems with a sigil giving both the interpreter and myself scope information, and since Ruby is a very dynamic language without any sort of variable declarations I don't see how else the interpreter could determine scope, but if you never want to see the @ sign again, here you go...

    class Klass Object
        # create instance variables @num1 & @num2,
        # instance accessors Klass#num1 & Klass#num2,
        # and instance mutators Klass#num1= & Klass#num2=
        attr_accessor :num1, :num2

        def add_nums
            var1 + var2 # note, these are method calls
        end
    end