Better HN
topnewbestaskshowjobs
Log inSign up

yb66

5 karma · joined Apr 27, 2012 (14y ago) · 21 submissions

Submissions

comment 14y ago · link · parent

Neither, I asked a question which you didn't answer and instead decided to respond with ad hominem. Ad hominem is the sign of a lost argument, so either answer the question or remain a loser in this debate.

comment 14y ago · link · parent

> Wanting to protect your children does not excuse censorship.

If we're not using principles to protect people, what are they for?

comment 14y ago · link · parent

Since we're talking about Wikipedia, let me direct you to an article that may be helpful: http://en.wikipedia.org/wiki/Perfect_solution_fallacy

;-)

comment 14y ago · link · parent

Just a reminder of duck typing:

Haskell style => function applied to parameter, e.g f(x) Ruby duck type style => parameter applies function to itself e.g x.f()

An example:

  module Dialable
    def dial
      # do stuff with self
      puts "Dialling..."
    end
  end
  
  # I wouldn't do this, but...
  class String
    include Dialable
  end
  
  # So, phone number as a string can be dialled
  my_phone_number = "01 23 45678"
  my_phone_number.dial
  Dialling...
  
  # I'd rather do this
  class PhoneNumber < String
    include Dialable
  end
  
  my_phone_number = PhoneNumber.new "01 23 45678"
  my_phone_number.dial
  Dialling...
  
  # now you get an error on non phone number strings
  "just a random string".dial
  NoMethodError: undefined method `dial' for "just a random string":String
  
  my_phone_number == "01 23 45678"
  => true
  
  my_phone_number == "just a random string"
  => false

You get all the regex and string functions for free too.