<< 25-03-2017 >>

00:00:02krux02well I think I found a better solution
00:00:20krux02I just use projectile-project-root
00:00:35krux02with that I can simpley remove a lot of code
00:00:55krux02it is another dependency, but as a fallback I can just use the buffer-file-name
00:01:17krux02dom96, I don't know why nimsuggest doesn't find the project root on its own
00:01:32krux02probably because it is emacs
00:02:25*rupil joined #nim
00:03:23*yglukhov quit (Ping timeout: 264 seconds)
00:08:28*gokr quit (Ping timeout: 240 seconds)
00:10:39dom96'night
00:19:17*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
00:26:56*BitPuffin joined #nim
00:27:07zachcarterhttp://imgur.com/a/iE4Up
00:34:36*bjz joined #nim
00:39:06*vendethiel quit (Ping timeout: 240 seconds)
00:39:30*rupil quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
00:54:14*djellemah_ joined #nim
00:57:41*djellemah quit (Ping timeout: 240 seconds)
01:01:12*Matthias247 quit (Read error: Connection reset by peer)
01:07:57*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
01:10:11zachcarterwhere can I obtian pcre.dll?
01:45:48*bjz joined #nim
02:10:12*brson quit (Quit: leaving)
02:11:47krux02zachcarter, don't you have a mac?
02:12:04zachcarterI do, but I was testing my game framework on windows
02:12:09zachcarterit’s all good I’m dropping that dependency anyway
02:12:45krux02yea it sucks that regular expressions are not simply there on windows
02:12:57krux02in linux that dependency is just not an issue
02:13:53zachcarteryeah
02:37:56*chemist69 quit (Ping timeout: 258 seconds)
02:50:35*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:51:40*chemist69 joined #nim
02:58:22*yglukhov joined #nim
03:02:47*yglukhov quit (Ping timeout: 264 seconds)
03:08:36*krux02 quit (Quit: Leaving)
03:09:15FromGitter<Varriount> I bet the .NET framework has regular expressions.
03:09:45FromGitter<Varriount> zachcarter: All you need to do is call into the .NET runtime environment. >:D
03:09:56zachcarter:P
03:20:39*user0___ quit (Quit: user0___)
03:39:31FromGitter<Varriount> zachcarter: And since you're using VSCode, I thought I just might post this: https://news.ycombinator.com/item?id=13940014
03:39:47zachcarterhahaha
03:39:52zachcarternot surprised
03:40:24FromGitter<Varriount> I'll be blunt: I don't like the "lets use a browser to implement a desktop application" trend
03:41:38FromGitter<Varriount> As far as I'm concerned, it's just adding several layers of abstraction
03:46:05zachcarteryeah
03:46:15zachcarterI just use it because it works well with nim
03:46:24zachcarterand nim suggest
03:47:09jivank_can you statically linked against pcre.dll?
03:47:19jivank_statically link*
03:55:36*bjz joined #nim
03:56:45FromGitter<Varriount> jivank_: You would first need a pcre.lib file (the static library). After that, you would use the dynlib override argument when invoking the compiler.
04:46:55*ludocode_ quit (Quit: ludocode_)
04:57:11*zachcarter quit (Quit: zachcarter)
05:08:01*Jesin quit (Ping timeout: 256 seconds)
05:12:34*Jesin joined #nim
05:58:14*vendethiel joined #nim
06:11:18*yglukhov joined #nim
06:11:35*Nobabs27 quit (Quit: Leaving)
06:39:31FromGitter<rsirres> ``````
06:39:39FromGitter<rsirres> import random ⏎ ⏎ randomize() ⏎ echo random(1.0) [https://gitter.im/nim-lang/Nim?at=58d610aa41a045e94dc5e941]
06:44:52FromGitter<rsirres> returns the same result
06:45:47FromGitter<rsirres> Do I *have to* set a seed ?
06:48:01*yglukhov quit (Remote host closed the connection)
06:57:05*Trustable joined #nim
07:02:41*vendethiel quit (Ping timeout: 240 seconds)
07:06:15FromGitter<Araq> the seed is timer dependent
07:06:48FromGitter<Araq> and the timer's resolutions is not good. seems to be a bug
07:12:07*rauss quit (Quit: WeeChat 1.7)
07:17:22*Trustable quit (Remote host closed the connection)
07:24:32*vlad1777d joined #nim
07:48:49*yglukhov joined #nim
07:50:58*yglukhov quit (Remote host closed the connection)
07:51:14*yglukhov joined #nim
07:51:47*yglukhov quit (Remote host closed the connection)
08:26:36*vivus joined #nim
08:29:01*nsf joined #nim
08:32:11*vivus quit (Quit: Leaving)
08:52:17*yglukhov joined #nim
09:06:18*gokr joined #nim
09:10:40*Tiberium joined #nim
09:23:52*yglukhov quit (Remote host closed the connection)
09:24:42*yglukhov joined #nim
09:29:21*yglukhov quit (Ping timeout: 260 seconds)
09:43:43TiberiumHow can I fix issues like " Warning: not GC-safe:" ?
09:43:57Tiberium"Warning: not GC-safe: 'callMethod("messages.send", data, TOKEN)' [GcUnsafe]"
09:44:45Tiberiummy callMethod returns table or nil
09:54:05cheatfatehttps://nim-lang.org/docs/manual.html#threads-gc-safety
09:55:40Tiberiumif i would make my program async, will I need to make my procs gc safe?
09:55:44Tiberiumor it's only for threads?
10:00:30*Matthias247 joined #nim
10:00:58cheatfatethreads only
10:04:49Tiberiumoh, nice
10:04:49*gokr quit (Ping timeout: 260 seconds)
10:08:05Tiberiumand another question - is there any difference between performance if all my variables are "var", or if some of them are "let" ?
10:14:59Tiberiumhm, I probably found a bug in nimsuggest - I have an API object, and create instance of it like that: let api = newAPI() nimsuggest says "redefenition of API"
10:17:36Tiberiumor no
10:17:36Tiberiumwait
10:19:10Tiberiumit works now
10:26:24*Vladar joined #nim
10:29:30*yglukhov joined #nim
10:56:20*vendethiel joined #nim
10:58:41*yglukhov quit (Ping timeout: 240 seconds)
11:04:15dom96Good afternoon
11:05:30*zachcarter joined #nim
11:07:27TiberiumDoes Nim disables all checks with -d:release?
11:09:25TiberiumAnd how can I make nimble file only for installing dependencies (I don't want to provide my program as a lib, and I want to use nimble to install deps automatically)
11:10:58VladarTiberium: yes, and https://github.com/nim-lang/nimble#dependencies
11:11:53TiberiumVladar, but nimble still will output things like "VKBot package installed successfully" on successful installation of the package?
11:11:57Tiberiumah, nevermind, it's fine
11:12:19Tiberiumbecause I will want in the future to have my program in nimble
11:12:54*Matthias247 quit (Read error: Connection reset by peer)
11:17:42dom96Just specify the `bin` option in the nimble file
11:17:52dom96That way it will be a binary package
11:20:13Tiberiumdom96, and how can I pass compile params in nimble file?
11:20:23Tiberiumfor example SSL support
11:20:26Tiberium-d:ssl
11:20:33dom96You can't, put it in a .nim.cfg or a config.nims or a .nims
11:21:33Tiberiumdom96, can I use nakefile for it? no?
11:21:34*vendethiel quit (Ping timeout: 258 seconds)
11:21:52dom96no
11:22:10Tiberiumdom96, is there any docs on config.nims for building with nibmle?
11:22:13Tiberium*nimble
11:22:32dom96https://nim-lang.org/docs/nims.html
11:29:31Tiberiumdom96, still no luck :( https://paste.pound-python.org/show/47jVQW4qv4zZZEUd9C4B/
11:29:42Tiberiumthis is my config.nims
11:29:57Tiberiumit it doesn't build binary with ssl support
11:30:00*yglukhov joined #nim
11:30:40dom96why is it in a procedure?
11:31:30TiberiumI found it in other nim repos
11:31:38TiberiumI don't need to put it into a procecure?
11:32:35*couven92 joined #nim
11:33:35*krux02 joined #nim
11:33:35dom96No
11:33:43Tiberiumdom96, for example - https://github.com/vegansk/nimboost
11:33:52Tiberiumhttps://github.com/vegansk/nimboost/blob/master/config.nims
11:34:23dom96Think about it.
11:34:37dom96If you put it in a procedure, you need to call that procedure.
11:34:44Tiberiumyeah, but how does nimboost call it?
11:35:01dom96Search for "buildBase" and you'll see
11:35:14dom96You don't need so much complexity though
11:35:21dom96Just add -d:ssl into the file.
11:35:43dom96Literally: echo "-d:ssl" > config.nims # should be enough
11:36:33Tiberiumdom96, but maybe it's better to have debug build by default? or no?
11:36:39Araqdom96: can we make -d:ssl the default now?
11:37:16dom96Araq: why?
11:37:30Araqhttps is everywhere
11:37:42Araqand people stumble upon this
11:37:42dom96Tiberium: It's already debug by default
11:37:46Tiberiumdom96, ah
11:37:55Tiberiumdom96, but for nimble - it's better to have a debug build or release?
11:38:05Tiberiumby default
11:38:06dom96Tiberium: Nimble will decide itself.
11:38:09Tiberiumwow
11:38:14Tiberiumok
11:38:21dom96When you install a package it will build in release mode by default
11:39:30dom96Araq: So you see someone struggling with config.nims and your immediate solution is to make sure they don't need to specify the flag in question?
11:39:51Araqit came up for ldlework too
11:40:06AraqI see people reporting problems and count them.
11:40:30Araqand when N >= 2 it indicates a problem and when N >= 3, 4 I take some action
11:40:46dom96Your identifying an incorrect problem
11:40:56dom96*You're
11:41:31dom96We can make -d:ssl default once there is no dependency on openssl
11:41:57dom96(or we allow loading of openssl when it's actually used)
11:42:10Araq(hell no :P)
11:42:47Araqthe dependency on openssl is not that bad. but ok.
11:43:03couven92dom96, I theory, we could depend on openssl on Linux, couldn't we? And on Windows we could use the Built-in Win32 SceChan implementation?
11:43:36couven92s/SceChang/SecureChannel
11:44:44dom96Araq: Instead we should improve our documentation to make it obvious how to enable -d:ssl for Nimble packages.
11:45:00Tiberiumcan I report somewhere that foreignDep detects my Manjaro (based on Arch Linux) wrongly?
11:45:12Tiberium"sudo pkg install openssl"
11:45:17Tiberiumbut it's pacman
11:45:35AraqTiberium: no, you can only fix it. lib/pure/distros.nim
11:46:44TiberiumAraq, ok
11:47:47dom96couven92: Perhaps. I'm not sure how good Win32's SceChan is.
11:48:05dom96couven92: If you're up for it, implementing that on Windows would be very much appreciated :)
11:49:09couven92I should really learn to shut my mouth instead of accepting lots of side-projects! :P All right, I guess this is more important that the nimsuggest and NimStudio stuff?
11:49:26TiberiumNimStudio? Is it a new IDE?
11:49:34Tiberiumah
11:49:36TiberiumVS support
11:49:59dom96couven92: Definitely more important :)
11:50:17couven92dom96, I'll look into it now
11:50:51*yglukhov quit (Remote host closed the connection)
11:51:48couven92And yes, SecureChannel is Win32 API implementation for SSL/TLS and all that stuff... It's basically how .NET, PowerShell, Windows Update, Internet Explorer, MS Edge, and so on do HTTPS without 3rd party libraries
11:52:41dom96Nice. If we could get dependency-less SSL on Windows that would be awesome.
11:53:49couven92And I was thinking the other day: If we port the monolithic SQLLite C source to Nim, we could also have a pure SQLLite implementation for Nim, we wouldn't need the library for that anymore either
11:54:19cheatfatecouven92, only microsoft trusts microsoft ssl implementation, all opensource software running windows using its own ssl implementation
11:55:10couven92cheatfate, so you say that all those people doing network stuff in C# are all writing/using their own custom SSL implementation?
11:55:19couven92Don't think so!
11:55:44Tiberiumhmm, if I have all my source files in VKBot, and config.nims outside this folder, and srcDir in .nimble file is defined "VKBot", but nimble doesn't detect config.nims. But if I put my config.nims into VKBot dir, nimble detects it
11:55:45couven92And those people writing Python services or python HTTPS clients
11:55:59dom96couven92: We could also just embed the C source code for SQLite
11:56:05cheatfateC# adepts using microsoft ssl
11:56:28cheatfatebut python using openssl, go using its own implementation, rust uses its own ssl
11:56:48cheatfatepython https clients using openssl
11:57:38cheatfateonly microsoft and couple of c# adepts which don't want to be cross-platform
11:59:34couven92cheatfate, do you want me to introduce an openssl defined just so that you can escape the evilness of SecureChannel on Windows?
12:01:53cheatfatecouven92, do you know that some years ago, when SSL was version 1 i think, and when US crypto export restrictions was tough, Internet Explorer used weak 56bit DES for not US installations?
12:02:51cheatfatethat's one of the reasons why mozilla, chrome and everybody else except microsoft prefer to use opensource crypto implementations
12:02:53couven92No, I didn't. Before my (computer science) time...
12:03:54cheatfateThere only one thing used from whole windows security by opensource ssl implementations
12:04:37cheatfateits system PRNG, and you know, it used only to seed opensource prng implementation
12:05:10cheatfateso i prefer to stay with openssl implementation, or make my own
12:05:29cheatfatebut not use microsoft's implementation
12:06:19cheatfatecouven92, i have made pure nim connection to windows com
12:06:36cheatfateso i can now obtain installation path of vs2017
12:07:31couven92great! Let's make a vswhere.nim file in tools/vccexe ?
12:08:24cheatfatei thought you already made it too
12:09:49*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
12:10:01*zachcarter quit (Quit: zachcarter)
12:10:53Tiberiumstill no luck with config.nims hmm
12:10:54dom96I think that the vast majority of people won't mind using the MS SSL implementation. A lot of them will appreciate the lack of errors.
12:11:14dom96And openssl will always be available anyway.
12:11:22dom96To switch using a compiler flag
12:12:52couven92dom96, cheatfate, I am doing a when defined(openssl) statement to decide whether to load MS SSL or OpenSSL, is that okay?
12:13:41cheatfatecouven92, it will be easy to adopt sync stuff, but what with async?
12:14:29dom96couven92: Sure that would be fine. But maybe we could even create a `sslImplementation` (or similar) value define. So that you can write -d:sslImplementation:openssl?
12:14:29couven92uhm... baby steps mister! I'll have a look when the sync stuff is complete... And implement async if necessary
12:15:10couven92dom96, yeah I can do that... Both maybe?
12:15:29dom96I'd rather have one.
12:15:46couven92agreed, sslImplementation it is then
12:15:50dom96Otherwise we'll have to support both which will be double the work :)
12:16:08cheatfatecouven92, there so many semi-finished modules inside of stdlib...
12:16:46couven92don't worry cheatfate, I'll make async a prio no.1 once the basic stuff works
12:16:59cheatfatecouven92, its better to start with async
12:17:04cheatfatewho cares about sync
12:17:15cheatfatelet `sync` users use openssl
12:17:19*zachcarter joined #nim
12:18:25*dddddd joined #nim
12:18:39couven92cheatfate, I'll have to experiment a lot and I have to read a lot of the MSDN documentation... So I'll do what is easier at the starts and then work my way through it
12:18:58dom96Yeah, start with sync it will be easier to get working.
12:19:15couven92But, I know C# has both async and sync SslStreams, so if they can do it, we can as well!
12:20:12cheatfatecouven92, c#'s async is a little different form nim's async, and also windows async is a lot different from unix async
12:20:40couven92I was talking about principle here!
12:21:16cheatfatei'm too
12:22:16couven92cheatfate, but back to vswhere, no I haven't done that yet, so go ahead... vsdiscover has a TODO comment about half-way through the file where you can integrate vswhere...
12:23:11*kunev quit (Ping timeout: 240 seconds)
12:23:32couven92oh, sorry, that's vccdiscover.nim, https://github.com/nim-lang/Nim/pull/5575
12:23:52*Snircle joined #nim
12:23:56cheatfatecouven92, i dont care about vswhere, i have made poc and want to say to you, that this is possible and easy
12:24:14*kunev joined #nim
12:25:20couven92ah, okay... Great! That confirms also my suspicions
12:25:51cheatfatesuspicions?
12:26:32couven92that is was possible and easy. I thought so as well, I just haven't had time to do it yet
12:39:09Tiberiumgdb says "No symbol table is loaded. Use the "file" command." in VSCode. Do I need to compile my program with some specific arguments?
12:39:40dom96--debugger:native
12:45:41Tiberiumdom96, thanks
12:51:39*yglukhov joined #nim
12:54:01FromGitter<rsirres> Hey guys
12:54:08FromGitter<rsirres> what do think about crystal lang ?
12:56:40dom96I haven't used it but it looks like a nice language, especially if you like Ruby syntax.
12:57:45dom96I wouldn't consider using it until they support Windows natively though.
12:59:58*dmi0 joined #nim
13:03:08*yglukhov quit (Ping timeout: 260 seconds)
13:04:52zachcarterlooks like a native replacement for ruby
13:05:10zachcarterand what dom96 said about windows
13:07:11TiberiumWhat are downsides of having a "{.procvar.}" proc?
13:07:19Tiberiumperformance, something else?
13:10:26dom96Nothing AFAIK
13:10:38dom96Using map etc. may have some performance downsides though
13:10:43*BitPuffin|osx quit (Ping timeout: 260 seconds)
13:12:18Tiberiumdom96, I have a table that looks like {"string": proc}, will it cause some performance downside over if's?
13:14:51dom96what are you using instead of if's?
13:15:14dom96Oh. You're dispatching the function to call via a hash map?
13:15:17Tiberiumyeah
13:15:32dom96hrm, not sure.
13:15:45dom96Probably. Would be interesting to benchmark it.
13:16:14nivhow's an anon proc implemented underneath? just a function pointer?
13:16:14Tiberiumbut *maybe* I should use if's, with if's I can have multi-word commands without for loop
13:17:52dom96Tiberium: Use a case statement if you can
13:18:02dom96niv: Yeah, I think so.
13:18:07Tiberiumdom96, ah, forgot about it :D
13:18:10dom96niv: Did you see my issue on your websockets repo?
13:18:42nivperformance most likely depends on what is wrapping your branching code, i.e. how many other code pathes it hits and how much non-sequential memory access it does
13:18:55nivdom96: i got the email and i felt guilty, as it's quite an old ticket. i will get around to it
13:19:26dom96niv: no need to feel guilty. My projects likely have far older issues...
13:19:56nivim having a hard time context switching into nim at the moment so getting back into it will require some free time
13:20:34nivyour suggestions seemed sane and fine though, obviously. i just dont want to break some parts of the api needlessly for people already using it
13:22:04dom96yeah, I understand. Best thing to do is tag the current commit and emphasise the breaking change.
13:22:18nivsure :)
13:22:23dom96or you could even deprecate the current API and offer a new version
13:22:27dom96But that would be more work
13:23:33nivwell, either way, i'll have to think carefully on how to shape a new api, if needed. i don't want to go through that a few times
13:24:23dom96sure
13:25:21nivare you using it in production somewhere? or is your interest more academic?
13:28:19dom96I will be using it in production soon
13:28:40dom96Adding real-time shared scores to picheta.me/snake/
13:29:04nivthat's cute :)
13:29:07dom96I will feature that on the new Nim site too I think :)
13:29:23nivoh, there'll be a new site? is that the blog you were thinking about?
13:29:39dom96It will be a redesign of nim-lang.org
13:29:45dom96The news will become a blog
13:30:27dom96If you want to check out what we have so far or help out https://github.com/nim-lang/website :)
13:31:27nivsmooth plug, but i can't really invest time right now in any serious capacity
13:31:43nivis it deployed/browsable somewhere?
13:34:36dom96afraid not
13:46:29*shashlick quit (Ping timeout: 260 seconds)
13:47:12*shashlick joined #nim
13:48:16*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
13:53:29*dmi0 quit (Ping timeout: 260 seconds)
14:03:42Tiberiumassume I have an Flags* = enum A, B, C, D and set of this flags - {A, B} Can I add this set to my object? I tried type SomeObj = flags: set[Flags], but it says it expects ordinal types
14:03:53TiberiumIs there a way to add this set to object?
14:12:58krux02Tiberium, well you have a syntax error
14:13:05Tiberiumkrux02, I know
14:13:24*BitPuffin|osx joined #nim
14:13:31Tiberiumjust field of the object
14:13:32Tiberiumflags*: set[Flags]
14:13:41krux02how about type SomeObj = object\n flags: set[Flags]
14:15:33Tiberiumkrux02, ah, it was because I'm trying to set type of the field earlier, than enum is defined
14:15:36Tiberiumbut error message confused me
14:15:43Tiberiumhttps://glot.io/snippets/eobjw62xd1
14:17:38krux02well for some reason it does work when you change the order of the two types in the types section
14:18:05krux02I always thought the types section was, so you could have types referencing each other
14:18:12krux02but hey
14:19:02Tiberiumkrux02, I mean the error message is confusing
14:19:09Tiberiumit didn't said "Flags is undefined"
14:20:02krux02well error messages are not the best in Nim
14:20:12krux02but for me they work, so you can get used to them
14:41:56*gangstacat quit (Quit: Ĝis!)
14:45:36Tiberiumtype mismatch: got VKAPI but expected VKAPI = object am I doing something wrong?
14:47:19Tiberiumadded "ref object" instead of "object", works now
14:47:33Tiberiumah no
14:47:54Tiberiumah
14:47:55Tiberiumnvm
14:50:01*gangstacat joined #nim
15:00:06*couven92 quit (Ping timeout: 240 seconds)
15:00:41*couven92 joined #nim
15:06:29*yglukhov joined #nim
15:09:02*gokr joined #nim
15:19:22*yglukhov quit (Remote host closed the connection)
15:21:17*Trustable joined #nim
15:25:35*vendethiel joined #nim
15:42:26*def-pri-pub joined #nim
16:12:08*couven92 quit (Ping timeout: 258 seconds)
16:27:15*BitPuffin quit (Remote host closed the connection)
16:29:30*BitPuffin joined #nim
16:34:10*brson joined #nim
16:52:51*yglukhov joined #nim
17:04:51*yglukhov quit (Remote host closed the connection)
17:05:39*mcc joined #nim
17:06:58*Jesin quit (Quit: Leaving)
17:07:21mccquick silly question: how do i get max/min values for eg int16, uint32 etc
17:07:26mccfrom the nim standard library
17:12:20mccnot finding it in the docs
17:15:11*brson quit (Ping timeout: 246 seconds)
17:19:41zachcarterhttp://imgur.com/a/FnUN1
17:20:50*Tiberium quit (Remote host closed the connection)
17:21:05krux02zachcarter, looks cool so far
17:21:09*Tiberium joined #nim
17:21:40krux02I have no idea how far of what you actually want to get it is away, but it is cool
17:23:48zachcarterthaanks
17:23:52zachcarterkrux02:
17:24:00zachcarterhttps://github.com/fragworks/frag
17:25:19zachcarterstill quite far off from where the project needs to be to support the types of games I’d like folks to be able to create with them
17:25:22zachcarterbut every day, getting a little closer
17:27:03krux02cool
17:27:24krux02I kind of struggle with mud that prevents me from getting anything done
17:27:34krux02you know when there is a lot of friction
17:27:39zachcarteryeah
17:27:54*sz0 joined #nim
17:28:04krux02I hate that my editor dos not proper error highlighting
17:28:13zachcarter:/
17:28:31krux02and wheneven I mention that it does not work, the answer is: It does work
17:28:44krux02and I say: that doesn't help because it doesn't
17:28:55krux02and then the maintenance of nim-mode in my editor is basically dead
17:28:59krux02so I have to take that over
17:29:05krux02I am no emacs-lisp developer
17:29:15krux02so I had to learn that language too, and the emacs api
17:29:33krux02and the horrible state, that the nim mode is written in
17:29:52krux02maybe it's just me not understanding the language properly
17:30:04*brson joined #nim
17:30:33FromGitter<TiberiumPY> do you always use terminal?
17:30:38FromGitter<TiberiumPY> maybe you can use GUI IDE
17:30:43FromGitter<TiberiumPY> like VSCode
17:31:19*krux02_ joined #nim
17:31:27*krux02_ quit (Client Quit)
17:31:57krux02I use a "gui ide", I use emacs
17:32:08krux02I tested VSCode, it doesn't work either
17:32:18Tiberiumhm
17:32:29Tiberiumit does for me, it just pulls errors from nimsuggest
17:32:33Tiberiumbut not autocompletion
17:32:45TiberiumI think there's no IDE's for Nim with smart auto-completion
17:32:52krux02Tiberium, but I guess you don't do the main file that includes everything pattern
17:33:25Tiberiumkrux02, it doesn't include, but import
17:33:37krux02import is no problem, include is the problem
17:33:43Tiberiumah
17:33:55TiberiumI use them only in plugins
17:34:03Tiberiumto not type same imports every time for each plugin
17:34:18krux02when you include, your file does not start at the beginning it starts where it is included from
17:34:37Tiberiumah
17:34:39Tiberiumdebugging?
17:34:54krux02debugging in emacs is quite bad
17:35:00krux02I gave up on it
17:35:10krux02it has this fancy debugger that nobody understands
17:35:31krux02it makes it especially hard, because I am not debugging a languaged that gdb knows about
17:35:51krux02I started writing python scripts to let gdb know more about nim
17:35:59krux02but it appears thit this is no easy task at all
17:37:17*Matthias247 joined #nim
17:37:27krux02I got so far, that I could actually bundle a python-gdb script in the executable that would then be seen and executed by gdb
17:37:30*couven92 joined #nim
17:37:44krux02and this script then tells gdb about the string type
17:39:05Tiberiumwow
17:40:29Tiberiumis there anything like PEP8 in Python for Nim?
17:40:33Tiberiumcoding standarts
17:41:04krux02what is PEP8?
17:41:11cheatfateTiberium, https://nim-lang.org/docs/nep1.html
17:41:21Tiberiumcheatfate, thanks
17:41:36Tiberiumkrux02, pep8 is a style guide for Python
17:42:03krux02ok
17:42:09krux02I just found out about it
17:42:44krux02well sadly because nim is with semantic whitespace, autoformat does not quite work
17:43:01krux02maybe it does, when it doesn't alternate the whatespace
17:43:20krux02bun in my emacs indent-region just destroyed everything
17:44:12krux02not everything but the semantic blocks
17:44:31krux02I used to really like go-fmt
17:44:39krux02for c++ there is clang-format
17:44:50Tiberiumwhat does "{.pure.}" do for enums?
17:45:07krux02Tiberium, probably nothing
17:45:16Tiberiumkrux02, "Non-pure enum values should use camelCase whereas pure enum values should use PascalCase."
17:45:28Tiberiumwhat's the difference?
17:46:30krux02https://nim-by-example.github.io/types/enums/
17:47:28Tiberiumah
17:47:32Tiberiumqualification
17:47:32Tiberiumthanks
17:47:59krux02could be more specific, but pure let's enums be a bit more like Java and non-pure like C
17:49:37Tiberiumhow to create an empty table?
17:49:44Tiberium{}.toTable() doesn't do the trick
17:49:55def-pri-pubIt should be in the `newTable`
17:50:17def-pri-pubOr new `newTableRef`
17:50:25krux02reactormonk, can you review the pull request of nim-mode
17:50:34krux02Tiberium, try it with just declaring it
17:50:43krux02var myTable : <tableType>
17:50:50def-pri-pub(They're in the `tables` module BTW)
17:50:51Tiberiumkrux02, i want to have a default value for my proc
17:50:55Tiberiumdef-pri-pub, I know :)
17:51:35Tiberiumso {}.newTable()
17:52:06def-pri-pubI would just do `newTable()`
17:52:31Tiberiumit says "cannot instantiate 'A' and 'B'
17:52:43TiberiumError: cannot instantiate: 'A' proc newTable*[A, B](initialSize=64): TableRef[A, B]
17:52:44krux02don't use the ref type
17:52:48krux02just use the Table type
17:52:56TiberiumI use it
17:52:57def-pri-pubWhat's wrong with Ref?
17:53:07def-pri-pubTiberium: You need to specify some types
17:53:18def-pri-pubMy bad, I should have explained better
17:53:20Tiberiumdef-pri-pub, proc callMethod* (api: VkApi, methodName: string, params: Table = newTable(), token: string = ""): JsonNode =
17:53:29def-pri-pube.g. `var table = newTableRef[string, int]()`
17:53:34Tiberiumah
17:53:39krux02I don.t get why people are obsessed with these ref types
17:53:45def-pri-pubYeah, it's a template.
17:53:55def-pri-pubRefs are a little safer IIRC
17:54:09krux02I would only need a ref type if I would actually share the ownership of a single instance of a table with multiple threads
17:54:18krux02but that means I would have to do manual locking
17:54:21krux02so I would not do it
17:54:27krux02so I don't use table ref types
17:54:33krux02jus Table[A,B]
17:54:50krux02refs are not a little safer
17:55:10krux02refs are just a bit more garbage collection heavy
17:55:32Tiberiumkrux02, but how to create a default non-ref value for table? in proc declaration
17:55:52krux02Tiberium, is the result a ref type?
17:55:58krux02a table type i mean
17:56:00*Nobabs27 joined #nim
17:56:10Tiberiumkrux02, no, I didn't use ref yet
17:56:25TiberiumI need to read docs to know why ref's are needed exactly :)
17:56:40krux02Tiberium, it's not documented in nim
17:57:01Tiberiumkrux02, my proc returns non-ref JsonNode
17:58:07krux02Tiberium, normally when you do not use ref types, your declarations of variables already contain an empty instance of that type
17:58:17krux02for objects all values are 0
17:58:19*rauss joined #nim
17:58:38krux02so all you would need to do is to append to it
17:58:41krux02I think
17:58:54krux02the only exception here are seq and string types
17:58:54Tiberiumkrux02, so it's better to use ref's everywhere or just values?
17:59:07TiberiumI have two objects
17:59:09krux02Tiberium, it's better to use values everywhere
17:59:12Tiberiumah
17:59:13Tiberiumthanks
17:59:41TiberiumI didn't knew that a language compiling to C can be used without pointers/ pointers to pointers/ etc...
17:59:44krux02just remember that values have copy semantic
18:00:06krux02so when you assign a value type to another variable you get a copy, not a reference to the same thing
18:00:14Tiberiumkrux02, I understand that
18:00:19TiberiumI don't need references for now :)
18:00:21krux02but function parameters and return values are hidden references
18:00:37krux02so you do not need to wory about a lot of copying types
18:01:15krux02they are not the garbage collected ref type, they are more like a hidden pointer
18:01:34Tiberiumkrux02, thanks a lot for answering!
18:02:07TiberiumI've got another question: what's the reliable way to get the amount of used memory (RAM)? I mean how much real RAM is used
18:02:12Tiberiumin linux or nim itself
18:02:21krux02htop
18:02:38krux02(command line)
18:04:11Tiberiumkrux02, so 6600 RES means it uses 6mb's of ram?
18:05:21*yglukhov joined #nim
18:05:47krux02well I have no I idea my htop tells me units in M
18:06:18Tiberiumkrux02, mine does too
18:06:20Tiberiumfor big apps
18:06:27Tiberiumbut for my app it's 6.6 mb it seems
18:06:53krux02seems legit
18:08:55Tiberiumby the way, so far I used only one 3rd party nimble package - strfmt, and one macro from stackoverflow
18:09:13Tiberiumin python I would've used like 3 3rd party packages
18:09:33Tiberiumfor example, httpclient in Nim is really simpler than urllib in Python (stdlib)
18:11:54dom96mcc: high/low IIRC
18:12:22krux02Tiberium, I just found out about strfmt, I really like it
18:12:36Tiberiumkrux02, I use it basically for interp :)
18:12:40krux02I nicely avoids creating unnecessary temporary strings
18:13:35Tiberiumand about Nim's stdlib: as I undestand, stdlib is split in many modules because this allows to make programs more optimized?
18:13:45Tiberiumlike optimize memory/ space usage
18:14:26dom96It's nothing to do with that. It's to make the stdlib easier to develop.
18:14:52Tiberiumdom96, that's good too
18:26:01*Tiberium quit (Remote host closed the connection)
18:27:19FromGitter<TiberiumPY> oh my god, I just renewed
18:27:33FromGitter<TiberiumPY> I just deleted my project
18:27:42FromGitter<TiberiumPY> Rebooting into Windows
18:28:12dom96what now?
18:28:21FromGitter<TiberiumPY> Live usb
18:28:28FromGitter<TiberiumPY> To restore it
18:31:56FromGitter<TiberiumPY> I just wanted to init a git repo inside Vscode, and it added all files including nimcache, so I pressed "revert" button, and VSCode asked "discard all changes?" Which sounded like "remove all changes" in Russian. I thought it would just delete files from git repo, NOT FROM MY HDD
18:33:01*dddddd quit (Remote host closed the connection)
18:36:32dom96And that's why I always use git through my terminal :)
18:38:36*yglukhov quit (Ping timeout: 240 seconds)
18:38:43FromGitter<TiberiumPY> I really hope I will restore them
18:40:02dom96To be honest, that seems like a VS code bug to me
18:40:41mccdom96: thanks
18:46:17*arnetheduck quit (Ping timeout: 256 seconds)
18:49:00FromGitter<TiberiumPY> Ok, my live cd is ready, let's hope for the best
18:59:27*nsf quit (Quit: WeeChat 1.7)
19:02:42*couven92 quit (Quit: Client Disconnecting)
19:04:33*Jesin joined #nim
19:05:55*krux02 quit (Remote host closed the connection)
19:33:23FromGitter<TiberiumPY> Yaaay
19:33:27FromGitter<TiberiumPY> I recovered them
19:36:12*yglukhov joined #nim
19:44:04dom96That's good :)
19:46:19*libman joined #nim
19:53:44*Tiberium joined #nim
19:57:01*BitPuffin quit (Ping timeout: 260 seconds)
20:09:36*yglukhov quit (Ping timeout: 240 seconds)
20:27:57def-pri-pubI need some help with working in the JS target.
20:28:20def-pri-pubI'm trying to port what I wrote for the linux game jam over to JavaScript & HTML5
20:29:13def-pri-pubI used my stopwatch library. (https://gitlab.com/define-private-public/stopwatch). It uses 64 bit integers by default.
20:29:57def-pri-pubFor the js backend, I had it return the number of nanoseconds using the `performance.now()` function. I've having Nim's compiled Js thrown an "Overflow error."
20:31:00def-pri-pubDoes Nim's JS backend use the Int64 type if someone specifies a Nim integers as 64 bit?
20:33:44def-pri-pubBecause I'm represetning my time deltas as 64 bit integetrs, but I'm guessing that the Nim compiler put them down to 32 bit when it transpiled it to Js
20:33:45stisadef-pri-pub not sure, probably related to https://github.com/nim-lang/Nim/issues/4714
20:34:08def-pri-pubThanks
20:34:32def-pri-pubCrap, I might have to lower the resolution of `stopwatch`'s JS resolution
20:42:23*Sentreen quit (Ping timeout: 258 seconds)
20:42:40Tiberiumis there any real implementation of case_token macro example? or it's easy to do even if I'm a newbie?
20:43:40dom96stisa: Hey. I made some improvements to your jswebsockets package: https://github.com/stisa/jswebsockets/pull/1
20:49:16def-pri-pubJS Web sockets for Nim?! (http://i.imgur.com/DXkLvT2.gif)
20:53:21dom96Yeah, they work too :)
20:56:05*Sentreen joined #nim
20:58:34AraqTiberium: there is my lexim project. hardly tested though.
20:58:59TiberiumAraq, https://github.com/Araq/lexim found it
21:02:57*mcc quit (Quit: Connection closed for inactivity)
21:06:24TiberiumAraq, ah, it fails with the same error as https://github.com/Araq/lexim/issues/1 :(
21:07:35Araqwell try the example first
21:08:13TiberiumAraq, ah it works
21:08:17Tiberiumneeded to compile "lexe"
21:08:36Tiberiumbackwards compatibility wow
21:08:43Tiberium2 years and still works
21:11:39*def-pri-pub quit (Quit: leaving)
21:13:50dom96Hrm, seems like Firefox's GC is pausing my game.
21:18:04TiberiumCan Nim's httpclient handle HTTP GET query parameters automatically?
21:18:16Tiberiumso I can pass them as JsonNode
21:18:26Tiberiumoh, I mean json object :)
21:19:08Tiberiumsomething like: let client = newHttpClient(); let resp = client.get("https://example.com", %*{"data":1})
21:20:47*yglukhov joined #nim
21:20:59*yglukhov quit (Remote host closed the connection)
21:24:04Tiberiumah nvm
21:24:27Tiberiumok, will do it myself probably :)
21:26:12zachcarterhttp://imgur.com/a/LXlIh
21:32:09Tiberiumzachcarter, gif is downloading slower than Nim :)
21:32:37Tiberiumzachcarter, did you compile as c++ ?
21:32:42zachcarternope
21:32:43zachcarterC
21:34:32zachcarterwhy do you ask Tiberium?
21:34:45Tiberiumzachcarter, just curious
21:34:50zachcarterah okay
21:35:15zachcarteryeah C for max portability
21:39:38Tiberiumwhat can be the reason of "TLS reference in /home/tiber/NimProjects/VKBot/src/nimcache/VKBot_vkapi.o mismatches non-TLS definition in /hom
21:39:38Tiberiume/tiber/NimProjects/VKBot/src/nimcache/stdlib_system.o section .bss" ?
21:39:45Tiberiumit's gcc error
21:40:04Tiberiumah, force build helped
21:41:32TiberiumWhat's the best thing to use to have a key: value variable? tables?
21:41:44Tiberiumsize is dynamic
21:43:09FromGitter<Varriount> Tiberium: What do you mean?
21:43:36TiberiumVarriount: I mean what's the best container for dynamic key: value variable?
21:43:44TiberiumTables?
21:44:36FromGitter<Varriount> Well, tables are usually the best when you want... A table of values
21:45:10demi-heh
21:45:22federico3how can access a socket's protocol field? It belongs to SocketImpl: https://nim-lang.org/docs/net.html
21:46:35*Vladar quit (Quit: Leaving)
21:48:00dom96You can't. It's not exported.
21:48:44federico3I'm confused by repr: it manages to print the field name and value
21:50:29TiberiumI came up to this (to have query parameters for get request): https://glot.io/snippets/eobwexiin6
21:50:50Tiberiumyes, url then has additional "&" on the end, but it's fine (all websites understand it)
21:52:45TiberiumI don't know better way to create a query :)
21:53:09*Sentreen quit (Ping timeout: 240 seconds)
21:54:58cheatfateTiberium, do not forget to url-encode items you added
21:55:04Tiberiumcheatfate, I did
21:55:20Tiberiumcheatfate, cgi.encodeUrl
21:55:23Tiberiumfor both key and value
21:56:28cheatfateTiberium, yeah i see now, but anyway if you can avoid json package usage - avoid it
21:56:37cheatfateits too memory angry
21:56:55Tiberiumcheatfate, but httpclient itself uses json, and web api that I'm using uses json too :(
21:57:24Tiberiumah wait
21:57:30Tiberiumhttpclient doesn't
21:57:31Tiberiumhow?
21:57:41Tiberiumah
21:57:51cheatfatehttpclient don't using json
21:57:58Tiberiumit converts json body to string, but I can't do that with query parameters
21:58:31Tiberiumah, I see, it's somehow implemented in newHttpHeaders
21:59:11Tiberiumopenarray[tuple[key: string, val: string]]) it's the trick, wow :)
21:59:50cheatfateTiberium, the best way to learn nim is to browsing nim's stdlib and nim's packages...
22:00:08Tiberiumcheatfate, I'm starting to think so
22:02:33*dddddd joined #nim
22:02:33demi-some of the API calls in the posix module are less than desirable, was working with `gethostname` earlier today and the usage of that API is pretty gross would PRs to make that less horrible to use be acceptable?
22:02:42*zachcarter quit (Read error: Connection reset by peer)
22:03:22*zachcarter joined #nim
22:04:28cheatfatedemi-, posix module is for declarations
22:04:34FromGitter<Varriount> demi: Sure, although I believe (I may be wrong) that Posix is for low-level API wrapping
22:04:53cheatfatemaybe try to look at getHostAddr
22:05:22cheatfateoops
22:05:29cheatfategetAddrInfo
22:06:14cheatfatenativesockets.getAddrInfo
22:06:15demi-never-the-less, the interface for `gethostname` is awful, since there isn't a way to allocate a cstring nicely
22:06:22*Sentreen joined #nim
22:06:34Araqthere is.
22:06:53demi-oh? i only saw interfaces for cstringArray
22:06:54Araqvar foo = "nim string here"; takesCstring(foo)
22:07:12Araqthe conversion from string to cstring is implicit even.
22:07:49cheatfatedemi-, but you need to remember about internation names and convert it using punycode.nim
22:07:55cheatfateinternational
22:08:00Tiberiumhow can I set KeyVal* = openarray[tuple[key: string, val: string]] to empty value?
22:08:47demi-based on the way that `gethostname` works, it modifies the cstring inplace, which casues you to lose whatever was after that to some void? like does that memory get cleaned up automatically or is it leaked?
22:09:16demi-so you need to pre-allocate the buffer with something like `var foo = " ".repeat(1024)`
22:09:29cheatfatevar foo = newStringOfCap(1024)
22:12:19cheatfatealso gethostname returns up to HOST_NAME_MAX characters
22:12:21FromGitter<brechtm> Is it possible to forward declare a type?
22:12:45demi-so if a null character gets inserted into the string somewhere before the last char of the string, what happens to the rest of that string?
22:13:58cheatfatedemi-, what can be happens with block of memory allocated via `malloc()`?
22:14:05cheatfatenothing
22:14:42cheatfatenim string can hold 0x00 bytes inside
22:15:00demi-ok, thanks
22:15:26cheatfatedemi-, but some `echo` will not show it to you...
22:15:33cheatfatedemi-, so you need some better `echo`
22:15:37demi-yeah
22:17:28dom96brechtm: no. Put your types in the same type section
22:17:31TiberiumKeyVal* = openarray[tuple[key: string, val: string]] var test: KeyVal doesn't work
22:18:02cheatfateTiberium, sometimes you need to read the manual too, `openarray` has limits
22:18:21cheatfatehttps://nim-lang.org/docs/manual.html#types-open-arrays
22:18:34TiberiumI just want to have a default value for KeyVal
22:19:11Tiberiumso if user doesn't provide it to my func, it wouldn't do something
22:19:38Tiberiumwait
22:19:43cheatfateopenarrays can be used only as procedure arguments
22:19:49Tiberiumit worked???
22:19:58Tiberiumproc callMethod* (api: VkApi, methodName: string, params: KeyVal = [], token: string = ""): JsonNode =
22:20:42*FromGitter quit (Remote host closed the connection)
22:20:43*BlaXpirit quit (Quit: Bye)
22:20:58*FromGitter joined #nim
22:21:32*BlaXpirit joined #nim
22:29:04*littleli left #nim (#nim)
22:31:16*vlad1777d quit (Quit: Leaving)
22:45:27*yglukhov joined #nim
22:49:28*yglukhov quit (Ping timeout: 240 seconds)
23:01:03*libman quit (Quit: Connection closed for inactivity)
23:13:03*Trustable quit (Remote host closed the connection)
23:27:09*Matthias247 quit (Read error: Connection reset by peer)
23:39:15TiberiumHow can I assing multiple cookies to http request?
23:39:17Tiberiumhttpclient
23:41:14*brson quit (Quit: leaving)
23:42:02*nsf joined #nim
23:44:48*hcorion joined #nim
23:45:27dom96Set multiple Set-Cookie headers I guess
23:46:18hcorionHi All! Does anybody know how I might go about getting the maximum size of an enum? Like for generating a random number to cast to the enum's type
23:49:13FromGitter<Varriount> hcorion: sizeof?
23:49:40FromGitter<barcharcraz> Can our enums have holes?
23:49:48FromGitter<barcharcraz> Also probably high()
23:49:50FromGitter<Varriount> Although, you probably want high(enumType) instead
23:51:30hcorionAh, more like ord high (enumType), cool thanks
23:54:36Tiberiumdom96, doesn't work. I call it like client.headers = newHttpHeaders({"Set-Cookie":"...", "Set-Cookie":"..."})
23:54:44Tiberiumonly last cookie is being processed
23:55:03dom96client.headers["Set-Cookie"] = ...
23:55:08dom96does setting them like that twice work?
23:55:38dom96That is a bug in any case, please report it