News for hackers. Stuff that matters.
Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Thursday May 29, 2025 @01:26PM (#44128193)
I am the author of the nature programming language. You can find code examples and a playground to try it out on the official website at https://nature-lang.org I would appreciate your feedback.
Re:Show HN: A new programming language inspired by Go, no LLVM by je42 on Sunday June 01, 2025 @02:35AM (#44149025)
Looking at the co routine example. Does the function type implicitly change when using co.sleep in the function body?
Re:Show HN: A new programming language inspired by Go, no LLVM by Simpliplant on Sunday June 01, 2025 @03:34AM (#44149252)
Any chance you missed “go” that turned the function into the future?
Re:Show HN: A new programming language inspired by Go, no LLVM by WhereIsTheTruth on Sunday June 01, 2025 @02:57AM (#44149116)
Do you have plans to support WebAssembly target?
Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Sunday June 01, 2025 @05:38AM (#44149699)
Plan to add wasm backend
Re:Show HN: A new programming language inspired by Go, no LLVM by gonzus on Sunday June 01, 2025 @04:22AM (#44149412)
There are some misspellings in the README, such as "natrue". Just FYI.
Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Sunday June 01, 2025 @05:42AM (#44149715)
thanks, I'll fix it
Re:Show HN: A new programming language inspired by Go, no LLVM by nextn on Sunday June 01, 2025 @04:22AM (#44149414)
Congratulations on finishing this.

If you were to do this again, how would you organize the source code differently?

Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Sunday June 01, 2025 @05:29AM (#44149671)
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.
Re:Show HN: A new programming language inspired by Go, no LLVM by gonzus on Sunday June 01, 2025 @05:03AM (#44149577)
Nice work. Some questions / observations:

Can you add methods to any type? There is an example of adding a method to a builtin type (string) -- can you add also add a method to a union type?

Any plans to add some sort of enum type? If yes, will it be possible to add methods to enums?

How do you support (or intend to support) Unicode? It says "Strings use ASCII encoding" -- why not UTF8?

The example with a timeout channel does not show how / when the timeout will be triggered. Is this a special kind of channel?

It says "Packages will be synchronized to the $HOME/.nature/package directory" -- will this respect the XDG standard directory structure, which defaults to $HOME/{.cache,.local,.config}?

Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Sunday June 01, 2025 @05:27AM (#44149663)
1. nature can add methods to built-in types, example

fn int.to_string() { }

I haven't considered whether union types can add methods, so I tested it, and it seems to be possible, but this may cause some unexpected behavior, so maybe I should disable this possibility for now.

type test_t = int|null

fn test_t.hello() { println('hello world') }

2. Enum support is planned. I plan to use type declarations. Why hasn't enum been added yet? Nature has adopted a conservative syntax design, and I hope to hear more opinions and avoid affecting existing functionality as much as possible when adding syntax features.

type weekly = enum {}

So methods can be added to enums.

fn weekly.found() { }

3. UTF-8 should be solvable via a library. I haven't thought much about UTF-8 yet, but if it can enhance nature's usability, I'll implement it as soon as possible. Usability is a key focus for nature moving forward.

4. Select{} timeout handling does require a special timer channel, which will be addressed in the standard library. Currently, it can only be handled via ch.try_recv() and ch.try_send(), which do not block the channel.

5. Actually, this is the first time I've heard of the XDG standard. I will study and understand the specification.

---

I am not an experienced programming language designer, so thank you for your questions. I will carefully consider them.

Re:Show HN: A new programming language inspired by Go, no LLVM by gautamcgoel on Sunday June 01, 2025 @08:53AM (#44150520)
Cool work! Just out of curiosity, what made you pick the name nature?
Re:Show HN: A new programming language inspired by Go, no LLVM by hualaka on Sunday June 01, 2025 @09:04AM (#44150582)
“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”

Re:Show HN: A new programming language inspired by Go, no LLVM by gautamcgoel on Sunday June 01, 2025 @09:16AM (#44150649)
"Tao" might be more search-engine friendly than "nature".