10 ms·
Nature: Programming language to experience the joy of programming
- pif 3y agoThe question I didn't find answered in their documentation: why?
- fsflover 3y agoThe answer is in the title?
- munro 3y agoA pleasant little language, it looks like weiwenhao started working on it back in 2021. It looks great! I couldn't find anything novel the programmer wanted to try out in this language-- seems like they just want to capture the zeitgeist, and condense it into a simpler form. It does make me wonder, how many other interesting languages are programmers toiling on out there? Wish there was a way to sort by newest repo, but this does start revealing some interesting underground langs: https://github.com/topics/programming-language?o=desc&s=updated https://github.com/topics/programming-language?o=desc&s=upda...
- booleandilemma 3y agoI don't know. I feel like the language space is very crowded right now. While that's a great thing for everybody, it does mean if you're going to be pushing a new language, you need to be clear about what sets your language apart from the dozens of others clamoring for attention.
- weiwenhao 3y agoI'm the creator of the Nature programming language, and I'm incredibly thrilled to see my project featured on the front page of Hacker News. I've been developing this project in my spare time; initially, I focused on building the compiler back-end, which is something I'm deeply passionate about. That alone took me roughly 3 years of part-time effort. Only in the past year have I started to design and implement the front-end of the programming language. I'm not one to give up halfway, and even though breaking into the programming language market is exceedingly difficult, I'm still committed to investing my enthusiasm and time into making this work. The first goal for Nature right now is to reach a minimum viable product stage. The second goal is to "stand on the shoulders of giants"(go/rust). The third goal is to incorporate more innovative ideas and possibilities. Even if Nature doesn't gain a user base, I will still use it to build interesting things.
- UncleOxidant 3y agoWhat was the main problem you were trying to solve with Nature? What did you find missing in other languages that motivated you to create Nature?
- weiwenhao 3y agoAfter the MVP (Minimum Viable Product) version of Nature is released, I plan to use it for game engine and game development. But that's probably not the answer you were looking for. I have experience with many programming languages like PHP, Python, Golang, JS, C, Scheme, etc. Each of these languages has its shortcomings that bother me. Taking C as an example, it lacks package management and doesn't support generics. In contrast, Nature is designed to improve upon C by featuring generics, package management, and null safety, among other things. Moreover, what drives me is simply the joy of the process.
- frizlab 3y agoI’m curious, did you try Swift? It’s has most (but not all) of your goals AFAICT.
- Jeff_Brown 3y agoIt might be interesting to write up comparisons of Nature to each of the dominant languages. My impression is you want to make something as welcoming as Python but more expressive and safer. Which, if true, is indeed a worthy effort.
- starkrights 3y agoHey, that’s a neat story! Genuinely, I’m not trying to be sarcastic with that- but you didn’t answer his question at all. What’s the point? Your goal is an “MVP stage”- what is your MVP? What are the minimum requisite features that are the core features of the language, and why are they important / better than any other languages, and in what specific ways? If the answer is just “because I like these syntax/feature choices and i just want to make a language, that’s okay- you’re allowed to do whatever you want on the internet lol- but answer the original question directly and specify it as such. The goals “get an MVP”, “stand on the shoulders of giants” and “innovate”, mean and say literally nothing- it’s just a smash of buzzwords that says nothing about your intents. They translate literally to “I want to make my thing work”, “i vaguely want recognition for being like xyz things”, and “I want to make it have more things” What does “make it work” mean? Why does “be popular like rust and go” matter to anyone/what does it mean for your product? Why are you talking about innovating more things when you haven’t even told us what the first thing is? These questions aren’t meant to be mean / dismissive- you made a programming language, and that’s cool (to me at least!) I wanna know!! If you want to stand on the shoulders of giants, you have to know what you’re doing- or if you do, be able to explain it lol.
- klyrs 3y agoNot every language needs a marketing department. This looks like a fun project.
- bwanab 3y agoI agree. Tell me what motivated the language. What does it do that other languages in the same space don't do well?
- nmz 3y agoif ++languages>1500 { error "too many languages" }
- zubairq 3y agoTotally agree. I wish that new languages would state the 3 things that are unique about them
- ljm 3y agoFrom another perspective, I think designing and building your own programming language is an incredible way to gain depth of knowledge and not simply breadth.
- rdevsrex 3y agoThat's true, but not every language has to cater to the whims of industry. Sometimes it can just be for fun.
- agentultra 3y agoDepends on what brings you joy. Update: Ok, non-glib serious comment: the "joy" of programming is highly subjective and the author might want to consider a different byline to avoid confusion. A "creative" or "hobby" programming lanugage for "experimentation," might make the point better. Personally I don't find much joy in C-like languages as they're all approximately the same to me... and the "joy of programming," is less about syntax than semantics and form.
- weiwenhao 3y agoI believe the pleasure you derive from a language largely depends on what you use it for. What a language can truly offer is increased convenience and efficiency.
- billfruit 3y agoHow exactly does it make someone experience the joy of programming?
- FrustratedMonky 3y agoJust quick take from the code examples. How is this more joyful than Rust Or Java or anything? What is the key difference here that is about adding 'joy'? Just not picking up on the sales case.
- colesantiago 3y agoWhy does everything need to be about 'sales'? There is an emphasis on 'joy', it can be just about having fun.
- comewoyhmexj 3y agoIf you want substitute in 'joy' for 'sales'. Its a figure of speech. What is the joys pitch of this language? It looks like a beginner friendly version of Java. Im all for the idea of optimising for developers fun and joy but im not picking up the sales pitch either
- nonameiguess 3y agoIt doesn't appear to have been submitted by the language writer and the website itself doesn't say it exists to bring you joy. It says "may you experience the joy of programming." Whoever wrote that is seemingly trying to be nice and say something similar to when a person on the street wishes you a good day. They're not trying to say you should be having a good day because their very existence is good for you. This is a hobby language that someone made in his spare time and he gave it a website to share it. I don't see a sales pitch at all. It's more like someone sharing pictures of a hand-carved pieced of furniture they made themselves. The point isn't to say everyone else should be using it and it's better than other furniture. It's just hey, I made this, take a look if you're interested.
- FrustratedMonky 3y agoOK. That puts some context. It isn't like there is some fancy new interface or paradigm to the language. It is using "Joy" as in "Joy to all", "be joyful", "Have a nice Day". Think the title of the post was maybe misleading that way.
- TeaDude 3y agoIn-house non-llvm compiler? Ooh! This looks fun! Will definately give this a peruse.
- weiwenhao 3y agoWhen I aim to create a piece of software, I not only want the users to be happy but also the people who build the software to find joy in the process. Using LLVM is a good choice, but creating your own compiler backend is definitely more interesting.
- zoogeny 3y agoI like the feel of the syntax on first glance. I have been thinking recently that all of the new powerful features showing up in language (Typescrpt, Go, Rust, Elixir, Kotlin, etc.) have been exposing programmers to combinations of programming language features that were not widely available before. I mean, I grew up with Pascal, Basic, C/C++ and Lisp but kids these days are growing up with Python, Typescript, Rust, Go, Haskel, Kotlin, Dart, Swift, C#. Specifically I was thinking about how I avoid classes now for almost all of my code. I used to be a OOP first guy. Now I want value semantics and abstract data types. I have always hated exceptions (or any non-local control flow in general) and I love guards and defer-like semantics. I love the idea of CSP and Erlang but I also want full low-level control of bits. I want custom allocators and no GC, except maybe when I want a GC for some reason. I love that people are just experimenting by taking the bits and pieces they like from the multitude of available high-quality languages and they are mixing them up into strange new soups.
- giancarlostoro 3y agoI do dream of some serious Erlang alternative that runs on its own without needing an entire runtime, but in all honesty Elixir / Erlang are insanely optimized, it blows my mind. I think I'm too used to the C#'s and Pythons of today, I too used Basic and a little bit of Pascal back in the day. I'm always excited by D but it gets overshadowed by Go and Rust it feels like, despite having really good features and a familiar syntax for anyone coming from C# / Java / C-like languages in my opinion.
- zoogeny 3y agoI'm glad you mentioned D and I literally paused while writing the above to consider if I should include it. Back when I was writing a lot of C++ (decades ago now) my greatest hope was that D would catch on. It is hard to say why it didn't and I think all of the hype on the C++ successor goes to Rust these days. Zig is probably the most likely candidate for a C replacement even though D has a subset termed as Better C. It really is the case that there is an endless list of programming languages now that serve as inspiration for almost every use case. I mean, I didn't even mention Clojure or Julia or Lua ... the list of truly interesting language and approaches is almost endless.
- gsuuon 3y agoThis is cool - it looks like there are a few languages developed targeting game development, like Odin and Jai. Are there others in this space? Really curious how these compare. It doesn't look like Nature has ADT's, is that true or just missing from the docs?
- Willamin 3y agoA bit of a nitpick on the language on the homepage: The description of the Fibonacci example seems incorrect, but I might be misunderstanding something about the language. > A fib evaluation function was defined using recursion. > The result of the function call was assigned to a variable named "result" and format the output using fmt.printf import fmt fn fib(int n):int { if n <= 1 { return n } return fib(n - 1) + fib(n - 2) } fmt.printf('fib result is %d', fib(30)) No variable named "result" is ever defined, right? Maybe the description is outdated from a time when an intermediate variable was present.
- 2023throwawayy 3y agoThis will also never do anything if you pass it 0.
- i-use-nixos-btw 3y agoLook at the if statement again.
- unfunco 3y agoIt'll return 0.
- deleted 3y ago[deleted]
- weiwenhao 3y agoThank you for pointing out the bug in the website description; I have now updated it.
- ozfive 3y agoYou are absolutely correct, while reading through it I was becoming increasingly concerned that whomever wrote the description was the language writer themselves. I expect a level of attention to detail from someone who is writing their own language.
- 3y ago
- dindobre 3y agoAllow me a shallow opinion since we are in "joy of programming" territory: after python anything with curly brackets feels "uh". Give me python with typescript typing
- throwaway_08932 3y agoNim does basically this.
- Uptrenda 3y agoNim looks beautiful and seems to have impressive platform support already. Good taste / 10.
- qwerty456127 3y agoAfter any good functional language like F# or Scala (also CommonLisp but it's less straightforward to start doing meaningful practical things in), anything else feels uh. My first experience with Scala was a shock about how concise and how bug-free programming can actually be. You just write what you mean and as soon as it builds successfully, it works and does what you expected it to do. Scala is easier to start with for those accustomed to the curly braces style languages and allow limitless expression. F# looks and feels more cool (although less familiar/intuitive for the majority, necessarily requiring some introduction) anyway and doesn't incentivize wizardy. To me F# essentially feels like "better Python" while Scala obviously is "better Java". Any good interactive visualization or gpio library also opens another dimension of joy. QuickBASIC with LPT (which did the GPIO's job back in the days) access and drawing functions was a lot of joy already. I am going to give this Nature language a try anyway. It indeed doesn't look super special at the first glance so it probably has some meaningful coolness hidden deeper - this is intriguing.
- deleted 3y ago[deleted]
- cies 3y agoI hear you. I like Elm, Haskell and Ruby for syntax, as a personal preference, and no curlies-for-scoping. But then I think the language models/paradigms are more interesting about these languages.
- sjm 3y agoSometimes I think we need more verbosity in programming languages. Imagine you're new to programming and come across this, - what the hell is fmt? - what the hell is fn? - int? - n? - printf? what is f? - what is %d? I know this probably isn't the crowd for this, but if my non-programmer friends curious about learning to code saw this they'd run for the hills. Sure this isn't a "learn to code" language, but a little verbosity is IMO not a bad thing: it is more humanist and can be self-documenting.
- booleandilemma 3y agoIt's better for people to invest the brief time to learn what these things mean up front than have a language that's burdened with verbose keywords, forever. Typing and reading "printFormatted" everywhere is going to get old really fast.
- mock-possum 3y agoYou can always have your cake and eat it too, if you allow either/or on all these reserved words - if you can define a function using either ‘defineFunction’ or ‘fn’
- crabmusket 3y agoYou may enjoy Austral: https://austral-lang.org/examples/fib https://austral-lang.org/examples/fib Though I have no idea how that would go over with someone new to programming.
- trealira 3y agoI think the kind of person who checks out programming languages in their free time probably does more coding on their own, so languages that appeal to them are the ones with concise syntax that's easy to type, even if some people find it cryptic. Rust and Haskell also may appeal to these programmers more than people with your opinion.
- joshbuckler 3y agoweiwenhao: The example in https://nature-lang.org/docs/the-basics/function#multiple-return-values https://nature-lang.org/docs/the-basics/function#multiple-re... has `balance` and `product` swapped.
- weiwenhao 3y agoThank you for the reminder. It appears I wasn't as prepared as I should have been. I will pay closer attention to details in the next version release.
- donpdonp 3y agoThe syntax choices are really nice here. It has a lot of what I would pick for a language. The one-liner test cases are awesome, <> for generics is comfortable since I use rust, sum types like elm are awesome. If I were to add something (well take it away really) its to use whitespace for array element separators. Eliminates the whole trailing comma issue and looks cleaner, though I admit it might create parsing ambiguities. 'try expr', returning (val,err) is curious and I think I like it better already than try {} catch {}.
- KerrAvon 3y agoUsing the C for loop syntax is looney tunes, though. Do range support and leave that 70's stuff in the dust.
- donpdonp 3y agoits got 'for k in list {}' (https://nature-lang.org/docs/the-basics/control-flow#iteration-loop https://nature-lang.org/docs/the-basics/control-flow#iterati...) though array.for_each(lambda) is a better way to go, imho.
- irq-1 3y agoI'd like: drop 'try' and always allow and error to be returned, and ignored or checked at the users discretion. Optionally add "@error" or such, and let the tooling add or remove the annotation. An FFI like luajit is asking alot, but inspired by it would be nice.
- munificent 3y ago> If I were to add something (well take it away really) its to use whitespace for array element separators. Eliminates the whole trailing comma issue and looks cleaner, though I admit it might create parsing ambiguities. Indeed: var array = [ 5 - 3 ] Does that produce [5, -3] or [2]?
- dmoy 3y agoOr ["5", "-", "2"] even
- twism 3y agoIn the "Error Handle" example ... 11 var t = test { --------------------------------------------- Should the variable `t` be `foo` here? --------------------------------------------- 12 list = [1, 2, 3, 4, 5] 13 } 14 15 var (l, err) = foo.list[8]
- weiwenhao 3y agoYou were right
- twism 3y agoMan i don't know ... if things are not strictly immutable (or at least by default) i'm not so sure about the joy part.
- mock-possum 3y agoReminds me of typescript, less parenthesis, and prefix typing.
- Vaslo 3y agoIt just looks like another programming language that I would waste time on instead of learning languages with tons more support and user acceptance that don’t look much different. Let’s keep reinventing the wheel!
- user8501 3y agoIf we didn’t reinvent the wheel we would all be riding on stone wheels. Do people think we’re going to run out of space or something for these languages? I’ll never understand how a persons personal triumph can be perceived negatively by another person. Are you equally as upset when somebody paints a picture of a mountain, simply because other people have done that before?
- 12_throw_away 3y agoconsider the hypothesis that some things in this world might not be about you
- riidom 3y agoIs Unicode support on the todo list?
- ejstembler 3y agoCongratulations weiwenhao! I like what I see so far and am looking forward to following the continued development of the language. Do you have any social media accounts set up for the language (e.g. X, Mastodon, Blue Sky, etc.) that people can follow?
- weiwenhao 3y agoThe primary channel for communication right now is https://github.com/nature-lang/nature https://github.com/nature-lang/nature , where you can engage and keep up-to-date through issues, discussions, and watching the repository. Additionally, this is my first time hearing about the Mastodon platform, it looks really cool.
- lifeisstillgood 3y agoI have a joy of programming in bash. Another language might be fun but the real joy lies in expressing oneself, solving a problem, getting the bon mot - its past bedtime and I have for the first time in a year found myself doing salaried work after hours for the fun of it
- dtgriscom 3y agoOh, yeah. Bash rules. (Perhaps because I don't know zsh or fish, but hey! it rules for me.)
- askiiart 3y agoI started programming I'm bash a few months ago, and also found it enjoyable. But the part I found enjoyable wasn't just programming in bash. The part I loved was making scripts to automate all kinds of stuff and make my life easier—automate updating my yum repo, automate building my Docker images, make some install scripts for whatever I need when I distrohop, and little scripts to backing up and restoring my dotfiles. If another language/shell, like zsh or fish was the preinstalled default, I'd program in that instead, but because of its basically-universal install base, I program in bash.
- lifeisstillgood 3y agoI guess I meant joy, even in something like bash... the joy lies in coding not in the language
- xwowsersx 3y agoThe general negativity and tone of "tell me precisely what the point of this is right now!" in the comments here deviates so completely from the spirit of play, tinkering, and experimentation inherent in the hacker ethos, at least as I see it, and I'm really disappointed to see it here. You can have your qualms with this language, you might feel personally overloaded by languages at the current moment, maybe you even have legitimate questions about the intended audience of this language — fine. None of those feelings or questions justify the kind of rude, interrogatory "How dare you do this! Show me why I should care!" attitude reflected in many of the comments here.
- lhorie 3y agoAdding my two cents of positivity: I love seeing language projects that implement their own compiler backends. There really aren't enough of these around. Anything that helps bridge the knowledge gap between newbies and production grade compilers is a net positive in my books. And extra brownie points for writing it in C. Think whatever about memory safety and language age but C code is abundantly explicit about what's going on with the code, which is something I really appreciate when approaching some new code to learn stuff.
- __loam 3y agoI think it's pretty fair to ask the question of "why should I use this?" I don't think it's rude to ask what this offers over other systems languages like Rust, Nim, Zig, or Go. All of those languages have been around for a while now and have some ecosystem and inertia. This language is claiming to bring back the joy of programming but frankly it looks like another c like language. Do we really need that? It's an impressive project for one person to make but if we're talking about it as a prospective general purpose language, that naturally invites comparisons and criticism. I haven't read the comments but I think most people have good intentions when they share their view on this project and aren't personally attacking the author.
- xwowsersx 3y agoI have no problem with genuine questions like "Who do you think should or would use this?" That's not what I'm addressing.
- johngossman 3y agoThere is a 1963 RAND paper where they considered whether it was time to standardize on a programming language (Not yet, was their conclusion). It contains one of my favorite quotes: “About the same time, however, a further complicating factor arose--the designing of programming languages became fashionable. Now the proliferation of languages increased rapidly as almost every user who developed a minor variant on one of the early languages rushed into publication, with the resultant sharp increase in acronyms. In addition, some languages were designed practically in vacuo. They did not grow out of the needs of a particular user, but were designed as someone's "best guess" as to what the user needed (in some cases they appeared to be designed for the sake of designing).” Personally, I find nothing wrong with designing for the sake of designing.
- johngossman 3y agoOne thing I miss about the Internet of just a few years ago is that such papers were freely available. Alas, now behind a paywall. https://www.rand.org/pubs/research_memoranda/RM3447.html https://www.rand.org/pubs/research_memoranda/RM3447.html
- gloria_mundi 3y agoIt is, of course, still freely available if you plug the title into your favourite search engine. From the US Defense Technical Information Center: https://apps.dtic.mil/sti/tr/pdf/AD0296046.pdf https://apps.dtic.mil/sti/tr/pdf/AD0296046.pdf Also in the Internet Archive: https://archive.org/details/DTIC_AD0296046 https://archive.org/details/DTIC_AD0296046 The mentioned quote is on page 22.
- johngossman 3y agoYour search-fu is better than mine.
- fyzix 3y agoAny eta on a json module?
- dvektor 3y agoLooks like the love child of Python and Go. I like the syntax.
- raytopia 3y agoI like it. I'm going to give it a try.
- klausnrooster 3y agoGlad to see things like this. Think Phix is contender in the space. 100% RosettaCode coverage in 2021.
- endorphine 3y agoBy reading the title, I expected this to be targeted towards newcomers to programming and hence be more close to Ruby (no types, reads like English etc)
- spinal 3y agoI really like the syntax around error handling. It is similar to the usual try/catch, but looks a lot cleaner (at least to me, coming from Go). Was this inspired by another language? I don't recall seeing a language with the same (or very similar) syntax.
- vanjajaja1 3y agooh yeah, 'try' as a hoist that can be programmed against would be so much nicer than forced blocks for try/catch. I like it a lot
- hamdouni 3y agoNice to see another language with different approaches... I will check it as it is always interesting to challenge its knowledge
- teo_zero 3y agoI find this promising. There are some weak points to highlight (not to criticize, but to help development). What I don't like is that there are more ways to declare what a name means. Variables: var x = ... int x = ... And even functions: fn f()... var f = fn()... It makes reading someone else's code difficult. When I want to know what an identifier is, I scan the code until I find its declaration. I might do it manually or via some macros of my editor, but the fact that such declaration can appear in different forms makes things difficult. Besides, looking for the first time at a piece of code it's not immediately clear if an identifier is a type or a variable. Especially in constructs where a variable and a type appear separated by a =, which suggests they are of the same kind: var box = rectangle {... My personal preference to solve the two issues in one go would be to use : to mark the type (which could be omitted in case of auto inference) and make 'var' mandatory: var x : u8 = 27 var y : = 'hello' var f : fn(int)->int = { With : repurposed, it can't be used for the return type; I used -> as in other languages. Now a macro or reader looking for the declaration of x, y or f knows exactly what to look for. Now types can only appear after a : or the keywords 'type' and 'as' (unless the syntax of the latter elements is changed to 'type:' and 'as:'). And talking about 'as', its priority must be clarified: z = a * -b as int Does 'as int' apply to b, to -b, to the whole product, or to z? I like how easy it is to declare union or sum types with '|', but the need to use 'as' and 'let' after an 'if ... is' makes it clumsy. Lazy programmers, the ones that wouldn't check for NULL in C, will simply add a 'let' here and there and perpetrate Tony hoare's billion-dollar mistake. Finally, I'd like to understand exactly how the parser handles new lines. It looks like they end a statement, but are ignored in other contexts.