Hacker News new | ask | show | jobs
by xdc55 3783 days ago
Javascript leading the way? What are you talking about?

First class functions is a concept from mathematics and many programming languages had this feature way before javascript existed, and I simply don't understand exactly what concept of Go's lexical scoping resembles anything exclusive of javascript.

I don't understand the last paragraphs about methods with data and data with methods, but Go's structs resembles C's structs, binding methods to a struct is an thing I've only seen in Go, but maybe some other programming language had this before.

2 comments

IIRC, the only difference in C++ between a struct and a class is the default visibility, and maybe some other bizarre quirky corner case or two.

Despite it technically not being in the Go lingo (the word "object" only appears once in the entire Go spec, and that's referring to composing arrays/slices together to get multi-dimensional arrays/slices), I generally don't kick myself too hard for referring to things in Go as "objects". They are. Sure, officially they're "structs with methods" (method is the official term), but given the diversity of other things the term "object" is applied to that's plenty close enough for me.

Go's structs resembles C's structs, binding methods to a struct is an thing I've only seen in Go, but maybe some other programming language had this before.

Oberon, probably others:

http://www.excelsior-usa.com/doc/xds/o2rep.html