<< 11-09-2017 >>

00:00:20FromGitter<Tatazaki_twitter> So I have a file called 'config.nim' in the root directory of my project, and a file called 'color.nim' in a subfolder called 'visualworks'. How would I go about importing config.nim in color.nim?
00:01:29*thomasross quit (Remote host closed the connection)
00:02:15*thomasross joined #nim
00:02:17FromGitter<Tatazaki_twitter> ...nevermind. (the answer: "../config")
00:04:47*Jesin joined #nim
00:16:11*dddddd joined #nim
00:17:03*mahmudov quit (Ping timeout: 248 seconds)
00:17:10*Jesin quit (Quit: Leaving)
00:24:29*yglukhov quit (Remote host closed the connection)
00:25:23*Jesin joined #nim
00:25:24*Jesin quit (Remote host closed the connection)
00:27:45*Jesin joined #nim
00:30:07*dddddd quit (Quit: Hasta otra..)
00:36:32FromGitter<zacharycarter> thanks @cabhishek kind of like that... I'm not sure scanf is the right tool for what I'm trying to do
00:37:47FromGitter<zacharycarter> basically I'm trying to capture all the text between two double quotes
00:38:06FromGitter<zacharycarter> without resorting to pcre etc
00:40:14FromGitter<Tatazaki_twitter> does it error or does it keep running?
00:40:39FromGitter<zacharycarter> does what error?
00:40:54FromGitter<Tatazaki_twitter> your scanf.
00:41:35FromGitter<zacharycarter> well that's the thing I'm not sure how to write the scanf to do what I want
00:42:35ryu0"\"%[^"]\"" ?
00:42:52FromGitter<zacharycarter> I think that'd work for C's scanf
00:42:56FromGitter<zacharycarter> not sure about Nims but I'll try
00:45:17ryu0appears nim's scanf has nothing like it. maybe you can try writing a function to extend. it appears to support it.
00:45:20ryu0${} and $[]
00:47:08FromGitter<zacharycarter> I guess I"ll have to
00:47:25FromGitter<zacharycarter> I figured there'd already be an easy way to do this
00:56:29*tjyoco joined #nim
01:08:07*int0x01 joined #nim
01:08:57*int0x01 quit (Client Quit)
01:17:56FromGitter<zacharycarter> https://play.nim-lang.org/?gist=2a7fe4f311c9e1a1af1ce0fc75b763d7
01:23:21FromGitter<zacharycarter> anyone have any idea how to get the last occurrence of a char in a string?
01:24:12*Jesin quit (Quit: Leaving)
01:26:33*chemist69 quit (Ping timeout: 252 seconds)
01:27:00FromGitter<superfunc> @zacharycarter `rfind`?
01:27:12FromGitter<superfunc> https://nim-lang.org/docs/strutils.html#rfind,string,char,int
01:28:24FromGitter<zacharycarter> thank you @superfunc
01:31:25FromGitter<superfunc> np
01:40:08*chemist69 joined #nim
01:41:46*Jesin joined #nim
01:48:11*tjyoco quit (Quit: Page closed)
01:53:44*Jesin quit (Quit: Leaving)
02:10:46*Jesin joined #nim
02:13:04*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
02:13:12*smt joined #nim
02:52:22*jsgrant joined #nim
02:54:14FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/Czrq/Screen-Shot-2017-09-10-at-10.53.58-PM.png)
03:00:01FromGitter<zetashift> Looks straight outta 2003, I love it
03:15:34*endragor joined #nim
03:15:58FromGitter<zacharycarter> :D
03:17:40*endragor_ joined #nim
03:17:44FromGitter<zacharycarter> can't quite get these new fonts centered hrm
03:18:09*endragor_ quit (Client Quit)
03:19:32FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/zUEp/Screen-Shot-2017-09-10-at-11.19.10-PM.png)
03:19:59*endragor quit (Ping timeout: 248 seconds)
03:27:07FromGitter<zacharycarter> bleh maybe I should just use bearlib terminal for this tutorial
03:29:41*Nobabs27 joined #nim
03:38:07*Nobabs27 quit (Quit: Leaving)
03:40:57*jsgrant quit (Read error: Connection reset by peer)
03:41:03*pilne quit (Quit: Quitting!)
03:41:13*jsgrant joined #nim
03:53:27*Nobabs27 joined #nim
04:06:22FromGitter<zacharycarter> orrrrr I could go graphical and just ditch ascii art
04:06:25FromGitter<zacharycarter> hrm
04:17:20FromGitter<zacharycarter> so if I have a grid of 80 x 45 of 12x12 cells, apparently the magic offset is 0.5, 0.5 to get a 12x12 font to render in the center
04:17:39FromGitter<zacharycarter> how I'm supposed to arrive at that number programmatically / formulaically I have no idea
04:28:39*yglukhov joined #nim
04:31:52*vivus quit (Quit: Leaving)
04:33:00*yglukhov quit (Ping timeout: 252 seconds)
04:34:50*Nobabs27 quit (Quit: Leaving)
04:42:39*BigEpsilon joined #nim
04:45:41*jsgrant quit (Quit: jsgrant)
04:46:04*jsgrant joined #nim
04:50:12*jsgrant quit (Client Quit)
04:50:32*jsgrant joined #nim
04:50:38*jsgrant quit (Remote host closed the connection)
05:39:00*BigEpsilon quit (Ping timeout: 252 seconds)
05:47:33*skrylar quit (Remote host closed the connection)
06:00:40*BigEpsilon joined #nim
06:00:51*BigEpsilon quit (Remote host closed the connection)
06:01:11*yglukhov joined #nim
06:05:32*yglukhov quit (Ping timeout: 255 seconds)
06:09:41*obadz quit (Ping timeout: 240 seconds)
06:13:21*yglukhov joined #nim
06:13:57*obadz joined #nim
06:30:49*Sentreen quit (Ping timeout: 255 seconds)
06:31:20*nsf joined #nim
06:33:10*yglukhov quit (Remote host closed the connection)
06:38:15*solitudesf joined #nim
06:44:11*Sentreen joined #nim
06:46:08*Vladar joined #nim
06:53:12*Matthias247 joined #nim
07:03:33*vivus joined #nim
07:13:27FromGitter<Grabli66> Hi. "Nim" is more modular language than object-oriented?
07:22:54*yglukhov joined #nim
07:24:36*deavmi joined #nim
07:24:39*claudiuinberlin joined #nim
07:25:00deavmiThat moment when you do your first operator overload and make the most useless use out of `$` :). I'm so happy.
07:30:37FromGitter<Bennyelg> Hey Guys, How Do I handle Future object of asyncrequest
07:30:47FromGitter<Bennyelg> I want to read it when it returnes
07:32:05FromGitter<Grabli66> let result = await yourFuture ? :)
07:32:16FromGitter<Bennyelg>
07:32:19FromGitter<Bennyelg> :P
07:32:24FromGitter<superfunc> you can also set a callback
07:32:50FromGitter<superfunc> ``` proc (future: Future[string]) = ⏎ echo("value: ", future.read)``` [https://gitter.im/nim-lang/Nim?at=59b63c22210ac26920180a41]
07:33:02livcdI wonder how much is the js backend used
07:33:32FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59b63c4c177fb9fe7ea6916b]
07:33:35FromGitter<Bennyelg> what is wrong ?
07:34:30FromGitter<Grabli66> You can use await only in async proc. You need write let res = waitFor response
07:34:50FromGitter<Bennyelg> oh Now I undertstand the concept
07:35:00FromGitter<Bennyelg> So I need to compile it --threads:on?
07:35:07FromGitter<Grabli66> No
07:35:26FromGitter<Grabli66> Async does not use threads
07:35:38FromGitter<superfunc> Async is for concurrency, not parallelism
07:37:11deavmiHow to I create a setter for a Human object (also second question, is there a root like top-type for all objects via inheritance for Nim like in Java, D etc.??)
07:38:24*PMunch joined #nim
07:39:14deavmiI have a `proc setAge(obj: Human, age: int) = ` and the body is `obj.age = age`. Gives a compilation error that such an assignment is not allowed
07:39:45FromGitter<superfunc> deavmi: try `proc setAge(obj: var Human, age: int) = ` as the type sig
07:40:00FromGitter<superfunc> deavmi: by default, that param is immutable, so it can't be assigned to
07:40:16deavmiOh, and var what does that do? Doesn't that take in a refernce or something?
07:40:19deavmiTo the object?
07:40:26deavmior just mutable?
07:41:18deavmiAh that works. Thanks
07:43:39FromGitter<superfunc> deavmi: np, https://nim-lang.org/docs/tut1.html#procedures-parameters for more info
07:43:58FromGitter<superfunc> I'm not sure on your second question, don't really write in OO style personally
07:44:26deavmisuperfunc: Thanks tho :)
07:44:51FromGitter<superfunc> deavmi: happy to help where I can
07:45:58deavmiAnd that's why I love programming language communities. They have the best people (maybe besides Java, they're alright)
07:46:54*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
07:48:09deavmiIs the compiler meant to give an error `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` when I do `var kak: prt`
07:48:14*couven92 joined #nim
07:48:15deavmiI must be doing something wrong XD
07:48:46deavmiah nvm
07:48:46livcdhow good is XML parsing in nim ? as in performance,support,libs
07:48:47deavmiGot it
07:49:44FromGitter<superfunc> livcd: the builtin module has been sufficient for my needs
07:50:05FromGitter<superfunc> https://nim-lang.org/docs/parsexml.html
07:51:15livcdcool
07:51:24livcdi wish i could also talk to soap apis but i guess nim is not there yet
07:51:25livcdor is it ?
07:51:39*claudiuinberlin joined #nim
07:51:46deavmiHow does one create a pointer variable
07:51:49deavmiuntraced
07:52:00PMunchaddr(x)
07:52:10FromGitter<Grabli66> proc `=?=`. It's ugly. :)
07:52:11PMunchReturns an untraced ptr to x
07:52:32deavmiThanks
07:53:13deavmiand once I have the pointer, how do I derefenece it?
07:53:18deavmi* dereferene
07:53:21PMunchx[]
07:53:28PMunchWith nothing in the brackets
07:54:02deavmiah
07:54:48PMunchlivcd, you certainly could do it with HTTP requests and the xmltools package. But AFAIK there's no ready built module to talk to a SOAP API in Nim
07:54:54PMunchYou could always create one :)
07:56:57deavmiand with traced (a.ak.a reference types) how does one assign to my `var reffy: ref int` a traced reference
07:57:44deavmiah
07:57:45deavmialso []
07:58:06deavmifordereference
07:59:08*Arrrr joined #nim
08:00:04PMunchWith reference types Nim is smart enough to automatically dereference
08:02:57*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:03:07*vivus quit (Quit: Leaving)
08:05:25*deavmi quit (Quit: leaving)
08:05:56*deavmi joined #nim
08:06:22*bozaloshtsh quit (Ping timeout: 264 seconds)
08:06:57*ldlework quit (Ping timeout: 252 seconds)
08:07:27*abeaumont quit (Ping timeout: 248 seconds)
08:07:53*abeaumont joined #nim
08:08:20*ldlework joined #nim
08:08:21*bozaloshtsh joined #nim
08:08:21*bozaloshtsh quit (Changing host)
08:08:21*bozaloshtsh joined #nim
08:22:53FromGitter<superfunc> Does anyone know where `seq` is defined in the repo?
08:23:24PMunchI think it's defined as a magic
08:23:58PMunchWas there anything in particular you were wondering about?
08:24:23FromGitter<superfunc> Nope, just wanted to learn about its internals
08:27:06FromGitter<superfunc> I guess one thing I had been curious about was what its growth factor is
08:41:16*dom96|w joined #nim
08:42:18*claudiuinberlin joined #nim
08:43:42Araq_it's 1.5
08:44:04FromGitter<superfunc> Cool thanks
08:47:00*claudiuinberlin quit (Client Quit)
08:48:55*claudiuinberlin joined #nim
08:50:33PMunchHas anyone tried using Nim and Electron?
08:51:31FromGitter<k0pernicus> @dom96: Thanks for the comments :-) I will update the code this evening ;-)
08:51:40FromGitter<k0pernicus> (and make a new PR after that)
09:20:34*Yardanico joined #nim
09:30:48*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:33:13*haha_ joined #nim
09:37:32*mahsav quit (Ping timeout: 260 seconds)
09:44:34*haha_ quit (Quit: haha_)
09:50:48PMunchHmm, is there a js2nim tool?
09:52:15FromGitter<Bennyelg> Any script with example of using async await
09:57:34*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
09:58:04*vlad1777d joined #nim
09:58:04*yingjun joined #nim
09:58:09yingjunhello there
09:58:27yingjunI heard Nim not supports compiling to Android?
09:58:38federico3Bennyelg: Jester for example?
09:59:23yingjuncan somebody give me some example about how to compile to android?
10:02:01*dom96|w joined #nim
10:02:38*dddddd joined #nim
10:02:43Araqyingjun: hi, I smell a troll here.
10:03:37*claudiuinberlin joined #nim
10:03:50yingjunHi Araq
10:03:56yingjunglad to talk with you
10:04:22*couven92 quit (Read error: Connection reset by peer)
10:06:38FromGitter<Grabli66> Can i assign typedesc to variable? Nim does not want to do that. Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'?
10:06:57yingjunmy another question is about cookie
10:07:27yingjuncan somebody give me an example about saving a cookie from a http request?
10:08:40enthus1ast-yingjun: server sets the cookie in its response header
10:09:07yingjunand then?
10:09:20enthus1ast-then you have it in headers ;)
10:09:41yingjunI see. Seems there is a 'cookies' module in Nim?
10:09:53*ldlework quit (Ping timeout: 255 seconds)
10:10:37Araqwasting our time counts as trolling ;-)
10:12:02*ldlework joined #nim
10:15:42ryu0https://www.youtube.com/watch?v=VjA9uJ2dFCI
10:17:17*yingjun quit ()
10:17:31*yingjun joined #nim
10:21:43*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
10:25:56*dom96|w joined #nim
10:26:33*ShalokShalom_ joined #nim
10:29:21*ShalokShalom quit (Ping timeout: 248 seconds)
10:39:29PMunchJust for reference (if someone reads this IRC log). Nim compiles to Android just fine, just check out the nim-sdl-template for example.
10:39:43*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:03:31FromGitter<Bennyelg> When I write var s = await FutureObject ⏎ How can I get s data?
11:05:34enthus1ast-s is the data then is suppose
11:06:33*arnetheduck joined #nim
11:10:48*mahmudov joined #nim
11:10:56FromGitter<zacharycarter> s.read()
11:11:44FromGitter<zacharycarter> maybe not
11:12:17ryu0What is the recommended way of learning Nim if you already have experience with other languages? Reading the language reference?
11:12:56ArrrrCheck out `tutorials` https://nim-lang.org/documentation.html
11:12:57YardanicoBennyelg: if you do "await", "s" will contain the result
11:13:10FromGitter<Grabli66> Read manual, read reference, read "Nim in action" :)
11:13:38ArrrrI read everything i could, asked here and on the forum, and from time to time check out the manual
11:14:58ryu0Thanks.
11:16:33*ryu0 left #nim (#nim)
11:23:30FromGitter<zetashift> I also liked the Nim By Example site
11:34:11*claudiuinberlin joined #nim
11:40:26*yingjun quit (Remote host closed the connection)
11:41:40*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:43:05*mahsav joined #nim
11:43:47*yingjun joined #nim
11:45:02*yingjun quit (Remote host closed the connection)
11:58:09*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:00:46*claudiuinberlin joined #nim
12:06:15*Snircle joined #nim
12:15:27Yardanicohttps://github.com/nim-lang/Nim/wiki/IRC-guidelines/_compare/b3daddb%5E...b3daddb :)
12:25:05*enthus1ast- quit (Ping timeout: 248 seconds)
12:25:12PMunchHmm, how would you communicate between a Nim JS program running under node and a Nim C program?
12:26:02Araqwebsockets
12:28:26*Matthias247 quit (Read error: Connection reset by peer)
12:28:27yglukhovor just sockets? =)
12:28:38PMunchyglukhov, sockets work in JS?
12:28:50yglukhovshould work in node, i think.
12:29:02yglukhovnot in browser, ofc
12:29:29yglukhovotherwise, how would nodejs become a popular backend platform?
12:29:42PMunchHaha, good point :P
12:32:15*ShalokShalom_ is now known as ShalokShalom
12:45:30*yingjun joined #nim
12:45:33PMunchHmm yglukhov I get an error that os is not imported to my system when I try to import net or sockets
12:46:33PMunchwebsockets seems like it's the way to go
12:47:14yglukhovPMunch: oh, you're trying to use nim sockets in nodejs? no, that's not gonna work. You'll have to use something more native to nodejs.
12:47:38yglukhovif websockets work for you, then you're all set, i guess =)
12:48:38PMunchWell my goal here is to be able to write a program in Nim which compiles to C (since it requires C libraries). Then I want to write some Nim JS code to interface the application with Electron. I've got Nim JS talking to electron, so now I need a way to bind together my Nim C code and my Nim JS code.
12:50:48*yingjun quit (Ping timeout: 240 seconds)
12:51:28federico3PMunch: are the two codebases running on different hosts or locally?
12:51:52PMunchLocally
13:03:36PMunchOkay, got it working now by using net in the Nim C code and https://nodejs.org/api/net.html for the JS side
13:03:55yglukhovyup, thats what i was talking about =)
13:05:42*ipjk joined #nim
13:11:36*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:13:48*mahmudov quit (Remote host closed the connection)
13:14:13*Matthias247 joined #nim
13:16:38Yardanicoohhhhh
13:16:39Yardanicohttps://github.com/Araq/ormin
13:16:46*claudiuinberlin joined #nim
13:18:02*claudiuinberlin quit (Client Quit)
13:18:11YardanicoI'm not sniping, it's all is github feed :P
13:18:42PMunchHaha
13:18:46PMunchNice project
13:18:58*claudiuinberlin joined #nim
13:21:00*dom96|w joined #nim
13:24:46yglukhovdom96: regarding https://github.com/nim-lang/nimble/pull/404 . does my comment make sense?
13:26:23*dom96|w quit (Ping timeout: 248 seconds)
13:31:58FromGitter<dandevelop> has anyone compiled Nim on windows with Visaul C++ ? If so, how did you modify build64.bat?
13:32:52Yardanicowell, I want to ask you.. do you really want to do that?
13:33:02Yardanicoyou can build it using mingw and then compile your programs using VCC
13:33:49Yardanicobut I don't really know how to compile Nim itself with VCC, I didn't try to do it
13:38:14*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:40:04PMunchHmm, https://github.com/PMunch/nim-electron
13:40:09PMunchPretty barebones, but it works
13:40:10FromGitter<dandevelop> @Yardanico Which mingw installer did you use on Windows?
13:40:32Yardanicohttps://sourceforge.net/projects/mingw-w64/
13:41:05Yardanicoonline mingw-w64 installer: https://sf.net/p/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
13:41:16Yardanicoand yeah, it's gcc 7.1 :)
13:43:26*tjyoco joined #nim
13:45:09FromGitter<dandevelop> @Yardanico what did you select for Architecture, threads and exception?
13:45:27Yardanicoarch - select x86_64, others - just default
13:46:01tjyocoI'm trying to understand macros and I get this 'type expected' error. How do I create procs like this? https://www.hastebin.com/kegewoxoru.nim
13:46:33Yardanicotjyoco, well you shouldn't use strings in macros for code generation
13:46:37Yardanicoyou should use AST
13:47:17tjyocoah okay, one of the examples had it on the docs and I thought it looked easier. I'll give AST a shot.
13:47:45Yardanicotjyoco, well it looks easier for simple stuff maybe, but not for hard stuff
13:47:53Yardanicotjyoco, what example contains strings as the code?
13:48:01Yardanicoah, yeah
13:48:14YardanicoparseStmt and parseExpr can be used for parsing strings into code
13:48:45tjyocoyeah, its "Generating source code" from nim tut pt2
13:49:09Yardanicoah I see
13:49:09*claudiuinberlin joined #nim
13:49:27Yardanicobut it's not generally recommended
13:49:33*PMunch quit (Quit: Leaving)
13:49:33tjyocogotcha
13:49:38YardanicoI'll fix your code now
13:50:04tjyocothank you!
13:50:27Yardanicowell your code isn't valid because you're trying to make a proc like this
13:50:38Yardanicoproc getx(): x = x
13:50:45Yardanicoso it would return "x" variable of type "x"
13:51:00tjyocoyeah, how would I get x's typedesc?
13:51:23Yardanicoyou would use AST for that :)
13:52:30Yardanicowell I would still do it
13:52:44tjyocoI'll give it a shot. So just dumptree: >insert example code and duplicate what pops out?
13:53:15Yardanicowell no
13:53:24Yardanicodumptree is used for getting AST
13:53:41Yardanicoyou can use dumpAstGen
13:53:48tjyocowell, yeah sorry I worded it wrong. But that would help me with structuring the statements correctly
13:53:49Yardanicobut it's generally better to write code in macros by hand
13:53:57Yardanicoe.g. using stuff like newProc
13:54:13tjyocoI haven't used the dumpAstGen, ill try that
13:55:41*Arrrr quit (Ping timeout: 240 seconds)
13:56:00tjyocoOh, thats very handy. A lot easier than dumpTree lol
13:56:28Yardanicobut generally you would write smaller code if you will do it by hand :)
13:56:55Yardanicobut yeah
13:57:03YardanicoI've fixed your example
13:57:17Yardanicohttps://gist.github.com/Yardanico/dbb6bb1ef876c38cf06ca64ae4252127
13:58:03FromGitter<Grabli66> Yardanico, can i store typedesc in some variable. And then create new object from that variable?
13:58:25Yardanicoin a macro?
13:58:37tjyocoYour a nim-wizard Yardanico thanks
13:58:40FromGitter<Grabli66> No
13:58:47Araqhell no, it's called "static typing", you are supposed to know your types
13:58:57Araqif you don't just use JSON
13:59:16Araqdon't fuck around with typedesc, it's a compiletime-only metatype
13:59:31FromGitter<Grabli66> Ok
14:04:54*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:07:59*tjyoco quit (Ping timeout: 260 seconds)
14:10:06*claudiuinberlin joined #nim
14:11:14*ldlework quit (Changing host)
14:11:14*ldlework joined #nim
14:12:31*tjyoco joined #nim
14:19:58*sz0 joined #nim
14:22:54*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:29:12*claudiuinberlin joined #nim
14:46:20*tjyoco quit (Quit: Page closed)
14:48:15*yglukhov quit (Remote host closed the connection)
14:48:33*yingjun joined #nim
14:52:48*yingjun quit (Ping timeout: 240 seconds)
14:54:58*Trustable joined #nim
14:59:37*nigga21 joined #nim
14:59:55*nigga21 quit (Client Quit)
14:59:56*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:04:12*spica joined #nim
15:05:34spicaHey guys. I'm a noob playing with nim. A question. Why does a continue inside a block without look give (SIGSEGV: Illegal storage access. (Attempt to read from nil?))? A bug or a feature?
15:05:59spicahttps://pastebin.com/p6n0nnaL
15:06:40spicablock without loop*
15:09:01Yardanicospica, because it seems to be a compiler error
15:09:05Yardanicoreport it on github
15:09:11Yardanicobut using "continue" in a block is pointless
15:09:32Yardanico"continue" is only used in "while" and "for"
15:09:35Yardanicoloops
15:09:58spicaI know it's pointless, I was trying to see what happens, I was trying to emulate a loop using block and labeled continue, but it didn't work
15:10:15Yardanicospica, well there's no labeled continue in nim AFAIK
15:10:29Yardanicobut I might be wrong
15:10:33spicawell, I know now. There's in java afaik, so I was just curious
15:12:12livcdI need to parse xmls and save the output as kv pairs in a database (or convert to huge simple json of { "lah":"lah","lah":"lah",...}. The xmls can have arbitrary structure and what I am interested in would be to just grab all xmlnodes and get values
15:12:35*arnetheduck quit (Ping timeout: 240 seconds)
15:12:39*enthus1ast- joined #nim
15:12:56Yardanicolivcd, https://nim-lang.org/docs/parsexml.html ?
15:13:05livcdhow easy / possible would this be in Nim ? ( i mean python/ruby would be better suited for this but I kinda need this standalone binary type of program)
15:13:19Yardanicowell https://nim-lang.org/docs/parsexml.html is a very high performance XML/HTML parser
15:13:23livcdYardanico: yes but don't i need to define the data structure first ? (as in knowing how it will look like?)
15:13:37Yardanicolivcd, no, you don't, if you just want to grab all nodes
15:13:48Yardanicoyou don't generally need to define the data structure
15:15:10*spica quit (Quit: Leaving)
15:15:13livcdok thanks
15:23:44*nsf quit (Quit: WeeChat 1.9)
15:24:41livcdYardanico: ok right i will do one version in go and one in nim. I will use dictionary for both to get the kv
15:25:12Yardanicook, but use string table if you have string:string table :)
15:25:15Yardanico"strtabs" module
15:25:22Yardanicoit's faster than usual Table[string, string]
15:26:02livcdYardanico: thanks
15:37:34Araqhuh? that's news to me
15:37:46Araqdid some benchmarking?
15:38:52*Arrrr joined #nim
15:38:52*Arrrr quit (Changing host)
15:38:52*Arrrr joined #nim
15:43:42*yglukhov joined #nim
15:45:21YardanicoAraq, but I thought it would be faster - it says "The strtabs module implements an efficient hash table that is a mapping from strings to strings. "
15:47:18Araqit predates generics and was kept because it allows case insensitive mappings
15:47:59*yglukhov quit (Ping timeout: 240 seconds)
15:49:38YardanicoAraq, oh, thanks then, I didn't knew about it
15:55:29*claudiuinberlin joined #nim
16:01:07*yglukhov joined #nim
16:02:10*Ven`` joined #nim
16:02:29*vendethiel- quit (Ping timeout: 240 seconds)
16:04:35*mahsav quit (Ping timeout: 240 seconds)
16:04:51*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:08:19*StarBrilliant quit (Quit: ZNC - http://znc.in)
16:08:41*StarBrilliant joined #nim
16:16:48FromGitter<Grabli66> I am trying to compile with --threads:on, but i get error "'callbackIter' is not GC-safe as it performs an indirect call here". What to do?
16:19:04Yardanicoyou use async, right?
16:19:17FromGitter<Grabli66> Yes
16:19:27Yardanicothen you need to make sure you're not using any global variables
16:19:41Yardanicoor, if you're using them and they're only for one thread, mark then with {.threadvar.} pragma
16:20:07Yardanicobut yeah, it's all about gc safety
16:21:14*mahsav joined #nim
16:22:08*claudiuinberlin joined #nim
16:23:30Yardaniconim has local thread GC heap
16:24:31FromGitter<Grabli66> I'll try to not use global variables
16:24:40Yardanicowell you can use them
16:24:55Yardanicobut use {.threadvar.} if you're sure you use this variable locally in one thread
16:25:41FromGitter<Grabli66> I marked my global Table with {.threadvar.}. But it's not helped
16:26:49FromGitter<Grabli66> And also i got error "a thread var cannot be initialized explicitly" :)
16:27:32FromGitter<Grabli66> I think it's better rewrite with objects
16:29:29*sz0 quit (Quit: Connection closed for inactivity)
16:30:34*solitudesf quit (Remote host closed the connection)
16:31:35*mal`` quit (Ping timeout: 240 seconds)
16:31:50*mal`` joined #nim
16:35:02FromGitter<Grabli66> Ok. I am understood. It does not like callbacks.
16:35:35Yardanicoah
16:35:45Yardanicotry to mark your callback with {.gcsafe.} pragma
16:37:01FromGitter<Grabli66> Great. It works. Thanks.
16:37:12*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
16:37:41*mahsav quit (Read error: Connection reset by peer)
16:39:13*abeaumont quit (Ping timeout: 255 seconds)
16:39:36FromGitter<Grabli66> Maybe you know what to do with error "'yield' cannot be used within 'try' in a non-inlined iterator"?
16:39:39*mahsav2 joined #nim
16:39:50Yardanicoyes
16:39:53Yardanicodon't use "await" in try
16:40:01Yardanicodon't use try at all
16:40:03Yardanicofor await calls
16:40:15Yardanicohttps://nim-lang.org/docs/asyncdispatch.html#asynchronous-procedures-handling-exceptions
16:40:27Yardanicothis is the best way for handling exceptions with futures
16:40:28FromGitter<adamrezich> weird question: there shouldn't be anything wrong with setting a table to nil, right?
16:40:29FromGitter<superfunc> so await is like yoda
16:40:34FromGitter<adamrezich> LOL
16:40:41Yardanicowell no :)
16:40:50Yardanicoit's just not a built-in language feature
16:40:53FromGitter<Grabli66> Ok
16:40:53Yardanicoit's just a macro
16:42:48Yardanicoasync/await is easy-to-use if you've used python asyncio for example :)
16:44:03FromGitter<superfunc> @adamrezich I dont think so, presuming you mean TableRef
16:44:10Yardanicoyeah
16:44:15*mahsav2 quit (Ping timeout: 248 seconds)
16:44:15Yardanicowell you can do it
16:44:24Yardanicobut any future access to it will throw SIGSEGV
16:44:28FromGitter<adamrezich> it's actually an OrderedTableRef
16:44:30FromGitter<adamrezich> but yeah
16:44:37FromGitter<superfunc> Sure yeah that should be fine
16:44:54FromGitter<adamrezich> well it's causing an error very rarely and idk why
16:45:16*relax joined #nim
16:45:23FromGitter<superfunc> Hmm, what kind of errors?
16:46:52FromGitter<adamrezich> well so I'm making a complex game engine, and new `Elem`s (entities) are created in the memory manager with a proc `result = castptr Elem (alloc(sizeof(Elem)))`—first off, is that bad?
16:47:34FromGitter<superfunc> Stepping back, are you sure you need to manage the memory yourself?
16:47:35Yardanicowell you really need custom memory management?
16:47:38Yardanicoyeah
16:47:48FromGitter<superfunc> It might be better to just controll gc passes instead
16:47:49FromGitter<adamrezich> I'd like to, for game performance :\
16:47:55Yardanicowell you wouldn't lose any performance
16:48:01Yardanicoyou can set max GC pause for GC
16:48:13Yardanicohttps://nim-lang.org/docs/gc.html
16:48:28Yardanicothere's realtime gc
16:49:02YardanicoThe GC is only triggered in a memory allocation operation. It is not triggered by some timer and does not run in a background thread.
16:50:00Yardanicobut yeah, I don't know about much about Nim GC performance because I don't use it for realtime stuff (I don't write software which requires realtime) :)
16:51:20Yardanicoyou already can, for example, specify the size of a seq, so it wouldn't reallocate memory
16:53:02FromGitter<adamrezich> well one of the main goals of my engine is to experiment with object hierarchies and component-based design, in a way that compromises ease of use and performance. it's hard to explain but instead of having a global collection of entities and components or whatever, Elems are created in a hierarchy (with pointers), and they have pointers to Comps (components). traditionally in C++ I'd allocate the Comps in a global
16:53:02FromGitter... collection per Comp subclass, but I'm experimenting with having Elems in the hierarchy contain the Comp allocators. thus, I can make an Elem called "world", attach a "PhysicsRealm" Comp to it, then add child Elems to "world" with "CircleCollider" Comps, and it'll allocate them in an allocator in the "world" elem, s ... [https://gitter.im/nim-lang/Nim?at=59b6bf6e177fb9fe7ea9b1a7]
16:53:14FromGitter<adamrezich> so it could be that I'm having a GC issue, because otherwise it works flawlessly :(
16:54:25Yardanicowell you can make a bug report if you've encoutered some gc bug
16:54:51FromGitter<superfunc> Yeah, my rec would be to go through standard ref facilities and report any issues you run into, I think it should be possible
16:55:33FromGitter<adamrezich> lemme trigger the error so I can show you real quick
17:00:18FromGitter<adamrezich> github: https://github.com/rezich/nch error, caused randomly by spamming spacebar to fire a ton of bullets: https://pastebin.com/cnFxeLfj
17:00:43FromGitter<Yardanico> Well it's most probably a GC bug
17:01:53FromGitter<superfunc> The traceback is in gc.nim, but it'd be hard for me to discern rn since its all going through manual memory management
17:02:10FromGitter<superfunc> Sorry I don't have much time to look at the moment
17:03:38FromGitter<adamrezich> it's also important to note that i'm allocating Comps by doing `alloc(sizeof(T) * compReg.perPage)`. it's a paged memory manager, allowing the user to specify how many of each specific type of Comp they want per page of each Comp. i.e. you want like 2 PlayerControllers, but 2048 CircleColliders, etc.
17:03:59FromGitter<adamrezich> but it works 99% of the time, and only crashes when I create a bunch of stuff really fast :\
17:04:29FromGitter<superfunc> I'd wait for @Araq to be around, he'd probably have the clearest understanding to help you there
17:05:15Yardanicoyeah :)
17:06:21FromGitter<adamrezich> k, sounds good
17:06:51FromGitter<adamrezich> I just tried `--gc:v2` and it does the same thing, with the same error lines in gc.nim, but with the error lines from assign.nim omitted o_O
17:07:24Yardanicotry mark and sweep gc
17:07:44FromGitter<adamrezich> isn't that gc:v2?
17:08:22Yardanicono
17:08:40Yardaniconim also has support for boehm gc and go gc :)
17:09:39FromGitter<superfunc> `--gc:markAndSweep`
17:09:53Yardanicoyeah
17:11:13FromGitter<adamrezich> it just makes it crash sooner :(
17:11:21Yardanicowhat about boehm gc? :)
17:11:27FromGitter<adamrezich> I can almost guarantee it's because I'm using a combination of my own alloc stuff and also nim's refs
17:11:28Yardanicobut you should have boehm installed on your PC
17:11:36FromGitter<adamrezich> how do I do that?
17:11:38FromGitter<superfunc> I'd guess that its an error in your memory management
17:11:50Yardanicoyeah, you should also use some GC_ref and GC_unref
17:11:52FromGitter<superfunc> Just manifests itself in the gc's
17:12:34FromGitter<adamrezich> ooh didn't know about gc_ref and gc_unref
17:15:23FromGitter<Grabli66> Why my console programm can crash on ctrl+c ? There is no exception, just dialog window that my process crashed. :(
17:23:01AraqGabli66: which OS? signal handlers are super unsafe and I don't care about them
17:23:19FromGitter<Grabli66> Windows
17:24:01FromGitter<superfunc> @Grabli66 by default SIGINTs are handled, you can disable them
17:24:18FromGitter<superfunc> Ctrl+C == SIGINT
17:24:54FromGitter<superfunc> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59b6c6e6bac826f054a4c7ef]
17:30:05*vlad1777d quit (Ping timeout: 240 seconds)
17:36:31*vlad1777d joined #nim
17:47:00FromGitter<Grabli66> Strange. Does not work. :)
17:47:16FromGitter<superfunc> oh, might be linux/mac only, sorry
17:48:06FromGitter<zacharycarter> @adamrezich maybe consider writing your framework on top of one of the existing engines?
17:48:11FromGitter<Grabli66> It compiles. But does not work. Ok. I think it's not critical.
17:48:17FromGitter<zacharycarter> like zengine *wink* *wink*
17:50:40*yingjun joined #nim
17:55:05*yingjun quit (Ping timeout: 240 seconds)
17:55:43FromGitter<adamrezich> @zacharycarter I'll definitely take a look at what you made! but I really want to make my dream engine from scratch, exactly to the specifications I want :3
17:56:22FromGitter<zacharycarter> @adamrezich well I saw you using sdl2 etc so I was just thinking instead of using that renderer maybe you can use something built on top of it already
17:56:26FromGitter<zacharycarter> without reinventing the wheel
17:57:33FromGitter<zacharycarter> and still accomplish your goal
17:57:43*PMunch joined #nim
17:57:56FromGitter<adamrezich> I may very well end up doing that, the entity/component organization structure is what's especially interesting to me at the moment. my goal is to make an engine that lets me quickly prototype and explore 2d gameplay ideas w/ vector graphics
17:58:56FromGitter<zacharycarter> well zengine is that minus the vector graphics
17:59:10FromGitter<zacharycarter> lots of primitive drawing functions for both 2d and 3d
17:59:31*spica joined #nim
17:59:33FromGitter<zacharycarter> I'm interested to see what you cook up?
17:59:36FromGitter<zacharycarter> errr up!
17:59:52FromGitter<adamrezich> well and I eventually want 3d support as well, so I may very well hook up your engine or something else on the backend for graphics stuff
18:00:18FromGitter<adamrezich> my knowledge of graphics programming is pretty minimal, just basic vector/matrix math :p
18:00:23spicaHi guys. I'm a bit confused. "var x = int32(someOtherVar)". How does this work? int32 does't seem to be a function in system? Alias for toInt or something?
18:01:19FromGitter<zacharycarter> @adamrezich yeah I'd highly suggest giving zengine a spin, and checking out the code examples to see what I mean, it's a very unobtrusive library for prototyping so it doesn't dictate much beyond you using SDl2 | OpenGL
18:01:26FromGitter<zacharycarter> @spica thats' the same as writing
18:01:48FromGitter<zacharycarter> ``` ⏎ var x = someOtherVar.int32``` [https://gitter.im/nim-lang/Nim?at=59b6cf8c210ac269201b750d]
18:01:55FromGitter<zacharycarter> it's a cast
18:02:06FromGitter<zacharycarter> or coercion I guess
18:02:48spicawell it's frigging confusing... number.int, int(number) number.int() toInt(number)
18:02:56spicakinda confusing
18:03:55spicanumber'i64
18:04:13spicaI guess they are all the same
18:04:13FromGitter<adamrezich> @zacharycarter yeah will do, for now I'm fine with just drawing lines and circles but as soon as I want to do more complex stuff I'll give zengine a try. it should be super simple to make a "ZengineRenderer" component in my engine, to replace the simple (SDL) Renderer component. ⏎ ⏎ since I know next to nothing about graphics programming: does zengine let you do stuff with shaders? b/c I know you can't with just
18:04:13FromGitter... sdl
18:04:15spicaI hope
18:04:42FromGitter<zacharycarter> spica: https://play.nim-lang.org/?gist=638fd33d762bc3773726767d991cef28
18:04:45Yardanicospica, number'i64 - you DECLARE a number with that type
18:04:58Yardanicoif you do int64(somenumber) you create this number and only then convert it to int64
18:05:12FromGitter<zacharycarter> @adamrezich yup! you sure can
18:05:21FromGitter<adamrezich> rad c:
18:05:51*mahmudov joined #nim
18:05:54FromGitter<zacharycarter> I wrote this in ~6 hours with zengine
18:06:11spicaokay, thanks
18:06:24FromGitter<zacharycarter> https://twitter.com/Hahaitsfunny/status/906643667544354821
18:06:34Yardanicospica, it's UFCS
18:06:40Yardanicoand optional () :)
18:06:44Yardanicowell sometimes
18:06:49spicaso. is there any difference between: n.int() n int int(n) int n?
18:06:57Yardanicono
18:07:00spicagreat
18:07:09FromGitter<zacharycarter> UFCS = you can call foo.bar() or bar(foo)
18:07:15Yardanicoyeah
18:07:17FromGitter<zacharycarter> and since parens are optional
18:07:18Yardanicoint(5) or 5.int()
18:07:22FromGitter<stisa> pretty sure `n int` won't work
18:07:23FromGitter<zacharycarter> you can call foo.bar
18:07:27FromGitter<zacharycarter> err sorry
18:07:27spicaI've also seen that I can write: readLine readline read_line, that's also cool. is it consistent across every function?
18:07:31FromGitter<zacharycarter> bar foo
18:07:38Yardanicospica, yes
18:07:48YardanicocamelCase and snake_case identifiers are equal
18:07:57spicanice
18:08:00Yardanicoyou can you snake_case identifier as a camelCase one
18:08:16Araqthe convention is camelCase though ;-)
18:08:34spicaaha. So since int is not a function in system, is it some alias to a function call?
18:09:09Yardanicowell it's a compiler *magic*
18:09:15Yardanico(not real magic though)
18:09:20spicaconfusing magic
18:09:21Araqno, it's an ordinary type conversion
18:09:22FromGitter<stisa> int is a type
18:09:32Araqthe 'int' *type* however is builtin
18:09:47Araqlike in every other language out there (more or less)
18:09:58FromGitter<adamrezich> when you instantiate a T with T(foo: 0), but T has a foo and a bar, does the bar get set to 0, or is it uninitialized?
18:10:07*enthus1ast- quit (Ping timeout: 248 seconds)
18:10:11Araqto 0
18:10:11FromGitter<zacharycarter> 0
18:10:12Yardanicoif it's a value type - it's set to default value
18:10:27Yardanicoif it's a ref - nil?
18:10:42Araqyup
18:10:50FromGitter<adamrezich> cool
18:10:56FromGitter<zacharycarter> alright roguelike library time :D
18:11:14FromGitter<adamrezich> did you see the one that someone made recently?
18:11:16Yardanicodefaults for value types - https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement
18:11:21FromGitter<zacharycarter> nope!
18:11:29*d10n-work joined #nim
18:11:55FromGitter<adamrezich> erm, I thought I saw one, maybe I didn't
18:12:20FromGitter<zacharycarter> I made one a while ago but just deleted it as it's not really useful
18:12:58FromGitter<adamrezich> could've sworn I saw one the other day, maybe not
18:22:49FromGitter<adamrezich> when do you use `object` vs. `object of RootObj` for defining types?
18:25:14FromGitter<superfunc> If you want to inherit from it, see: https://nim-lang.org/docs/manual.html#types-tuples-and-object-types
18:25:27FromGitter<superfunc> The lower area of that section discusses RootObj
18:26:00FromGitter<superfunc> Key bit "Objects that have no ancestor are implicitly final and thus have no hidden type field."
18:27:09FromGitter<adamrezich> aha
18:36:51*abeaumont joined #nim
18:41:44*spica quit (Quit: Leaving)
18:51:13*claudiuinberlin joined #nim
18:51:17FromGitter<adamrezich> what's the difference in use case between tuple and object? aside from inheritance
18:51:42*vlad1777d quit (Ping timeout: 260 seconds)
18:52:01FromGitter<adamrezich> (I think I get it but I just want to be sure)
18:53:12Yardanicohttps://nim-lang.org/docs/manual.html#types-tuples-and-object-types
18:53:23FromGitter<superfunc> From the same section I linked to
18:53:24Yardanicothere's a description
18:56:02FromGitter<adamrezich> yeah I read that I'm just trying to wrap my mind around it
18:56:43FromGitter<adamrezich> what's the point of named tuples?
18:57:05FromGitter<superfunc> I'd represent a simple type like a point2d with a named tuple, so I have x and y fields.
18:57:21FromGitter<superfunc> But I have no need for information hiding or inheritance with such a type.
18:58:22FromGitter<adamrezich> so, because you don't use the name of the tuple to instantiate it, is tuple instantiation just pattern-matched with tuple types then?
18:58:51Yardanicoyes
18:58:55FromGitter<adamrezich> i.e. you have to declare all fields of it upon instantiation in order to make it an instance of the desired tuple type, and not just some new tuple type
18:59:08Yardanicowell
18:59:13Yardanicoif your proc returns a tuple for example
18:59:20Yardanicoyou can assign separate fields by using result variable
18:59:45FromGitter<adamrezich> ah, ok. but when you use assignment, you have to set all the fields, right?
19:00:27*Matthias247 quit (Quit: Matthias247)
19:01:24FromGitter<superfunc> Yeah
19:02:11FromGitter<adamrezich> cool. what happens when you do as @Yardanico said above, and have a proc that returns a tuple, but you don't declare all fields of it? are they zeroed or uninitialized?
19:02:36Yardanicoall value types contain binary zero
19:02:42Yardanicoall ref types are nil
19:03:01FromGitter<adamrezich> gotcha
19:03:08FromGitter<superfunc> They get there zero value yeah
19:03:27*vlad1777d joined #nim
19:03:46FromGitter<superfunc> ```code paste, see link``` ⏎ ⏎ outputs `(x: 3, y: 0)` [https://gitter.im/nim-lang/Nim?at=59b6de12b59d55b823e31e71]
19:06:38Yardanicoyou can also can use T: SomeNumber if you want some number :)
19:06:55Yardanicoe.g. all number types like int8, int16, int32, int64, float32, float64
19:07:06FromGitter<superfunc> Oh yeah heh, forgot about that
19:08:15FromGitter<adamrezich> SomeNumber? is that different from Number?
19:08:38FromGitter<zacharycarter> (https://files.gitter.im/nim-lang/Nim/Mtkt/Screen-Shot-2017-09-11-at-3.08.18-PM.png)
19:08:40FromGitter<zacharycarter> spelunking time
19:10:59FromGitter<zetashift> Is it using blt or zengine? Or just basic terminal ⭕
19:11:02Yardanicoadamrezich: SomeNumber is a generic type which covers all number types
19:11:12Yardanicoit's declared in system.nim
19:11:21FromGitter<adamrezich> oh neat, hadn't seen that before
19:11:33Yardanicohere
19:11:33Yardanicohttps://github.com/nim-lang/Nim/blob/master/lib/system.nim#L111
19:12:01FromGitter<zacharycarter> @zetashift it's not tied to any rendering output
19:12:25*nsf joined #nim
19:12:26FromGitter<zacharycarter> the goal here is a library for generating various types of dungeons, doing FOV, etc
19:15:30*Matthias247 joined #nim
19:24:57FromGitter<adamrezich> is it possible to write a constructor for a `ptr object` type without using alloc()?
19:25:27Yardanicowell it's a raw pointer
19:25:39Yardanicobut IDK :)
19:26:00FromGitter<adamrezich> right, so it needs a cast, which is ugly too. but then again, ptrs are inherently ugly (:
19:26:25*vlad1777d quit (Ping timeout: 248 seconds)
19:26:28Yardanicowell because they're made for integrating with C/C++
19:26:33Yardanicoand rarely for performance
19:27:19Yardanicoalso it's unsafe
19:27:59FromGitter<adamrezich> yeah i'm gonna try rewriting things to not use my c++-style memory management stuff, and see how that goes
19:28:29*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:28:59*relax quit (Ping timeout: 240 seconds)
19:30:25*mahmudov quit (Ping timeout: 246 seconds)
19:33:10*vlad1777d joined #nim
19:35:13*Yardanico quit (Remote host closed the connection)
19:39:32*Trustable quit (Remote host closed the connection)
19:39:48*Pisuke joined #nim
19:39:50*claudiuinberlin joined #nim
19:40:07*MyMind quit (Ping timeout: 260 seconds)
19:41:09*mahsav joined #nim
19:43:29*vlad1777d quit (Ping timeout: 248 seconds)
19:44:37*Vladar quit (Quit: Leaving)
19:52:16*yingjun joined #nim
19:57:00*yingjun quit (Ping timeout: 252 seconds)
19:57:06*PMunch quit (Quit: leaving)
19:59:48*ipjk quit (Read error: Connection reset by peer)
20:01:34*couven92 joined #nim
20:05:28FromGitter<mratsim> @adamrezich iirc @Araq had some in-depth link about Entity COmponent System and game design
20:06:05FromGitter<mratsim> I found an implementation tuto in C: https://www.gamedev.net/articles/programming/general-and-gameplay-programming/implementing-component-entity-systems-r3382
20:06:48FromGitter<zacharycarter> ECS = evil
20:06:53FromGitter<mratsim> and a repo with examples: https://github.com/sosolimited/Entity-Component-Samples (note I’m not a game programmer so judge the quality by yourself, it was just in my archives)
20:06:54FromGitter<zacharycarter> fyi
20:07:22FromGitter<zacharycarter> I'm not sure if @adamrezich is designing an ECS or more of a scene graph style node component system
20:08:24FromGitter<mratsim> quote: "well one of the main goals of my engine is to experiment with object hierarchies and component-based design, in a way that compromises ease of use and performance. it's hard to explain but instead of having a global collection of entities and components or whatever, Elems are created in a hierarchy (with pointers), and they have pointers to Comps (components). ..."
20:09:54FromGitter<zacharycarter> maybe conflating ideas here - ECS's tend to be geared towards organizing game logic
20:09:57FromGitter<adamrezich> yeah I'm just experimenting with ideas to see what works best. I've made several component-based frameworks in C, C++, and C# before, and I'm trying to figure out a good tradeoff between ease of use, performance, and Nimishness
20:10:04*vlad1777d joined #nim
20:10:20FromGitter<adamrezich> that's the thing, I'm designing a scene graph and ECS rolled into one
20:10:21FromGitter<zacharycarter> but there are also scene graphs that tend to employ node / component hierarchies
20:10:28FromGitter<zacharycarter> ala unity32
20:10:31FromGitter<zacharycarter> 3d*
20:10:38FromGitter<zacharycarter> ah okay interesting
20:11:02FromGitter<zacharycarter> I've never really found an ECS I enjoy using, maybe yours will change my perception of them :) (I hope)
20:11:07FromGitter<mratsim> wasn’t there a #nim-games channel btw?
20:11:12FromGitter<zacharycarter> if not we need one
20:12:37FromGitter<mratsim> Well, soon you won’t be needed anyway ;) https://www.theverge.com/2017/9/10/16276528/ai-video-games-game-engine
20:13:49FromGitter<zacharycarter> yeah once programs start writing programs we're all screwed
20:13:51FromGitter<mratsim> When I get Arraymancer up to speed, I’m definitely using it for game AI. Google and Blizzard released an AI API for Starcraft 2 for example
20:14:05FromGitter<zacharycarter> I'm excited for that
20:14:25FromGitter<mratsim> with some auto/exercise like “Teach your AI to collect minerals and Gas Vespene"
20:14:33FromGitter<mratsim> s/auto/tuto
20:14:41*vlad1777d quit (Ping timeout: 255 seconds)
20:19:59FromGitter<mratsim> Still, there is hope: http://www.commitstrip.com/wp-content/uploads/2016/08/Strip-Les-specs-cest-du-code-650-finalenglish.jpg
20:20:02*MightyJoe joined #nim
20:22:12*beatmox_ joined #nim
20:24:07*Sentreen quit (*.net *.split)
20:24:08*joshbaptiste_ quit (*.net *.split)
20:24:08*beatmox quit (*.net *.split)
20:24:10*cyraxjoe quit (*.net *.split)
20:24:12*beatmox_ is now known as beatmox
20:29:28FromGitter<adamrezich> @mratsim @Araq happen to have that link about component systems and game design handy? I'd like to check it out
20:30:29*joshbaptiste_ joined #nim
20:30:48FromGitter<mratsim> Try the irc logs with google I guess
20:30:57FromGitter<mratsim> it was in April May
20:31:19*Sentreen joined #nim
20:33:15FromGitter<mratsim> wow looking at google results it seems like every months or so there is a discussion about ECS/EntityComponent System
20:36:56obadzI see (!) operators here and there in nim code. what does it do?
20:37:27FromGitter<superfunc> https://devdocs.io/nim/macros#!,string
20:37:38*Arrrr quit (Read error: Connection reset by peer)
20:37:52FromGitter<superfunc> Theres a few other uses, just search for `!` in the sidebar
20:38:36FromGitter<mratsim> Can’t find it @adamrezich :/, it may not have been Araq
20:38:42obadzok I think I get it
20:38:44obadzthanks
20:40:32FromGitter<adamrezich> @mratsim thanks for looking anyways :)
20:41:50obadzis it allowed to have a ptr to an object that has a ref member? does the GC keep track of the ref member?
20:42:07*nitely joined #nim
20:46:43FromGitter<mratsim> It is allowed, but don’t do wild modifications using the pointer, they won’t be checked by the compiler
20:49:04FromGitter<mratsim> Except for C intro, in my experience, you don’t really need pointers in Nim. I even benchmarked 2 equivalent implementation of matrix multiplication one with pointers the other with seq + offset, and seq + ofset were faster. (I suppose the compiler could optimize those more aggressively)
20:49:20FromGitter<mratsim> C intro*
20:49:28FromGitter<mratsim> interop*
20:51:45FromGitter<mratsim> (matrix multiplication is a O(n3) memory bound operation, the faster your memory access are, the faster you get your result, the CPU compute is less important that getting data in the cache fast)
20:53:01*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
20:53:39obadz@mratsim: sure I'm not looking at ptr for speed but only because it seems to be the only way to share memory across threads?
20:54:26FromGitter<superfunc> channels are available for that
20:54:48obadzdon't think it's appropriate for sharing a 1Gb array
20:55:16FromGitter<mratsim> You can use pointers no worry
20:55:52FromGitter<superfunc> oh yeah, didnt realize the size
20:56:42obadzI'd still want to use channels to control the flow of what's going on but eventually there needs to be something in some shared heap
20:58:15FromGitter<superfunc> yeah `allocShared` would be what you'll want
20:59:43obadz@superfunc: how can I copy an object to an allocShared area?
21:01:25FromGitter<zacharycarter> https://play.nim-lang.org/?gist=0ea04dc15553f552d20450d3cd148c68 obadz
21:02:16obadz@zacharycarter: very nice, thanks!
21:02:56FromGitter<zacharycarter> sure thing
21:03:36FromGitter<superfunc> Yep, the locks module will probably come in handy for you too
21:03:58FromGitter<superfunc> The guard pragma is neat and useful for ensuring you grab a lock when accessing
21:05:36obadzwhoooaaa really nice and easy
21:05:36*nsf quit (Quit: WeeChat 1.9)
21:06:36obadzalso https://devdocs.io/nim/ is super useful, would be nice to have a link to it from https://nim-lang.org/documentation.html
21:06:54FromGitter<superfunc> obadz: yeah theres a bug open on the website repo for it
21:07:12FromGitter<superfunc> https://github.com/nim-lang/website/issues/45
21:08:06FromGitter<zacharycarter> obadz: if you want to use allocshared - https://play.nim-lang.org/?gist=7cde0920d9ac9fd67b5d45e9d00ed78b
21:12:31*vlad1777d joined #nim
21:14:52FromGitter<adamrezich> https://play.nim-lang.org/?gist=6abc1e40b716bcb0c13c76edafc69424 is the syntax on line 31-32 here possible with templates and/or macros? (I haven't messed around with macros at all yet)
21:16:19FromGitter<superfunc> @adamrezich yeah
21:16:28FromGitter<superfunc> Easiest way to find out is just use dumpTree
21:16:47FromGitter<adamrezich> where/on what?
21:17:05FromGitter<superfunc> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59b6fd51bc464729741fd10d]
21:17:40FromGitter<superfunc> If its valid syntax, dumpTree will succeed and spit out its AST representation at compile time
21:18:13FromGitter<superfunc> It doesn't need to be a compilable snippet, since you're just dumping the parsed AST
21:18:55FromGitter<superfunc> Then its just a matter of writing macros that will build up that AST
21:19:59FromGitter<adamrezich> oh ok
21:20:04FromGitter<adamrezich> so a template won't work here then?
21:21:08FromGitter<superfunc> I didn't look too closely at what the code is doing. If the generation needs to be procedural, its a macro, if its simple substitution, it can be a template
21:22:49FromGitter<adamrezich> basically I want to make it so I don't have to type `proc (elem: Elem) =` when declaring a thing that takes a proc with that signature, if possible
21:23:45FromGitter<krux02> well I don't really understand what you want exactly, but it sounds like it is possible
21:24:06FromGitter<adamrezich> in that example, I can do ⏎ ⏎ ```register(MyComp, proc (elem: Elem) = ⏎ echo $elem ⏎ )``` ⏎ ⏎ , but I 'd like to be able to write ... [https://gitter.im/nim-lang/Nim?at=59b6fef6177fb9fe7eab26cc]
21:24:16FromGitter<krux02> but maybe you want the lambda syntax
21:24:18FromGitter<adamrezich> (whoops messed up some backticks there)
21:24:28FromGitter<adamrezich> from future?
21:24:48FromGitter<superfunc> Yeah, I'd just use the stuff from future
21:25:01FromGitter<adamrezich> how do you make it not have a return value though?
21:28:51FromGitter<superfunc> I would presume something like `p: (T) -> void`
21:30:44FromGitter<zacharycarter> the reason your example doesn't work @adamrezich is that elem isn't defined anywhere
21:31:18FromGitter<adamrezich> line 21 is where I tried to define it, thinking that's how templates work
21:39:25FromGitter<zacharycarter> https://play.nim-lang.org/?gist=23b02e99097a9943531073849a9065a4 @adamrezich
21:40:26FromGitter<zacharycarter> although I'm guessing that's not what you want to do
21:42:50FromGitter<adamrezich> yeah not quite. it's ok though, I'll delve into macroland with dumpTree eventually
21:49:51FromGitter<stisa> @adamrezich maybe like this? https://play.nim-lang.org/?gist=9175fa9befc97281f8fdd8197e19d8b7
21:50:23FromGitter<stisa> i'm not sure it works properly if you call it multiple times though
21:53:56*yingjun joined #nim
21:54:56FromGitter<adamrezich> cool, didn't know about {.inject.}. can't I just put the contents of the template in a `block:`?
21:58:19FromGitter<stisa> Probably, yeah. Templates open a new scope, so a block is usually not necessary
21:58:22*yingjun quit (Ping timeout: 260 seconds)
22:00:34FromGitter<stisa> take a look at https://nim-lang.org/docs/manual.html#templates-hygiene-in-templates too
22:04:57*MightyJoe is now known as cyraxjoe
22:05:13FromGitter<adamrezich> awesome, thanks a lot
22:06:09*enthus1ast- joined #nim
22:15:27FromGitter<zacharycarter> @Yardanico can you link me to your py2nim stuff
22:16:22FromGitter<mratsim> What is the equivalent Nim type to “clonglong” ?
22:16:44FromGitter<mratsim> ah it’s int
22:17:01FromGitter<zacharycarter> culonglong
22:17:14FromGitter<zacharycarter> equivalent to uint64
22:26:36obadz@zacharycarter: makes sense, thanks. Is there a sizeof equivalent?
22:26:53FromGitter<zacharycarter> sizeof
22:27:04obadzha. easy enough.
22:27:08FromGitter<zacharycarter> :)
22:27:37obadzseems like createShared is superior to allocShared though, unless you need raw memory
22:28:16obadzwhat kind of allocation strategy does createShared (and I assume allocShared employ?)
22:29:07obadzs/employ?)/) use?/
22:30:15FromGitter<zacharycarter> good question
22:30:17ehmryare there any conventions or existing cases of completing futures from different threads? I know its hacky but I need to process multiple events from an additional external thread
22:31:29*vlad1777d quit (Ping timeout: 240 seconds)
22:36:30obadzalso where can I find what the locks pragma does?
22:40:45subsetparkhttps://nim-lang.org/docs/manual.html#guards-and-locks
22:42:38FromGitter<zacharycarter> http://imgur.com/a/gRvkz
22:42:41FromGitter<zacharycarter> getting some nice looking caves
22:42:44FromGitter<zacharycarter> now to connect them
22:43:04*nitely quit (Ping timeout: 260 seconds)
22:43:17subsetparkzacharycarter is this with your framework?
22:43:20obadzsubsetpark: thx
22:43:29*couven92 quit (Quit: Bye)
22:44:18FromGitter<zacharycarter> subsetpark: no I'm writing a roguelike library for Nim
22:44:31FromGitter<zacharycarter> then my plan is to write a tutorial using it + zengine to make a roguelike
22:44:54subsetparkOh very cool
22:45:03subsetparkI started a roguelike in Nim
22:45:11subsetparkI don't know why I never put it online...
22:45:16SusWombatwhat is the difference between frag and zengine?
22:45:52FromGitter<zacharycarter> frag = very complex with lots of integration points between different libraries, also abandoned
22:46:14FromGitter<zacharycarter> zengine = stupid simple, akin to XNA | Allegro, with basic 2d and 3d primitive drawing
22:46:34SusWombatwhat libs does it use?
22:46:38FromGitter<zacharycarter> it's meant to be a prototyping library, but it's capable of whatever you're willing to write on top of it really
22:46:45FromGitter<zacharycarter> SDL2, OpenGL Assimp
22:47:15FromGitter<zacharycarter> oh and Nuklear for IMGUI
22:47:29FromGitter<zacharycarter> but that's totally optional
22:47:30SusWombatdoes it support shaders?
22:47:34FromGitter<zacharycarter> yup!
22:47:39FromGitter<zacharycarter> along with skeletal animation
22:47:46SusWombatHm might need to check it out
22:47:57FromGitter<zacharycarter> it's really a glorified port of Raylib to Nim
22:48:05FromGitter<zacharycarter> with my own take and def-pri-pubs take on certain things
22:48:24SusWombatDoes it have "debugging"?
22:48:39FromGitter<zacharycarter> hrm what do you mean by that?
22:48:55SusWombati mean errorhandling/errormessages
22:49:19FromGitter<zacharycarter> oh, yeah it does
22:49:46SusWombatah cool because i think raylib doesnt have
22:50:07FromGitter<zacharycarter> I tried to plug error messages in where I thought they were sensible
22:50:30FromGitter<zacharycarter> it probably needs a lot more
22:50:51FromGitter<zacharycarter> it's stupid simple to use for the most part though and we've built up a few examples, with hopefully lots more to come
22:51:04subsetparkzacharycarter http://chiselapp.com/user/subsetpark/repository/nogue/home
22:51:25FromGitter<zacharycarter> :D
22:52:10FromGitter<zacharycarter> here's the library so far - https://play.nim-lang.org/?gist=71b846eed37ad57ce0f5032d85065a14
22:54:44subsetparkWell if you see anything you like in there feel free to steal it
22:55:25FromGitter<zacharycarter> thank you!
22:57:17subsetparkI sort of liked the idea - I don't remember why I lost interest. Probably was a pain working with ncurses
22:58:23FromGitter<zacharycarter> you should resurrect it with bearlibterminal!
23:02:00subsetparkI probably should... I think at the time I was resisting out of terminal purism, but now I don't care and just want to avoid antiquated APIs :)
23:02:51SusWombati still think it sucks that there isnt a crossplatformalternative to ncurses. Atleast i couldnt find one
23:03:02FromGitter<zacharycarter> yeah we need a nimtermbox
23:07:32subsetparksounds like you know your next project zacharycarter...
23:09:22*chemist69 quit (Ping timeout: 264 seconds)
23:12:02subsetparkzacharycarter - blt's not on nimble?
23:14:05FromGitter<ephja> I used it for a chat client. seems to work well
23:15:35FromGitter<zacharycarter> subsetpark I don't think I ever published the bindings
23:15:56FromGitter<zacharycarter> they're just on github
23:16:03subsetparkwell get on it man, how else am I gonna write my roguelike now?
23:16:21FromGitter<zacharycarter> just use the git repo!
23:16:29FromGitter<zacharycarter> https://github.com/zacharycarter/blt-nim
23:17:32subsetparkwhat, you want me to copy in the file? what is this 1996
23:17:59FromGitter<zacharycarter> no no no
23:18:05FromGitter<zacharycarter> are you using nimble?
23:18:19subsetparkyeah - can you point `requires` at a .git URL/
23:18:25FromGitter<zacharycarter> yessir
23:18:58subsetparkI never knew that! Super cool
23:19:01FromGitter<zacharycarter> subsetpark - you were curious about AWS lambda and Nim too right?
23:19:06subsetparkThat makes my professional life easier too
23:19:21subsetparkYou could say it was a morbid curiosity, maybe
23:20:29*Matthias247 quit (Read error: Connection reset by peer)
23:20:43FromGitter<zacharycarter> a couple folks in here (including myself) now have Nim code running in lambda being called from python
23:20:50FromGitter<zacharycarter> I'm about to go to production at work with it
23:21:31FromGitter<zacharycarter> we used https://github.com/jboy/nim-pymod to make it work
23:23:46FromGitter<zacharycarter> anyone want to help me re-write this in Nim?
23:23:58FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59b71b0e319100804e22b064]
23:24:22FromGitter<zacharycarter> because I'm getting hung up on split_sets
23:25:23subsetparkactually, i'm working on the opposite solution
23:25:35subsetparkAt work I use ctypes to call Nim from Python
23:26:07subsetparkso I am gonna put together a simple ntypes library that provides ctypes for Nim types
23:26:53FromGitter<zacharycarter> that will be handy
23:27:06subsetparkthen you compile the nim code to C and distribute the C sources with the Python package; you don't need the nim compiler to install the python package
23:30:27*Jesin quit (Quit: Leaving)
23:36:10*Jesin joined #nim
23:44:40*pilne joined #nim
23:51:02*def-pri-pub joined #nim
23:51:10def-pri-pubzacharycarter: heya, you here right now?
23:51:29FromGitter<zacharycarter> yup
23:51:41def-pri-pubcool
23:52:25def-pri-pubHow is the 3D texture example coming along? That's probably the next thing that blocking me. I'm going to work on the ZSprite tool in the meantime.
23:52:48FromGitter<zacharycarter> I have questions about the 3d texture example
23:53:01FromGitter<zacharycarter> did you see the screenshot I posted the other day?
23:53:44FromGitter<zacharycarter> https://files.gitter.im/nim-lang/Nim/MJe9/thumb/Screen-Shot-2017-09-10-at-8.13.19-AM.png
23:53:45def-pri-pubno,
23:53:52FromGitter<zacharycarter> do you want something like that?
23:53:54def-pri-pubdats tiny
23:53:58def-pri-pubreally tiny
23:54:16FromGitter<zacharycarter> hrm let me try to find the og picture
23:55:01FromGitter<zacharycarter> https://files.gitter.im/nim-lang/Nim/MJe9/Screen-Shot-2017-09-10-at-8.13.19-AM.png
23:55:19def-pri-pubYeah, that's what I'd like
23:55:23FromGitter<zacharycarter> okay
23:55:32def-pri-pubCan I at least rotate/orient the texture in all three directions?
23:55:35*yingjun joined #nim
23:55:41FromGitter<zacharycarter> I need to add billboarding for that
23:55:48FromGitter<zacharycarter> I'll work on this tonight
23:55:50def-pri-pubAlso, I assume transparnecy works?
23:55:57FromGitter<zacharycarter> good question
23:56:06FromGitter<zacharycarter> it needs to
23:56:21FromGitter<zacharycarter> yeah I'll get all this straightened out tonight
23:56:36def-pri-pubEh, I don't think you need bill-boarding per-se. It's moreso that you need orienting for bill-boarding
23:56:45FromGitter<zacharycarter> right
23:56:47FromGitter<noctisdb> Ive just been tinkering with moving things around, and editor support for brackets (closest thing to atom like I could find for 32 bit)
23:56:50def-pri-pubCan you post your work to the repo on a non-master branch?
23:57:04FromGitter<zacharycarter> well I accidentally deleted the above example
23:57:07FromGitter<zacharycarter> let me recreate it
23:57:10FromGitter<zacharycarter> and I'll make a new branch
23:57:23def-pri-pub¯\_(ツ)_/¯
23:57:34FromGitter<zacharycarter> pretty much
23:57:43def-pri-pubI do think an actual function should be formalized in zgl.nim
23:57:46def-pri-pubI can do that for you
23:58:28def-pri-pubI'll probaby need to shove some OpenGL code anyways in `SpriteBatch` like I orignally planned.
23:58:57*yglukhov quit (Remote host closed the connection)