Live data from Hacker News

Execution in the Kingdom of Nouns (2006)

steve-yegge.blogspot.de

51–60 of 73 posts

Re: Execution in the Kingdom of Nouns (2006)

#51

Yeah, but you can always have static methods, which let you call a function without creating an object.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

* C: function pointer is a hack. The evidence of this is in the code. Most people don't even know it can be done, and it is rarely done in code(in some central piece no body looks at)

* Pascal: It's been a decade since I last looked at it, but I don't know if procedural type can be passed around.

* Java: Yep, Java doesn't have first class functions. Will give you that. However, in his example, Yegge was talking as if everything in Java has to be a object, and that somehow functions cannot be called without an associated object.

If you think C function pointers are a valid argument, I can provide a similar hack in java

http://pastebin.com/cSJ8ffar

You can call as many methods as you want. It is disturbing to me when people think C is some holy grail. C, at it is best, is conceptually weak. It is great for working with hardware, but for language features, it would be at the bottom of my list to look at.

Re: Execution in the Kingdom of Nouns (2006)

#52

Yeah, but you can always have static methods, which let you call a function without creating an object.

and you can, in principle eat soup with a fork. but in practice you shouldn't.

This, I agree. It is in the spirit of "Beware of the Turing tar pit in which everything is possible but nothing of interest is easy."

Re: Execution in the Kingdom of Nouns (2006)

#53

It's funny that this is so popular, because I think it is probably the single most counterproductive thing written about software ever. Seriously. As far as I can tell, the only point of speaking about the poor oppressed "verbs" is to screw up the thinking of the reader, making the reader feel sorry for them. It seems to have worked in some cases, but is there some other reason for it? But what really annoys me is th…

Is "eat" a noun too now?

What's the subject of the previous sentence?

If we insisted on only using gerunds + "do", English would be a very strange world indeed. I imagine it would sound much like Java often does: "Eating is done by me of a sandwich.". Sometimes even "An eating is done [...]" :)

PS: The author is hardly illiterate. That's plain uncharitable.

Re: Execution in the Kingdom of Nouns (2006)

#54

Too long. An idea could be stated in a few sentences.) Java: This is an instance of an mammal of an animal kingdom which doesn't include dolphins and whales, which has a..., placed within the instance of a class Plain of polymorphic shape which has some private attributes... ML-family: This is a member of a set of only mammals of animal kingdom, excluding dolphins and whales, of small size, which has a..., located on…

Lisp: (sat(mat preposition(article 'cat ('the))))

(sat cat (on mat))

Re: Execution in the Kingdom of Nouns (2006)

#55

Yeah, but you can always have static methods, which let you call a function without creating an object.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

I believe the Java equivalent is something like

  passableF = new NotAClosure() {
    public void execute(int i) {
      return f(i);
    }
  }
But maybe someone knows better than me. I've had thankfully little to do with Java recently.

EDIT: Which I guess defeats the purpose of "without an object", but...

Re: Execution in the Kingdom of Nouns (2006)

#56
post #55

Earlier quoted context omitted.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

I believe the Java equivalent is something like passableF = new NotAClosure() { public void execute(int i) { return f(i); } } But maybe someone knows better than me. I've had thankfully little to do with Java recently. EDIT: Which I guess defeats the purpose of "without an object", but...

[deleted]

Re: Execution in the Kingdom of Nouns (2006)

#57
post #55

Earlier quoted context omitted.

Sure, which you can use the following ways: * C: function pointer * Pascal/Delphi: procedural type * JavaScript: function/expression as r-value (weakly typed) * C#: delegate * Java: er, ah, well, I guess you're screwed, as there is no way to pass that function around to other functions. Maybe in Java version N+1! (or Scala or Groovy) -- that is, a static function is even worse than a "virtual" function, since you can…

I believe the Java equivalent is something like passableF = new NotAClosure() { public void execute(int i) { return f(i); } } But maybe someone knows better than me. I've had thankfully little to do with Java recently. EDIT: Which I guess defeats the purpose of "without an object", but...

Yeah, but you have created an object in doing so, which my parent poster claimed you cannot do without.

Re: Execution in the Kingdom of Nouns (2006)

#58
post #53

It's funny that this is so popular, because I think it is probably the single most counterproductive thing written about software ever. Seriously. As far as I can tell, the only point of speaking about the poor oppressed "verbs" is to screw up the thinking of the reader, making the reader feel sorry for them. It seems to have worked in some cases, but is there some other reason for it? But what really annoys me is th…

Is "eat" a noun too now? What's the subject of the previous sentence? If we insisted on only using gerunds + "do", English would be a very strange world indeed. I imagine it would sound much like Java often does: "Eating is done by me of a sandwich.". Sometimes even "An eating is done [...]" :) PS: The author is hardly illiterate. That's plain uncharitable.

What's the subject of the previous sentence?

"eat". Words used as words are nouns in that context. Like the word "eat". Like the word "word". When something is eaten, someone or something is doing the eating, eat" doesn't eat itself.

I think it's fair to be a bit harsh when the entire essay is based on grade-school level misunderstanding of what nouns and verbs are.

Re: Execution in the Kingdom of Nouns (2006)

#59
post #31

I like first class functions. I get hung up on the trash example in this essay though. To show the commonality of verbs in a person's general understanding Yegge says 'get the garbage bag from under the sink'. WTF (Who the fuck) 'gets' the garbage? I do. 'I' is implied. I get the garbage from under the sink. Or perhaps 'Steve' gets the garbage from under the sink. These are nouns (or pronouns, whatever). If anything,…

> If anything, verbs do nothing without a noun to do them, and nouns need verbs to do anything.

This is only true in natural language. Formal math languages are generally verb-oriented, hence functional languages are verb biased.

> So perhaps we should just acknowledge the value of traits, objects, and functions and move on.

The only thing we (OOP vs. FP fanboys) generally argue about is whether the noun should come first or the verb, which has significant implications in how dispatch is done. It really does determine whether your designs are more naturalistic (noun first) or mathematical (verb first).

Re: Execution in the Kingdom of Nouns (2006)

#60
post #7

The problem with verbs is that they are black boxes. With objects you can subclass and override methods - do stuff like the Universal Design Pattern - basing something on prototypes that you tweak here and there. Functions you can only apply, objects have parts that have names.

You can fake objects and subclassing with closures, in addition to making it trivial to implement the "one method interface" (aka "functor"). http://roboprogs.com/devel/2010.06.html (example using a subset of JavaScript, rather than a language likely to be unfamiliar to most) TODO: edit example someday to get rid of "useless use of local variables" (in place of original formal parameters), fix where I call the outer…

> Of course, it's easier to work with both real objects AND real functions/closures/lambdas -- I can use a hammer and a screwdriver :-)

But do you hit your screwdriver with the hammer, or do you twist your hammer with the screwdriver? This can be a real problem if one programs in Scala.

Post reply on HN