HackerTrans
TopNewTrendsCommentsPastAskShowJobs

hualaka

no profile record

Submissions

Show HN: A new programming language inspired by Go, no LLVM

github.com
82 points·by hualaka·ano passado·90 comments

comments

hualaka
·ano passado·discuss
When debugging complex projects, the C language is more flexible and convenient to view data in memory.
hualaka
·ano passado·discuss
custom backend
hualaka
·ano passado·discuss
How efficient is neural rendering at this stage for game rendering?
hualaka
·ano passado·discuss
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.

I have not yet considered GPU-related features.
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
“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”
hualaka
·ano passado·discuss
? Commonly used for nullable types.

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.
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
That's a very good point, and I agree with you. I will adjust the relevant wording and use words such as “system” more carefully.
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
Yes, public, I won't add pub syntax. But maybe there will be a label provided for the editor to recognize, but this won't be the main route.

#local fn test() {

}
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
nature will support more major platforms and wasm. also linux_riscv64 is in the process of being supported and I've done most of the work.
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
vlang is a Golang-like programming language. I will use vlang as an example,

v has the same syntax as golang and is derived from it. But otherwise, v is moving closer to rust, with immutability, bounds checking, and so on.

Here's a discussion of vlang's implementation of coroutine https://github.com/vlang/v/discussions/11582 Until recently, vlang has not supported coroutines very well

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.
hualaka
·ano passado·discuss
thanks, I'll fix it
hualaka
·ano passado·discuss
Plan to add wasm backend
hualaka
·ano passado·discuss
I will consider the issue.
hualaka
·ano passado·discuss
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.
hualaka
·ano passado·discuss
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.