Hacker News new | ask | show | jobs
by claystu 4242 days ago
What weaknesses of Pascal are being repeated in Go?
1 comments

There is no escape. The language thinks it knows better than you. The standard library is allowed to do things that your code isn't.
Like what? The standard library is no more special, other than where it resides in the filesystem. You can write C and assembly code as well and link it to your Go code. And I'm not talking about cgo, I mean [568][ac], the Plan 9 C compiler and assembler that come with Go.
> Like what?

Maps, slices, the pre-defined functions.

More powerful languages make no big distinction between user defined types and the language provided ones.

I was thinking most obviously of generics. The go standard library is full of generic collections, but you're not allowed to use generics in your own code.
It looks like free pascal has generics: http://www.freepascal.org/docs-html/ref/refch8.html#refse46....

But to your larger point, doesn't any non-programmable programming language exhibit the same weakness to some extent?

Any language will have some "magic" things that are special-cased in the compiler - things like the basic integer datatypes, or the threading primitives - and probably a few more things that are implemented as C code (though if you're lucky this can be done in a "standard" way, through the language's FFI). But most of the standard library should be implemented in the language itself (look at e.g. the Java standard library, or the Python standard library. In a more coherent language like TCL, even language constructs may be written this way - e.g. "for" or "if" can be just ordinary methods. At the other extreme, PHP has the infamous T_PAAMAYIM_NEKUDOTAYIM, because a simple-seeming piece of syntax had to be special-cased in the parser). If the standard library authors kept feeling the need to step outside the language itself, that's a bad sign - it suggests the language is poorly suited to writing libraries in. But you're right that it's a question of degree rather than a binary thing.
That's not the standard library, though.
Actually, the c compiler just got deleted.

https://groups.google.com/forum/#!topic/golang-codereviews/A...