Eloquently sums up my feelings about the disadvantages of dynamic typing

Jacob Carlborg doob at me.com
Wed Oct 16 12:06:55 PDT 2013


On 2013-10-16 17:37, Sean Kelly wrote:

> I'm reasonably okay with dynamic languages so long as you can require a variable to be declared before it's used.  Those that implicitly declare on first assignment are a nightmare however. I once spent an entire day debugging a Lua app that turned out to be broken because of a typo in an assignment. Never again.

That can be quite annoying in Ruby sometimes:

class Bar
   attr_accessor :foo

   def bar
     puts foo # calls the getter
     foo = "asd" # declares a local variable
     self.foo = "foobar" # calls the setter
     @foo = "barfoo" # bypasses the setter and set the instance variable 
directory
     puts foo # prints the local variable
   end
end

Bar.new.bar

Although I like that instance variables are not required to be declared.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list