Re: Hacktoberfest with Nim

2019-10-03 Thread ffred60
would be nice to be possible (for Nim dev team) to pin a post at the top of the list on the forum. this one would be a good candidate, at least for a few weeks...

Re: nimpretty binary could not be found

2019-10-03 Thread zetashift
Try from the command line nimpretty file_to_format.nim and see if that works?

Re: generated_not_to_break_here breaks coco

2019-10-03 Thread e
Unfortunately that doesn't seem to work for me; I still get #line 99 "generated_not_to_break_here" Run In fact with `-d:release` I also get #line 189 "iterators.nim" Run as a relative path as well as the correct absolute path in the

Re: Difference between discard and await?

2019-10-03 Thread cantanima
Is this what you did? let line = discard client.recvLine() Run If so, then: @[anyone else] That should be a bug, shouldn't it?

Re: Difference between discard and await?

2019-10-03 Thread juancarlospaco
`await` gets you the content of a `Future`. `discard` just discards whatever you pass as argument. `proc` with `{.async.}` always return `Future`. (usually compiler wont let you just discard/not use stuff).

Re: generated_not_to_break_here breaks coco

2019-10-03 Thread juancarlospaco
`-d:release` wont generate those, not sure I understand tho... 樂

Re: Nim for Beginners Video Series

2019-10-03 Thread Kiloneie
I will, thank you all for the support :).

Re: Global proc/method to print a type and its properties?

2019-10-03 Thread sky_khan
`for v in users: for name, value in fieldPairs(v[]): echo(name, "=", value) ` Run

generated_not_to_break_here breaks coco

2019-10-03 Thread e
The Nim compiler is putting lines like this into the generated C code: #line 99 "generated_not_to_break_here" Run This is breaking `coco`, which uses `lcov` by causing it to try to process the file `generated_not_to_break_here`, which doesn't exist. Is there a

Re: Showing available memory

2019-10-03 Thread Lecale
That's probably a bit beyond me, or at least the level of time I want to invest to get this to work tomorrow. Still I look at the example that prints out the dimensions of the screen and dream I might work out how to call that.

Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread girng
Wow server.bindAddr(Port(9000)) Run `server` gets passed to the first argument in the background? Then in my case, the next argument is port, which is the first argument. Interesting, but very confusing at first.

Re: nimpretty binary could not be found

2019-10-03 Thread girng
Can I compile nimpretty on Windows? Is there a guide?

Global proc/method to print a type and its properties?

2019-10-03 Thread girng
Example code: type Client = ref object of RootObj name: string user_id: int var users: seq[Client] users.add( Client(name: "george", user_id: 1) ) for v in users: echo v.name Run For example,

Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread SolitudeSF
read the tutorial/manual. [https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax](https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax)

Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread juancarlospaco
Your `server` is `AsyncSocket`. You can pass `port = Port(9000)` too. Nim is style agnostic. `bindAddr(server, Port(9000))` will work too. echo "a" echo("b") echo"c" "d".echo "e".echo() Run Nim has

Re: nimpretty binary could not be found

2019-10-03 Thread SolitudeSF
just compile it yourself and place its binary in PATH. its sources are included with nim.

Re: nimpretty binary could not be found

2019-10-03 Thread girng
@miran Thanks for the update. In the meantime, are you on windows? Or is there anyone here that can send me their nimpretty executable? I'm on a roll with nim, I really like the syntax so far.

Re: Showing available memory

2019-10-03 Thread dom96
I'm not aware of any packages that do this, but you can write your own. The WinAPI is fairly straightforward to use once you get the hang of it, I and many others I'm sure are happy to help as well. This is likely what you want:

Re: NIM in action offline resources

2019-10-03 Thread pouya
@miran sorry for late reply, cause an image worth thousand words here are the images. [Images Gallery](https://postimg.cc/gallery/2ikttr5ei/) regarding TOC, I meant navigating through TOC using Kindle Go to option in the Toolbar. Normally it should list all the heading and subheading of the

Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread girng
> const dont need all uppercase names anyway. That is my style, I like my const names all uppercase `bindAddr` has 3 parameters AFAIK, socket, port and address, correct? How come simply passing in `Port(9000)` works, instead of `port = 9000`? I'm following the parameter guide from

Showing available memory

2019-10-03 Thread Lecale
Hi, another nim newbie here. I was looking for a way to show the available system memory for Windows OS. My research took me as far as the psutils package, and then I started sobbing when I read "Linux only". Is there anything else I can use, like a way to query windows counters with nim. If

Re: nimpretty binary could not be found

2019-10-03 Thread miran
It is a known problem, and we will fix it (ship nimpretty with Windows version) for v1.0.2 coming out next week.

Re: Parameter location doesn't match proc api parameter location

2019-10-03 Thread juancarlospaco
Your `PORT` is colliding with `Port`, it literally says that, `const` dont need all uppercase names anyway. Your `server` is a socket. Check `nimpretty` and `nim check --styleCheck:hint` on the terminal. const portNumber = 9000 server.bindAddr(Port(portNumber)) Run

Re: Nim for my future project ?

2019-10-03 Thread juancarlospaco
Because most of the linked pages are unmaintained. TLDR is pretty maintained sin people can contribute to it. Licenses are restrictions. You have licenses like WTFPL which mentions no restrictions, then software is Proprietary for the law. Just like a software with no license is proprietary

Re: Integrate NIM with C based project.

2019-10-03 Thread mratsim
> (heap overlaps stack, so one function jump outside one's bound). That seems very improbably. It's more likely that you have a stack overflow and while writing a stack variable you also overwrite the return instructions of your function. Is your code open-source? If you compile your code

Re: Nim for Beginners Video Series

2019-10-03 Thread girng
I'm an avid Crystal user. And I just stumbled upon these videos, heck yeah. This language's syntax is freaking awesome I'm falling in love with it. Please continue to do more tutorials

nimpretty binary could not be found

2019-10-03 Thread girng
I downloaded the Windows version of nim here: [https://nim-lang.org/install_windows.html](https://nim-lang.org/install_windows.html) Installed the nim extension, but when I save my files, I receive an error: > No 'nimpretty' binary could be found in PATH environment variable I can't find any

Re: Nim for Beginners Video Series

2019-10-03 Thread Kiloneie
#10 is live at: [https://youtu.be/AtLz9Q_pcNM](https://youtu.be/AtLz9Q_pcNM) Longest one so far.

Re: What does the asterisk do after a variable name?

2019-10-03 Thread girng
Nice. I thought it had to do with pointers, references, etc. I was like omg lol

Integrate NIM with C based project.

2019-10-03 Thread Lachu
I tries to rewrite my project, called progress: call to power (game based on Freeciv) to nim, because I have memory problems (heap overlaps stack, so one function jump outside one's bound). I tries different approach. First was adding nim.cfg given bellow: cincludes:../c-files/common

What does the asterisk do after a variable name?

2019-10-03 Thread girng
Example: var users* {.threadvar.}: seq[string] Run I'm brand new to nim. Just heard about it today and I'm in love with the syntax. I googled but couldn't find anything. I think I read it was something to do with exports, but not sure?

Re: Copy-on-write container

2019-10-03 Thread cumulonimbus
I might need a copy-on-write implementation, and was wondering if this is still a good way. Am I right in thinking that this will only work with the refcount gc, and not with the new (owned/bd) or alternative (mark & sweep, boehm, regions) gcs?

Re: Using Nim to create an Xcode framework

2019-10-03 Thread pier
> The GC and memory management between nim, c, and switch would be a constant > pain point. You would have to export c style structures. It might even make > sense to write the header file in C as glue and have both nim and swift use > it. I will have time in a couple of weeks to try this. I

Re: How to tie procedure to type?

2019-10-03 Thread japplegame
Looks disgusting, sorry.

Re: Nim vs. Python & Groovy (string splitting): Why is string splitting so slow in Nim?

2019-10-03 Thread brentp
I finally wrote a quick wrapper for gzfile that looks a lot like nim's File. You can use like import gzfile import strutils var vcf:GZFile doAssert vcf.open("test.vcf.gz") for line in vcf.lines: if not line.startsWith('#'): # do something

Re: Nim for my future project ?

2019-10-03 Thread sschwarzer
Thanks for your extensive reply! I think I see where our misunderstanding comes from. As I understand, you're seeing the term "open source" literally from the perspective of an individual user. In contrast, my perspective is that of a software maintainer picking a license for their publicly

Re: Nim for my future project ?

2019-10-03 Thread sschwarzer
The reason why I think the Peer Production License doesn't comply with the open source definition (point 5) is that, even though the license doesn't restrict _all_ commercial use, it restricts _some_ commercial use (point 4 c and d). This isn't visible in the boxes at the top of the respective

Re: Introducing nim-metrics - a client library supporting Prometheus, StatsD and Carbon

2019-10-03 Thread zulu
Wonderful!! ill check it out when i have more time

Re: procedure as table value

2019-10-03 Thread cdome
You can as long as a_proc and b_proc has exactly the same type signature.

procedure as table value

2019-10-03 Thread geohuz
Is it possible to put the procedure into table's value, and be dispatched like python dictionary? var dispatch_table = {"a": a_proc, "b": p_proc}.toTable Run it looks like im getting this error: Error: invalid type: 'None' in this context: 'proc (s: var

Re: Nim for my future project ?

2019-10-03 Thread juancarlospaco
[https://tldrlegal.com/license/mit-license](https://tldrlegal.com/license/mit-license) ↔️ [https://tldrlegal.com/license/peer-production-license](https://tldrlegal.com/license/peer-production-license)

Re: Nim for my future project ?

2019-10-03 Thread LeuGim
Well, then... call that "not-legally-usable-for-some open source" :). Or "with restrictions". Though seems the only restriction about the sources themselves is "You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the

Re: NIM in action offline resources

2019-10-03 Thread miran
> there is no way to upload images in the forum If you could upload them to [imgur](https://imgur.com/) or any other image-sharing site, and then post links here, it would be really helpful for me to see what is going on. (I'm not seeing that in Calibre) > Table Of Contents doesn't work as

Re: Nim for my future project ?

2019-10-03 Thread federico3
> The definition of open source at opensource.org seems to be quite > restrictive; by common sense, sources are open, if just are freely > accessible, in the original, non-obfuscated form. In this case common sense is not correct. Making sources available online does not provide legal rights

Re: NIM in action offline resources

2019-10-03 Thread pouya
@miron Many thanks for your time and effort. I scanned through the book on my kindle paper white (actually its pretty and old one. Generation 1) Things that took my attention: 1. Table Of Contents doesn't work as expected. 2. There is extra space everywhere. I took some pictures but it

Re: Introducing nim-metrics - a client library supporting Prometheus, StatsD and Carbon

2019-10-03 Thread stefantalpalaru
> non-blocking The StatsD protocol is also used over TCP, not just UDP: [https://github.com/statsd/statsd#statsd](https://github.com/statsd/statsd#statsd)\--

Re: Getting Unix-Style file permissions

2019-10-03 Thread cblake
It may also depend on how "standard" the desired string is whether @jasper's solution is enough for @cnuzzi. Usually, the setuid, setgid, sticky bits have some `'s'` or `'t'` substitutions for the `'x'`, and capitialized `[ST]` if one of those bits is set but the corresponding execute

Re: Nim in Action Help thread

2019-10-03 Thread Stefan_Salewski
OK: $ nim -v Nim Compiler Version 1.0.99 [Linux: amd64] Compiled at 2019-10-03 Copyright (c) 2006-2019 by Andreas Rumpf git hash: c51857f4348823f647110e8a1ede07d76d93b7da active boot switches: -d:release The chess game compiles and runs fine for me still. But I can test only on 64 bit linux,

Re: Nim in Action Help thread

2019-10-03 Thread Stefan_Salewski
No, no reason -- but my last update was only two weeks ago. Will update now, but will not test all my packages again. Have first to finish tgs bulk loading for my RTree, and maybe then make a nimble package out of it. So testing other packages have to wait, maybe next year.

Re: Introducing nim-metrics - a client library supporting Prometheus, StatsD and Carbon

2019-10-03 Thread federico3
There's also a lightweight StatsD-only library: statsd_client [https://github.com/FedericoCeratto/nim-statsd-client](https://github.com/FedericoCeratto/nim-statsd-client)

Re: Nim in Action Help thread

2019-10-03 Thread miran
> `nim -v Nim Compiler Version 0.20.99` Is there a reason why you didn't update to v1?

Re: Nim in Action Help thread

2019-10-03 Thread torarinvik
Yes, it didn't work. However the graphics on the picture was really nice, almost like the standard chess board just nicer looking. And 1400 lines for a fully functional chess game is really cool.

Re: Is there a way to write tests & benchmarks for functions operating on NimNode?

2019-10-03 Thread akavel
:/ So, I [tried to add a test](https://github.com/akavel/macromatch/blob/c494cd6b2e141323895417da77fb101517583478/tests/test1.nim), but it doesn't really seem to work with the usual approach in a `static:` block: $ cat tests/test1.nim import unittest import macros

Re: NIM in action offline resources

2019-10-03 Thread pouya
Hi would you please provide an EPUB format along with other formats as well? Diversity of choice is a thing which is always respected.

Re: NIM in action offline resources

2019-10-03 Thread pouya
I hope Dom takes time to provide its book readers with an update page. I'm reading the book and enjoying.

Re: NIM in action offline resources

2019-10-03 Thread miran
> Mirans tutorial is available as PDF and HTML, it is based on Asciidoctor, > maybe you can generate epub yourself. If there is a need for .epub format, I can see if I can make one officially available.

Re: How to tie procedure to type?

2019-10-03 Thread LeuGim
This version does type-checking (correctly pointing to procedure definition), and allows that simple method invocation syntax. type BinaryTree*[V; cmp: static[proc(a, b: auto): bool]] = object # different ways of providing a procedure # an `echo` is added to each

Re: NIM in action offline resources

2019-10-03 Thread Stefan_Salewski
Dom's book was available in ebub format from the beginning, I read the early drafts in epub. Note hat the book is not needed to learn Nim, there are many great resources for beginners now: [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html) The book is a nice to have, for some

Re: Getting Unix-Style file permissions

2019-10-03 Thread Araq
Or use the posix.nim module for this.