Passing iterators as arguments

2020-11-04 Thread Araq
Thanks, I now understand the feature better. However, I'm even less convinced that it's a good idea for Nim. Even assuming that it is bug-free and works well with the existing features, it would cement our current generics system (generic proc bodies are not type-checked) futher. But I long for

handmade hero in nim ( warning: noob)

2020-11-04 Thread 19
How can I make sure I'm getting maximum performance when writing code that uses traced data types? Is there a set of rules/guidelines? I also noticed that move semantics come into play when I want to move this data around in the codebase. Thanks!

Newbro here, Hi to NIM comunity

2020-11-04 Thread torarinvik
> Perhaps you might tell me "Learn python first, then come back." Please, NO! You don't really need to know Python before you start with Nim. The real benefit of Python is that it has more libraries and if you are stuck you can just google the problem and teaching material is in abundance. Howe

Passing iterators as arguments

2020-11-04 Thread Sixte
@timothee's alias resp. aliassym should provide a witness. > I still don't understand the problem domain and solution space well enough. > Your tests only prove that the feature works as you claim it works. We have > no idea what an "alias"-heavy codecase looks like, how the feature interacts >

[b]Tìm hiểu cách thức tham gia làm tiếp thị kết liên cho Lazada hiện nay.[/b]

2020-11-04 Thread anh1990
[b]Tìm hiểu cách thức tham gia làm tiếp thị kết liên cho Lazada hiện nay.[/b] Để [u][url= tiếp thị liên kết cho Lazada[/b][/url][/u] - Tiếp thị liên kết hiện đang là một kinh thức buôn bán tuyệt vời đ

quit() returning bool in else branch?

2020-11-04 Thread solo989
You can work around it with if init(): discard ok() else: quit(1) Run or if init(): ok() else: quit(1) discard Run

quit() returning bool in else branch?

2020-11-04 Thread solo989
I looked into it a bit further. Your ok function returns bool and is {.discardable.} correct? The type of an if stmt is determined by it's first branch. If the first branch is quit(1) the type is void and ok() {.discardable.} is compatible. However if the first branch is ok() it determines the

quit() returning bool in else branch?

2020-11-04 Thread solo989
I assume your ok function returns a bool. This is the case of a slightly misleading error message. All branches of an if stmt have to return the same type so the quit branch implicitly returns a bool. If your ok function returned nothing or was discarded the error message would disappear.

Nimpretty GitHub Action

2020-11-04 Thread juancarlospaco
GitHub Action to auto-prettify all your Nim source code files using `nimpretty`. *

quit() returning bool in else branch?

2020-11-04 Thread Akito
I've encountered something weird. Not sure if it is a bug or if I'm missing something. Works: if not init(): quit(1) else: ok() Run Does not work: if init(): ok() else: quit(1) Run Telling me: >

Overriding ==

2020-11-04 Thread aqeelat
How would this be inheritable? Also, this means that we need to recompile the class when we want to add functionality. For example, if we designed a HashSet class, and then another developer wanted to create a SuperHashSet, they would have to access our code and add stuff to it, and they would h

Overriding ==

2020-11-04 Thread sschwarzer
Um, would this allow adding new methods without modifying `LoadDrawSaveable` (which then should have a more generic name)? Sorry if I come across as picky here. mratsim brought up the expression problem and I'm just curious if _both_ "dimensions" (independently adding types and adding operation

Newbro here, Hi to NIM comunity

2020-11-04 Thread Dan
This is how i imagined it to look:

Someone have an idea on how to implement a `[][]=` function?

2020-11-04 Thread zevv
Make it a two-step process: import tables type FormTableSeq[T] = seq[T] FormTableRef[T] = ref object table: Table[string, FormTableSeq[T]] proc `[]`*[T](f: FormTableRef[T], key: string): var seq[T] = f.table[key] proc `[

Someone have an idea on how to implement a `[][]=` function?

2020-11-04 Thread Yardanico
What about func `[]=`*[V](form: FormTableRef, key: string, index: BackwardsIndex, value: V) = form.table[key][index] = value formData["test", 0] = "abc" Run I think that this should work for you

Someone have an idea on how to implement a `[][]=` function?

2020-11-04 Thread mrhdias
I wanted to implement a function to read from a table the value of a sequence index for a key. A hypothetical example: Instead of this: func `[]=`*[V](form: FormTableRef, key: string, pair: tuple[index: BackwardsIndex, value: V]) = form.table[key][pair[0]] = pair[1]

handmade hero in nim ( warning: noob)

2020-11-04 Thread 19
Thanks amalek, that looks interesting indeed, thanks for sharing! I managed to rewrite the ugly pointer code using a seq from the first try! I love Nim ! proc resizeTextureAuto(renderer:var Renderer, width: int, height:int ) = if globalTexture != nil: destroyTexture(gl

First Nim package: Euler angle command line utility. Feedback appreciated!

2020-11-04 Thread kamek
I recently got interested in Nim and have been reading the manual. Anxious to get my hands dirty, I decided to re-implement one of my C++ projects in Nim. It is a simple command line utility that converts Euler angles to rotation matrices and unit quaternions. Project is here:

How to measure HttpClient request total time

2020-11-04 Thread tutamona_io
This is sweet! Thank you both! I want to learn Nim so I’m trying to port my cli tools without any Python like syntax and do this Nim way. Thanks again!

Sublime Text user experience

2020-11-04 Thread Stefan_Salewski
> Semantic highlighting is in fact better Does it work without causing high CPU load? I tested it some years ago with my NEd editor, only with nimsuggest without lsp, but for nearly all edits there was a lot of nimsuggest traffic generated. I had no idea how I could avoid the traffic, so I stop

Sublime Text user experience

2020-11-04 Thread Yardanico
Why though? Semantic highlighting is in fact better than normal syntax definitions, because with semantic highlighting you know the tokens as the compiler sees them, so it's always correct.

Sublime Text user experience

2020-11-04 Thread AmjadBHD
As for sublime there was a lengthy discussion on the ST discord server about semantic highlighting and whether or not sublime should provide API to support it without a final say for now. See also: and

How to measure HttpClient request total time

2020-11-04 Thread treeform
If you just want to time a request call: import httpclient, times let startTime = epochTime() var client = newHttpClient() echo client.getContent("http://google.com";) echo "took: ", epochTime() - startTime, "s" Run

Sublime Text user experience

2020-11-04 Thread AmjadBHD
I don't think semantic highlighting reduces the need for good syntax definitions. But works as a complementary to it.

How to measure HttpClient request total time

2020-11-04 Thread juancarlospaco
timeit(100): # Python-like timeit.timeit("code_to_benchmark", number=int) sleep(9)# Repeats this code 100 times. Output is very informative. Run `sleep(9)` is like your code with the task to measure. Prints something like: 2020-06-17T21:59:09+03:00 TimeIt: 10

How to measure HttpClient request total time

2020-11-04 Thread juancarlospaco
If must be without any library for some reason: include prelude let t0 = cpuTime() code_here() # Code here echo t0 - cpuTime() Run

How to measure HttpClient request total time

2020-11-04 Thread tutamona_io
Hello, I'm new to Nim and I'm trying to learn it by doing and currently working with HttpClient and I'm trying to port some of my simple Python tools to Nim just for fun and wondering if anyone knows how to get total request time in Nim? I have a tool which does some API calls and rapports back

Where to request code review?

2020-11-04 Thread Kiloneie
Join the discord server, there is a lot of activity on it, you can ask Nim stuff in #main channel.

Some questions regarding gc-safety, httpclient and timezones

2020-11-04 Thread graynk
Thanks, it's working now! @treeform thank you for offering help, but I went with using system tzdata as @GULPF suggested, I wanted to do that from the start, just didn't know it was an option. Now only two questions remain, both kind of about the same thing regarding gc safety and accessing gl