首页 > 其他分享 >how golang build itself?

how golang build itself?

时间:2023-03-02 15:55:55浏览次数:50  
标签:code golang how itself build compiler first

how golang build itself?

https://www.reddit.com/r/golang/comments/vbibey/is_golang_compiler_open_source_from_noob/?sort=confidence

"
The first go compilers were not written in Go.
Once the compiler for go was stable, they used the newest stable version and converted all their compiler's code to go, then they used the newest compiler to compile the next version, so it was compiling itself.
It is called self-bootstrapping. A lot of languages do it. Even Java is written at least somewhat in Java! This is often used as a way to try and prove a language is theoretically turing complete, because it is able to build itself.
The very first compiler for anything would have been written in assembly or machine code. The very first assembler would have been machine code. Once that was out the way you could just reuse stuff.
It is like using a crane to build a crane. Once you have the first crane up you can use it to build more of them.
"

Like lisp, it keeps a theoretically turing complete.

But, in my own view, there are some problems that existed.I took a test for python and golang "hello world"(~0.025s vs ~0.06s in my 12th i5 machine).

If golang keep self-bootstrapping, one day it may be very heavy.

标签:code,golang,how,itself,build,compiler,first
From: https://www.cnblogs.com/qianxinn/p/17172067.html

相关文章

  • golang 生成Sqlserver数据表实体
    最近开始学习golang,公司原来很多项目都Sqlserver数据库的,世面上很多文章,都是关于Mysql的,自己参考了一个博主的文章,整了一个生成Sqlserver实体的小工具分享一下,能给个星......
  • C++ vs golang
    以前学过ruby,gml,lisp这些小众语言的我又开始了golang基本上所以语言,我觉得都应该和C++对比一下C++vsgolangInbrief,golangisalanguagewhichmixesC++,Pyth......
  • golang 判断元素是否在切片中
    在Go中,可以使用类型为 map[T]bool 的映射来判断切片中是否包含某个元素。例如,假设你想要判断整型切片 s 中是否包含元素 x。你可以这样做://声明一个名为m的映......
  • 搬运工:How SAML Authentication Works?
    HowSAMLAuthenticationWorks?(goteleport.com)SAMLTerminologyUnfortunatelybeforegoinganyfurtherwehavetodefinesomeSAML-specificterminology,ofwh......
  • How to play Genshin games on Apple Silicon Mac All In One
    HowtoplayGenshingamesonAppleSiliconMacAllInOne如何在Apple芯片的Mac上玩原神游戏macOS&M1/M2CPU✅macOS&IntelCPU❌PlayCoverRuniOSa......
  • golang 连接clickhouse
    1.驱动:"github.com/ClickHouse/clickhouse-go/v2"2.连接代码:packagemodelimport("database/sql""fmt"_"github.com/ClickHouse/clickhouse-go/v......
  • (转)数据结构和算法(Golang实现)(8.2)基础知识-分治法和递归
    原文:https://juejin.cn/post/6844904132378263565分治法和递归在计算机科学中,分治法是一种很重要的算法。字面上的解释是分而治之,就是把一个复杂的问题分成两个或更多......
  • Golang make和new的区别及实现原理详解
    在Go语言中,有两个比较雷同的内置函数,分别是new和make方法,二者都可以用来分配内存,那他们有什么区别呢?下面我们就从底层来分析一下二者的不同。感兴趣的小伙伴们可以参考......
  • (转)GoLang之标准库strings包
    原文:https://blog.csdn.net/weixin_52690231/article/details/123593614?ops_request_misc=&request_id=&biz_id=102&utm_term=golang%20strings%20%E5%8C%85%20%E8%AF%A6%......
  • ctfshow web入门 命令执行 37-39
    37-39基于GET传参的include()38、39是37的变种分析伪协议常用于文件包含漏洞中文件包含函数有:include、include_once、require、require_once、......