nimja; compiled and statically typed template engine (like twig or jinja2)

2024-08-16 Thread termer
Thanks for the improvement, it was much needed. Your library is great, I've been using it in production for a small site for years and it has always served me well.

Compile times normal or my fault?

2024-07-25 Thread termer
What are you building?

Am I losing something by learning Nim without learning C/C++?

2024-06-29 Thread termer
I basically learned C through using Nim. Previously I had done almost no C, just enough to do basic file operations and that's about it. Using Nim's unsafe features and FFI taught me C intrinsics, but general methodologies and memory management I had to deal with for those tasks helped me under

Introducing an async library inspired by Go in Nim

2024-06-07 Thread termer
The Nim CPS lib has some great docs that explain how it works conceptually, and why it's beneficial. You can suspend continuations at any point, and you can learn more about that on the CPS docs, especially the tutorial on how to

Introducing an async library inspired by Go in Nim

2024-06-07 Thread termer
You may be interested in looking at a library that has been doing (non-stackful) coroutines successfully for quite a while: There's a supporting dispatcher and mostly complete asyncio library that works with it:

choosenim: what is the development state?

2024-06-05 Thread termer
There's Disruptek's [gitnim](https://gitnim.com/) for those interested. I haven't tested it in a while, but Disrupted tends to make tools that work pretty well

Hot Code Reloading viability for Jupyter-Notebook like Nim IDE

2024-05-31 Thread termer
Does the stdlib HCR work at all? I tested the program in the [docs](https://nim-lang.org/docs/hcr.html) (making sure that the logic was in a separate file), and on 2.0.2 and 2.0.4 it produced bad codegen. On 1.16.14 it compiled, but it didn't actually work.

What's the lowest level that Nim can navigate or even dive breaking OS-dependant protected modes?

2024-04-20 Thread termer
You can use Nim anywhere C can be used, so long as you compile with the `--os:any` and `-d:useMalloc` flags. From there, it's just a matter of whether certain stdlib modules are usable in your environment. If they aren't, don't use them and you'll be fine.

Glaucus Linux

2024-03-27 Thread termer
I like the Terry quote on the website

how to parse a multipart/form-data POST body string?

2024-03-22 Thread termer
Do not worry, my son, the dream of a headless multipart form parser in pure Nim will someday come true

how to parse a multipart/form-data POST body string?

2024-03-20 Thread termer
Multiparty body parsing is surprisingly hard to do because the format is so stupid. I would wrap or rewrite something like this This is something I'm going to implement in my parser lib, eventually

forum mirror

2024-03-18 Thread termer
What did you build it with? I assume you used Nim, so I'm asking about libraries. As for usefulness, I've found myself annoyed at a lack of no-JS post viewing when viewing historical posts on web.archive.org, so I think the Wayback Machine will make it more useful. As a side note, I had no ide

Is there a plan to make Nim a language for normal businesses?

2024-03-12 Thread termer
Bevy is a focused project filling a specific need. Nim on the other hand very proudly doesn't target anything, so of course you're not going to see this without a niche or a roadmap. Like I said earlier, if you want a business lang filling a niche with a plan, look elsewhere. Regarding funding,

Is there a plan to make Nim a language for normal businesses?

2024-03-10 Thread termer
bad joke

Is there a plan to make Nim a language for normal businesses?

2024-03-10 Thread termer
There is no real longterm business plan, but the language is more or less feature complete. There are features being added to the compiler to improve speed and there are also tooling improvements in the works, but the language feature set is probably sufficient for your needs already. There's n

what is the nim equivalent to the python None type

2024-03-07 Thread termer
What are you wanting to represent with it? If you're just trying to represent whether something is present or not, the `Option` type will do well. It's also typesafe, and won't crash the program if you try to use it as a normal value. On the other hand, you can use `nil` for ref types, which is

a chat app please recommend necessary libraries

2024-03-07 Thread termer
You might want to try [Mummy](https://github.com/guzba/mummy), which is a web framework with websocket built in

What is `-d:nimNetLite`?

2024-02-25 Thread termer
I wanted to know more about the light network stack mostly. Obviously it's checking for the define, and I did see its functionality was implicitly enabled for some RTOSs, but what it actually doesn't appear to be documented anywhere.

static checking of strings

2024-02-25 Thread termer
> You're always overprotective. I have an inherent distrust of compilers lol > Anyway I would suggest naming the proc ipv4str so you can use > ipv4str"127.0.0.1" as it reads much nicer in my view. I agree with this

leave parenthesis for procedures that take 0 parameters like Ruby

2024-02-25 Thread termer
The converter keyword lets you do totally insane things. I also did something evil with it and created this [abomination](https://git.termer.net/termer/nim-dynval). You might get a kick out of it.

Would Nim modules or available Nim web frameworks suffice for an e-commerce back-end?

2024-02-25 Thread termer
Memory leaks under ORC and slowness. The fastest """async""" HTTP servers in Nim land, such as httpbeast, are fast because they use asyncdispatch as little as possible. In the case of httpbeast, all of its benchmarks are done without even using asyncdispatch (the request handler proc is allowed

static checking of strings

2024-02-24 Thread termer
Create a distinct string named IPv4 or whatever you want. Next, create a proc that takes in `static string` and outputs `IPv4`. func toIpv4(str: static string): Ipv4 {.inline.} = # Do your check here. # As long as you use `static` types and `const`, you can do everyth

What is `-d:nimNetLite`?

2024-02-24 Thread termer
I was reading the source for the stdlib's `net` module when I came across [a line](https://github.com/nim-lang/Nim/blob/805b4e2dc2afddf7be27e32fe0543e4227b31f74/lib/pure/nativesockets.nim#L26) that checked for for a const called `nimNetLite`. It's not documented and Googling it turned up nothing

Would Nim modules or available Nim web frameworks suffice for an e-commerce back-end?

2024-02-21 Thread termer
One other thing not directly related to your question I think is worth mentioning: You can build an e-commerce site much quicker with Wordpress + WooCommerce or a similar plugin. Unless your client needs some very special features, that'll do the trick and allow you to do your job much quicker,

Would Nim modules or available Nim web frameworks suffice for an e-commerce back-end?

2024-02-21 Thread termer
Prologue crashes in multithreaded mode. HappyX is a fullstack framework and has a lot of features and HTTP backends, so your mileage may vary. I can tell you that it will be limited by Nim's async ecosystem, which has many problems. Nexus I don't know. I would recommend you use Mummy because it

Do not understand the error when trying to add to seq inside loop

2024-02-21 Thread termer
You could check for a signature that matches everything except the var part, then offer the advice "add(var seq[T], sink T) would match, but argument 1 is not mutable." This would at least give a clue, and doesn't require the compiler to have any additional context.

Nim safety features like Zig & Rust?

2024-01-24 Thread termer
It's only bullshit if you only see it as a means to specialize in your allocation. Its utility is knowing for certain whether something dynamically allocates memory or not, which is hard to do in Nim. It's especially hard when you realize that exceptions are dynamically allocated, too.

chronos 4.0

2024-01-24 Thread termer
How is the HTTP server's performance with multithreading? Is this designed to work well with ARC/ORC?

Nim safety features like Zig & Rust?

2024-01-24 Thread termer
If you use Nim with its default memory management system, you get Rust-style borrow checking with little effort, and you also get cycle collection which Rust doesn't have, meaning you're less likely to leak memory as a novice. If you stick to managed ref types instead of raw pointers and don't d

macro pragma: param's default value not support?

2024-01-23 Thread termer
Wouldn't tag go after p?

Dynamic Typing in Nim

2024-01-23 Thread termer
I don't remember if I implemented the negative operator, but if I did, you can

punctuations rituals

2024-01-23 Thread termer
I like the way you speak, keep it up

What are your options for dealing with leaks in asyncCheck under arc?

2024-01-14 Thread termer
As painful as it is, I recommend using something like Chronos if you want to give your users async/await support. asyncdispatch is known to leak under ARC, and that's a core design flaw.

Dynamic Typing in Nim

2024-01-12 Thread termer
That sounds very similar to what I'd have to do for wrapping procs. Thanks for the link, I'll take a look at it

Dynamic Typing in Nim

2024-01-12 Thread termer
call properties as if they were procs. Here's my dynamic typing code: <https://git.termer.net/termer/nim-dynval> You can look at the README and tests to see what it can do. What's missing is the actual thing I started out trying to do: accessing and assigning arbitrary properties and call

Maybe nappgui is best cross platform gui lib for nim

2024-01-04 Thread termer
The largest browser in the world does what I'm describing with much success. On the other hand, Firefox used to be more styled toward the operating system, and has also moved away from that. Even then, its default widgets are styled like the system, which has led to inconsistent and annoying sty

Maybe nappgui is best cross platform gui lib for nim

2024-01-03 Thread termer
I'm over the native GUI thing for a few reasons: > * People don't care if things look like their OS anymore, they already use > multiple OSs given they have smartphone > * What native toolkits provide that people want are context menus and > consistent keyboard shortcuts > * They want good

Maybe nappgui is best cross platform gui lib for nim

2024-01-03 Thread termer
Video player tends to be complicated not from a UI standpoint, but from a dependency standpoint. I can understand why a toolkit might not provide it.

ccal: Calendar with local holidays via ip location

2023-12-24 Thread termer
> What is the `ical`? is it macos calendar? It sounds like it, but it's actually a calendar spec designed by the IETF. It's supported by all major calendar applications.

ccal: Calendar with local holidays via ip location

2023-12-24 Thread termer
I like this concept. If you wanna make it more useful, you could add ical support

Sitemap Parser

2023-12-24 Thread termer
I'd suggest using dot syntax whenever you want something to look like it would in OOP, or if it's a property. For example: var player = getPlayer("Robert") player.kill() # kill(player) # ^ This wouldn't be as idiomatic since this is an action on the player, and

Nim v2: what would you change?

2023-12-24 Thread termer
> That is hindered by The Thing Which Cannot Be Mentioned. I honest to god have > never had an issue with style insensitivity in my life, regardless of whether > I'm doing C interop, JSON (de)serialization, or anything else for that > matter. Have you ever actually had issues with this in real p

SIGSEGV: Illegal storage access. (Attempt to read from nil?) in coroutines

2023-12-23 Thread termer
For future reference by anyone who has been burned by buggy async and high memory usage (and lack of working coroutines in the stdlib), CPS is the only real alternative that actually works efficiently and properly. I hope that they'll eventually be implemented in the compiler, because I keep see

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

2023-12-11 Thread termer
> > proc covers(entry: AttestationEntry; bits: CommitteeValidatorsBits): bool > = > ... > > > Run Today I learned arguments can be separated by semicolon instead of comma

Is it possible to encode constraints directly into a type, and enforce them at runtime?

2023-12-09 Thread termer
As @shirleyquirk suggested, you could use an object with a string field. That would be very helpful if you need to be treating the value like a string often. This would be what a full string-compatible example would look like, complete with implicit conversion: type HandLike* {.req

Ideas about strings

2023-11-30 Thread termer
Yeah, I meant uint. I care because it would cut half the capacity of the string for no reason, and that's significant when designing an ABI that'll potentially affect the language forever

Ideas about strings

2023-11-30 Thread termer
Shouldn't rawlen be a hint, especially since you're using the first bit as a flag? The length will never be less than 0, so you're just throwing away size for no reason otherwise.

creating nimstring using pre-allocated buffer to prevent copy

2023-11-28 Thread termer
This isn't exactly what you're asking for, but if you just want something with a fixed size or capacity that is resistant to copying issues and heap-related bugs, I wrote a library called [stack_strings](https://github.com/termermc/nim-stack-strings) that has a fixed-sized stack-allocated buffe

Is Nim Dead?

2023-11-25 Thread termer
Nim is dead. Long live Nim. Thank you for making this thread. This reply is my punishment for taking the bait and clicking on it.

NIR

2023-11-24 Thread termer
There is no WebAssembly target. The current official targets are C, C++, Objective C and JS. You can currently compile Nim to wasm with a C to wasm compiler when you use the C target.

What would I lose if I turn of garbage collection?

2023-11-23 Thread termer
Using `--mm:none` would be an unpleasant experience because you wouldn't be able to use managed reference types (such as anything that is or is based on a `ref` object) without leaking them. Just use `--mm:arc` if you don't want a GC at all. Objects with reference cycles will leak, but as long a

Chronos v4 RC

2023-11-22 Thread termer
I chose Go and a library in that ecosystem. I'm not here to shit on Nim, but the issues I had with ORC and slowness + leaks + everything else was too much. The most promising thing I found was the [nim-sys](https://github.com/alaviss/nim-sys) library's I/O, which uses [CPS](https://github.com/n

Chronos v4 RC

2023-11-22 Thread termer
I'd be interested in running some memory benchmarks on the HTTP server with ORC, especially some of the things I had issues with before like reading bodies. Now that the cycles are gone, it'll probably perform better and have fewer leak opportunities. I think everyone who has seriously tried us

Memory leakage caused by the use of asyncftpclient's rter process

2023-11-19 Thread termer
You can expect anything built with asyncdispatch to leak memory under ORC. Unfortunately that's just the state of things right now. The asyncftpclient lib might be extra bad, but keep in mind that asyncdispatch has memory issues and you often have to run `GC_fullcollect` manually to free memory

Mindset Nim

2023-09-21 Thread termer
I'm surprised I don't see any mention of the INim REPL. You can `nimble insta inim` and have a functional CLI REPL for testing small code snippets. I use it a lot when I want to test the behavior of a single line, and I used it quite a bit when I was first learning. It's not something that can m

The secret of Nim

2023-09-21 Thread termer
I saw it too, before I even read the replies to this post. I've seen deliberate imagery just like that before in psytrance visuals, so this isn't just a "dirty mind" thing lol

what are the equivalent libraries to these ?

2023-09-08 Thread termer
It's also worth noting that if there's a C or C++ library you want to use (either OS libraries like those, or a 3rd party library), it's very easy to interface with it. You can find information on importing C functions here

GuildenStern web server 6.0.0 is here

2023-08-23 Thread termer
I'd love to stream building an application with this like I did for Mummy. Interested to see how it compares, especially on performance.

SQLiteral db driver 4.0.0 is here

2023-08-23 Thread termer
I'll give this a go. I have several multithreaded web projects that could benefit from this, and I've been considering switching to a better SQLite lib for a while

[Advice] Ways to handle "dynamicity"

2023-08-21 Thread termer
The compiler caches it, so other than verifying that source files haven't changed, it's just about as fast as running the cached binary directly.

Potential users

2023-08-19 Thread termer
@Hobbyman > I have not yet seen a rule that some discussions must be done on IRC/Discord No rule, just convention. I like to have more contentious conversations there because it's less visible, and I don't want to have drama or repeated conversations with negative connotations being archived ve

Nim Side-Effects

2023-08-17 Thread termer
For proc authors I'd agree with @Araq that using `var` means you're stating your intentions and it's not a big deal. The issue is that it's not clear to consumers necessarily, and it's harder to depend on `{.noSideEffects.}`. But, as with any other language, there are usually flags that should b

Potential users

2023-08-17 Thread termer
You label it more precisely than most, but I'd rather not rehash a conversation that's been had numerous times on IRC/Discord. I do think it's important that you pointed out fun though. That's the primary reason I use Nim these days.

Exceptions occurring in top level statements of submodule not being reported/handled

2023-08-15 Thread termer
@ringabout 的努力真太神奇了

How to echo distinct type

2023-08-14 Thread termer
What does `{.borrow.}` do? Is it like `lent`?

How to echo distinct type

2023-08-14 Thread termer
Use int(myVar) or myVar.int to get it as a normal int

Equivalent to Rust's Command spawn/try_wait?

2023-08-14 Thread termer
On the topic of peeking, keep in mind that at least one of the osproc peek methods isn't implemented and will segfault when called. I think it was peeking the process input stream, but I don't really remember right now.

[Scala background] How does a macro in Scala differs from macro in Nim?

2023-08-14 Thread termer
Scala 3 sucks lol, did you see what they did the the syntax?

Networking with Nim

2023-08-14 Thread termer
I don't know if you're familiar with the SSH protocol itself, but SSH uses TCP. With this fact in mind, Nim can easily be proven to be able to use SSH because it can open TCP connection and read and write to sockets. That's not unique to a systems programming language though, and in fact any lan

Equivalent to Rust's Command spawn/try_wait?

2023-08-14 Thread termer
This may not be desirable to you, but there's a [library](https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim) that provides an async interface for processes. I think the Chronos library also offers similar.

Equivalent to Rust's Command spawn/try_wait?

2023-08-14 Thread termer
See the osproc module

battinfo - a cli tool & nim library to query battery details

2023-08-12 Thread termer
As I understand it, it reads from the Linux battery files. Is that correct?

Weekly Nim Streams

2023-08-12 Thread termer
First stream was a success in my eyes, got about 8 viewers consistently (including @ElegantBeef of course LOL), and wrote a simple chat webapp with Mummy. I'll post the recording somewhere, but for now, the code from the stream is [here](https://git.termer.net/termer/weekly-nim-stream

Weekly Nim Streams

2023-08-12 Thread termer
I was wanting to try out Ratel, but the issue is that I'd have to set up a camera to show me working with my Arduino

Weekly Nim Streams

2023-08-12 Thread termer
Not a bad idea, I'll give it a go

Weekly Nim Streams

2023-08-11 Thread termer
Also if people would prefer another time, I can also switch it if other times would fit other peoples' schedules. I know there are a lot of Europeans here

Weekly Nim Streams

2023-08-11 Thread termer
I want to livestream Nim programming on weekends, I'm thinking 8PM EST on Saturdays. I've done this once before for the people on the #nimworks channel (the people behind CPS, Nimskull, etc.), and it was pretty fun and productive, at least for me. If anyone's interested, let me know and suggest

Nim 2 and need for try-finally?

2023-08-11 Thread termer
It's worth documenting part of the stdlib that have their resources freed with a `=destroy` hook since it's currently the exception, not the rule. I wouldn't mind contributing a little bit to this, but I suspect it might conflict with existing try/finally uses if there are new `=destroy` hooks a

Is ORC considered production-ready? What is the consensus on its use?

2023-08-08 Thread termer
@Araq I think Jester has fixed this issue since last time I checked on it, which is good. Prologue still has issues with ORC and threads, and they all still have leaking issues with asyncdispatch (asyncnet?), but I think things are looking better than they were before this release. Jester doesn

Is ORC considered production-ready? What is the consensus on its use?

2023-08-05 Thread termer
> It's a bit later, but it does seem like the stdlib's async library will need > some TLC to work well with ORC. Future's cause all sorts of chaotic cycles. > Ideally the core async library will be ARC compatible itself, which would > make it more deterministic. I imagine in the coming months t

Nim version 2.0.0 is here

2023-08-01 Thread termer
I'll be interested in reading about overloadable enums, I haven't seen those before. Another thing I'm hoping to see is a lot of feature removal, but we shall see. Sad to see IC pushed back again, but such is life.

How to get information about .lnk(link) file extension?

2023-07-25 Thread termer
I don't know if anyone has written a library for parsing them, but if not, you can read [Microsoft's docs](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/16cb4ca1-9339-4d0c-a68d-bf1d6cc0f943) about their format and make a library that does it yourself. =

Concepts in Nim v2

2023-07-25 Thread termer
@Araq Hahaha you haven't forgotten, eh. I'm using microasynchttpserver in some limited projects to see how it does. Time is lacking these days, but I've also played around with disruptek's CPS project and webserver implemented in it, which performs extremely well. I wouldn't mind building stream

Concepts in Nim v2

2023-07-25 Thread termer
New-style concepts are super broken right now, and concepts in general are unusable when you're trying to use generics. Believe me, I've tried. I'd be really happy if there was an overhaul of concepts in v2, but I don't expect it.

Compiling nimrtl.nim as static library

2023-07-09 Thread termer
People have talked about this before, and the problems come down to this: > * GC would need to be ARC/ORC, otherwise you would need to manually import > and call NimMain > * You would need to create what would effectively be Nim header files to > import the stdlib's procs > * The compiler

Bisect bugs GitHub Action

2023-07-09 Thread termer
This is amazing. I'd like to re-create this on some of my projects because it would save such a headache.

Suggestion to improve proc type infer, and some complains

2023-07-09 Thread termer
I only use the JS-style sugar proc syntax when I'm doing really simple functional array manipulation. Most other times it looks ugly or stupid.

asyncdispatch debugging

2023-07-05 Thread termer
If you're just starting out and don't depend on asyncdispatch for library support yet, I recommend trying Chronos. It's a lot better than asyncdispatch.

Ferus -- a tiny web engine written in Nim

2023-07-05 Thread termer
Yeah, I'd also like that. It'd be nice to be able to use a proper HTML parser library in Nim and be able to contribute to that.

GUI app with nim

2023-07-03 Thread termer
I agree with @SpotlightKid, using imgui-type UIs suck. Textboxes don't work right, keybinds are missing, and in the Nim ImGui project demo, there was no unicode support.

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

2023-07-03 Thread termer
Nimflatulenceationstancialisms

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

2023-06-30 Thread termer
@walkr This sucks

RIP Nitter

2023-06-30 Thread termer
lol that explains why my instance stopped working all of a sudden

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

2023-06-30 Thread termer
@Calonger It's a slightly more vulgar way of saying "stupid"

Twitter Clone in 60 lines of Nim

2023-06-30 Thread termer
JSON DB? Oh no

NodeJS/Bun addons powered by Nim 👑

2023-06-30 Thread termer
Hey that's super cool. I've always wanted a nice tool for creating native Node modules with Nim.

GUI app with nim

2023-06-30 Thread termer
@oyster You may want to check out [NIUP](https://github.com/dariolah/niup) which is a seemingly more complete and up-to-date binding with a higher level API

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

2023-06-30 Thread termer
I have never once considered myself a "Nimmer" or any other retarded made up word. I'm a Nim user lol

signalfd leaks in addProcess()

2023-06-27 Thread termer
I tried really hard to get asyncdispatch to work well for me, but the sad reality is that asyncdispatch fundamentally sucks. You should bite the bullet now and switch to Chronos before you further entrench yourself into the asyncdispatch ecosystem. Jester is slow and httpbeast (the server it ru

GUI app with nim

2023-06-26 Thread termer
I'm currently building an application with IUP and it's pain. The only reason I'm using that and not something else is because we need to support Windows XP. Otherwise, use something else. I'd also like to point out that Araq's IUP binding isn't updated for recent versions of IUP, so you'll have

  1   2   >