Hacker News new | past | comments | ask | show | jobs | submit | SamReidHughes_'s comments login

What he should and shouldn't do is for him and his employer to decide, not you.


You don't find it ironic that you are now telling me what I should and should not do?


C++ requires that all overloaded versions exist at compile time; Haskell allows them to exist at runtime. For example, in Haskell you can make a datatype like

    data Foo a = Blah a | Bar (Foo [a])
and you'll have no trouble making a function "showFoo :: Show a => Foo a -> String" using straightforward programming. If you try to do that in C++ you'll get infinite template recursion.

Also, C++ templates don't restrict you to match the right type signatures, the way Haskell typeclasses do.

But other than that, they are pretty much the same kind of thing and are used in the same way.


You've mixed together a lot of stuff here. your Foo data type is recursive. I can achieve something similar in C++ without infinite template recursion, but I have to use pointers to do it. (Your Haskell has pointers too, they're just hidden from you.) Also there is nothing 'runtime' about the example you've got here. I can do the same thing with a tagged-union type in C/C++ and a switch statement, which is what your Haskell compiles down to. Maybe you were thinking of existential types? http://en.wikibooks.org/wiki/Haskell/Existentially_quantifie... . That's something C++ can't do.

---------

Edit: nm I see what you did there with the Foo a = ... | Blah (Foo [a]). That would probably break C++.


No, both of those are bad monkey-patching.

There is no reason for that function to be defined as a method in Array.


Well, admittedly, that should probably be a mixin, I just grabbed the first thing I saw.

I don't see why it's so bad though - it's not like it's overriding anything.


The problem is that you throw this in your module, and then someone else defines another Array#to_sentence (say in some Natural Language module you require) and all of a sudden you've got hell on earth.

For more information, take a look at some of the discussion about Array#sum: http://github.com/raganwald/homoiconic/blob/master/2009-04-0...


You're actually taking the quote out of context. Getting a C in an art class is different from getting a C in macroeconomics. "Everything" doesn't refer to, say, athletic ability, I'm sure. There's some limitation to the set of abilities involved, centered around mental abilities, and art skills might be outside that limit, in the quotee's mind.

I mean, it's really easy to imagine a "good student" branching out, taking an art class, and getting a C, but it's hard to imagine a "good student" branching out, trying macroeconomics, and struggling.


I certainly can imagine a curious student taking macroeconomics and get so utterly bored and annoyed that he gets a C. In my case the course was "Entrepreneurship" and while the course itself was (mostly) interesting and inspiring, the test at the end was stupid and I recieved a C (well, something equivalent in Germany).

Now i'm thinking whether look for a job is the right way or whether I should rather look for a cofounder.


However, it's also easy to imagine someone taking a class and discovering he simply wasn't interested in it (or thought it was complete bull), only finishing the class to get the credit. It is silly to judge people by an occasional C amidst A's.


Yes, but then he wouldn't be a "good student."


There is no correlation with 'powerful' and it's only natural that elegant languages are easier to implement.


Which version of C# are you thinking of?

In C# 3, the verbosity level is much less than in C# 2, where it's slightly less than C# 1.

I don't see where Ruby syntax is particularly more concise than C# 3's.

Well, let me clarify "particularly". I don't find myself feeling like I'm suffering under C#'s syntax, relative to Haskell's. It has about the same amount of syntactic overhead: writing types for method parameters, and when defining data structures. Occasionally I have to explicitly write a type parameter to a function.


"I don't see where Ruby syntax is particularly more concise than C# 3's."

1.upto(10).each{|x| print x}

I'm curious - how would you print 1 through 10 in C# 3 by comparison?


C# 3:

  (1).UpTo(10).ForEach(x => Console.WriteLine(x));
Of course, "UpTo" requires first extending int, which is trivial:

  public static class IntExtensions {
      public static List<int> UpTo(this int start, int end) {
          var range = new List<int>();
          for(int i = start; i < end; i++) {
              range.Add(i);
          }
          return range;
      }
  }


That's cool and all, but I think being able to do this natively in Ruby wins:

  p *1..10
Edit: you may need to do a "require 'pp'" first.


One way to do this in Scala:

  def print[T] (value:T) = System.out.println(value)
  1.until(10).foreach(x => print x)
This is a fairly uninteresting example, however. Something more interesting would be, for instance, the use of structural types to implement type-checked duck typing.

Scala example:

  // Declare a structural type for any class implementing close()
  type Closable = {def close(): Any}
  
  // Executes the provided function with the given
  // closable generator, creating a new instance which
  // will then be closed on completion. The provided
  // function's value will be returned.
  def withClosable[T, C <: Closable] (c: => C) (f: (C) => T) = {
    val closable = c
    try {
      f(closable)
    } finally {
      closable.close
    }
  }
  
  // Example usage
  def usage = {
    val updated = withClosable(db.openConnection) { conn =>
      conn.update("INSERT INTO example VALUES (...")
    }
    System.out.println("Rows updated: " + updated)
  }
This could be compared with Python's new 'with' syntax.


Since there's plenty of shitting on Scala going on, I'd like to point out that the Scala equivalent of that is:

    1 to 10 foreach println
Which seems more concise than the equivalent Ruby to me. Feh.


I still find this clearer:

  for x in range(1, 10): print x


I'm nitpicking, but your range should be range(1,11).


Every nit picked is valuable :)


Not so different in Ruby:

for x in 1..10; print x end


Yes, but we all know that Ruby is the haven of Devils!!


Ad hominem.


Ad...lingua?


in Python:

    for i in range(1,11): print i
Python FTW? ;)


Flagging might need 51, but downvoting needs more. I don't know how much.


I'm not totally sure how accurate this is anyway. I think the administrators increase karma thresholds sometimes to account for karma inflation.


> Requiring a degree in CS, SE, or EE (I don't see the point of requiring a degree if it's not directly related to the field) does exactly this.

But it doesn't. There are plenty of people with CS or SE degrees that lack a minimal level of understanding. Even with a terribly lenient definition of minimal.

I'm talking about people who get through 4 years of a decent CS program and would vehemently insist that "array" is an exact synonym for "linked list".

I'd say that the benefit of a CS degree is weaker -- just that it brings forced exposure to important topics, so if you have two people who are smart, the one with a CS degree is going to be more well-rounded. The thing is, you usually don't get to decide between two smart people when hiring. And the CS degrees that are around don't seem to reduce the risk of bugmaking.


Having had a lab partner who in Senior year EE couldn't do even the most basic things, I sympathize with you. But you need to consider what that person knows "as a whole." I've found that if you take the time to talk to graduates who were poor students that they do have a basic understanding of the subject matter, but there are gaps. The gaps tend to be most noticeable when they're really simple things, which I think is the point you're making.

Contrast that with someone who has say, a History degree who happens to be a good programmer. That person's expertise tends to be in one narrowly defined area and when taken outside that range he does badly. I'd rather hire someone who had promise to be reasonably good at anything I threw at him than amazing in one aspect and weak at most everything else.

I don't know where you work, but the people who make it through both our HR screen and the technical phone screen and end up in front of me are generally pretty bright. We normally weed people out for teamwork/communication skills rather than technical ability.


Next time you turn down someone with a History degree that has become a coding expert in a narrowly defined area, please send them to me so we can collaborate on something that rocks in another narrowly defined area.


You're misinterpreting reality with that quote, because labor that produces inherently more valuable goods is inherently more valuable labor than labor which does not. Part of the wealth that goes into the peanuts and book is the extremely valuable labor of finding out who needs what resources.


Probably to simplify the add/remove code and life in general.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: