OrderedTable missing Seq methods

2022-02-26 Thread JohnLuck
@sls1005 I know, I use sort to topologically sort and actually also to reverse Tables. Pop does not remove the first key/value in a ordered table, so not exactly the use case I desire. @ynfle No, indexing makes sense for anything ordered. Obviously you can reasonably talk about for example the

Raises tracking and no more cyclic references in `chronos`

2022-02-26 Thread elcritch
> Really cool! Does this mean that Chronos can be used with ARC without leaks > now? That’d be awesome! Given that both closures and iterators are ARC compatible it seems likely chronos async could work with ARC. I’ll have to try it out and see if it’ll work on an embedded service. :-) > poor

Fidget UI: scrolling on OpenGL backend

2022-02-26 Thread elcritch
P.S. here's a demo of a slider bar that can use mouse scrolling:

Fidget UI: scrolling on OpenGL backend

2022-02-26 Thread elcritch
> Always good to have a new GUI option. I wonder how the competition of the > GUIs wil turn out. Hopefully it's not a zero-sum game. :-) Though Nim has a lot of half-workable UI options which is a pain. It's odd but Fidget is like 90% of the way to making useable UIs comparable to ImGUI. > I m

linux moving to C11

2022-02-26 Thread reneha
Well, yeah, stronger type checking would be worth it. Maybe Linus would do the switch if he know how to keep the programmers from using the other features of C++. As I remember it, Linus didn't want C++ because because the programmers could be tempted to do "OO model crap".

Anyone working on a new Nim book or second edition of Nim in Action?

2022-02-26 Thread Pyautogui
This is might not be formally released soon, but it is a book in development. It is written in English by a non-native speaker of English, which might throw some people off, but it is certainly an extremely valuable resource and a lot of effort has been dedicated to it.

OrderedTable missing Seq methods

2022-02-26 Thread ynfle
A table, the general programming, doesn't have a concept of indexes so accessing by index doesn't make so much sense. I'm not sure if you want to find by key or value. For key you can use `in`. For value you can use @sls1005's answer. It seems your ids are sequential, so you could use a `seq`.

Anyone working on a new Nim book or second edition of Nim in Action?

2022-02-26 Thread gcao
Hi, If anyone is working on a new Nim book or the second edition of Nim in Action, please share the link for EAP here. I understand Nim in Action code examples are updated to work with newer version of Nim. However, I hope more books are released in order to attract more people to Nim. A good c

Fidget UI: scrolling on OpenGL backend

2022-02-26 Thread Hobbyman
Always good to have a new GUI option. I wonder how the competition of the GUIs wil turn out. I myself have chosen for the browser-based interface because I think the browser isnt going away any time soon. But what do i know? :-)

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread haoliang
thanks for awesome documents you have made, i'm deadly longing for the missing chapters: * A more elaborate discussion on garbage collection, and the available GC flavours in Nim. * Using Nim without a garbage collector / embedded systems with tight memory. * The new Nim runtime! * Memor

linux moving to C11

2022-02-26 Thread Araq
Nim targets C89 with some extensions like `__inline`. What Linux does has no impact on Nim.

Calling nim-server-code from javascript

2022-02-26 Thread Hobbyman
It may be a poor choice but it is a working choice now :-) In the end of the file the cookie-processing-code is written. I use now only one cookie that i set to disabled after it has been read by the server to prev

OrderedTable missing Seq methods

2022-02-26 Thread sls1005
[sort](https://nim-lang.org/docs/tables.html#sort%2COrderedTableRef%5BA%2CB%5D%2Cproc%28%2C%29) and [pop](https://nim-lang.org/docs/tables.html#pop%2COrderedTable%5BA%2CB%5D%2CA%2CB) are in std/tables. I agree that `reverse` should be provided. It's hard to implement without accessing the under

Embedded STM32 - Bare Metal Bootstrap

2022-02-26 Thread rad
Want to get Nim fired up on a STM32 board? I uploaded a video showing a process that hopefully works for most boards. The STM32cubeIDE is used to generate all the steps needed to build a project and then abandoned. Well mostly, the IDE is a powerful tool for debugging. The steps in the process:

linux moving to C11

2022-02-26 Thread sls1005
I think it's compiled to C99. I've tested for `--passC:-std=c89`. It failed, saying inline is not defined, but it works with `-std=c99`. And I don't think the change will affect us, unless you're going to compile your own kernel.

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread zevv
Take a peek at for more details

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread PMunch
Ah, it seems like I was slightly mistaken. I could've sworn that's how they worked, but I seem to have mixed refc and ARC. But you're right, on the default refc GC it almost follows the memory layout I mentioned, but it's only a pointer which is stored on the stack and the data in the struct is

linux moving to C11

2022-02-26 Thread tcheran
This is just for curiosity. It appears Linux will move to C11. What C version does Nim currently compile to? Will this migration of Linux to C11 have any foreseeable impacts on Nim?

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread Stefan_Salewski
> A sequence holds three things in a small stack-allocated object, the > "capacity" which is the size of the buffer, "length" which is the current > amount of elements in the buffer and a pointer to the "buffer" itself. This > amounts to 24 bytes. Sorry, I do not have you valid email address, a

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread PMunch
We can do this with a bit of simple math. I'm assuming here that you're on a 64-bit machine so that pointers and integers are 8 bytes long. A sequence holds three things in a smalle stack-allocated object, the "capacity" which is the size of the buffer, "length" which is the current amount of el

Is there any kalman filter package in Nim?

2022-02-26 Thread elcritch
Here's that second example converted to Nim (mostly):

Is there any kalman filter package in Nim?

2022-02-26 Thread elcritch
I just searched and didn't find any. I'd like to make one soon though for embedded work, but I won't get to it for at least a month. They're really not too difficult to implement with a linear algebra solver. Arraymancer should have one, or the SciNim repos might have an alternative implementat

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread mardiyah
Anyone really understand how Nim MM works ? what being asked is The array of string pre allocation e.g. `newSeqOfCap[ array[ 3, string ] ](50)` How to definitively calculate the memory being allocated at the moment the command/statement is executed as the `string` won't determine the size and ho

Comprehensive knowledge on Nim memory management (MM)

2022-02-26 Thread ElegantBeef
Generally speaking Nim's collections allocate enough for 64 elements by default, so you can use that as an assumption of the memory allocations unless manually specified.

Is there any kalman filter package in Nim?

2022-02-26 Thread mardiyah
Not yet AFAIK, and as can be seen in algorithm module there's none One can start create, build one