[ale] Ruby vs C, a non-technical chat
Ed Cashin
ecashin at noserose.net
Thu Aug 6 16:16:58 EDT 2015
On Thu, Aug 6, 2015 at 1:12 PM, leam hall <leamhall at gmail.com> wrote:
> On Thu, Aug 6, 2015 at 12:58 PM, Ed Cashin <ecashin at noserose.net> wrote:
>
>> Responding to, 'With Ruby, I can say "It's on the machines, so I can use
>> it"'...
>>
>> If you write a Ruby script, that script has to be deployed to the target
>> where it will run, so that's one file being added that wasn't on the
>> machines before.
>>
>> If you write a Go program and compile it, you get a statically linked
>> executable (if you are using regular go), which is also one file that has
>> to be deployed to the target where it will run.
>>
>> Either way, you have to add one file that wasn't there to the target
>> machine. So if you don't install the Go build tools on the targets, the
>> distinction isn't significant.
>>
>> This is an advantage Go has over a lot of other compiled languages. It
>> avoids some of the dependency hell that motivated people to adopt Docker
>> and containers. It's kind of ironic.
>>
>
> Ed, sorry if I'm confused. If I compile a Go program and drop it on a
> server without any other Go tools, the program will run? That assumes it's
> not calling anything else, but something like "Hello world!"?
>
Yes, the default normal Go distribution will create a statically compiled,
self-sufficient executable that can run without any special packages,
shared libraries, or other files being on the target.
You can do it in C and C++, too, but it's a little off the beaten path, so
you usually have to install special packages and use special command-line
options.
Interestingly, distros do tend to split the Go cross compilers into
separate packages. Cross compiling Go looks like:
GOOS=windows GOARCH=386 go build hello
... on Linux, giving you a hello.exe that runs fine on Windows 7. But you
have to yum install golang-windows or something first.
--
Ed Cashin <ecashin at noserose.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20150806/752889df/attachment.html>
More information about the Ale
mailing list