00:16:41 | * | Nobabs27 joined #nim |
01:10:01 | * | chemist69 quit (Ping timeout: 276 seconds) |
01:20:25 | * | brson quit (Quit: leaving) |
01:23:10 | * | chemist69 joined #nim |
01:55:24 | FromGitter | <NevnHiwEjuam_twitter> hmm... I like how Nim does async I/O... surprised how little I'd have to code actually... however, what if I want a timeout mechanism for like hanging connections? |
01:58:41 | FromGitter | <NevnHiwEjuam_twitter> trying to look at asyncdispatch and asyncnet to see what they do with any possible time-related code |
02:43:53 | subsetpark | When using a seq as a stack, is a deque more performant than a vanilla seq? |
03:04:06 | FromGitter | <NevnHiwEjuam_twitter> hmm.... expression has no address... I'm passing an array variable and the body of the proc is just a wrapper around <streamVar>.writeData(addr(g), 16) |
03:04:50 | FromGitter | <NevnHiwEjuam_twitter> proc write*(s: Stream, g: Guid) {.inline.} = s.writeData(addr(g), 16) |
03:05:17 | FromGitter | <NevnHiwEjuam_twitter> with Guid being array[0..15, uint8] |
03:05:42 | * | dexterk__ joined #nim |
03:06:32 | * | bjz joined #nim |
03:11:41 | * | dexterk_ quit (*.net *.split) |
03:11:41 | * | gangstacat quit (*.net *.split) |
03:15:23 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
03:18:59 | * | gangstacat joined #nim |
03:19:07 | * | bjz joined #nim |
03:23:50 | FromGitter | <NevnHiwEjuam_twitter> nvm, 'var' fixes it but I think parseHex in parseutils is bugged |
03:27:46 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
03:32:17 | * | bjz joined #nim |
03:40:51 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
03:44:04 | * | chemist69 quit (Ping timeout: 240 seconds) |
03:53:02 | * | kunev joined #nim |
03:54:48 | * | Nobabs27 quit (Quit: Leaving) |
04:09:33 | * | BennyElg quit (Remote host closed the connection) |
04:11:23 | * | chemist69 joined #nim |
04:15:48 | * | BennyElg joined #nim |
04:16:57 | * | BennyElg quit (Remote host closed the connection) |
04:37:53 | * | def-pri-pub quit (Quit: leaving) |
04:42:44 | * | gangstacat quit (Ping timeout: 240 seconds) |
04:44:35 | * | dexterk joined #nim |
04:44:42 | * | dexterk__ quit (Ping timeout: 264 seconds) |
04:58:44 | FromGitter | <NevnHiwEjuam_twitter> nvm, fixed that too |
05:11:47 | * | Vladar joined #nim |
05:15:17 | * | zachcarter quit (Quit: zachcarter) |
05:16:20 | * | gokr quit (Quit: Leaving.) |
05:18:36 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
05:21:08 | * | tankfeeder joined #nim |
05:30:32 | * | gokr joined #nim |
05:54:32 | * | nsf joined #nim |
06:01:44 | * | rauss quit (Quit: WeeChat 1.7.1) |
06:41:49 | * | yglukhov joined #nim |
06:46:44 | * | yglukhov quit (Ping timeout: 260 seconds) |
06:59:05 | * | Snircle joined #nim |
07:08:50 | * | puh_nepo joined #nim |
07:19:36 | * | puh_nepo quit (Remote host closed the connection) |
07:22:06 | * | BennyElg joined #nim |
07:22:37 | * | BennyElg_ joined #nim |
07:22:37 | * | BennyElg quit (Read error: Connection reset by peer) |
07:26:24 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
07:27:26 | * | gangstacat joined #nim |
07:32:40 | * | vlad1777d joined #nim |
07:39:54 | * | tankfeeder quit (Ping timeout: 246 seconds) |
07:42:28 | * | Arrrr joined #nim |
07:42:28 | * | Arrrr quit (Changing host) |
07:42:28 | * | Arrrr joined #nim |
08:08:22 | * | chemist69 quit (Ping timeout: 258 seconds) |
08:15:38 | * | bjz joined #nim |
08:32:32 | * | couven92 joined #nim |
08:35:22 | * | chemist69 joined #nim |
08:36:33 | * | yglukhov joined #nim |
08:40:48 | * | yglukhov quit (Ping timeout: 246 seconds) |
08:41:05 | * | zachcarter joined #nim |
08:44:51 | * | aedigix- quit (Ping timeout: 255 seconds) |
08:44:53 | * | zachcarter quit (Read error: Connection reset by peer) |
08:45:58 | * | zachcarter joined #nim |
08:55:49 | * | krux02 joined #nim |
09:01:10 | m712 | /!\ |
09:01:20 | m712 | wrong window |
09:04:04 | Arrrr | Hmm, why don't you remove parseOpt and rename parseOpt2 to parseOpt? |
09:09:15 | Araq | parseOpt2 breaks the compiler and I never looked at why |
09:09:58 | Araq | also neither would make it into the stdlib today :P |
09:11:03 | * | tankfeeder joined #nim |
09:17:48 | * | Vladar quit (Remote host closed the connection) |
09:21:22 | Arrrr | wtf |
09:25:27 | * | yglukhov joined #nim |
09:40:45 | * | yglukhov quit (Remote host closed the connection) |
09:40:57 | * | zachcarter quit (Quit: zachcarter) |
09:48:23 | * | yglukhov joined #nim |
09:50:22 | * | aedigix joined #nim |
09:50:49 | bbl__ | https://github.com/nim-lang/Nim/blob/devel/doc/manual/generics.txt#L577-L630 this is quite wild stuff |
09:52:02 | bbl__ | Is rendered documentation from devel hosted somewhere? |
09:54:45 | * | zachcarter joined #nim |
10:02:43 | * | krux02 quit (Remote host closed the connection) |
10:02:53 | Araq | bbl__: no but you can do 'koch web' and look at the produced manual.html |
10:03:24 | * | krux02 joined #nim |
10:09:58 | Araq | hmm any really simple Nim websocket examples out there? |
10:12:30 | * | chemist69 quit (Ping timeout: 246 seconds) |
10:14:04 | FromGitter | <stisa> Araq client or server? |
10:14:11 | Araq | both |
10:15:20 | * | yglukhov quit (Ping timeout: 240 seconds) |
10:15:48 | Araq | server being more important |
10:15:53 | * | chemist69 joined #nim |
10:17:55 | FromGitter | <stisa> I remember this one http://niv.github.io/websocket.nim/docs/0.1.1/websocket/server.html worked after fiddling with imports |
10:21:24 | FromGitter | <andreaferretti> should c2nim be installed by `koch tools`? |
10:21:47 | FromGitter | <andreaferretti> installing via nimble is often broken - I assume because of the dependency on compiler |
10:40:57 | niv | Araq: if you have issues with the websocket thing, feel free to poke me. i havent looked at it in a while but it should be perfectly servicable |
10:41:01 | * | planhths joined #nim |
10:43:09 | * | aedigix quit (Remote host closed the connection) |
10:55:47 | Araq | niv: alright thanks :-) |
10:56:50 | * | arnetheduck joined #nim |
11:00:52 | * | bjz_ joined #nim |
11:02:26 | * | bjz quit (Ping timeout: 240 seconds) |
11:02:37 | * | Snircle joined #nim |
11:15:31 | * | aedigix joined #nim |
11:23:47 | Araq | niv: the example is incomplete |
11:25:05 | niv | it might be :( |
11:25:25 | niv | are you looking at setting up a client or server endpoint? |
11:26:52 | niv | either way, the code should be virtually identical as to packet handling. the only difference is packet masking, a single flag |
11:32:41 | * | aedigix quit (Quit: disconnecting) |
11:35:35 | Araq | niv: no I mean the call to |
11:35:37 | Araq | waitFor server.serve(Port(8080), cb) |
11:35:40 | Araq | is missing |
11:36:00 | Araq | is there a standard port to use for websockets? |
11:36:42 | niv | example: yes, documentation is kind of lacking. websockets usually go over http (ws://) or ssl (wss://) and are then proxied to an app server |
11:37:00 | niv | that's what the Connection: Upgrade stuff is about |
11:37:14 | niv | you can run it on any port you want though and it'll work in any browser, as long as it's not firewalled |
11:38:08 | niv | if you want restrictive network or proxy support you probably need to stick to 80/443 |
11:38:44 | * | bjz_ quit (Ping timeout: 260 seconds) |
11:39:28 | * | bjz joined #nim |
11:46:29 | * | aedigix joined #nim |
11:48:16 | * | PMunch joined #nim |
12:02:32 | * | aedigix quit (Remote host closed the connection) |
12:03:06 | * | aedigix joined #nim |
12:03:32 | dom96 | Araq: My snake game uses websockets |
12:04:43 | * | aedigix quit (Remote host closed the connection) |
12:04:52 | * | Vladar joined #nim |
12:05:50 | FromGitter | <Varriount> subsetpark |
12:05:52 | PMunch | I noticed something when working with macros; dumpTree outputs in a format that looks nice but isn't very useable. Is there a way to get it to output the code to create the AST instead? That would really speed up macro programming. |
12:06:12 | * | aedigix joined #nim |
12:06:20 | Araq | PMunch: use templates+getAst instead? |
12:06:37 | Araq | dumpTree is not for boilerplate creation, we strive to eliminate boilerplate |
12:06:58 | * | aedigix quit (Remote host closed the connection) |
12:08:23 | PMunch | Yeah I know. But often when writing a macro I will write an example of expected output, and what I want to type to generate it. Then I will step through the input AST and generate the output. It would be nice if I could get code I could just copy-paste into the macro to then manipulate to respond to changes in the input. |
12:09:12 | * | aedigix joined #nim |
12:18:36 | * | aedigix quit (Ping timeout: 240 seconds) |
12:18:37 | * | krux02 quit (Remote host closed the connection) |
12:18:54 | * | krux02 joined #nim |
12:19:50 | * | aedigix joined #nim |
12:19:54 | * | chemist69 quit (Ping timeout: 246 seconds) |
12:20:16 | * | chemist69 joined #nim |
12:20:47 | Araq | alright, PR it then |
12:20:51 | subsetpark | Varriount |
12:23:25 | * | zachcarter quit (Quit: zachcarter) |
12:56:17 | PMunch | Hmm, is there a way to say "if n.kind in <list of kinds>:"? |
12:58:57 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
12:59:23 | PMunch | Ah, it was actually just "if n.kind in [list, of, kinds]:"... |
12:59:34 | PMunch | Should've checked that first :P |
12:59:41 | Araq | no, it's n.kind in {....} |
12:59:53 | * | tankfeeder quit (Quit: Leaving) |
13:00:04 | Araq | the [] version is slower |
13:00:05 | PMunch | With curly brackets? |
13:00:08 | PMunch | Ah right |
13:00:09 | Araq | yes+ |
13:00:53 | PMunch | Wait, what's a {}? |
13:02:10 | PMunch | A set? |
13:03:45 | * | Tiberium joined #nim |
13:05:34 | couven92 | yes, PMunch that's a set |
13:05:57 | PMunch | But why checking a set is faster than an array? |
13:06:06 | PMunch | (barring having duplictes in an array) |
13:06:17 | * | Tiberium quit (Remote host closed the connection) |
13:06:57 | couven92 | ordinal elements in the set, I think, making Nim order and sort lookup at compiletime? |
13:06:58 | * | Tiberium joined #nim |
13:08:17 | Araq | it's converted to a bit mask, that's why. |
13:09:26 | * | Tiberium quit (Remote host closed the connection) |
13:09:46 | couven92 | ah, right! :) It's magic! :D |
13:10:10 | * | Tiberium joined #nim |
13:10:24 | * | Tiberium quit (Remote host closed the connection) |
13:12:54 | * | Sentreen quit (Ping timeout: 260 seconds) |
13:13:14 | * | Tiberium joined #nim |
13:13:35 | * | zachcarter joined #nim |
13:13:45 | * | planhths quit (Ping timeout: 240 seconds) |
13:14:00 | * | planhths joined #nim |
13:17:39 | * | Tiberium quit (Remote host closed the connection) |
13:17:55 | * | Tiberium joined #nim |
13:18:36 | * | planhths quit (Ping timeout: 240 seconds) |
13:20:37 | PMunch | Why does NimNodes have len but not high? |
13:21:57 | * | Tiberium quit (Remote host closed the connection) |
13:22:09 | * | Tiberium joined #nim |
13:24:16 | Araq | we had 'high' but it was buggy because the spec says 'high' must not be overloaded |
13:33:03 | * | krux02 quit (Ping timeout: 268 seconds) |
13:39:19 | * | rauss joined #nim |
13:40:26 | * | gokr left #nim (#nim) |
13:40:53 | * | gokr joined #nim |
13:42:51 | * | rauss quit (Client Quit) |
13:44:38 | PMunch | Hmm |
13:44:39 | PMunch | Okay |
13:44:56 | PMunch | That's something which tripped me up when working with macros as well |
13:45:46 | * | rauss joined #nim |
13:45:50 | PMunch | By the way, while I'm editing this code. In the macros documentation it says that dumpTree and dumpList uses the toTree and toList functions which doesn't exist. Instead they use the treeRepr and listRepr functions. Should I fix that? |
13:46:10 | Araq | sure |
13:47:11 | * | Tiberium quit (Quit: Leaving) |
13:49:48 | FromGitter | <Varriount> subsetpark: Yes? |
13:50:10 | * | planhths joined #nim |
13:50:19 | subsetpark | I don't know you said my name :) |
13:51:28 | * | BitPuffin|osx joined #nim |
13:56:06 | * | Sentreen joined #nim |
13:57:51 | PMunch | Araq: https://github.com/nim-lang/Nim/pull/5778 |
14:00:01 | couven92 | Araq, what's a benign proc? |
14:01:49 | * | Tiberium joined #nim |
14:02:11 | PMunch | Hmm, tested it some more and it still has some bugs.. |
14:02:44 | Araq | couven92: a proc with .locks: 0, gcsafe |
14:02:51 | couven92 | ah |
14:03:14 | * | Tiberium quit (Remote host closed the connection) |
14:03:33 | * | Tiberium joined #nim |
14:25:54 | FromGitter | <andreaferretti> I have a maybe trivial question about `ref` and `ptr` |
14:26:12 | FromGitter | <andreaferretti> for C apis that take pointers, it is usually safe to pass a `ref` |
14:26:27 | FromGitter | <andreaferretti> provided the C api does not store it anywhere |
14:26:43 | FromGitter | <andreaferretti> when the C call return, the `ref` is still alive and all is ok |
14:27:01 | FromGitter | <andreaferretti> now - say the C api takes a struct containing pointers |
14:27:52 | FromGitter | <andreaferretti> I assume that now a struct of `ref`s will not work, because (I guess) `ref`s have a different layout in memory wrt `ptr`s |
14:28:19 | FromGitter | <andreaferretti> by which I mean - I guess that just before the `ref` lies a memory area with the refcount |
14:28:29 | FromGitter | <andreaferretti> so that `ref` pointers will not be adiacent in memory |
14:28:59 | FromGitter | <andreaferretti> unlike, say, an object made of `ptr` |
14:29:14 | FromGitter | <andreaferretti> is this right? (is it even clear what I mean?) |
14:33:52 | Araq | not sure but it sounds wrong. an object on the stack with ref(s) in it works |
14:34:52 | * | BennyElg_ quit (Remote host closed the connection) |
14:36:57 | * | yglukhov joined #nim |
14:39:07 | * | bjz joined #nim |
14:41:17 | * | yglukhov quit (Ping timeout: 258 seconds) |
14:42:12 | FromGitter | <andreaferretti> ok, great to know! |
14:42:49 | FromGitter | <andreaferretti> but where is the refcount stored? |
14:42:55 | FromGitter | <andreaferretti> (just to know) |
14:49:17 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
14:51:24 | tyler569 | looking at the generated struct for an object with 4 ref int's - it's just 4 pointers to ints, no extra padding or metadata |
14:51:57 | tyler569 | I would imagine the GC aleviated the need for refcounts, though I can't say I know for sure. I know D doesn't need refcounts because of its GC in most circumstances |
14:55:52 | tyler569 | here's the definitions: https://pastebin.com/raw/hd5t7tDv |
14:57:21 | * | planhths quit (Read error: Connection reset by peer) |
14:57:38 | * | planhths joined #nim |
14:59:11 | Araq | at a negative offset |
15:14:55 | * | krux02 joined #nim |
15:17:42 | * | nsf quit (Quit: WeeChat 1.7.1) |
15:24:33 | * | vlad1777d quit (Quit: Leaving) |
15:41:15 | FromGitter | <hbakhtiyor> any frontend frameworks available for nim? |
15:42:19 | * | brson joined #nim |
15:45:30 | PMunch | hbakhtiyor, define frontend |
15:46:28 | FromGitter | <hbakhtiyor> web frontend |
15:46:54 | FromGitter | <hbakhtiyor> i saw some lib a while ago, but can't find now |
15:47:25 | FromGitter | <hbakhtiyor> it was said better performance than many like react, .... |
15:49:00 | PMunch | Karax? |
15:49:56 | FromGitter | <hbakhtiyor> ah, yeahhh! |
15:50:10 | FromGitter | <hbakhtiyor> @PMunch Thanks! |
15:50:45 | * | yglukhov joined #nim |
15:55:09 | ftsf | yay! my nim game is greenlit on steam :3 |
15:57:08 | Tiberium | ftsf, lol, really? btw I heard that greenlight is shutting down |
15:57:26 | PMunch | ftsf, oh wow. That's really cool! |
15:57:50 | ftsf | Tiberium, yeah, just in time! |
15:58:13 | dom96 | ftsf: congrats! |
15:58:26 | ftsf | thanks =) |
16:00:29 | dom96 | Should it be findable via the Steam store's search bar? |
16:01:00 | ftsf | hmm not eyt |
16:01:02 | ftsf | yet |
16:01:11 | ftsf | lots of forms to fill out first ~__~ |
16:03:29 | Tiberium | ftsf, yeah, but there's no screenshots of them in internet because of NDA :) |
16:04:27 | Arrrr | What game? |
16:06:08 | krux02 | is there a reason why ``high`` is implemented as compiler internal instead of simple overloading? |
16:07:02 | ftsf | http://steamcommunity.com/sharedfiles/filedetails/?id=905664367 |
16:08:03 | Arrrr | Ahh, i remember you posted some screens before |
16:08:36 | Arrrr | This looks greats, congratulations. I hope you make a blog post to teach us how did you use nim in this |
16:08:58 | ftsf | yeah, i'll do a writeup =) |
16:09:07 | ftsf | hopefully bring some people over to nim |
16:09:24 | ftsf | i'll be polishing up the framework i made for it and open sourcing that too |
16:09:35 | krux02 | ftsf: is that your game? |
16:09:41 | ftsf | krux02, yeah |
16:09:55 | krux02 | looks charming |
16:10:24 | krux02 | even though I already have Wipeout HD on my PS3 |
16:10:58 | krux02 | you should not use qualifying words in the video description |
16:11:15 | ftsf | hmm, what do you mean? |
16:11:32 | krux02 | it is up to the cosumer to decide if something is fun/fast/intense etc |
16:11:48 | * | BennyElg joined #nim |
16:11:52 | ftsf | oh ok |
16:12:14 | ftsf | true, but i dunno, how to marketing? |
16:12:20 | krux02 | well you can describe that it is designed to provide a certain feel |
16:12:32 | krux02 | but a game is never objectively fun |
16:12:50 | ftsf | true |
16:13:22 | krux02 | I haven't realeased a game on steam yet, so you only get my consumer perspective |
16:13:37 | ftsf | *nods* thanks for the feedback |
16:13:51 | ftsf | i'll get my marketing friends to go over it |
16:15:32 | krux02 | I think you should be as declarative and minimal as possible |
16:15:55 | krux02 | the description should cover the points you put most effort in |
16:17:16 | PMunch | Looks really cool |
16:17:49 | Arrrr | Is local mp or internet mp? |
16:17:56 | ftsf | local only |
16:18:22 | krux02 | well that you should put in the description |
16:18:33 | krux02 | hot steat multiplayer |
16:19:30 | krux02 | and try to get the tags from steam that you have full gamepad support |
16:19:41 | krux02 | so steam controller and normal gamepads |
16:19:56 | PMunch | Hmm, how do I make a CharLit node? |
16:20:07 | krux02 | you could also do something like in micromachines controller sharing (two people share one controller) |
16:20:38 | krux02 | newLit('a') |
16:20:44 | * | nsf joined #nim |
16:21:10 | krux02 | https://nim-lang.org/docs/macros.html#newLit,char |
16:24:20 | krux02 | ftsf: what did you use for rendering? |
16:24:49 | ftsf | krux02, just a seq[uint8] |
16:25:00 | ftsf | put it to the screen via sdl2 |
16:26:24 | * | Vladar quit (Ping timeout: 240 seconds) |
16:26:30 | krux02 | so it's all software |
16:26:48 | * | Vladar joined #nim |
16:26:56 | ftsf | yep |
16:28:00 | krux02 | did you realease a software rendering library to the nim community :D |
16:28:28 | ftsf | i've published it on github, but not really announced it since it's quite messy |
16:28:31 | ftsf | will clean it up soon |
16:30:49 | krux02 | hmm couldn't find it |
16:31:02 | ftsf | https://github.com/ftsf/nico-ldbase |
16:31:45 | krux02 | oh, I was on that page, but I didn't know that it was it |
16:32:28 | Arrrr | I remember you mentioned Pico8 |
16:32:45 | * | Trustable joined #nim |
16:32:45 | ftsf | yep, it's mostly based on pico8's api |
16:35:20 | krux02 | lexaloffle |
16:35:25 | krux02 | funny guy |
16:35:31 | krux02 | he likes chocolate |
16:35:41 | krux02 | bought the indie games bundle |
16:36:10 | ftsf | yeah, chocolate castle is great |
16:36:25 | ftsf | ok, bedtime! o/ night yall |
16:37:03 | krux02 | ok |
16:37:11 | krux02 | so I guess you are in russia |
16:37:19 | krux02 | because here it is very bright |
16:38:40 | krux02 | anyway I go, too. Stopped beging productive a while ago. |
16:38:52 | * | krux02 quit (Remote host closed the connection) |
16:44:34 | PMunch | Hmm, is there a way to get a string from AST exactly as it was typed? I've got some code which has things like "\"" in it (ie. to add a " to a string). Now I want a macro to output that, but when I try to do "\"" & ($n.strVal) & "\"" but then strVal is " and the output comes out as """ which is no good... |
16:57:17 | * | dexterk_ joined #nim |
16:57:46 | * | dexterk quit (Remote host closed the connection) |
17:00:31 | PMunch | Aah, escape |
17:00:53 | PMunch | Araq, when doing dumpCode it seems I need to escape some characters.. |
17:01:11 | PMunch | I'm guessing you don't want to import strutils into the macros module? |
17:01:33 | PMunch | Or rather "from strutils import escape" |
17:02:58 | * | brson quit (Quit: leaving) |
17:10:52 | * | yglukhov quit (Remote host closed the connection) |
17:29:25 | * | Matthias247 joined #nim |
17:33:05 | * | tankfeeder joined #nim |
17:34:16 | * | vivus joined #nim |
17:40:41 | vivus | is this the stdlib hashing library: https://nim-lang.org/docs/hashes.html ? |
17:41:20 | PMunch | Yup |
17:42:54 | vivus | it doesn't tell me how to get a specific output hash value |
17:42:57 | vivus | eg. 256 |
17:42:59 | vivus | or 512 |
17:44:42 | * | PMunch quit (Quit: leaving) |
17:50:36 | vivus | dom96: ^^ |
17:53:22 | * | Trustable quit (Remote host closed the connection) |
18:24:22 | * | Trustable joined #nim |
18:39:15 | * | PMunch joined #nim |
18:51:37 | * | tankfeeder quit (Quit: Leaving) |
18:52:39 | * | couven92 quit (Quit: Client disconnecting) |
18:56:49 | vivus | where can I view the latest/most up to date list of nimble packages? |
18:59:46 | PMunch | github? |
18:59:58 | PMunch | https://github.com/nim-lang/packages |
19:00:05 | PMunch | That's the version nimble pulls |
19:01:36 | PMunch | I'm pretty sure someone at some point also wrote a simple site to search through it, but I can't seem to find it |
19:02:13 | vivus | I see this: https://github.com/fmorgner/nim256 . which isn't here: https://nim-lang.org/docs/lib.html |
19:02:28 | vivus | but then on rosetta code I see this: https://rosettacode.org/wiki/SHA-256#Nim |
19:02:38 | vivus | is option 2 the better option? |
19:02:43 | Tiberium | PMunch, there's some of them |
19:02:57 | Tiberium | PMunch, https://nimble.directory/ , http://nimism.co/ |
19:03:13 | PMunch | vivus, you can make a nimble package and not put it in the repository |
19:03:38 | PMunch | To install them just git clone and then run "nimble install" in their root directory |
19:04:30 | PMunch | Tiberium, thanks :) dom96 maybe these should be linked from the github package directory? |
19:05:14 | PMunch | vivus, I think that page is a pretty manually managed part of the documentation. It's not an exhaustive list of packages |
19:05:20 | Tiberium | PMunch, also https://libraries.io/search?platforms=Nimble |
19:05:33 | vivus | so which hashing lib should I use? |
19:06:04 | PMunch | Well, the rosettacode version uses OpenSSL |
19:06:08 | PMunch | Which is pretty solid |
19:06:43 | PMunch | So I'd say go for that |
19:07:11 | PMunch | You are pretty much sure that it is scrutinized and exhaustively checked |
19:07:19 | * | Arrrr quit (Quit: Leaving.) |
19:07:33 | PMunch | So if you have OpenSSL available for you target, go for it. |
19:08:40 | vivus | I tried nimSHA2 and the output it gave me from doing a 256 hash was not what I expected |
19:09:05 | * | yglukhov joined #nim |
19:10:29 | PMunch | As I said, the OpenSSL version from rosettacode is probably your best bet |
19:10:47 | * | Tiberium quit (Quit: Leaving) |
19:10:50 | vivus | def-: is sha256 a library you are using internally here: https://gist.github.com/def-/52fca91b0e0158f1b26920b822ec3815 ? |
19:11:04 | vivus | PMunch: yeah, that worked. just learning about hashing |
19:11:05 | vivus | thanks |
19:13:09 | PMunch | When it comes to cryptography it is always best to use the tried and tested method. It's way to easy to introduce some super dumb bug that can break your entire system |
19:13:47 | * | brson joined #nim |
19:13:57 | * | Vladar quit (Quit: Leaving) |
19:20:11 | * | Trustable quit (Remote host closed the connection) |
19:24:44 | * | niomix joined #nim |
19:26:38 | niomix | Good, Nim community can i have an explaination of why i was mistreated in the nim's forum?, i am a new member, i really like the language, and i wanted to make friends and some tips to master the language |
19:27:47 | zachcarter | niomix: not sure what forum thread you’re referencing |
19:28:04 | zachcarter | the community is generally very friendly and welcoming |
19:28:15 | zachcarter | I’m sorry you had that experience, but it isn’t and shouldn’t be the norm |
19:28:32 | niomix | i just said, i wanted to become an excellent nim programmer, and that i wanted some tips |
19:28:46 | niomix | my account was moredated while a newer account wasn't |
19:28:48 | zachcarter | can you provide a link to the forum thread? |
19:28:51 | * | couven92 joined #nim |
19:28:53 | niomix | it got deleted |
19:28:56 | niomix | and i got banned |
19:29:27 | vivus | niomix: because that normally comes across as "trollish" behaviour when saying "I want to be a great nim programmer" |
19:29:52 | niomix | well i wasn't lying i even wrote it in a paper, i can show you |
19:30:32 | niomix | -_-' |
19:31:05 | vivus | niomix: it's best to not say those things. just focus on programming questions, ask and hope someone will volunteer an answer |
19:31:28 | niomix | well i thought the community hated me |
19:32:00 | vivus | people may have bad days but nobody has a right to "hate" you |
19:32:17 | niomix | you shouldn't judge everyone because of the trolls |
19:32:17 | vivus | why don't you start writing some code and asking questions about it. |
19:32:40 | vivus | otherwise you can discuss non-code related matters in: #nim-offtopic |
19:33:19 | niomix | ok |
19:33:24 | niomix | thanks |
19:35:24 | PMunch | We've had a share of actual trolls at least here in this channel. So it could be they just assumed you were a troll and banned you.. Sounds a bit weird though, as zachcarter said we're generally pretty friendly :P |
19:35:30 | * | zahary joined #nim |
19:41:01 | * | MyMind joined #nim |
19:42:40 | * | Sembei quit (Ping timeout: 268 seconds) |
19:43:31 | * | brson quit (Ping timeout: 240 seconds) |
19:44:08 | * | yglukhov quit (Remote host closed the connection) |
19:44:51 | * | brson joined #nim |
19:44:52 | * | yglukhov joined #nim |
19:47:18 | niomix | ok that's good to know |
19:49:34 | * | yglukhov quit (Ping timeout: 260 seconds) |
19:51:58 | * | tankfeeder joined #nim |
20:12:12 | * | BennyElg quit (Remote host closed the connection) |
20:13:17 | PMunch | Better now Araq? https://github.com/nim-lang/Nim/pull/5778 |
20:19:58 | Araq | meh |
20:21:20 | PMunch | meh? |
20:22:29 | PMunch | I could make two sets for checking against, and have a union of those for the last set? |
20:25:53 | * | niomix quit (Remote host closed the connection) |
20:26:54 | Araq | the formatting is ugly and it's more complex than necessary |
20:27:14 | Araq | you only need newLit vs newTree really |
20:28:15 | PMunch | Hmm |
20:28:30 | Araq | plus it breaks tests/manyloc/standalone/barebone.nim |
20:29:04 | PMunch | I guess, but I feel new<>Node is more "correct" or at least that's how people would actually use it |
20:29:13 | PMunch | Yeah, I was wondering about those tests |
20:29:59 | PMunch | Not really sure what you dislike about the formatting. The multi-line sets? |
20:32:10 | Araq | yeah |
20:33:24 | * | niomix joined #nim |
20:34:49 | PMunch | I was trying to limit the line length since you complained about that :P |
20:36:19 | Araq | yeah indeed, it reads like "fuck you" |
20:36:25 | PMunch | But I think I will split it into two sets and then do the union thing I mentioned earlier |
20:38:31 | PMunch | Haha, that was not the intention |
20:38:53 | PMunch | I commonly split long lists like that |
20:42:35 | * | zachcarter quit (Ping timeout: 260 seconds) |
20:44:09 | PMunch | I feel like doing a split at an arbitrary place is more confusing than no split at all |
20:44:28 | PMunch | But then again I've set my editor up to split lines for me, so all my splits are arbitrary.. |
20:45:42 | Araq | yeah but I review the diff in the browser so long lines cause a horizontal scrollbar |
20:45:57 | PMunch | Ah right, I can see how that would be annoying |
20:46:20 | PMunch | I guess I'll have to PR Github for that :P |
20:46:58 | Araq | in principle I agree with you, in 2017 we shouldn't have to care about long lines. |
20:47:49 | PMunch | Hmm, what's the issue with barebone.nim though? That seems serious |
20:48:03 | PMunch | I'm guessing my inclusion of escape from strutils? |
20:48:22 | * | bjz joined #nim |
20:49:09 | Araq | yeah barebone lacks strutils |
20:49:17 | PMunch | Should I take the same approach as for toLower? |
20:49:28 | PMunch | Basically copy it in as a sub-proc |
20:50:31 | Araq | just don't use escape, who cares if string literals are escaped, does that come up? |
20:51:23 | PMunch | Yeah, I tried to run dumpCode on the code itself. When using strings like "\"" it adds that as the string """.. |
20:51:43 | PMunch | So I either need to get the string value exactly as it was typed, or escaped |
20:51:59 | vivus | how do I call this proc to transform a variable: proc `$`*(sha: SHA256Digest): string = toString(sha) ? when I do: newvar = $(oldvar) is doesn't format correctly |
20:52:34 | PMunch | What do you mean doesn't format correctly |
20:52:49 | vivus | it outputs this: �wE�ǣ8��'��Gf��ی߸]F�q���X�� |
20:52:56 | vivus | instead of a string |
20:53:14 | demi- | it probably is a string, but it isn't encoded as a string |
20:53:15 | vivus | ref here: https://github.com/jangko/nimSHA2 where it says: to convert digest into string, use proc $ |
20:54:25 | PMunch | Ah, you're expecting a hex string I guess :P |
20:54:44 | * | dddddd joined #nim |
20:55:45 | demi- | it is hex in bytes, not as a string rep of the hex |
20:56:21 | * | rauss quit (Quit: WeeChat 1.7.1) |
20:56:51 | PMunch | vivus, if you used the OpenSSL version from RosettaCode as I told you it would give you a hex output |
20:56:56 | * | Ven joined #nim |
20:57:19 | vivus | PMunch: I am using that option, but I am just figuring out how this library works (as well) |
20:57:20 | * | Ven is now known as Guest59987 |
20:57:31 | * | tankfeeder quit (Quit: Leaving) |
20:57:43 | vivus | demi-: so how do I convert it using the "proc $" ? |
20:59:41 | PMunch | Well, looking in types.nim it seems that HashBytes (the return value of the hash proc) is an array of 32 uint8s |
21:00:08 | PMunch | So if you use the toHex procedure in strutils on each of those then it would give you what you assume |
21:01:21 | vivus | so something like: newvar = toHex(oldvar) ? I tried that and got a code error |
21:03:16 | PMunch | toHex only does one integer at a time |
21:03:59 | PMunch | So something like "result = ""; for i in hash("Hello World"): result = result & toHex(i)" |
21:05:04 | Araq | result = result & x ? that's result.add x or result &= x |
21:05:44 | PMunch | Oh okay, wasn't sure if &= worked |
21:06:22 | vivus | using digest.hex() gives a hex output |
21:07:25 | FromGitter | <barcharcraz> wowah how does koch find cl when did didn't specify it anywhere |
21:07:30 | FromGitter | <barcharcraz> (with --cc:vcc ofc |
21:07:32 | vivus | yeah this lib is a bit tougher to use, the rosetta code solution is cleaner |
21:15:03 | FromGitter | <Varriount> PMunch: I tend to use consts instead for long sets like that. ⏎ ⏎ ```const category = { ⏎ a ⏎ b ⏎ }``` [https://gitter.im/nim-lang/Nim?at=590b99db33e9ee771c750fd7] |
21:15:49 | PMunch | Hmm, what's the benefit of that? It's just as long |
21:19:13 | couven92 | @barcharcraz, use the `vccexe` tool |
21:22:06 | Araq | couven92: speaking of which, can you make that work for VS 2017? |
21:22:23 | couven92 | @barcharcraz, please refer to [Use the Microsoft C/C++ Compiler backend instead of MinGW](https://github.com/couven92/nim-website/blob/master/jekyll/install_windows.md#use-the-microsoft-cc-compiler-backend-instead-of-mingw) for now |
21:22:44 | couven92 | Araq, yeah... I'll try to do that in weekend |
21:24:56 | * | ofelas quit (Ping timeout: 258 seconds) |
21:28:10 | * | yglukhov joined #nim |
21:34:03 | * | yglukhov quit (Ping timeout: 268 seconds) |
21:34:20 | FromGitter | <Varriount> PMunch: You aren't combining a (relatively) long datastructure literal with a logic statement. |
21:34:33 | FromGitter | <Varriount> Makes it more readable to me. |
21:34:37 | PMunch | Ah, that's a good point |
21:34:42 | PMunch | I was planning on doing that |
21:40:44 | * | DebugDude12 joined #nim |
21:40:44 | jackv | does the nim compiler have a quiet mode? my brief scan of the manual didn't reveal a flag I should set for that |
21:40:45 | * | ofelas joined #nim |
21:41:01 | PMunch | To remove the compile output? |
21:41:15 | jackv | or at least all of the hints |
21:41:30 | PMunch | --verbosity:0? |
21:42:32 | jackv | hmm...still getting hints |
21:42:41 | PMunch | Hmm, seems to have removed only some of them for me.. |
21:42:45 | PMunch | That's strange |
21:44:00 | DebugDude12 | I need to initialize a bunch of external resources, but close all of them if this fails |
21:44:10 | jackv | yeah, it removed like the last hint about "compilation successful" but that's it |
21:44:18 | DebugDude12 | I want to do this, without nesting try/expect statements 100 times: http://dpaste.com/2QVED5M |
21:44:19 | PMunch | --hints:off |
21:44:25 | PMunch | That's probably what you're looking for |
21:44:45 | jackv | PMunch: perfect thanks! |
21:45:04 | PMunch | No problem :) I just ran "nim --advanced" and went through the list :P |
21:45:09 | demi- | DebugDude12: are these dependent files? |
21:45:23 | PMunch | DebugDude12, defer statements? |
21:46:19 | DebugDude12 | demi-: these are not files, in my case GPU resources. But there must be some idiom for this type of problem. |
21:46:27 | demi- | ah i see |
21:46:28 | PMunch | Yeah, defer |
21:46:29 | DebugDude12 | PMunch: i want to keep them on success for a long time |
21:46:37 | PMunch | Hmm, that's a problem |
21:46:57 | * | nsf quit (Quit: WeeChat 1.7.1) |
21:47:00 | DebugDude12 | i would like to implement my own deferFailure, but can't find how defer itself is implemented |
21:47:27 | PMunch | How do they fail? Throw or return nil |
21:47:59 | DebugDude12 | they throw. But even if they would return nil, i would replace the 100s of try/expects with if/else |
21:48:41 | PMunch | Well, you can have one try/expects around the entire thing. And then close the open ones |
21:48:59 | Araq | sounds like you use exceptions in a suboptimal way |
21:49:49 | DebugDude12 | beeing used to RAII/scope(failure) i would like to know the nim counterpart |
21:50:55 | DebugDude12 | I either want to work with those 10-20 resources or none of them. And if i use only 1 try/catch i don't know which one i have opened. |
21:51:12 | PMunch | Can't you check? |
21:51:22 | Araq | withRes a, b, c, d, e, f, g, h: body |
21:51:22 | demi- | isn't this normally abstracted away through whatever GPU library you use? |
21:53:02 | DebugDude12 | demi-: in my specific case it may be. But one day i need to use some other type of external resources |
21:53:17 | demi- | i see |
21:54:03 | FromGitter | <Varriount> DebugDude12: I have a solution, one moment |
21:55:32 | Araq | for i in 0..<10: try: a[i] = openRes(...) except: rollback(a, i-1); raise |
21:55:47 | Araq | use(a) |
21:55:55 | Araq | rollback(a, 10) |
21:56:17 | Araq | ^ wrap in a template, be happy |
21:57:41 | * | zachcarter joined #nim |
21:57:44 | * | kunev quit (Ping timeout: 240 seconds) |
21:58:20 | DebugDude12 | My other problem is that this leaks into types which contain those resources. Now the wrapper needs to have a close() function to cleanup as early as possible :S |
21:58:34 | DebugDude12 | and now i can't create the wrapper without the rollback trick |
22:00:29 | * | kunev joined #nim |
22:00:31 | DebugDude12 | but then ... all languages with exceptions interfacing with external resources have this problem |
22:00:38 | DebugDude12 | so there must be some solution |
22:01:03 | FromGitter | <Varriount> DebugDude12: https://gist.github.com/Varriount/c6ed6caa4d968d7f6d57c2fa8de9bb9b |
22:02:32 | FromGitter | <Varriount> Just loop through the sequence to clean up opened resources. |
22:03:03 | Araq | varriount: I already proposed such a thing ;-)# |
22:03:09 | FromGitter | <Varriount> Alternately, if the memory for the resources is allocated with new(), you can attach a finalizer |
22:03:32 | FromGitter | <Varriount> Araq: I saw. I felt my example couldn't hurt. |
22:03:44 | DebugDude12 | Varriount: which may be problematic, if the order/timing of closing is important |
22:05:04 | FromGitter | <Varriount> DebugDude12: Hm. Are such conditions common though? |
22:06:11 | DebugDude12 | I don't know, but there must be ways to not leak resources without tricks and hacks |
22:07:19 | DebugDude12 | Java "solves" this with pokemon style catch-em-all clutter |
22:08:48 | FromGitter | <Varriount> What do you mean? |
22:09:16 | FromGitter | <Varriount> And what's wrong with the examples above? |
22:10:16 | DebugDude12 | some kind of deferOnThrow would be way simpler |
22:11:19 | * | niomix left #nim (#nim) |
22:11:30 | DebugDude12 | And most resources offer some kind of withFoo: block |
22:12:10 | FromGitter | <Varriount> Nim has a defer block mechanism that always runs at the end of a function. You still have to track which resources you've opened though. |
22:12:49 | FromGitter | <Varriount> Either you explicitly track and control the order/time, or you let the garbage collector run finalizers. |
22:13:28 | DebugDude12 | Im going the explicite way, i just asked whats idiomatic |
22:14:05 | FromGitter | <Varriount> Place the resources into a sequence, and use a try block or defer block |
22:14:29 | FromGitter | <Varriount> you could even use a boolean that is checked in the defer block |
22:15:18 | Araq | I could try to convince you why it's not as much of a problem as you think it is |
22:16:11 | FromGitter | <Varriount> I mean, if you only want to release resources when there's an error in any portion of the function, and don't want to wrap the entire thing in a try block, use a sentinel boolean variable that's set to 'false' at the end of normal function return. |
22:16:25 | FromGitter | <Varriount> In the defer statement, if the boolean is true, release the resources. |
22:21:47 | FromGitter | <Varriount> Araq: Wrapping an entire procedure body in a try body would be more performant, correct? |
22:25:44 | Araq | correct. but for the JS/C++ backends it can be irrelevant |
22:27:01 | DebugDude12 | So now my resource is wrapped by some object a, contained by object b, attached to object c. Now initializing c, b and a must be also wrapped in such a rollback loop? |
22:27:14 | DebugDude12 | I just want deterministic, guaranteed resource closing in all cases. |
22:27:51 | FromGitter | <Varriount> DebugDude12: Could you past some of the code you're working on? |
22:28:28 | DebugDude12 | Varriount: this isn't specific to my code. I just want my determinism. |
22:28:52 | FromGitter | <Varriount> If you want guaranteed resource closing in all situations, at all times, you have to use finalizers/destructors. |
22:29:11 | DebugDude12 | but then im greenspunning C++ :S which i want to ditch |
22:30:18 | * | gokr quit (Quit: Leaving.) |
22:30:22 | FromGitter | <Varriount> I don't know of any other possible mechanism, in any language, that allows one to provide similar resource cleanup behavior. |
22:30:53 | FromGitter | <Varriount> Not unless you personally ensure that any and all users call cleanup routines at the appropriate times. |
22:31:52 | FromGitter | <Varriount> Or, you can automatically clean up/invalidate the resource in procedures where the error is initially thrown, if you have control over such code. |
22:32:13 | FromGitter | <Varriount> Either you clean up at the beginning of the error, or at the end. :/ |
22:32:13 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:32:44 | FromGitter | <Varriount> You still have to clean up when the resource goes out of scope/is deallocated though. |
22:33:08 | DebugDude12 | This is exactly what im doing, cleaning up where the error happens. But now the caller expects an initialized return value, but gets an exception or C-style nil as return value |
22:33:41 | FromGitter | <Varriount> Ok... so what's the problem? |
22:34:02 | DebugDude12 | Nothing. Just asking if there is some more concise construct than try/catch |
22:34:22 | FromGitter | <Varriount> 'defer'? |
22:34:48 | FromGitter | <Varriount> DebugDude12: https://nim-lang.org/docs/manual.html#exception-handling-defer-statement |
22:35:37 | DebugDude12 | We are going circles. Where is defer implemented? It doesn't seem to be a template |
22:35:46 | FromGitter | <Varriount> It's a compiler intrinsic |
22:40:16 | FromGitter | <Varriount> DebugDude12: i'm curious, what's so bad about finalizers? |
22:41:05 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:41:31 | DebugDude12 | Varriount: lack of determinism. But i see almost all languages suffer from this. |
22:41:51 | DebugDude12 | Especially when 99% of lines in my code could throw. |
22:44:21 | vivus | can I use the openssl lib to get a sha256 sum on a file? |
22:44:56 | FromGitter | <Varriount> vivus: Sure, as long as the openssl lib has a procedure to get the sha256 sum on a file/piece of data. |
22:45:44 | Araq | template withRes(r, body) = |
22:45:48 | Araq | var r = createRes(...) |
22:45:53 | Araq | try: |
22:45:58 | Araq | body |
22:46:01 | Araq | finally: |
22:46:04 | Araq | r.close |
22:49:49 | DebugDude12 | thank you all for your efforts and patience. Have a good night. |
22:50:04 | FromGitter | <konqoro> hey why that happens? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ for https://gist.github.com/konqoro/3fc1dd88556dc84dd737c0734bc5a452 [https://gitter.im/nim-lang/Nim?at=590bb01f12f05b512a2d80ab] |
22:50:13 | * | DebugDude12 quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
22:53:10 | FromGitter | <Varriount> @konqoro What happens if you explicitly pass in generic parameters to 'solve'? |
22:54:32 | * | def-pri-pub joined #nim |
22:55:49 | FromGitter | <konqoro> like: echo solve6, 21 (k, v) ? |
22:56:33 | FromGitter | <Varriount> Yes |
22:56:52 | FromGitter | <konqoro> pmatrix.nim(77, 12) Error: type expected |
22:57:12 | FromGitter | <Varriount> The first parameter needs to be a type, the second a value |
22:58:08 | FromGitter | <Varriount> `echo solvefloat, 21 (k, v)` |
22:59:46 | FromGitter | <konqoro> sorry i can't really follow you |
23:02:26 | FromGitter | <konqoro> why float? |
23:02:48 | FromGitter | <Varriount> I'm assuming it's float. I haven't used this particular code before. |
23:03:26 | FromGitter | <konqoro> M is an int |
23:03:29 | FromGitter | <Varriount> `proc solve*M, N: static[int (...)` - 'M' is a type parameter, 'N' is a integer known at compile-time |
23:03:54 | FromGitter | <Varriount> Or wait, maybe you're right. |
23:03:59 | FromGitter | <Varriount> Let me look in the manual |
23:04:52 | FromGitter | <konqoro> i tried doing something like proc solve*M: static[int (...) and it didnt work |
23:06:24 | FromGitter | <barcharcraz> nimsuggest is not able to open files when I give it the absolute path on windows |
23:06:30 | FromGitter | <barcharcraz> "can not open ''" |
23:06:37 | FromGitter | <barcharcraz> no spaces in my path |
23:08:04 | Araq | barcharcraz: put the path in double quotes |
23:08:37 | FromGitter | <barcharcraz> same issue |
23:09:59 | FromGitter | <konqoro> why it expects the first to be a type anyway ?? |
23:10:45 | FromGitter | <barcharcraz> huh it simply segfaults in terse mode |
23:11:11 | FromGitter | <Varriount> @konqoro I was wrong, it's something else |
23:11:30 | FromGitter | <konqoro> no i get why you got confused |
23:11:59 | FromGitter | <Varriount> @konqoro For some reason, the type for 'solve' is hardcoded to be a C integer |
23:16:15 | FromGitter | <konqoro> anyway thanks for looking at it |
23:16:20 | FromGitter | <konqoro> goodmorning |
23:17:09 | FromGitter | <Varriount> @Araq There seems to be a compiler bug with @konqoro's code. |
23:17:38 | FromGitter | <Varriount> The compiler is preventing me from passing a static integer into a generic parameter |
23:18:16 | * | planhths quit (Quit: Konversation terminated!) |
23:18:42 | * | chemist69 quit (Ping timeout: 240 seconds) |
23:20:24 | * | Guest59987 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:20:32 | FromGitter | <Varriount> @konqoro There's a compiler bug. :/ |
23:28:16 | FromGitter | <barcharcraz> huh even with the quotes it's the c:\ (the : I assume) that screws nimsuggest up |
23:32:19 | FromGitter | <Varriount> @barcharcraz Just use '\' then. That is the 'current' drive |
23:36:48 | FromGitter | <barcharcraz> yeah that's what I did |
23:40:39 | FromGitter | <barcharcraz> grr still not working right |
23:40:56 | PMunch | Woo, got my tweening to work! :) |
23:45:51 | * | chemist69 joined #nim |