News for hackers. Stuff that matters.

arsv

Re:The State of Go on Saturday February 14, 2015 @07:37PM (#9051330)
> After doing your research, you're welcome to submit a magical CL and PR that brings down the binary sizes, then you won't need to argue anymore.

The original link is titled "The State of Go". The first thing I want to know about a state of a new language is whether it works. Then how well it works. Then, maybe, how to fix it and which VCS to use. There is an issue I think is within the range of these two questions, but it is not even mentioned there.

So to make life a bit easier for people who like me expect that issue to be discussed first, I posted a comment summarizing (in my opinion) the state of Go.

My thoughts on how to fix it are hardly relevant to the current state of Go.

> It doesn't print just strings. It can print anything.

The fact it is just a string should be statically (build-time) inferable in a strongly-typed language. Reflection, at least as I understand it, implies run-time type information. So the question does make sense. Yes, I understand why it may be needed for a particular implementation of printf, this is why I called it a lesser issue.

Re:The State of Go on Saturday February 14, 2015 @06:39PM (#9051152)
"not a dynamic executable"

In case you wonder, that's dietlibc which is typically built with no dynamic linking capabilities whatsover.

Re:The State of Go on Saturday February 14, 2015 @06:34PM (#9051136)
> Besides, bickering over the size of hello world is pretty pointless; better to compare the size of programs that actually do something.

It is not about the size of hello world executable, that is just a symptom. A code smell if you like. There is something badly broken in the dead code (or dead data) elimination area. And I hope that code is in fact dead, because if it is not, add code generation to the list of smelly things.

What I suspect I see here is a kind of C++ vtable problem built deep into the language design somewhere. And the reaction is, let's talk about large executables so that it would kinda become not so visible. Or maybe let's take a look at glibc, because glibc is definitely a paragon of clear design befitting a new language.

> fmt.Print does use reflection

There are two problems with this. The lesser one is why does it need reflection to print a string. The bigger one is why do I see about 600 reflect.* entries in the resulting ELF instead of a single one for the string type.

Re:The State of Go on Saturday February 14, 2015 @05:48PM (#9051029)
> A simple C "hello, world" program compiled and linked statically using gcc on Linux is around 750 kB

diet gcc -o hello hello.c; strip hello

2280 bytes on my system.

There are reasons why using glibc results in executables so big, and why it is tolerated (kind of). Those reasons hardly apply to a new language being actively developed. Yet said language produces executables almost twice the size.

"Run-time support and type information", why is it linked into a an executable that never allocates memory and does no introspection of any kind?

Re:The State of Go on Saturday February 14, 2015 @05:36PM (#9051000)
> Where we're at in February 2015

Still producing 1.3M hello world executables.

I wonder if rewriting the linker from C to Go will be primarily rewriting, or maybe they will start fixing it somehow.

Re:Rat Park on Friday February 13, 2015 @02:24AM (#9043285)
They tested the hypothesis that heroin is addictive by itself, the one supported by the self-administration experiment, and got pretty unexpected results. As far as the scientific method is concerned, their experiment looks ok to me.

It's interesting to note that the criticism of the Rat Park experiment uses exactly the same reasoning Rat Park designers used against self-administering experiment, namely that one of seemingly innocuous parts of experimental setup (isolation and genetic variance respectively) was causing a major results bias.

Re:The bell has tolled for rand() on Thursday February 12, 2015 @11:11AM (#9039411)
The title is grossly misleading. It should read "C++17 people choose Boost over std::rand() for their RNG needs" or something like that, a hardly surprising statement since C++17 people would choose Boost for pretty much anything else as well.

In particular, it has little to do with rand() (as in rand(3) from libc), which has its uses as well as well-known alternatives within C world.

As a side note, it's funny to see fresh new C++ code that boils down to srand(readintfrom("/dev/random")), except /dev/random is now given an "abstract standard name" random_device.

And that part about limited seeding options. Beats me Boost (the library) alone won't fit in the memory of a device with 16bit ints, so inability to seed the RNG will be among the least of their problems.