Calling C code can solve most performance and ecosystem issues. Nature natively implements the system ABI for various operating systems and CPU architectures, enabling C code libraries to be called at extremely low cost. In Go, a separate thread + hook is required to call C functions.
In my view, a compiler is a text transformation tool that converts high-level descriptive text languages into the format required by the target machine. Target machines typically have two specifications: operating system specifications and CPU specifications. As long as the final generated binary encoding satisfies both, it can run on the target machine. For example, Linux systems have ELF program loading specifications, while ARM64 manufacturers have CPU instruction specifications. As long as the CPU can recognize the binary encoding, it can command the CPU to perform the required computations.
In concrete implementation, it is usually necessary to convert high-level text languages into an Abstract Syntax Tree (AST), perform necessary detection and optimization based on the AST, and then convert it again into a lower-level Linear Intermediate Representation (LIR). After performing necessary detection and optimization on the LIR, the LIR can be converted into readable assembly instructions required by the target CPU. Further implementing an assembly instruction conversion tool converts the readable assembly instructions into binary encoding that the CPU can recognize.
Next, this set of binary encodings is wrapped into an executable file according to the operating system's requirements, ultimately obtaining a file that can run on the target device. Since a compiler is a text transformation tool, it can run this tool on any device - this is the essence of cross-compilation.
“Tao follows nature” (道法自然) is a phrase from classical Chinese philosophy, and it is the design philosophy behind the nature programming language. It can be understood as being natural and intuitive. I hope that nature can build upon Go's ‘less is more’ philosophy and achieve ‘Tao follows nature.’
Unfortunately, nature is not SEO-friendly, so the name has received a lot of criticism. Therefore, I am considering changing it to a name that starts with ”na”
The tup is an interesting question. I often think about tup(int, bool, string) vs (int, bool, string). I convince myself that there might be a better choice.
`var t = (1 as i8, true, false)` Use automatic inference to replace active type declarations.
t.0 vs t[0] is equally difficult to choose, but t[0] is the more commonly used syntax. Using t[n] consistently across map/vec/set/tup might be the more correct decision.
I really enjoy thinking about such issues. I actually spend a lot of time considering whether to use type prefixes or suffixes, [] or <>, and ultimately settled on “<>”.
In my opinion, the change from `<>` to `[]` is a minor adjustment. `<>` is already widely adopted, and I don't want to break with convention for such a small benefit.
The position of the type is similarly considered. Postfixing the type has some advantages over prefixing it, but those advantages aren't sufficient for me to break with convention.
This is the Natural Selection interstellar spacecraft from the Three-Body Problem novel. In fact, the disc-shaped part is the head.
I tried to draw this logo myself, but my drawing turned out rather ugly. The lines of the Millennium Falcon closely match my imagination of the Natural Selection spacecraft's appearance, so I borrowed its lines.
However, this is not permanent. In fact, the name “Nature” may be modified because it is not SEO-friendly.
Thank you for finding the discussion from two years ago. The usable version took me another two years to complete. Focusing on implementation caused me to neglect collaboration and promotion, and I fell into many misconceptions.
You're right, but nature doesn't seem to be a good name, it gets a lot of criticism because its not search engine friendly. Maybe I should change the name before nature becomes popular.
The syntax of nature is different from golang. But everything else is the same as golang, including goroutine, GC, channel, cross-compilation and deployment, and even free programming ideas, less is more, and so on.
I think these features are the best thing about golang, even in front of all programming languages. That's why I'm trying to see if I can create a better golang.
In the early stages of availability, I would not advise others to switch to nature, as this would be irresponsible. When nature is sufficiently advanced, the situation will be different.
This is an advertisement, and I usually don't put “no LLVM” in the title or use it as a promotional feature.
I posted this project on HackNews a few times, but it quickly sank to the bottom. Maybe “no LLVM” might pique some people's interest in the project, so I added it. Actually, I posted this link a few days ago and had already given up on it, but unexpectedly, it suddenly appeared on the HackNews homepage.
I now need some attention, which will give the Nature project more capital.
I am more in favor of flat code organization, but I probably won't use C to implement a compiler again, as it involved a lot of unnecessary work. Zig or Rust would be better choices.