What's stopping Nim from going mainstream? (And how to fix it?)

2024-07-25 Thread cmc
"rapid development everywhere" is the best I've come up with to explain why Nim is so good in a nutshell.

How to Efficiently Implement Microservices with Nim?

2024-07-22 Thread cmc
I did a web-connected motor controller using raspberry pi GPIO pins using plain `asynchttpserver`, mostly because it's included in the standard library. I just run a case statement on the request method and path combination. I've fought too many frameworks to do anything more for less than a few

Small game written in Nim with a from-scratch-engine written in Nim (on Steam now)

2024-07-08 Thread cmc
Oh my goodness, just discovered this, it's just fantastic.

Cross-Compile Native Gui Apps with uing

2024-07-08 Thread cmc
Thank you! Ah, yes- I agree, you need to thoroughly manually test your code on all systems. However, when your major release is done and you shift into maintenance mode, and especially long-term maintenance, I found that importance shifts dramatically to automatic regression tests. That is wher

Cross-Compile Native Gui Apps with uing

2024-07-08 Thread cmc
Hi everyone! I noticed how much Nim changes the economics of software writing- you can write easily distributable GUI apps just as quickly as web apps, making GUI apps just as cheap. This is quite remarkable- try writing one in C++ or Rust, and suffer. Or just use Nim instead. Researching libr

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-18 Thread cmc
Oh, great- I thought you meant a fully-nim Nim pthread creator. A realtime Nim thread creator is totally worth it.

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-17 Thread cmc
Thanks!!! Oh yes I love std/posix- the emphasis here was 'quick'. A `pthread` solution is throwaway, any more effort would have to go towards Nim threads with `SCHED_FIFO`. Maybe copy/paste `createThread` into `createThreadRealtime`, add scheduling and put into Nimble package. But I don't know

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-17 Thread cmc
Okay so I got myself a a quick-and-dirty interim quick fix that works... I noticed I could just compile the C example into Nim and run it, getting a `runRealtime` proc that I can just feed a callback to. Primitive! But does work! I found you can use proper Nim threads for everything that isn't r

Realtime thread in Nim (SCHED_FIFO) in Linux

2024-06-17 Thread cmc
I'm looking to create a realtime thread in Nim- Linux-only is fine for now. In C, [according to the LInux foundation](https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base), creating a realtime thread looks like this (shortened C-like pseudocode):

How ready is Nim (and the ecosystem) for front-end web development?

2023-10-05 Thread cmc
I'd say it is completely ready right now as long as you are willing to read some source code of libraries to get information when documentation is missing. Also, the Nim channel on matrix is a great way to get quick help, people there are amazing.

Improving Examples and Documentation

2023-09-26 Thread cmc
Hahaha yeah, another Supercollider user! I learned the hard way to read the source instead of the docs using SuperCollider! It worked wonders for Nim as well! I know what, we'll just scrap the whole documentation thing and have Nim marketing exclusively target SuperCollider users, then we can cu

Improving Examples and Documentation

2023-09-26 Thread cmc
That's a really neat theory about documentation aversion. Reading your explanation, I got a hunch that maybe it's because considering others emotionally is built-in, while considering others cerebrally is rather hard work that can lead to overthinking and other problems so people throw in the t

Which tools do you use to code in Nim?

2023-09-22 Thread cmc
> choosenim + nim + nimble + vim + nimlsp Same here!

Cross-compile to Rpi4 :(

2023-09-22 Thread cmc
Nice!!! I'm doing it a little differently because I think using the musl C library means you need to compile statically, but I needed to depend on a dynamic library. So I installed a fairly old GCC (via the arch linux aur repository, other linux distros have other options). This means I have a

Improving Examples and Documentation

2023-09-18 Thread cmc
Yeah I don't mean to say we should do things the Python way- just be as effective. I'm rather fond of Nim's minimalism and terseness both in the language and the docs, I think 'comprehensive' is perhaps the most urgent need, both in scope and in detail. Why is testament internal use only? Would

Improving Examples and Documentation

2023-09-18 Thread cmc
I have created a github issue to serve as a central point of discussion and to hold sub-tasks, I will be adding the ideas from this discussion into sub-tasks in the coming days. Many thanks to everyone who participated and shared!

Improving Examples and Documentation

2023-09-15 Thread cmc
But @Araq, many of Nim's commonly used packages aren't documented at all- and I can tell that the ones that are fall short in very important areas. * They don't state in a nutshell what the package does, and when it should be used * They don't tell you how to get started, and if they do, the

Improving Examples and Documentation

2023-09-14 Thread cmc
Absolutely, that's what we should go for. If you want to go minimal, Starlette (FastAPI's little-known base) will do. I do suspect that you have the second part the wrong way around. I think part of why those examples are popular is because they put in the good documentation _first_.

Improving Examples and Documentation

2023-09-14 Thread cmc
Arch Linux has the best technical documentation I ever encountered, full of copy/pastable stuff that comes from a comprehensive list of things you might want to do. Then you can add your own stuff from there. Fantastic. The documentation is a wiki! Pretty much like what you're proposing. Of cou

Improving Examples and Documentation

2023-09-14 Thread cmc
I agree that we don't have to please everybody, especially not everybody on Twitter (yikes!). However- this guy's reaction, strong interest in Nim and then outright disgust at the careless state of the docs closely mirrored my own, so it resonated strongly with me. I was almost that guy- I almos

Improving Examples and Documentation

2023-09-14 Thread cmc
So you're the owlkettle guy? Owlkettle has some really, really nice documentation!!

Improving Examples and Documentation

2023-09-14 Thread cmc
I believe the correct way to document such a button would be to have a little blurb: "How to contribute to this guide: Use the edit button to create a standard github pull request. We are mostly looking for contributions in expanded examples, but correcting errors is also welcome." I actually u

Improving Examples and Documentation

2023-09-14 Thread cmc
This would be absolutely fantastic. I'm _always_ getting my info from the sources and _never_ expanding the readme. This should be put into the subject "Documentation contribution friction" in our to-be-created documentation plan.

Improving Examples and Documentation

2023-09-14 Thread cmc
Yeah, you're right! That was pretty cool. I have this blog commenting module I made that looks pretty much like the PHP thing, maybe that's worth a shot. It's kinda like a minimal disqus but without an iframe. Docs were really not bad at all with PHP. The language kind of constantly picked at

Improving Examples and Documentation

2023-09-14 Thread cmc
> Can we form some group/sub-community (in some channel) which solely focuses > on documentation of the ecosystem? That is an excellent idea. I'm in!!! I think that group could formulate a vision for documentation in Nim (lots of ideas in this thread could go in), and then create a series of st

Improving Examples and Documentation

2023-09-14 Thread cmc
Yes!!! There is a very simple reason why examples are so important: They allow you to operate on inductive logic- deriving a general rule from special cases. Without them, you have to rely on deductive logic- creating your own special cases from a general rule. This is much, much harder. Someo

Improving Examples and Documentation

2023-09-14 Thread cmc
Yes it does! No it doesn't! Yes it does ;) I think it kinda does imply that. Right now it's kind of like a road sign pointing at a road block. Remember that 10x underestimation assessment of mine? This is one of those areas where you go against your instincts.

Improving Examples and Documentation

2023-09-13 Thread cmc
Thanks!!! I believe I am :) Don't feel bad- it's normal. You know how at university, at a subject you're average at, it's so frustrating to go to a tutorial where the tutor is really, really good? They gloss over all the crucial basics because they think they're obvious. I would however ask yo

Improving Examples and Documentation

2023-09-13 Thread cmc
> Not really actionable and it's the nature of the thing that e.g. > strutils.replace doesn't tell you how to install Nim. No that's not needed, but the karax should show you how to install the package, run a hello world (it does some of this okay), but > Examples aren't working Inexcusable. C

Improving Examples and Documentation

2023-09-13 Thread cmc
Every programmer is a Nim programmer! They just might not know it jet ;) In all seriousness- the existing karax documentation isn't even remotely up to the job of introducing Karax even seasoned Nim programmers. I just started a project and I have to look through the source all the time even for

Improving Examples and Documentation

2023-09-13 Thread cmc
I have been talking about Nim on Twitter/X recently, and I got this feedback right here: `Nope I'm giving up on NIM. Karax has bad documentation too. Nim seems like a cool language but the frameworks really, really suffer from lack of examples and documentation.` [view thread](https://twitter.

Best Web Framework Features?

2023-06-03 Thread cmc
Personally, I only want a fast webserver. case statement on the path and method are good enough for me. I don't use an ORM- I either use raw typed SQL with tiny_sqlite, or limdb if I don't need SQL querying. I spent too much time trying to get the ORM to spit out the query I want. I do like som

Need suggestions for time scheduling async tasks

2023-06-01 Thread cmc
@PMunch thanks for recommending `at`!! @viud09 it's a lightweight persistent task scheduler. I have an unpublished comment system that uses `at` combined with `limdb` for that exact purpose- in fact, having a rate limiter is the original use case why `limdb` AND `at` were written. I would reco

German Tax Upload in Nim with Futhark

2023-06-01 Thread cmc
Hello @zembrowski! Welcome to the Nim-community- it's very cool that you joined us on this forum as well. Everyone, @zembrowski found my post on the elster forum and just went ahead contributed an essential feature to my very C-like code even though a just a little while earlier he had never hea

German Tax Upload in Nim with Futhark

2023-05-31 Thread cmc
@namisboss @PMunch That's right, you need to apply for a tax developer account to view the forum, which you can do here: . It can take a week or so to get your credentials. That's how you know it's actually from the German government, an imp

German Tax Upload in Nim with Futhark

2023-05-30 Thread cmc
I just got some feedback from a developer on the tax forum who tried Nim. He thinks Nim's compiler error feedback is very good- that's great news, I used to struggle there but not so much anymore.

German Tax Upload in Nim with Futhark

2023-05-26 Thread cmc
Of course- you're welcome, and thanks a lot for making futhark! Can't wait to unleash it on something else. Haha the manual API- it worked like this. You submit a SOAP request where you submit a request ID and a list of dataset-IDs and your e-mail address. Then you receive by email a reply that

German Tax Upload in Nim with Futhark

2023-05-26 Thread cmc
Tax time again in Germany. I've been dreaming of completely automating my taxes with a script for years and I finally went ahead and applied for a developer account at the German tax site, elster.de. I have interfaced with a few public German IT systems in the past and expected the worst- the mo

clarification on nim v2 removal of parallel & spawn

2023-05-22 Thread cmc
> Well, but I took great inspiration from it. :-) You mean you nimmed everything of value and hit the road.

Teach you to write nim code comfortably use vim if you like vim you must try :)

2023-05-20 Thread cmc
Works great, using it now

Teach you to write nim code comfortably use vim if you like vim you must try :)

2023-05-20 Thread cmc
Cool love me some Nim-Vim tips

Announce: LimDB 0.3.0 Now with types & block-syntax transactions

2023-05-13 Thread cmc
Thanks! I realized that was a core LMDB feature that needed a Nimish interface.

Announce: LimDB 0.3.0 Now with types & block-syntax transactions

2023-05-12 Thread cmc
LimDB 0.3.0 has landed! This is a rather large feature release. LimDB is a key-value store that makes it as convenient as possible to use the LMDB memory-mapped key-value database by providing an interface that is like a table. import limdb let db = initDatabase("myDirectory")

Good Languages Borrow, Great Languages Nim

2023-05-05 Thread cmc
I always felt a tiny bit uncomfortable with the name _Nim_ \- it has a nice ring to it, but _a shortened version of Nimrod_ just seamed a bit lacking in mystiqued. Now I just found out that that ["Nim" means "steal"](https://www.merriam-webster.com/dictionary/nim). There's even a mathematical

fetching data from many small .txt files

2023-04-30 Thread cmc
Seems like a good use-case for my LimDB. It's a table-like interface to a mature key-value database based on memory-mapped files . For smallish strings, this is usually a lot faster than file access because once the data is loaded the first time round, your code won't be doing calls to the kerne

Pass generic proc object different sub-types

2023-04-24 Thread cmc
For reference: Added request to improve error message here:

Pass generic proc object different sub-types

2023-04-23 Thread cmc
Thank you very much! Now considering if using typedesc params might be a smoother UI but maybe `f.deriveDifferentFoo[: string, float]()` is fine.

Pass generic proc object different sub-types

2023-04-22 Thread cmc
I have having trouble creating a generic type that can spawn other objects with a shared resource but different composite types. type Foo[A, B] = object a: A b: B x: int proc initFoo[A, B](x: int): Foo[A, B] = result.x = x proc de

Nim for mobile

2023-04-21 Thread cmc
> waiting for others to do things for you is usually a bad idea But we all try at least once, now don't we? ๐Ÿ˜‰

Article on wrapping C libraries in Nim

2023-04-18 Thread cmc
Intriguing. Did you have to deal with a build system to get CoAP working?

Which might be the best way to store complex data in MySQL

2023-04-18 Thread cmc
Personally I usually do stuff like that normalized to a database. Structured data you can mutate one-by-one is kind of the definition of what a relational database is supposed to do. I like tiny_sqlite a lot because it neatly maps type information without doing strings, and it's in-process- no s

Scan syntax tree for procedure calls

2023-04-13 Thread cmc
Thanks for the warning- and for your extended disussion for that matter! Darnit, I think I'm going for `(b)`.

Scan syntax tree for procedure calls

2023-04-13 Thread cmc
Aw shucks, discovered an issue db.withTransaction: t["fuz"] = "buz" if false: t.commit # does not add anything # transaction not ended, program blocks Run Statically ensuring a tagged proc is called in all code paths seems more trouble t

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
I stopped parsing the AST and I'm using tag-tracing now, so if someone missed anything, it was probably you! In all seriousness, this ought to cover all the cases. If you call the C-API in the indented code block you had it coming. I also just switched to generic types in the `generics` branch

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
Thank you! In @Araq's defense, you can always raise an exception to trigger a reset. And `withTransaction` only responds to compile-time logic. If you have a runtime-conditional write, you always get a commit, as proposed. You know, maybe I ought to go with `withTransaction` not because it's be

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
> It's pretty bad DSL design. Here is a better one: Thanks! Could you be a tiny bit more specific about what's bad about it, aside of naming?

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
> > When I first read about it I steered clear- I was struggling with generics > > and it seemed like >> just another one of Andreas' schemes to make my code > > harder to compile. > > Wait ... what? When you are used to dynamic languages, visible restrictions to enforce safety or keep data fl

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
This design here is a tiny bit magical but since you can override the magic and be explicit in a natural-feeling way, it might be the best of both worlds. It might also be a horrible nightmare of unclear corner cases. Care to play a guessing game with me? import limdb let

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
That's cool, so I think I'll use it in a 1.0 compatible way, or at least 1.4, since it's a library. I'm surprised how well tag tracking matches this need. I read about it and it seemed neat but I somehow imagined it was going to be overly restrictive. Far from it, it just does what it's suppose

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
> implement something big and find out what breaks You got the wrong guy! Betting the farm on a niche language? No problem. But stuff labeled 'experimental' is where this programmer draws the line.

Scan syntax tree for procedure calls

2023-04-12 Thread cmc
> One thing to note about using effects though is that it only tells you that a > write or read might be called Yes, in this case that's fine- if it's an automatic transaction, we commit if there might be a write, but reset if we're sure there was no write. For a read-only transaction we error

Scan syntax tree for procedure calls

2023-04-11 Thread cmc
Sounds great!! But why does this compile without any funky flags? According to the docs it's experimental, but it seems to work fine on my 1.4.8. And I would like to know if this can be done manually (in a reasonable way) as well.

Scan syntax tree for procedure calls

2023-04-11 Thread cmc
Holy flying bajeesus, it worked!!! I could have sworn I tried that exact combo with an untyped parameter but I guess I didn't. Thanks!!! To take it a step further I'm looking into if it's possible to track calls that aren't directly in the `body` parameter but in a procedure called by it. Seems

Scan syntax tree for procedure calls

2023-04-11 Thread cmc
@Pmunch hIf I may- even if I don't end up using it exactly in the way I imagined, I'd love to learn more about your approach to statically finding procedure calls in a code block. I might still ignore all expert advice ;) and go for rollback/commit autodetection after all, but even if I don't, I

Scan syntax tree for procedure calls

2023-04-11 Thread cmc
I see! Yes, this case would be covered by raising an exception. try: db.withTransaction t: t["foo"] = "bar" raise CatchableError("bail") except CatchableError as msg: echo msg # withTransaction rolled back Run This is kind of nice b

Scan syntax tree for procedure calls

2023-04-10 Thread cmc
Thanks for the ideas! I intend to have the commit and rollback as part of the transaction template so you don't forget it, that's why two different templates are needed. I originally intended one template with automatic choice but was convinced otherwise by the kind responders.

Scan syntax tree for procedure calls

2023-04-10 Thread cmc
thinking some more, actually `readTransaction` / `writeTransaction` describe the most common use case really well, so a note in the docs will do fine to explain the finer points. Looks like we have a winner.

Scan syntax tree for procedure calls

2023-04-10 Thread cmc
`readTransaction` / `writeTransaction` These are really good for exposing what's going on to whoever is reading the code. Adapting the freedom to drop the python-with, `read` and `write` might do it as well. But hang on- you can read from a writable transaction. The accurate terms would be ro

Scan syntax tree for procedure calls

2023-04-09 Thread cmc
> The programmer needs to do a little bit more thinking I am going to have to go write on Twitter now about problems in the Nim community, Andreas is requiring us to think. ๐Ÿ˜‰ All jokes aside, I just realized there is no loss in flexibility to get the readability, since you can raise an excepti

Scan syntax tree for procedure calls

2023-04-08 Thread cmc
That'll do it. I was thinking though it might be too inflexible to have to decide on whether to commit or not before the transaction is complete. Then I noticed it static analysis might not be enough to make that distinction- it may be better to simply have a 'written' flag in the transaction o

Scan syntax tree for procedure calls

2023-04-08 Thread cmc
That simple!!! Impossible. How can it be good if it's not complicated? ๐Ÿ˜‰ Actually that may be a way better idea. More control... But I'd still like to learn how to do the automatic version if it's not out-of-this-world complicated, it has its charm as well.

Scan syntax tree for procedure calls

2023-04-08 Thread cmc
Thanks for your feedback! Robust solution is why I'm here! My [limdb-module](https://capocasa.github.io/limdb/limdb.html) allows creating a transaction object, reading or writing to it with a table-like interface, and then either rolling it back or committing to it. For a read-only transaction,

Scan syntax tree for procedure calls

2023-04-08 Thread cmc
Cool looking into it... ๐Ÿ‘

Scan syntax tree for procedure calls

2023-04-08 Thread cmc
I am looking to write a syntax tree scanner. I have a list of procedures- call them `foo`, `bar` and `fuz`\- and I want to know if any of them are called in a code block. The point of the exercise is to have a template that behaves a bit differently depending on the block passed to it. The temp

Nim v2.0.0 RC2 is out

2023-04-03 Thread cmc
Good points! `async`, `json` and `threadpool` are different because their alternatives live in nimble. stdlib gives you clear guidance that you can follow or deviate from. You can invest brain cycles in a proper evaluation, but in a pinch you can accept stdlib's suggestion and move forward more

Nim v2.0.0 RC2 is out

2023-04-03 Thread cmc
You could make a good argument about that if it were good for adoption to argue with new users.

Generic initialization procedure with default type

2023-04-03 Thread cmc
Not bad!!! Now I to ponder whether I should actually do this... my init has some args.

Generic initialization procedure with default type

2023-04-03 Thread cmc
A default type can be a lot of things in general but what I mean here is to not to infer anything but to instruct the compiler to call `initFoo[string]()` instead of erroring out on any call to `initFoo()`.

Nim v2.0.0 RC2 is out

2023-04-03 Thread cmc
> But your other points are good. Thank you! > "Bugs" can be subjective, there is no pressure to "fix" them It depends. The one I fixed gave ["f", "oo", ""] splitting "foo" with whitespace. Complying with Perl's behavior might not be as critical but it we can start considering `re` a "comfort

Generic initialization procedure with default type

2023-04-03 Thread cmc
Is there any way to have a default type for an initializer for generics? I would like to allow users to call it without specifying type information to get a default type. It seems obvious this is not directly supported, but is there a way to achieve this behavior? type Foo[T] = obj

Nim v2.0.0 RC2 is out

2023-04-03 Thread cmc
And why do you think nobody is fixing those `re` bugs? Would you improve something with a perceived 50% chance of premature removal? It took a notorious risk-taker like me to fix even a glaringly obvious one. So what if `nre`'s API is marginally better? As you pointed out many times, if you wan

Nim v2.0.0 RC2 is out

2023-04-02 Thread cmc
Hard data is good when you have it but an impossible standard for every decision (and can have its own perils). Hence, my falling back the educated guess. I think that we would be losing zero users because of re/nre is downright implausible. I can't think of a programmer I know who doesn't use

Nim v2.0.0 RC2 is out

2023-04-02 Thread cmc
> each time we do it it adds friction to somebody's porting efforts I wouldn't recommend it lightly, but in this case I'd go as far as to say it's close to imperative with an eye on helping new users. Learning a new programming language is special because you are simultaneously studying and eva

Announce: LimDB 0.2.0

2023-04-01 Thread cmc
Thanks! That was a main design goal, glad it worked. I'd been using nim-lmdb before in my web apps, which already worked great, but I wanted something a little less verbose.

Nim v2.0.0 RC2 is out

2023-04-01 Thread cmc
Since this is a unique opportunity for breaking changes- Wouldn't it be a good time to put `nre` into a nimble package?

Announce: LimDB 0.2.0

2023-04-01 Thread cmc
You're welcome! Please do share about how you're using it if you like, it's always great to hear.

Announce: LimDB 0.2.0

2023-03-31 Thread cmc
I just released a new version of LimDB, the table-like interface to the LMDB in-process key value store. I've been using it in almost all my projects, mostly small web apps, and it works like a charm. I also found the interface very satisfying to use, so I think I struck the right balance betwee

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-31 Thread cmc
Great, thanks for the `lent` tip I thought that required a switch to enable. Suggested documentation is in this pull request, comments welcome.

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-31 Thread cmc
Okay I think I can see dawn... so if I were to simply use a dummy value, then I would be creating unpredictable behavior in those instances where the `var T` is passed to another function. So the reason to return a `var T` from a table is to allow another proc to modify it. But if I have a tab

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-31 Thread cmc
Oh yeah I understand heap values, refs and pointers, I specifically want to understand how mutable objects work, where there memory resides, and how the compiler treats them. I am also facing the practical problem of wanting a proc to return `var string` for consistency with similar procs with t

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-31 Thread cmc
@ElegantBeef @Araq Thanks! That makes sense. But if it's going to be a copy anyway, why can't I do this? proc foo(): var string return "foo" var a = foo() Run I know the direct answer is 'because it's not an l-expression', but my question is, why does i

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread cmc
The part I don't understand though- with `mgetOrPut` the manual goes to great lengths to explain that a mutable copy of the value is returned. import tables var t = initTable[string,string]() var foo = t.mgetOrPut("foo", "bar") foo = "fuz" echo foo # prints bar, not

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread cmc
Oh great thanks for explaining! That helps a lot

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread cmc
Please disregard the previous message, I'd overlooked something! But now I've got it. Okay so my Eureka moment was that there have to be two different `[]` accessors, one for `Foo` and one for `var Foo`, and that's exactly what's happening in the tables module where there is one for `Table` and

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread cmc
Thanks for explaining! Can you show me how to create such an l-value and return it? If I just define a mutable variable it resides on stack and cannot be returned.

Mutable return type works fine for myTable.mgetOrPut but not for a custom proc

2023-03-30 Thread cmc
It says in the manual that a mutable return value needs to be derived from the first argument of the proc. What is strange that for the `mgetOrPut` proc, calling `[]` seems to count as deriving, but using a custom proc does not. Here, it seems to be a problem that a copy of an immutable variabl

A seasoned programmer's take on Nim's docs

2023-02-07 Thread cmc
Thank you for the thoughtful input and the real world data points. I've felt similarly to your colleague a lot, I tend to run into situations where I'm stuck and there's nowhere to go. Then it seams that Nim is creating more problems than it solves. I think a good word that somes everything up

Getting started with Nim on attiny85

2023-02-07 Thread cmc
I think a good thing to look at is power. Raspberry pi pico seems to draw 25mA if idle and 390uA dormant, compared to the attiny85's 2mA and 1ยตa dormant. So if you don't need the pi's features, you can run an attiny85 a lot longer on a coin cell. I made a similar comparison once when I was look

Nim v2: what would you change?

2023-02-06 Thread cmc
Small one- in the times lib, scrap old initDatetime and rename inconsistently named datetime proc to initDatetime.

Getting started with Nim on attiny85

2023-02-06 Thread cmc
It has a nice web site and a pleasing demo on the first page! That counts for something. Don't worry, I expect plenty of swearing and hair-pulling later.

  1   2   >