<< 04-05-2017 >>

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:24FromGitter<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:41FromGitter<NevnHiwEjuam_twitter> trying to look at asyncdispatch and asyncnet to see what they do with any possible time-related code
02:43:53subsetparkWhen using a seq as a stack, is a deque more performant than a vanilla seq?
03:04:06FromGitter<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:50FromGitter<NevnHiwEjuam_twitter> proc write*(s: Stream, g: Guid) {.inline.} = s.writeData(addr(g), 16)
03:05:17FromGitter<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:50FromGitter<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:44FromGitter<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:10m712/!\
09:01:20m712wrong window
09:04:04ArrrrHmm, why don't you remove parseOpt and rename parseOpt2 to parseOpt?
09:09:15AraqparseOpt2 breaks the compiler and I never looked at why
09:09:58Araqalso 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:22Arrrrwtf
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:49bbl__https://github.com/nim-lang/Nim/blob/devel/doc/manual/generics.txt#L577-L630 this is quite wild stuff
09:52:02bbl__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:53Araqbbl__: no but you can do 'koch web' and look at the produced manual.html
10:03:24*krux02 joined #nim
10:09:58Araqhmm any really simple Nim websocket examples out there?
10:12:30*chemist69 quit (Ping timeout: 246 seconds)
10:14:04FromGitter<stisa> Araq client or server?
10:14:11Araqboth
10:15:20*yglukhov quit (Ping timeout: 240 seconds)
10:15:48Araqserver being more important
10:15:53*chemist69 joined #nim
10:17:55FromGitter<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:24FromGitter<andreaferretti> should c2nim be installed by `koch tools`?
10:21:47FromGitter<andreaferretti> installing via nimble is often broken - I assume because of the dependency on compiler
10:40:57nivAraq: 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:47Araqniv: 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:47Araqniv: the example is incomplete
11:25:05nivit might be :(
11:25:25nivare you looking at setting up a client or server endpoint?
11:26:52niveither 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:35Araqniv: no I mean the call to
11:35:37AraqwaitFor server.serve(Port(8080), cb)
11:35:40Araqis missing
11:36:00Araqis there a standard port to use for websockets?
11:36:42nivexample: 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:00nivthat's what the Connection: Upgrade stuff is about
11:37:14nivyou 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:08nivif 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:32dom96Araq: My snake game uses websockets
12:04:43*aedigix quit (Remote host closed the connection)
12:04:52*Vladar joined #nim
12:05:50FromGitter<Varriount> subsetpark
12:05:52PMunchI 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:20AraqPMunch: use templates+getAst instead?
12:06:37AraqdumpTree is not for boilerplate creation, we strive to eliminate boilerplate
12:06:58*aedigix quit (Remote host closed the connection)
12:08:23PMunchYeah 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:47Araqalright, PR it then
12:20:51subsetparkVarriount
12:23:25*zachcarter quit (Quit: zachcarter)
12:56:17PMunchHmm, 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:23PMunchAh, it was actually just "if n.kind in [list, of, kinds]:"...
12:59:34PMunchShould've checked that first :P
12:59:41Araqno, it's n.kind in {....}
12:59:53*tankfeeder quit (Quit: Leaving)
13:00:04Araqthe [] version is slower
13:00:05PMunchWith curly brackets?
13:00:08PMunchAh right
13:00:09Araqyes+
13:00:53PMunchWait, what's a {}?
13:02:10PMunchA set?
13:03:45*Tiberium joined #nim
13:05:34couven92yes, PMunch that's a set
13:05:57PMunchBut why checking a set is faster than an array?
13:06:06PMunch(barring having duplictes in an array)
13:06:17*Tiberium quit (Remote host closed the connection)
13:06:57couven92ordinal elements in the set, I think, making Nim order and sort lookup at compiletime?
13:06:58*Tiberium joined #nim
13:08:17Araqit's converted to a bit mask, that's why.
13:09:26*Tiberium quit (Remote host closed the connection)
13:09:46couven92ah, 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:37PMunchWhy 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:16Araqwe 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:38PMunchHmm
13:44:39PMunchOkay
13:44:56PMunchThat's something which tripped me up when working with macros as well
13:45:46*rauss joined #nim
13:45:50PMunchBy 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:10Araqsure
13:47:11*Tiberium quit (Quit: Leaving)
13:49:48FromGitter<Varriount> subsetpark: Yes?
13:50:10*planhths joined #nim
13:50:19subsetparkI don't know you said my name :)
13:51:28*BitPuffin|osx joined #nim
13:56:06*Sentreen joined #nim
13:57:51PMunchAraq: https://github.com/nim-lang/Nim/pull/5778
14:00:01couven92Araq, what's a benign proc?
14:01:49*Tiberium joined #nim
14:02:11PMunchHmm, tested it some more and it still has some bugs..
14:02:44Araqcouven92: a proc with .locks: 0, gcsafe
14:02:51couven92ah
14:03:14*Tiberium quit (Remote host closed the connection)
14:03:33*Tiberium joined #nim
14:25:54FromGitter<andreaferretti> I have a maybe trivial question about `ref` and `ptr`
14:26:12FromGitter<andreaferretti> for C apis that take pointers, it is usually safe to pass a `ref`
14:26:27FromGitter<andreaferretti> provided the C api does not store it anywhere
14:26:43FromGitter<andreaferretti> when the C call return, the `ref` is still alive and all is ok
14:27:01FromGitter<andreaferretti> now - say the C api takes a struct containing pointers
14:27:52FromGitter<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:19FromGitter<andreaferretti> by which I mean - I guess that just before the `ref` lies a memory area with the refcount
14:28:29FromGitter<andreaferretti> so that `ref` pointers will not be adiacent in memory
14:28:59FromGitter<andreaferretti> unlike, say, an object made of `ptr`
14:29:14FromGitter<andreaferretti> is this right? (is it even clear what I mean?)
14:33:52Araqnot 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:12FromGitter<andreaferretti> ok, great to know!
14:42:49FromGitter<andreaferretti> but where is the refcount stored?
14:42:55FromGitter<andreaferretti> (just to know)
14:49:17*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:51:24tyler569looking 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:57tyler569I 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:52tyler569here'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:11Araqat 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:15FromGitter<hbakhtiyor> any frontend frameworks available for nim?
15:42:19*brson joined #nim
15:45:30PMunchhbakhtiyor, define frontend
15:46:28FromGitter<hbakhtiyor> web frontend
15:46:54FromGitter<hbakhtiyor> i saw some lib a while ago, but can't find now
15:47:25FromGitter<hbakhtiyor> it was said better performance than many like react, ....
15:49:00PMunchKarax?
15:49:56FromGitter<hbakhtiyor> ah, yeahhh!
15:50:10FromGitter<hbakhtiyor> @PMunch Thanks!
15:50:45*yglukhov joined #nim
15:55:09ftsfyay! my nim game is greenlit on steam :3
15:57:08Tiberiumftsf, lol, really? btw I heard that greenlight is shutting down
15:57:26PMunchftsf, oh wow. That's really cool!
15:57:50ftsfTiberium, yeah, just in time!
15:58:13dom96ftsf: congrats!
15:58:26ftsfthanks =)
16:00:29dom96Should it be findable via the Steam store's search bar?
16:01:00ftsfhmm not eyt
16:01:02ftsfyet
16:01:11ftsflots of forms to fill out first ~__~
16:03:29Tiberiumftsf, yeah, but there's no screenshots of them in internet because of NDA :)
16:04:27ArrrrWhat game?
16:06:08krux02is there a reason why ``high`` is implemented as compiler internal instead of simple overloading?
16:07:02ftsfhttp://steamcommunity.com/sharedfiles/filedetails/?id=905664367
16:08:03ArrrrAhh, i remember you posted some screens before
16:08:36ArrrrThis looks greats, congratulations. I hope you make a blog post to teach us how did you use nim in this
16:08:58ftsfyeah, i'll do a writeup =)
16:09:07ftsfhopefully bring some people over to nim
16:09:24ftsfi'll be polishing up the framework i made for it and open sourcing that too
16:09:35krux02ftsf: is that your game?
16:09:41ftsfkrux02, yeah
16:09:55krux02looks charming
16:10:24krux02even though I already have Wipeout HD on my PS3
16:10:58krux02you should not use qualifying words in the video description
16:11:15ftsfhmm, what do you mean?
16:11:32krux02it is up to the cosumer to decide if something is fun/fast/intense etc
16:11:48*BennyElg joined #nim
16:11:52ftsfoh ok
16:12:14ftsftrue, but i dunno, how to marketing?
16:12:20krux02well you can describe that it is designed to provide a certain feel
16:12:32krux02but a game is never objectively fun
16:12:50ftsftrue
16:13:22krux02I haven't realeased a game on steam yet, so you only get my consumer perspective
16:13:37ftsf*nods* thanks for the feedback
16:13:51ftsfi'll get my marketing friends to go over it
16:15:32krux02I think you should be as declarative and minimal as possible
16:15:55krux02the description should cover the points you put most effort in
16:17:16PMunchLooks really cool
16:17:49ArrrrIs local mp or internet mp?
16:17:56ftsflocal only
16:18:22krux02well that you should put in the description
16:18:33krux02hot steat multiplayer
16:19:30krux02and try to get the tags from steam that you have full gamepad support
16:19:41krux02so steam controller and normal gamepads
16:19:56PMunchHmm, how do I make a CharLit node?
16:20:07krux02you could also do something like in micromachines controller sharing (two people share one controller)
16:20:38krux02newLit('a')
16:20:44*nsf joined #nim
16:21:10krux02https://nim-lang.org/docs/macros.html#newLit,char
16:24:20krux02ftsf: what did you use for rendering?
16:24:49ftsfkrux02, just a seq[uint8]
16:25:00ftsfput it to the screen via sdl2
16:26:24*Vladar quit (Ping timeout: 240 seconds)
16:26:30krux02so it's all software
16:26:48*Vladar joined #nim
16:26:56ftsfyep
16:28:00krux02did you realease a software rendering library to the nim community :D
16:28:28ftsfi've published it on github, but not really announced it since it's quite messy
16:28:31ftsfwill clean it up soon
16:30:49krux02hmm couldn't find it
16:31:02ftsfhttps://github.com/ftsf/nico-ldbase
16:31:45krux02oh, I was on that page, but I didn't know that it was it
16:32:28ArrrrI remember you mentioned Pico8
16:32:45*Trustable joined #nim
16:32:45ftsfyep, it's mostly based on pico8's api
16:35:20krux02lexaloffle
16:35:25krux02funny guy
16:35:31krux02he likes chocolate
16:35:41krux02bought the indie games bundle
16:36:10ftsfyeah, chocolate castle is great
16:36:25ftsfok, bedtime! o/ night yall
16:37:03krux02ok
16:37:11krux02so I guess you are in russia
16:37:19krux02because here it is very bright
16:38:40krux02anyway I go, too. Stopped beging productive a while ago.
16:38:52*krux02 quit (Remote host closed the connection)
16:44:34PMunchHmm, 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:31PMunchAah, escape
17:00:53PMunchAraq, when doing dumpCode it seems I need to escape some characters..
17:01:11PMunchI'm guessing you don't want to import strutils into the macros module?
17:01:33PMunchOr 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:41vivusis this the stdlib hashing library: https://nim-lang.org/docs/hashes.html ?
17:41:20PMunchYup
17:42:54vivusit doesn't tell me how to get a specific output hash value
17:42:57vivuseg. 256
17:42:59vivusor 512
17:44:42*PMunch quit (Quit: leaving)
17:50:36vivusdom96: ^^
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:49vivuswhere can I view the latest/most up to date list of nimble packages?
18:59:46PMunchgithub?
18:59:58PMunchhttps://github.com/nim-lang/packages
19:00:05PMunchThat's the version nimble pulls
19:01:36PMunchI'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:13vivusI see this: https://github.com/fmorgner/nim256 . which isn't here: https://nim-lang.org/docs/lib.html
19:02:28vivusbut then on rosetta code I see this: https://rosettacode.org/wiki/SHA-256#Nim
19:02:38vivusis option 2 the better option?
19:02:43TiberiumPMunch, there's some of them
19:02:57TiberiumPMunch, https://nimble.directory/ , http://nimism.co/
19:03:13PMunchvivus, you can make a nimble package and not put it in the repository
19:03:38PMunchTo install them just git clone and then run "nimble install" in their root directory
19:04:30PMunchTiberium, thanks :) dom96 maybe these should be linked from the github package directory?
19:05:14PMunchvivus, I think that page is a pretty manually managed part of the documentation. It's not an exhaustive list of packages
19:05:20TiberiumPMunch, also https://libraries.io/search?platforms=Nimble
19:05:33vivusso which hashing lib should I use?
19:06:04PMunchWell, the rosettacode version uses OpenSSL
19:06:08PMunchWhich is pretty solid
19:06:43PMunchSo I'd say go for that
19:07:11PMunchYou are pretty much sure that it is scrutinized and exhaustively checked
19:07:19*Arrrr quit (Quit: Leaving.)
19:07:33PMunchSo if you have OpenSSL available for you target, go for it.
19:08:40vivusI 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:29PMunchAs I said, the OpenSSL version from rosettacode is probably your best bet
19:10:47*Tiberium quit (Quit: Leaving)
19:10:50vivusdef-: is sha256 a library you are using internally here: https://gist.github.com/def-/52fca91b0e0158f1b26920b822ec3815 ?
19:11:04vivusPMunch: yeah, that worked. just learning about hashing
19:11:05vivusthanks
19:13:09PMunchWhen 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:38niomixGood, 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:47zachcarterniomix: not sure what forum thread you’re referencing
19:28:04zachcarterthe community is generally very friendly and welcoming
19:28:15zachcarterI’m sorry you had that experience, but it isn’t and shouldn’t be the norm
19:28:32niomixi just said, i wanted to become an excellent nim programmer, and that i wanted some tips
19:28:46niomixmy account was moredated while a newer account wasn't
19:28:48zachcartercan you provide a link to the forum thread?
19:28:51*couven92 joined #nim
19:28:53niomixit got deleted
19:28:56niomixand i got banned
19:29:27vivusniomix: because that normally comes across as "trollish" behaviour when saying "I want to be a great nim programmer"
19:29:52niomixwell i wasn't lying i even wrote it in a paper, i can show you
19:30:32niomix-_-'
19:31:05vivusniomix: it's best to not say those things. just focus on programming questions, ask and hope someone will volunteer an answer
19:31:28niomixwell i thought the community hated me
19:32:00vivuspeople may have bad days but nobody has a right to "hate" you
19:32:17niomixyou shouldn't judge everyone because of the trolls
19:32:17vivuswhy don't you start writing some code and asking questions about it.
19:32:40vivusotherwise you can discuss non-code related matters in: #nim-offtopic
19:33:19niomixok
19:33:24niomixthanks
19:35:24PMunchWe'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:18niomixok 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:17PMunchBetter now Araq? https://github.com/nim-lang/Nim/pull/5778
20:19:58Araqmeh
20:21:20PMunchmeh?
20:22:29PMunchI 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:54Araqthe formatting is ugly and it's more complex than necessary
20:27:14Araqyou only need newLit vs newTree really
20:28:15PMunchHmm
20:28:30Araqplus it breaks tests/manyloc/standalone/barebone.nim
20:29:04PMunchI guess, but I feel new<>Node is more "correct" or at least that's how people would actually use it
20:29:13PMunchYeah, I was wondering about those tests
20:29:59PMunchNot really sure what you dislike about the formatting. The multi-line sets?
20:32:10Araqyeah
20:33:24*niomix joined #nim
20:34:49PMunchI was trying to limit the line length since you complained about that :P
20:36:19Araqyeah indeed, it reads like "fuck you"
20:36:25PMunchBut I think I will split it into two sets and then do the union thing I mentioned earlier
20:38:31PMunchHaha, that was not the intention
20:38:53PMunchI commonly split long lists like that
20:42:35*zachcarter quit (Ping timeout: 260 seconds)
20:44:09PMunchI feel like doing a split at an arbitrary place is more confusing than no split at all
20:44:28PMunchBut then again I've set my editor up to split lines for me, so all my splits are arbitrary..
20:45:42Araqyeah but I review the diff in the browser so long lines cause a horizontal scrollbar
20:45:57PMunchAh right, I can see how that would be annoying
20:46:20PMunchI guess I'll have to PR Github for that :P
20:46:58Araqin principle I agree with you, in 2017 we shouldn't have to care about long lines.
20:47:49PMunchHmm, what's the issue with barebone.nim though? That seems serious
20:48:03PMunchI'm guessing my inclusion of escape from strutils?
20:48:22*bjz joined #nim
20:49:09Araqyeah barebone lacks strutils
20:49:17PMunchShould I take the same approach as for toLower?
20:49:28PMunchBasically copy it in as a sub-proc
20:50:31Araqjust don't use escape, who cares if string literals are escaped, does that come up?
20:51:23PMunchYeah, I tried to run dumpCode on the code itself. When using strings like "\"" it adds that as the string """..
20:51:43PMunchSo I either need to get the string value exactly as it was typed, or escaped
20:51:59vivushow 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:34PMunchWhat do you mean doesn't format correctly
20:52:49vivusit outputs this: �wE�ǣ8��'��Gf��ی߸]F�q���X��
20:52:56vivusinstead of a string
20:53:14demi-it probably is a string, but it isn't encoded as a string
20:53:15vivusref here: https://github.com/jangko/nimSHA2 where it says: to convert digest into string, use proc $
20:54:25PMunchAh, you're expecting a hex string I guess :P
20:54:44*dddddd joined #nim
20:55:45demi-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:51PMunchvivus, 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:19vivusPMunch: 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:43vivusdemi-: so how do I convert it using the "proc $" ?
20:59:41PMunchWell, looking in types.nim it seems that HashBytes (the return value of the hash proc) is an array of 32 uint8s
21:00:08PMunchSo if you use the toHex procedure in strutils on each of those then it would give you what you assume
21:01:21vivusso something like: newvar = toHex(oldvar) ? I tried that and got a code error
21:03:16PMunchtoHex only does one integer at a time
21:03:59PMunchSo something like "result = ""; for i in hash("Hello World"): result = result & toHex(i)"
21:05:04Araqresult = result & x ? that's result.add x or result &= x
21:05:44PMunchOh okay, wasn't sure if &= worked
21:06:22vivususing digest.hex() gives a hex output
21:07:25FromGitter<barcharcraz> wowah how does koch find cl when did didn't specify it anywhere
21:07:30FromGitter<barcharcraz> (with --cc:vcc ofc
21:07:32vivusyeah this lib is a bit tougher to use, the rosetta code solution is cleaner
21:15:03FromGitter<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:49PMunchHmm, what's the benefit of that? It's just as long
21:19:13couven92@barcharcraz, use the `vccexe` tool
21:22:06Araqcouven92: speaking of which, can you make that work for VS 2017?
21:22:23couven92@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:44couven92Araq, 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:20FromGitter<Varriount> PMunch: You aren't combining a (relatively) long datastructure literal with a logic statement.
21:34:33FromGitter<Varriount> Makes it more readable to me.
21:34:37PMunchAh, that's a good point
21:34:42PMunchI was planning on doing that
21:40:44*DebugDude12 joined #nim
21:40:44jackvdoes 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:01PMunchTo remove the compile output?
21:41:15jackvor at least all of the hints
21:41:30PMunch--verbosity:0?
21:42:32jackvhmm...still getting hints
21:42:41PMunchHmm, seems to have removed only some of them for me..
21:42:45PMunchThat's strange
21:44:00DebugDude12I need to initialize a bunch of external resources, but close all of them if this fails
21:44:10jackvyeah, it removed like the last hint about "compilation successful" but that's it
21:44:18DebugDude12I want to do this, without nesting try/expect statements 100 times: http://dpaste.com/2QVED5M
21:44:19PMunch--hints:off
21:44:25PMunchThat's probably what you're looking for
21:44:45jackvPMunch: perfect thanks!
21:45:04PMunchNo problem :) I just ran "nim --advanced" and went through the list :P
21:45:09demi-DebugDude12: are these dependent files?
21:45:23PMunchDebugDude12, defer statements?
21:46:19DebugDude12demi-: these are not files, in my case GPU resources. But there must be some idiom for this type of problem.
21:46:27demi-ah i see
21:46:28PMunchYeah, defer
21:46:29DebugDude12PMunch: i want to keep them on success for a long time
21:46:37PMunchHmm, that's a problem
21:46:57*nsf quit (Quit: WeeChat 1.7.1)
21:47:00DebugDude12i would like to implement my own deferFailure, but can't find how defer itself is implemented
21:47:27PMunchHow do they fail? Throw or return nil
21:47:59DebugDude12they throw. But even if they would return nil, i would replace the 100s of try/expects with if/else
21:48:41PMunchWell, you can have one try/expects around the entire thing. And then close the open ones
21:48:59Araqsounds like you use exceptions in a suboptimal way
21:49:49DebugDude12beeing used to RAII/scope(failure) i would like to know the nim counterpart
21:50:55DebugDude12I 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:12PMunchCan't you check?
21:51:22AraqwithRes a, b, c, d, e, f, g, h: body
21:51:22demi-isn't this normally abstracted away through whatever GPU library you use?
21:53:02DebugDude12demi-: in my specific case it may be. But one day i need to use some other type of external resources
21:53:17demi-i see
21:54:03FromGitter<Varriount> DebugDude12: I have a solution, one moment
21:55:32Araqfor i in 0..<10: try: a[i] = openRes(...) except: rollback(a, i-1); raise
21:55:47Araquse(a)
21:55:55Araqrollback(a, 10)
21:56:17Araq^ wrap in a template, be happy
21:57:41*zachcarter joined #nim
21:57:44*kunev quit (Ping timeout: 240 seconds)
21:58:20DebugDude12My 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:34DebugDude12and now i can't create the wrapper without the rollback trick
22:00:29*kunev joined #nim
22:00:31DebugDude12but then ... all languages with exceptions interfacing with external resources have this problem
22:00:38DebugDude12so there must be some solution
22:01:03FromGitter<Varriount> DebugDude12: https://gist.github.com/Varriount/c6ed6caa4d968d7f6d57c2fa8de9bb9b
22:02:32FromGitter<Varriount> Just loop through the sequence to clean up opened resources.
22:03:03Araqvarriount: I already proposed such a thing ;-)#
22:03:09FromGitter<Varriount> Alternately, if the memory for the resources is allocated with new(), you can attach a finalizer
22:03:32FromGitter<Varriount> Araq: I saw. I felt my example couldn't hurt.
22:03:44DebugDude12Varriount: which may be problematic, if the order/timing of closing is important
22:05:04FromGitter<Varriount> DebugDude12: Hm. Are such conditions common though?
22:06:11DebugDude12I don't know, but there must be ways to not leak resources without tricks and hacks
22:07:19DebugDude12Java "solves" this with pokemon style catch-em-all clutter
22:08:48FromGitter<Varriount> What do you mean?
22:09:16FromGitter<Varriount> And what's wrong with the examples above?
22:10:16DebugDude12some kind of deferOnThrow would be way simpler
22:11:19*niomix left #nim (#nim)
22:11:30DebugDude12And most resources offer some kind of withFoo: block
22:12:10FromGitter<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:49FromGitter<Varriount> Either you explicitly track and control the order/time, or you let the garbage collector run finalizers.
22:13:28DebugDude12Im going the explicite way, i just asked whats idiomatic
22:14:05FromGitter<Varriount> Place the resources into a sequence, and use a try block or defer block
22:14:29FromGitter<Varriount> you could even use a boolean that is checked in the defer block
22:15:18AraqI could try to convince you why it's not as much of a problem as you think it is
22:16:11FromGitter<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:25FromGitter<Varriount> In the defer statement, if the boolean is true, release the resources.
22:21:47FromGitter<Varriount> Araq: Wrapping an entire procedure body in a try body would be more performant, correct?
22:25:44Araqcorrect. but for the JS/C++ backends it can be irrelevant
22:27:01DebugDude12So 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:14DebugDude12I just want deterministic, guaranteed resource closing in all cases.
22:27:51FromGitter<Varriount> DebugDude12: Could you past some of the code you're working on?
22:28:28DebugDude12Varriount: this isn't specific to my code. I just want my determinism.
22:28:52FromGitter<Varriount> If you want guaranteed resource closing in all situations, at all times, you have to use finalizers/destructors.
22:29:11DebugDude12but then im greenspunning C++ :S which i want to ditch
22:30:18*gokr quit (Quit: Leaving.)
22:30:22FromGitter<Varriount> I don't know of any other possible mechanism, in any language, that allows one to provide similar resource cleanup behavior.
22:30:53FromGitter<Varriount> Not unless you personally ensure that any and all users call cleanup routines at the appropriate times.
22:31:52FromGitter<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:13FromGitter<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:44FromGitter<Varriount> You still have to clean up when the resource goes out of scope/is deallocated though.
22:33:08DebugDude12This 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:41FromGitter<Varriount> Ok... so what's the problem?
22:34:02DebugDude12Nothing. Just asking if there is some more concise construct than try/catch
22:34:22FromGitter<Varriount> 'defer'?
22:34:48FromGitter<Varriount> DebugDude12: https://nim-lang.org/docs/manual.html#exception-handling-defer-statement
22:35:37DebugDude12We are going circles. Where is defer implemented? It doesn't seem to be a template
22:35:46FromGitter<Varriount> It's a compiler intrinsic
22:40:16FromGitter<Varriount> DebugDude12: i'm curious, what's so bad about finalizers?
22:41:05*Matthias247 quit (Read error: Connection reset by peer)
22:41:31DebugDude12Varriount: lack of determinism. But i see almost all languages suffer from this.
22:41:51DebugDude12Especially when 99% of lines in my code could throw.
22:44:21vivuscan I use the openssl lib to get a sha256 sum on a file?
22:44:56FromGitter<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:44Araqtemplate withRes(r, body) =
22:45:48Araq var r = createRes(...)
22:45:53Araq try:
22:45:58Araq body
22:46:01Araqfinally:
22:46:04Araq r.close
22:49:49DebugDude12thank you all for your efforts and patience. Have a good night.
22:50:04FromGitter<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:10FromGitter<Varriount> @konqoro What happens if you explicitly pass in generic parameters to 'solve'?
22:54:32*def-pri-pub joined #nim
22:55:49FromGitter<konqoro> like: echo solve6, 21 (k, v) ?
22:56:33FromGitter<Varriount> Yes
22:56:52FromGitter<konqoro> pmatrix.nim(77, 12) Error: type expected
22:57:12FromGitter<Varriount> The first parameter needs to be a type, the second a value
22:58:08FromGitter<Varriount> `echo solvefloat, 21 (k, v)`
22:59:46FromGitter<konqoro> sorry i can't really follow you
23:02:26FromGitter<konqoro> why float?
23:02:48FromGitter<Varriount> I'm assuming it's float. I haven't used this particular code before.
23:03:26FromGitter<konqoro> M is an int
23:03:29FromGitter<Varriount> `proc solve*M, N: static[int (...)` - 'M' is a type parameter, 'N' is a integer known at compile-time
23:03:54FromGitter<Varriount> Or wait, maybe you're right.
23:03:59FromGitter<Varriount> Let me look in the manual
23:04:52FromGitter<konqoro> i tried doing something like proc solve*M: static[int (...) and it didnt work
23:06:24FromGitter<barcharcraz> nimsuggest is not able to open files when I give it the absolute path on windows
23:06:30FromGitter<barcharcraz> "can not open ''"
23:06:37FromGitter<barcharcraz> no spaces in my path
23:08:04Araqbarcharcraz: put the path in double quotes
23:08:37FromGitter<barcharcraz> same issue
23:09:59FromGitter<konqoro> why it expects the first to be a type anyway ??
23:10:45FromGitter<barcharcraz> huh it simply segfaults in terse mode
23:11:11FromGitter<Varriount> @konqoro I was wrong, it's something else
23:11:30FromGitter<konqoro> no i get why you got confused
23:11:59FromGitter<Varriount> @konqoro For some reason, the type for 'solve' is hardcoded to be a C integer
23:16:15FromGitter<konqoro> anyway thanks for looking at it
23:16:20FromGitter<konqoro> goodmorning
23:17:09FromGitter<Varriount> @Araq There seems to be a compiler bug with @konqoro's code.
23:17:38FromGitter<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:32FromGitter<Varriount> @konqoro There's a compiler bug. :/
23:28:16FromGitter<barcharcraz> huh even with the quotes it's the c:\ (the : I assume) that screws nimsuggest up
23:32:19FromGitter<Varriount> @barcharcraz Just use '\' then. That is the 'current' drive
23:36:48FromGitter<barcharcraz> yeah that's what I did
23:40:39FromGitter<barcharcraz> grr still not working right
23:40:56PMunchWoo, got my tweening to work! :)
23:45:51*chemist69 joined #nim