Sum types, 2024 variant

2024-06-13 Thread walkr
I think that's better, since for both single and multi-field objects, the `(...)` is consistently applied to perform the unpacking. Perhaps it could even support multiple unpacking variants. For illustrative and comparison purposes: of IfStmt as (cond, left, right): of IfStmt a

Sum types, 2024 variant

2024-06-13 Thread walkr
I'm also thinking about tuples. Are they supported in sum types? type Device = case of Mobile: (string, int) of Server: (string, int, bool) let device: Mobile = ("iPhone", 15) Run How will they be unpacked? Can I do this? cas

Dear Araq, how do I create a programming language?

2024-04-18 Thread walkr
I'm sure in this day and age, there are many good resources available, but I've read that the book **Crafting Interpreters** by Robert Nystrom is a good resource for those interested in developing programming languages.

Sum types, 2024 variant

2024-04-13 Thread walkr
+1 for sum types a la F# (discriminated unions). They're very clean and minimal. type Option<'a> = | Some of 'a | None let opt = Some("hello") match opt with | Some x -> printfn "%A" x | None -> prinfn "None" Run ty

Austral (a simple-ish language with a linear type system)

2024-03-19 Thread walkr
Who said this? Albert Einstein I think? > Any intelligent fool can make things bigger and more complex... It takes a > touch of a genius - and a lot of courage to move in the opposite direction. So I applaud the push towards simpler systems, if done right. Having said that, to me the most inter

-d:thanks

2024-03-12 Thread walkr
It's highly productive to have a forum where we can discuss the language, ask questions, etc. But besides quenching our thirst for technical knowledge and skills, we can also use it to express appreciation, and recognize the hard work that goes behind the scenes. So I just want to say thank yo

Hello `nph`, an opinionated source code formatter for Nim

2023-12-18 Thread walkr
I think in this case, it would be cool if the tool would be smart enough to reason: _" Ha, I'm already seeing two different import lines here as opposed to being comma separated, maybe this user wants it this way, therefore I won't change it"._ No matter how one slices it, there's no single sty

Hello `nph`, an opinionated source code formatter for Nim

2023-12-18 Thread walkr
I know some people have expressed different preferences, but just to illustrate another perspective, I think at the module level it's preferable to indent what's after `import`, `var`, `const`, `type` on a different line, even if it the whole structure could be formatted as a single line, that's

Hello `nph`, an opinionated source code formatter for Nim

2023-12-18 Thread walkr
How about naming your project [`noir`](https://github.com/arnetheduck/noir)? It means [`black`](https://github.com/psf/black) in French.

And the fastest language to print hello world is ...

2023-10-17 Thread walkr
The benchmarks might be quite imperfect, sure, but we've got at least some guiding elements. Plus, in the case of someone who's never heard of Nim before, stumbling upon it while looking at the top of those rankings is good marketing.

And the fastest language to print hello world is ...

2023-10-16 Thread walkr
NIM Now in all seriousness, looking around the benchmarks on the page, once can see Nim performs quite well all around, and by _well_ I mean _fast & with low memory usage_; not to mention often times with far less code than

What is the best way to learn nim for someone who is fluent with python

2023-08-17 Thread walkr
I'd like to point out is also a pretty good resource for beginners since the examples are short and well organized, and thus you can quickly get a feel for the language.

Why is My Nim Code Faster when Doing This

2023-08-08 Thread walkr
let s = "Thank you all for your inputs! (:" Run Since compiling modern programming languages involves so many moving parts, there's lots of useful information in here to learn from. I'm not going to be spending much more time on this microbenchmark, but it's good to know now

Why is My Nim Code Faster when Doing This

2023-08-07 Thread walkr
I was doing some testing, comparing Nim and Rust for some string operations, and I somehow managed to cut Nim's runtime in half by adding a call to my reverse function outside of the loop. proc reverse(s: string): string = result = s let size = s.len for (i,

A template inside a template

2023-08-02 Thread walkr
Thank you, I've just read the explanation: > ... system.currentSourcePath which returns the path of the source file > containing that template call. but that doesn't clarify why I ought to get different results. The call to my template `mySourcePath()` on the line `let path2 = mySourcePath()`,

A template inside a template

2023-08-02 Thread walkr
Nim 1.6 and 2.0.) Here's my repo: [walkr/source_path](https://github.com/walkr/source_path)

Why is a Nim enthusiast/programmer called a "Nimmer"?

2023-06-30 Thread walkr
Some other ideas: • Nim ⋈ Wizard → Nimzard • Nim ⋈ Engineer → Nimgineer