sequtils.nim(786, 15) Error: expected: ':', but got: 'result'

2022-12-04 Thread PMunch
Are you sure it was done via the extension? It lists "Rename support" as a TODO feature. If it is through the extension, or another Nim aware extension, then it's likely done through nimsuggest. If so then please raise an issue in the nimsuggest issue tracker.

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread Araq
View types come with borrow restrictions though and will offer a Rust-like experience. `strutils` won't be patched to use them because strutils is for ease of use and not for performance. Also, strings could simply offer O(1) slicing and copy on write. This model would be much nicer for newcome

Can wasMoved be overloaded?

2022-12-04 Thread Araq
Unfortunately not. But it should be supported.

ROS2 Library port (Robotics)

2022-12-04 Thread inventormatt
This is exciting news and I'll definitely check it out when I have a chance. I can't wait to see the final product and finally be able to do robotics more readily in nim

Can wasMoved be overloaded?

2022-12-04 Thread demotomohiro
Can wasMoved be overloaded? `wasMoved` cannot be overloaded? I tried to overload `wasMoved` proc for my object type but it is ignored. # testmove.nim type Foo = object name: string x: int proc `=destroy`(x: var Foo) = echo "Destory ", x.name,

ROS2 Library port (Robotics)

2022-12-04 Thread elcritch
Hey all, I finished porting over CDR from a typescript implementation. This is the core serialization piece of ROS2. Turns out it packs data similar to structs in most C compilers with padding/alignment roughly the same. There's a header with endiannes information, but it's pretty simple. Most a

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread Stefan_Salewski
> It’s a pity that is relatively easy to do the wrong thing (performance wise) I guess the split(lines) is the main issue, as it does some allocations. Maybe 18 months ago I read somewhere, that this may improve with the new view types, maybe in Nim 2.0 or 3.0? I don't know. Actually I did some

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread jrfondren
It's a very very marginal 'wrong thing', and it comes with conveniences: you have a value type that you can mutate or pass around or sometimes make live much longer than the current line without fighting a lot of friction. For example, if you're adding this line-processing to existing code that

Forum subscription feature

2022-12-04 Thread moigagoo
Let's have a hackathon and fix some issues with the forum? I think the lack of subscriptions in not an issue, it's a blessing. But switching to Norm, refactoring the code, and adding the docs would be great. Maybe fix that Like issue (I don't think switching from SPA to traditional site is possi

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread Araq
> Perhaps there could be a macro that you could use to wrap some code and if > there were any allocations inside of it it would throw an error? No, just use a profiler and don't expect to be able to produce the fastest code within 10 minutes of tinkering around. You shouldn't expect splitLines+s

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread didlybom
It’s a pity that is relatively easy to do the wrong thing (performance wise) for some of these simple cases, particularly coming from Python. Perhaps there could be a macro that you could use to wrap some code and if there were any allocations inside of it it would throw an error?

Forum subscription feature

2022-12-04 Thread exelotl
I've probably said some of this before but: * I like the Nim forums, they're simple and run well even on underpowered devices. * There is room for improvement, but I don't think that means they should be replaced... they handle the 90% case pretty well. * I dislike the fact that the forums

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread nimcurious
`nim` does have a `sum()` in [std/math](https://nim-lang.org/docs/math.html#sum%2CopenArray%5BT%5D) Not using `sum()` or `mapIt()` cuts runtime in half for me: Original code: Expected total = 44850.0 Actual total = 44850 real0m0.457s

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread bjorn_madsen
An undocumented feature is perhaps that parsecsv also handles utf-encoding formidably. I ran this: import std/parsecsv from std/os import paramStr from std/streams import newFileStream var s = newFileStream(paramStr(1), fmRead) if s == nil: quit("Cannot

Forum subscription feature

2022-12-04 Thread carterza
Because the folks who built the forum have always claimed they are good enough and that the forums are a shining example of Nim's capabilities. Therefore, we should keep them around not migrate to alternatives. Plus, it's probably work. It's a good question regardless.

Advent of Nim 2022

2022-12-04 Thread jasonfi
Related: [Placing #1 in Advent of Code with GPT-3](https://news.ycombinator.com/item?id=33850999) I asked ChatGPT to write a web framework for Nim. It wrote a a small program that looked like it could work, but was very minimal.

Advent of Nim 2022

2022-12-04 Thread SolitudeSF
> but nobody writes their api to accept openArray[char] damn shame

Advent of Nim 2022

2022-12-04 Thread Yardanico
> but nobody writes their api to accept openArray[char] This is changing though, thanks to Beef we have this in devel (and it'll be in 2.0): "Added openArray[char] overloads for std/parseutils allowing more code reuse. Added openArray[char] overloads for std/unicode allowing more code reuse."

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread N4v
Thanks guys, this is very informative and give me a lot to think about! @Araq, at the time I was starting to read the CSV in Nim, I didn't know there was a `parsecsv` module. Also, I wanted to make the examples as similar as possible. (Of course I see now that my two examples were different in s

Advent of Nim 2022

2022-12-04 Thread shirleyquirk
Does mmap.lines allocate too many strings for your liking? sure, you could iterate over memslices, but nobody writes their api to accept openArray[char], do they now. why not mmap the file directly into memory as a nim string literal? import std/[memfiles,parseutils,posix,sequtils,

Forum subscription feature

2022-12-04 Thread pposca
I agree with you, but why does not the community migrate to a modern feature rich solution? From your words, I think this has been an already discussion here.

Forum subscription feature

2022-12-04 Thread carterza
If that's all you're doing when browsing the forum, then no, I guess not. The forum has a documented issue with retrieving old posts though. I've been struck by this in the past when trying to dig up old threads. My main gripe with NimForum is t

Forum subscription feature

2022-12-04 Thread moigagoo
Sorry but I can't relate. I have zero issues retrieving posts on this forum. I just visit it from time to time and check unread messages. Am I doing it wrong?

Why is Rust faster than Nim in this CSV parsing example?

2022-12-04 Thread Hlaaftana
To simplify the answers, the biggest differences are: 1. `splitLines` returns full `string`s, which are copied substrings from the original string vs. something like `lent string` or `openarray[char]` which would be equivalent to what Rust does 2. `sequtils` procs like `mapIt` do not produce