<< 04-05-2018 >>

00:11:14FromGitter<gogolxdong> @dom96 Your guess about the websocket frame data size limit is probably right.
00:31:17*yglukhov quit (Read error: Connection reset by peer)
00:31:53*yglukhov joined #nim
00:54:12FromGitter<sivakon> @mratsim genetic algorithms would be nice. Open AI gym stuff
01:00:50shashlicksherjilozair: nope, c2nim doesn't and nimgen uses c2nim
01:04:20CodeVanceshashlick comments are included
01:04:32CodeVanceIf you don't tell c2nim to remove them
01:22:51FromGitter<sherjilozair> Can nimgen show the c2nim command it's using? I'm using nimgen and the comments do get removed.
01:38:12FromGitter<sherjilozair> Can I have both C and Nim code in a project and compile with nim?
01:38:50CodeVancesherjilozair, only the C code inside nimcache gets compiled
01:39:55FromGitter<sherjilozair> That doesn't really answer my question. In principle, `nim` could copy the C code to nimcache, and then compile it. Is it not common practice to have mixed-source codebases?
01:40:10*bwlang_ joined #nim
01:40:36FromGitter<sherjilozair> i.e. without going the shared library route. I want to write both C and Nim code, and have Nim call C functions, without create intermediate libraries.
01:44:05bwlang_i’m just trying out nim… when i read lines from stdin (https://bpaste.net/show/2310325dc35a ) the first line is 0x00,0x00 until a chunk of the way through the line, then it looks like a normal string. Am I mssing something here?
01:44:38bwlang_unicode vs ascii mode or somesuch?
01:49:04shashlickSherjilozair u can pass flags to c2nim
01:49:55shashlickYou can also refer to c code in your Nim file with a compile pragma
01:58:32shashlickIf you see other nimgen projects, you can see how it refers to c files
02:11:57*leorize joined #nim
02:30:17FromGitter<sherjilozair> Thanks @shashlick
02:34:30bwlang_i thought it would be pretty simple to just read from stdin and write to stdout…
02:35:00bwlang_when i add an empty line to my file i get expected output… @[""]
02:35:00bwlang_@["chr1", "450564", "450764", "0.270000", "200", "-1", "-1", ".", "ATGACTCATTTTGAACAAGGAATATATTCATCATATATTCATCAGATAAGAATTATGTTACAGGTCTAATAACATTCAAATCAATACATAATGTCTCATAGTTCCTGAATCTAAAATATCAAAGAAAGAAACATAAAGCCATATCATGTTTAATGAGAAGGGCTTATTATATCATTTATGAGATCCTCTTGTAAATCACT"]
02:35:57bwlang_i don’t think is is input… checked it over with hexdump. nothing strange in there.
02:40:29FromGitter<sherjilozair> bwlang_ Can you show code?
02:40:56bwlang_sherjilozair: from above… https://bpaste.net/show/2310325dc35a
02:43:39FromGitter<sherjilozair> bwlang_: does it happen when you write to stdin manually? or is it only happening when you pipe from another program?
02:44:00FromGitter<sherjilozair> I think this is due to something other than nim in your pipeline.
02:44:11bwlang_tried that , did not notice anything when i type in
02:44:22bwlang_ran it like this: nim compile --run calc_exp_meth_pct < ../test/test.bed
02:44:39bwlang_also tried cat ../test/test.bed | ./calc_exp_meth_pct
02:44:58bwlang_same result
02:45:13bwlang_python handles this same file just fine.
02:51:10leorizebwlang_: looks like there's a bug with readLine(file, var string), if you use line = readLine(stdin) then it's fine
02:52:40bwlang_whoa - what are the chances that i find a bug in my very first toy nim program… I actaully tried while line = reaLine(stdin) first but got wierd output (one line per character).
02:53:09bwlang_er. . for line in readLIne(stdin):
02:53:29leorizeyou would want `for l in lines(stdin):`
02:54:21*vivus quit (Quit: Leaving)
02:57:35bwlang_huh? yep - that seems towork.. but i don’t grok what readLine is doing then. docs say it gives back a TaintedString. https://nim-lang.org/docs/streams.html#readLine,Stream. same as lines… what am i missing ?
02:57:38leorizereadLine(stdin) returns a string, so doing a `for in` loop with it would actually becomes `for line in items(readLine(stdin))`, which would yield each character of the string
03:00:40leorizereadLine is not an iterator, please take a look at https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement
03:01:41bwlang_leorize: welp - thanks for ublocking me… i’ll keep plugging away
03:15:36*endragor joined #nim
03:45:01*bwlang_ quit (Quit: bwlang_)
03:50:06FromGitter<gogolxdong> @PMunch Does protobuf-nim compile to js?
04:00:21*leorize quit (Quit: WeeChat 2.1)
04:02:05FromGitter<sherjilozair> How can I import a module but change its name and not import any of its contents? I basically want the effects of `from module import nil` and `import module as m` combined.
04:10:53FromGitter<sherjilozair> How can I convert an int to enum?
04:26:36*dddddd quit (Remote host closed the connection)
04:35:18*leorize joined #nim
04:36:32FromGitter<gogolxdong> load local file cause `Failed to load file:///D:/cmp-frontend/management/cmp.proto: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.`
04:36:48FromGitter<gogolxdong> in karax
04:39:56*endragor_ joined #nim
04:42:21*endragor quit (Ping timeout: 264 seconds)
04:53:35*leorize quit (Quit: WeeChat 2.1)
04:56:51*CodeVance quit (Quit: Leaving)
04:58:28*CodeVance joined #nim
05:15:43*avsej quit (*.net *.split)
05:15:43*zielmicha_ quit (*.net *.split)
05:15:51*avsej joined #nim
05:15:51*avsej quit (Changing host)
05:15:51*avsej joined #nim
05:16:11*zielmicha_ joined #nim
05:22:01*leorize joined #nim
05:35:45*yglukhov quit (Read error: Connection reset by peer)
05:36:21*yglukhov joined #nim
05:41:20*nsf joined #nim
05:44:59*leorize quit (Quit: WeeChat 2.1)
06:06:55*CodeVance quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org)
06:25:03*leorize joined #nim
06:27:43*icebattl1 joined #nim
06:30:21*icebattle quit (Ping timeout: 240 seconds)
06:30:39*jjido joined #nim
06:42:55*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
06:49:15TangerHey folks, so I was thinking of messing around with templates and compile time. What I was thinking of doing was setting up a decorator of sorts (using a template), that would register decorated procs at compile time and add them to a compile-time defined seq or array or whatnot
06:51:37TangerSo if I have a .compiletime. pragma on a template that would pass in name: string and a pointer to a procToregister: untyped, do those procs have to also be .compiletime.'d, or does the fact that it's a pointer make that not matter?
07:26:36FromGitter<Varriount> Tanger: You wouldn't use a template, just a compile time proc
07:29:07FromGitter<Varriount> What is your end goal?
07:32:16*PMunch joined #nim
07:34:37TangerVarriount: Haha, that makes sense. A template does seem overkill
07:35:01TangerI'm making a super duper basic shell. But I wanted to make any builtin commands kinda modular
07:35:44TangerSo I guess I wanted to be able to be able to register a proc definition and have the system know about it come run-time
07:41:39FromGitter<survivorm> Can anyone name the downsides of this: ⏎ ⏎ ```proc `+=`*[T,U](a:var T, b:U) = ⏎ a = a + b``` [https://gitter.im/nim-lang/Nim?at=5aec0eb31eddba3d04d000de]
07:42:37FromGitter<survivorm> If i understand correctly, `+` existance for the chosen types is checked at compile-time
07:42:54*floppydh joined #nim
07:44:22FromGitter<survivorm> and it's return type, of cause
07:46:04PMunchdata-man: https://github.com/dloss/binary-parsing/pull/6
07:49:25*Vladar joined #nim
07:57:51livcdyay 2vg fixed mofuw for me!
07:58:01FromGitter<gogolxdong> @PMunch protobuf.nim doesn't support package statement?
08:01:23*sendell joined #nim
08:03:40PMunchIt should
08:06:32FromGitter<gogolxdong> Have you ever sent protobuf data through websocket?
08:20:47FromGitter<mratsim> @sivakon, great suggestion, I definitely want to be able to do something OpenAI gym like
08:21:46FromGitter<mratsim> @sherjilozair you can run C or C++ code along with Nim just use {.compile: “foo.c”.} Nim will copy foo.c and anything it includes (headers …) during compilation
08:22:24FromGitter<mratsim> there are several mixed codebases, for example: https://github.com/status-im/nim-secp256k1
08:23:27*wishi_ quit (Ping timeout: 240 seconds)
08:23:32FromGitter<mratsim> or another: https://github.com/status-im/nim-decimal
08:27:27*wishi joined #nim
08:29:39FromGitter<sherjilozair> @mratsim Would I also need to add declarations for all the functions like `proc func_name*() {.stdcall, importc.}` ?
08:32:06FromGitter<mratsim> I just used c2nim to generate that
08:32:47FromGitter<mratsim> if you {.compile: “foo.c”.} at least you don’t need to declare importc: “mpdecimal_add”.}
08:32:59FromGitter<mratsim> if the function have the same name
08:33:22FromGitter<mratsim> for call convention I’m just blind guessing between cdecl and stdcall :D
08:35:03FromGitter<mratsim> also you can use a template if you do the same custom thing all over again
08:35:59FromGitter<mratsim> here is a basic example to lift a unary function so that it works on Tensor: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/ufunc.nim#L28
08:38:09FromGitter<mratsim> And here is an example of how I use template to wraps C++ Cuda function: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_kernels_interface_cuda.nim#L23
08:38:44PMunchgogolxdong, no I haven't tried websockets
08:39:07PMunchDid you figure out the package statement by the way?
08:39:53FromGitter<gogolxdong> add package statement just goes wrong.
08:42:18PMunchexample1 uses a package statement
08:43:27FromGitter<sherjilozair> Thanks a lot @mratsim !
08:47:40FromGitter<gogolxdong> @PMunch , package statement have to be behind syntax="proto3"
08:48:22PMunchYes, as per the spec
08:49:01PMunchThe first line of the file specifies that you're using proto3 syntax: if you don't do this the protocol buffer compiler will assume you are using proto2. This must be the first non-empty, non-comment line of the file.
08:49:13PMunch^ From the protobuf specification
08:49:51PMunchAnd my implementation only supports proto3, hence you must have the syntax line as the first non-whitespace, non-comment line in your definition
08:52:39*floppydh quit (Remote host closed the connection)
08:53:29*floppydh joined #nim
08:59:35*brainproxy quit (Ping timeout: 240 seconds)
09:04:47FromGitter<Varriount> Tanger: Hmm. Well, the simplest way would be to have a macro that is used as a pragma
09:05:25FromGitter<Varriount> It would take in the procedure definition, and output the same definition + a call to add the procedure pointer to the sequence.
09:06:46FromGitter<Varriount> The downside is that this would be done at runtime. A compile-time approach is possible, but would be more complex.
09:11:09*Trustable joined #nim
09:27:36*CodeVance joined #nim
09:28:57FromGitter<xmonader> @dom96 can you review https://github.com/nim-lang/nimble/pull/483/files ? nimble enhancement to show pr url after successfully executing nim publish?
09:37:55FromGitter<sherjilozair> Is this not possible `proc f(x = 0, y = 0) = return 'something'; echo f(y=0)` ?
09:38:19FromGitter<xmonader> echo after return?
09:40:58FromGitter<narimiran> you didn't define the return type
09:41:11FromGitter<sherjilozair> No, passing later default arguments. Never mind, it was another issue.
09:49:08FromGitter<mratsim> yes it works
09:51:38*leorize quit (Quit: WeeChat 2.1)
10:00:59*Vladar quit (Quit: Leaving)
10:31:41*kier quit (Read error: Connection reset by peer)
10:32:50*kier joined #nim
10:35:23*bwlang_ joined #nim
10:44:01*NimBot joined #nim
10:57:41*natrys joined #nim
11:13:16*brainproxy joined #nim
11:15:43FromGitter<sherjilozair> So the manual lists a "Horrible example" of interfacing with a C++ library, but no good way. Where can I find a good way of interfacing with c++ library?
11:17:47PMunchLink?
11:17:51PMunchTo the horrible example?
11:18:05PMunchMost of the time you would use c2nim on the header file for the library
11:18:14FromGitter<sherjilozair> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma
11:18:20PMunchThat should create a Nim/C++ binding
11:18:51FromGitter<sherjilozair> Does c2nim also create objects for classes?
11:19:57PMunchI think so
11:20:25PMunchThe idea is to only have to run it through c2nim to be able to use it in Nim. But it's not always 100%
11:21:12FromGitter<sherjilozair> Is there an example `package.cfg` I can see?
11:22:53PMunchpackage.cfg?
11:23:22FromGitter<sherjilozair> To use with nimgen.
11:24:45PMunchOh with nimgen..
11:24:53PMunchUhm, not sure really. Haven't used it myself
11:26:25FromGitter<sherjilozair> I've never been able to run c2nim, only nimgen.
11:26:50FromGitter<sherjilozair> I called gcc -E on the header file, and then `c2nim -cpp process_header.h` and that gave me an error.
11:27:01*bwlang_ quit (Quit: bwlang_)
11:27:07FromGitter<sherjilozair> `/Users/sherjilozair/nim-sfml/binding/window.h(57, 23) Error: identifier expected, but found '( (pxParLe)'`
11:33:51PMunchHmm, not quite sure what that is. Haven't used c2nim all that much myself
11:34:11PMunchMaybe check with dom96 if he can help
11:34:16FromGitter<data-man> @sherjilozair: c2nim don't supports all horrible constructions of C
11:34:34PMunchAre you wrapping SFML by the way?
11:34:37FromGitter<sherjilozair> Yes.
11:34:53PMunchOh hi data-man, did you see my PR to the repo you sent me yesterday?
11:35:01PMunchCool!
11:35:05FromGitter<sherjilozair> I'm trying to use nimgen now. How can I get it to include <> includes ?
11:35:26FromGitter<data-man> @PMunch: Hi! Yes, thanks!
11:37:40FromGitter<data-man> @sherjilozair: For examples look at other bindings by genotrance: nimssl, ssh, rax, bass, ...
11:38:32FromGitter<data-man> E.g. https://github.com/genotrance/nimssh2/blob/master/nimssh2.cfg
11:39:32FromGitter<sherjilozair> All of them are C, not c++.
11:39:55PMunchdata-man, I also wrote this: https://peterme.net/handling-files-in-nim.html which is mostly about binaryparse
11:41:25PMunchYou know that https://github.com/oprypin/nim-csfml exists right? Trying to get away from the destructor stuff I assume?
11:43:54FromGitter<data-man> @PMunch: Yesterday you already boasted by this. :-D
11:44:31PMunchOh right, you were on yesterday :P
11:44:53PMunchI was getting tired and heading off for bed, just dropped the link and walked away from the machine more or less
11:46:40dom96So I haven't used c2nim for C++ wrapping
11:46:45dom96Not sure how well it works
11:47:24FromGitter<sherjilozair> Doesn't seem to be working at all, @dom96. Let me know if you try and it works for you.
11:47:49dom96sherjilozair: what issues are you seeing?
11:48:25FromGitter<sherjilozair> @dom96 I get parse errors. I was using it on SFML, which is a fairly typical C++ library.
11:50:02dom96c2nim needs some help sometimes
11:50:26dom96so you may need to patch the header a little
11:54:15FromGitter<sherjilozair> I'm trying nimgen on a C library now (csfml), and it seems to have stuck in an infinite recursion.
11:54:33FromGitter<sherjilozair> Hasn't returned after 10 minutes on a 500 lines header file.
12:08:38*floppydh quit (Quit: WeeChat 2.1)
12:09:31FromGitter<narimiran> very nice to see more activity on /r/nim in recent days
12:11:39*floppydh joined #nim
12:18:27*bwlang_ joined #nim
12:21:58*xkapastel quit (Quit: Connection closed for inactivity)
12:24:21PMunchnarimiran, yes indeed
12:24:52PMunchI particularily enjoy the "Nim day #" stuff, interesting to always have a new little project to look through in the morning :)
12:32:20CodeVanceI dont see nim day one
12:33:02CodeVanceIs it going to be a nim week or a nim month
12:33:47*vivus joined #nim
12:34:14shashlicksherjilozair: check out nimfuzz which is processed using --cpp
12:34:29shashlickhttps://github.com/genotrance/nimfuzz
12:35:08shashlickgcc -E includes all the standard include file defs which have to be filtered out, nimgen does that for you
12:35:12PMunchI think this was day one CodeVance: https://www.reddit.com/r/nim/comments/8facba/dmidecode_parsing_library_and_a_walkthrough/
12:36:09shashlicksherjilozair: post what you have so far in your cfg and I can take a look in a couple hours
12:39:23shashlickAlso nimgen is far from performant, if someone can code review and suggest improvements, will be appreciated. Lots of string manipulation which could do with optimization
12:40:16FromGitter<narimiran> @CodeVance: "nim week #" might be interesting too. to see some more complex projects done each week
12:40:39FromGitter<sherjilozair> shashlick: https://gist.github.com/sherjilozair/fd008b91f633d47e43f8aaea4f76093d
12:41:25FromGitter<sherjilozair> And this is the file: https://github.com/SFML/CSFML/blob/master/include/SFML/Window/VideoMode.h
12:45:59*Vladar joined #nim
12:46:06CodeVanceShashlick, you develop nimgen?
12:46:11shashlickYa
12:47:06CodeVancePerformant in what sense, like the output or nimgens execution?
12:51:39yglukhovwhich is faster? "myVar > 0" or "myVar != 0". @mratsim? ;)
12:52:12FromGitter<xmonader> @CodeVance dmidecode library was day 1 but I couldn't change the title sadly
12:52:19AraqmyVar != 0 might produce slightly shorter code
12:52:32Araqdepending on the architecture.
12:53:54FromGitter<xmonader> @CodeVance I hope I keep it can keep the nim day going for a while to have enough as introductory material for people coming to nim
12:54:28yglukhovAraq: does it make any difference for i386 or amd64?
12:54:56FromGitter<xmonader> Interestingly, today i was trying to use mdbook project to generate an online book but the underlying library doesn't support nim :'(
12:58:28PMunchYou might have luck with adoc
12:58:45CodeVanceXmonader, its good, small yet illustrative code
12:59:38FromGitter<xmonader> @Pmunch adoc? asciidoc?
13:00:38Araqyglukhov: no.
13:01:16FromGitter<xmonader> @CodeVance thanks, hopefully more to come :)
13:01:23*athenot joined #nim
13:02:20PMunchxmonader, yes asciidoc
13:03:25FromGitter<xmonader> I'll check it, thank you:)
13:03:28*leorize joined #nim
13:03:50PMunchxmonader, or even use RST which is the format used for Nim's documentation
13:03:58PMunchIt should be convertible to most things as well
13:04:52PMunchhttps://rsmith.home.xs4all.nl/miscellaneous/making-my-first-epub.html < RST to EPUB
13:04:53FromGitter<xmonader> @PMunch, I prefer markdown because of the easy syntax :(
13:05:08PMunchRST isn't that much harder when you get used to it
13:05:37FromGitter<xmonader> also, today i tried softcover.io today, and it's amazing generating beautiful html, couldn't get the other builders to run :S
13:09:28FromGitter<xmonader> wow, in mdbook nim is supported but under the old name `nimrod` :D
13:09:57PMunchYeah, that's a common theme :P
13:14:39*ieatnerds joined #nim
13:14:39*ieatnerds quit (Remote host closed the connection)
13:18:38*ieatnerds joined #nim
13:18:40*dddddd joined #nim
13:26:12*endragor_ quit (Remote host closed the connection)
13:29:59*BitPuffin joined #nim
13:34:24PMunchHmm, in a template, is there a way to turn an identifier into a string?
13:35:03PMunchSay I call my template with "myTemplate(hello_world)" I want to both access a variable named hello_world but also use "hello_world" in an error message.
13:37:03Araqsystem.astToStr()
13:39:21Araqhttps://github.com/nim-lang/Nim/pull/7770 congrats yglukhov for winning the "Nim pure gold" award that I just invented
13:40:50FromGitter<data-man> Need new labels for awards :)
13:42:27PMunchNice, thanks Araq
13:44:44PMunchHmm, with that I get a nice erro message with a trace through my templates. When I passed it a string I didn't get that. How come?
13:45:09yglukhovthanks, Araq :)
13:45:30PMunchOh wait, no
13:45:31PMunchHmm
13:46:34PMunchI was getting an error message on my usage.. Is there a way I can make the exception include the position of an identifier?
13:47:32FromGitter<data-man> Whose PR will have a number 7777? :)
13:49:31yglukhovdata-man: or bug... :)
13:53:23FromGitter<data-man> Then it most likely will be @mratsim :-D
13:55:04*miran joined #nim
13:57:02*xkapastel joined #nim
14:22:08*floppydh quit (Quit: WeeChat 2.1)
14:23:24FromDiscord<2vg> awesome yglukhov ... 🎉
14:24:17dom96yeah, this is a really awesome PR
14:25:02*thor77 quit (Quit: ZNC 1.6.6 - http://znc.in)
14:25:17*thor77 joined #nim
14:36:31*max3 joined #nim
14:37:14yglukhovthanks guys, now who's gonna try and break it? ;)
14:39:56AraqStatus?
14:41:30yglukhovhaha, probably :)
14:43:35FromGitter<data-man> Oh, Arch got gcc 8.1
14:45:07*bwlang_ quit (Quit: bwlang_)
14:48:41*bwlang_ joined #nim
14:49:51dom96yglukhov: You should really join the 2-space indent party :)
14:50:52dom96Any ideas whether this affects the performance much?
14:51:33dom96I was going to try and break it but your tests look discouragingly thorough :)
14:53:45PMunchCan someone tell me why this works: http://ix.io/19pB/nim, while this doesn't: http://ix.io/19pC/nim ? It fails with this error http://ix.io/19pD/
14:53:51*avsej quit (Ping timeout: 240 seconds)
14:58:59*avsej joined #nim
14:58:59*avsej quit (Changing host)
14:58:59*avsej joined #nim
15:03:07yglukhovdom96: about performance, i don't think it will be noticeable. while the old code could technically flow straight between the states, that was unlikely, as most of the time the iter is interrupted anyway. the new code technically jumps between the states by breaking the loop an starting all over. this should not really be noticeable, and in reality it should be equal to the overhead of old iters. yields in try-catch-finally surely impliy just a
15:03:08yglukhov bit more overhead, as there is additional control flow logic. It is designed to work as fast as possible when no exceptions happen. propagating exception through multiple levels of try-catch-finally blocks is somewhat expensive, as every propagation reraises.
15:04:00dom96sounds good :D
15:04:15dom96I'm going to start ripping out the crappy try transformation in the async macro now
15:05:05*vegax87 quit (Changing host)
15:05:05*vegax87 joined #nim
15:05:05*vegax87 quit (Changing host)
15:05:05*vegax87 joined #nim
15:06:15dom96Araq: Is this worth marking as high priority? https://github.com/nim-lang/Nim/issues/5617
15:06:43*smt quit (Read error: Connection reset by peer)
15:12:12yglukhovdom96: i was also willing to simplify asyncmacro by making await a template
15:12:41yglukhovand by removing try-catch transforms of course =)
15:13:02dom96One step at a time :)
15:13:03yglukhovso, just keep in mind we need a nice await template ;)
15:14:55dom96I think I now remember the reason why I didn't use a template for await in the first place: Nim didn't support (yield x; x.read()) back then.
15:15:05yglukhov;)
15:15:25yglukhovnow nim supports yield (yield 1; 2)
15:15:36dom96:D
15:15:54yglukhov(yield (yield (yield 0; 1)); 2)
15:16:02dom96yieldception
15:16:39yglukhovi guess i'll add a few more tests...
15:16:48dom96hehe
15:17:39yglukhovand reindent :P
15:32:59*smt joined #nim
15:38:19FromDiscord<awr> so like all of the nim code I've ever seen seems to stick to the standard "style" (that is https://nim-lang.org/docs/nep1.html) but I have to ask, who isn't using this style?
15:40:35FromDiscord<awr> i like that nim provides the case insensitivity stuff but i've noticed nim code doesn't share C/C++'s stylistic variability
15:41:59FromDiscord<awr> "braces on the same line!" "braces on the next line!" "4-space!" "2-space!" "snake_case!" "camelCase!" "hungarian notation!" "_t prefix!"
15:42:22FromGitter<kayabaNerve> I don't use the result variable most times. I use 4 spaces.
15:43:07FromGitter<kayabaNerve> I've been told I have very nice code though. https://github.com/kayabaNerve/Pacman3d
15:44:04dom96kayabaNerve: far too much indentation in the object constructors IMO
15:44:49dom96otherwise nice
15:44:50FromGitter<kayabaNerve> Boi, I don't care I bought your book, fite me
15:45:12FromGitter<kayabaNerve> Thanks for the feedback ;p
15:45:32miranwaaay too much indentation, indeed
15:45:51FromDiscord<awr> when i do indentation for parameters i usually keep the first parameter on the same line as the open parens
15:46:03FromDiscord<awr> and put the closing parens on the same line as the final parameter
15:46:04dom96kayabaNerve: https://media1.giphy.com/media/pp33lEFcdDGRG/giphy.gif
15:46:30FromGitter<kayabaNerve> The indentation is because I was trying to line up the parantheses for all my one lined math formulas.
15:46:54FromGitter<kayabaNerve> And then I did it once so it become practice for everything
15:47:47Araqdom96: that is part of the plan (TM)
15:48:06Araqbut I would fix the contruction APIs instead of adding a setter
15:48:07FromDiscord<awr> also wrt https://github.com/kayabaNerve/PacMan3D/blob/master/main.nim#L79 have you seen filterIt() before
15:48:21dom96Araq: Okay, marking as high priority then
15:48:39mirankayaba: and if you change the name of your type (so its length changes), you'll need to re-align everything....
15:48:45*PMunch quit (Quit: Leaving)
15:49:29dom96We need to get nimpretty up and running ASAP
15:49:32FromGitter<xmonader> the pegs documentations needs tons of work :S how do i visit the nodes? any idea?
15:49:36FromGitter<kayabaNerve> miran: Worth it
15:49:57miranok, i surrender
15:50:24FromGitter<kayabaNerve> have I met a French person now
15:50:34Araqxmonader: pegs don't have "nodes"
15:50:35miranhahaha no
15:50:59FromGitter<kayabaNerve> You are a person that surrenders. What's the difference? *I'll stop*
15:51:00dom96Yardanico: Internal error already :)
15:51:28FromGitter<kayabaNerve> Been a few months since I've spoken here.
15:51:42*CodeVance quit (Ping timeout: 256 seconds)
15:51:45*leorize quit (Quit: WeeChat 2.1)
15:51:48FromGitter<xmonader> @Araq so visiting the matching rules isn't possible?
15:51:50FromGitter<kayabaNerve> Trying to remember why I reopened Gitter. Have had it open for a few days now
15:51:50Araqdom96: nimpretty would be good, alternatively we can try to convince people that "tooling" is not the same as a freaking pretty printer which exist since the 80ies and found no love back then
15:52:04*leorize joined #nim
15:52:18dom96Araq: Not sure what you mean
15:52:22Araqnow they are more important than a type checker, I know, I know
15:55:02dom96er, why did I write Yardanico.
15:55:14dom96yglukhov: Internal error already :) https://github.com/nim-lang/Nim/pull/7770#issuecomment-386645116
15:55:22*vivus quit (Quit: Leaving)
15:55:53Araqhuh? why was this closed?
15:56:08yglukhovfound some bugs. fixing...
15:56:13yglukhovdom96: thanks
16:01:58*xkapastel quit (Quit: Connection closed for inactivity)
16:10:06FromGitter<arnetheduck> yapf port FTW! it works - it's magic - it's the greatest invention and time-saver since.. compilers!
16:15:08*CodeVance joined #nim
16:16:41*jxv joined #nim
16:21:54FromGitter<xmonader> @Araq I checked couple of libraries on Peg, lots of them provide a way to create a pegged parse tree?
16:36:11Araqarnetheduck: so much for the "code is read much more often than written" argument huh. writing code now takes so much time we need to tool the heck out of it
16:38:37*Ven`` joined #nim
16:39:59*CodeVance quit (Ping timeout: 256 seconds)
16:42:03*Trustable quit (Remote host closed the connection)
16:42:14FromGitter<brentp> the new zero-copy interoperability with cstring will avoid a copy for $cstring?
16:44:12leorizebrentp: It's not new and only applies to string -> cstring IIRC. I think $cstring w still needs a copy, as we can't be sure that the cstring would stay allocated
16:44:40FromGitter<brentp> that makes sense.
16:49:02*smt` joined #nim
16:49:05*sendell quit (Remote host closed the connection)
16:51:32*xkapastel joined #nim
16:53:01*smt quit (Ping timeout: 256 seconds)
16:54:08*leorize quit (Quit: WeeChat 2.1)
16:57:56*jxv left #nim ("string can snapped")
17:02:39*smt` quit (Read error: Connection reset by peer)
17:08:15*leorize joined #nim
17:09:38*Jesin joined #nim
17:11:07*CodeVance joined #nim
17:27:22*PMunch joined #nim
17:28:01*CodeVance quit (Ping timeout: 248 seconds)
17:32:40shashlickdoes anyone know how to get the --docSeeSrcUrl to work?
17:34:41*noonien joined #nim
17:38:16PMunchhttps://github.com/nim-lang/Nim/blob/devel/config/nimdoc.cfg#L62
17:38:54PMunchBasically HTML to output with three substitution variables
17:39:50PMunchshashlick ^
17:40:03*Jesin quit (Remote host closed the connection)
17:40:29shashlickso i tried running without changing the file on an existing .nim file and it generates no src urls
17:42:17shashlickI also tried changing nimdoc.cfg (cached copy in the same dir as .nim file, assuming it works similar to nim.cfg overrides) and that did nothing either
17:45:31PMunchAhh, it appears you need both a nimdoc.cfg file specifying the pattern, and a docSeeSrcUrl option
17:46:00*CodeVance joined #nim
17:50:00*yglukhov quit (Remote host closed the connection)
17:50:36*yglukhov joined #nim
17:55:05*yglukhov quit (Ping timeout: 240 seconds)
17:56:37*yglukhov joined #nim
17:59:00shashlicki did that, but does it have to be the global file or can you simply edit the local copy?
17:59:30shashlickanyway, i don't see where this option is used, if you check tools\nimweb.nim, it too doesn't actually run a nim command with that flag
17:59:44*yglukhov quit (Read error: Connection reset by peer)
18:00:20*yglukhov joined #nim
18:00:43*lukas_ joined #nim
18:04:55FromGitter<data-man> @shashlick: grep seesrc in the compiler's dir
18:07:59*natrys quit (Ping timeout: 276 seconds)
18:14:47*yglukhov quit (Remote host closed the connection)
18:20:22*Sembei joined #nim
18:21:35*Pisuke quit (Ping timeout: 240 seconds)
18:23:01*jrbrt joined #nim
18:23:34*ieatnerds quit (Quit: Leaving)
18:23:41*Hycryon joined #nim
18:23:55*Hycryon quit (Client Quit)
18:24:11*Hycryon joined #nim
18:32:22miranis the author of NiGui here?
18:34:44shashlickdata-man: looking at the code
18:39:08*Sembei quit (Quit: WeeChat 2.2-dev)
18:40:07*Sembei joined #nim
18:42:05*natrys joined #nim
18:46:24*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:03:04*jrbrt quit (Quit: jrbrt)
19:03:20Araqmiran: he used to be around iirc
19:03:38FromGitter<xmonader> my pipe operator ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aecae8a1eddba3d04d24835]
19:03:46FromGitter<xmonader> definitely should be part of nim xD
19:04:12miranxmonader: pipe in nim is.... wait for it.... `.` (yeah, dot)
19:04:33FromGitter<xmonader> . :/ as in compose `dot` ?
19:04:53FromGitter<xmonader> oh u mean for the ufcs
19:04:53miranyou can do `"hello".toUpperAscii().reverse().whatever()`
19:05:25FromGitter<xmonader> yea yea u r right, i only think of piping through |> or >>= operators
19:05:29*bwlang_ quit (Ping timeout: 260 seconds)
19:09:08FromGitter<Vindaar> @miran @xmonader and in most (?) cases you can even leave out the `()`
19:09:54FromGitter<xmonader> btw if i leave the parens how do i get a reference to the proc?
19:10:42Araqf a # call
19:10:49Araqf # proc pointer
19:11:05Araqf a, b # call with 2 args, only valid in a statement context
19:11:31Araqg f a, h y # g(f(a), h(y))
19:11:53FromGitter<xmonader> and .len gives a pointer not a proc call?
19:11:56Araqdunno why so many people stumble upon this, it just works (TM)
19:12:11miranAraq: why can't we do `let a = f b, c`?
19:12:16Araqx.len same as len x
19:12:26Araqor len(x) for that matter.
19:12:49Araqthe feature is called "syntactic harmony" in my book
19:12:55Araqlol
19:13:07FromGitter<xmonader> Your book? Which book :D
19:13:23miranhis figurative book :D
19:13:42Araq"Learning Nim as your first and only language"
19:14:30FromGitter<xmonader> thought that was lisp xD
19:14:45Araqmiran: because we were conservative, we left 'let a = f b, c' for the future
19:15:06miranhopefully this future will come soon :)
19:15:52FromGitter<data-man> I hope that this book will be read more easily than the works of Knuth. :)
19:15:53Araqwell as a start you could fix the downright embarrassing issue with unary operators
19:16:09Araqf -3 doesn't parse iirc
19:16:18miranouch!
19:16:55*lukas_ quit (Quit: leaving)
19:17:03miranis this related? https://github.com/nim-lang/Nim/issues/7685
19:17:32Araqnot sure, I still need to look into that one
19:17:49Araqbut the rule is rather clear, be consistent in the spacing around binary operators
19:18:10Araqso i-1 and i - 1 are valid and i- 1 is not
19:18:15mirani usually am. i have discovered this after making a typo (leaving a space out)
19:18:19Araqand i -1 would be "apply -1 to i"
19:18:35Araqand probably the error message could be improved
19:18:49Araqwell they always can.
19:21:22shashlickaraq: can nimdoc.cfg be overridden like nim.cfg?
19:22:14*smt joined #nim
19:23:19PMunchHmm, that feeling when you have a problem in a >1500 line project and you are just completely unable to figure out what causes it or create a minimal example..
19:27:32miranPMunch: it is friday night, that should be postponed ;)
19:27:46PMunchI know, but it's been bugging me for ages..
19:28:01miranbtw, i'll have the first "beta version" of my tutorial for you hopefully by the end of this weekend
19:28:08PMunchOh nice
19:28:55miranthis took waaaaay too long time, and it is time to hear some feedback....
19:29:20PMunchLooking forward to it :)
19:29:42PMunchhttp://ix.io/19qw <- that's the output of the macro, along with the error. Is it just me or does that look correct?
19:30:56PMunchThe error is on the line that calls the macro, and the last thing it does before returning is to create that output
19:33:31Araqshashlick: it can.
19:34:01shashlickok, it wasn't clear that you needed --git.url also on the command line, had to look thru code to figure that out
19:35:29AraqPMunch: gimme something complete
19:35:45dom96shashlick: If you can please update the docs for this.
19:36:02shashlicksure
19:39:39*smt quit (Read error: Connection reset by peer)
19:39:52FromGitter<xmonader> ok who is ready for nim day 6?
19:40:25*smt joined #nim
19:41:56*jrbrt joined #nim
19:44:08dom96I'm ready :)
19:45:08dom96So guys, I will finally be investing some development time into our forum. Apart from a refreshed design what features should be prioritised?
19:45:24FromGitter<xmonader> nice ^_^
19:45:29shashlickmobile view!
19:45:50miranmake `quote` work as it has worked 15 years ago on most forums ;)
19:45:59shashlickaraq: I don't think the --docSeeSrcUrl param is consumed at all, you need to use --git.url: and --git.commit: and that's good enough
19:46:19dom96miran: `> ...` not good enough? :)
19:46:46mirannope, as i don't see the author of quoted text nor i can easily click to go to the original comment
19:47:01dom96Fair. I was thinking about adding something a bit more detailed.
19:47:20dom96Probably integrated into RST, but I'll add a little editor UI that will make it easy to insert
19:47:45miranwithout exaggeration, forums in 2003 had this feature
19:48:02dom96miran: yes, well, Reddit nor HN have this feature :P
19:49:56shashlickdo we have a nim => html code view generation?
19:50:05dom96yes, many
19:50:34dom96htmlgen module in stdlib, filters, multiple Nimble packages
19:51:13shashlickno I mean, a syntax highlighted output of nim code in html format
19:51:32mirananother thing: when i click on a user, it would be nice to see his/her post history
19:51:37dom96yes, the doc gen has a syntax highlighter
19:51:51dom96miran: oh yes, that's a must
19:52:58dom96On a scale of GNU Mailman to Discourse, how much JS should I utilize? :P
19:53:34dom96My opinion on this is that Discourse relies on JS far too much (just like most "web apps" these days)
19:53:50FromGitter<data-man> It would be great to have subforums. But this will require a lot of work for migrating existing messages.
19:53:53dom96But of course, using JS is useful for certain features.
19:53:58miranas little as possible (but not 'littler') :D
19:54:13dom96data-man: I'd rather go the Discourse "categories" route
19:54:27dom96and host multiple instances if necessary
19:54:55dom96btw I'm amazed that Discourse are charging $100/month for hosted instances of Discourse
19:54:59miranbtw, see this forum thread for some inspiration :) https://forum.nim-lang.org/t/3534/
19:56:00shashlickdom96: what I want is to generate a static html file that contains all the nim code highlighted, similar to how code shows up in github, not the docgen output, the actual source code
19:57:30dom96shashlick: https://github.com/nim-lang/Nim/blob/devel/lib/packages/docutils/highlite.nim
19:57:56dom96I don't think it generates HTML though
19:57:58FromGitter<data-man> Is it so important to have a forum engine written on Nim?
19:58:03dom96But you can see how it's used in the related modules
19:58:23dom96data-man: no, but it's a great opportunity to test Nim
19:58:33shashlickthanks :)
19:58:56dom96data-man: I don't want to spend hours writing Ruby plugins for Nim code eval for example
19:59:26FromGitter<data-man> Why Ruby?
19:59:48FromGitter<data-man> I prefer FluxBB or SimpleMachineForum
20:00:05dom96Because Discourse is currently the best
20:00:06FromGitter<data-man> Both on PHP :)
20:00:17dom96I can safely say that PHP is even worse :)
20:03:43shashlickhttps://prismjs.com
20:03:59FromGitter<data-man> @shashlick: https://github.com/andre-simon/highlight supports Nim
20:04:00dom96SSL error
20:04:24dom96So it seems people also really want emails for forum threads
20:05:05dom96We might have to start paying mailgun :(
20:05:39*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:06:03federico3:(
20:06:17federico3why mailgun?
20:06:30dom96what else is there?
20:08:11federico3postfix
20:08:28dom96yeah, been there
20:08:42dom96I don't want to deal with maintaining my own outgoing MTA
20:09:39shashlickthanks data-man, will check it out
20:10:15dom96shashlick: If the language for the syntax highlighter doesn't matter then I would suggest pygments
20:12:13shashlickgood idea, i'll check dom96
20:14:04FromGitter<data-man> Chroma for Go also supports Nim. Based on Pygments.
20:16:30federico3dom96: why do you have to send mails directly to people? We were using an external mailing list until you stopped smtp
20:17:29dom96federico3: I need to send emails directly to people at least for email confirmation/password resets.
20:17:45*miran quit (Ping timeout: 264 seconds)
20:18:01federico3ah that's a different use-case
20:18:25dom96But sending emails when people are mentioned or maybe "follow" a thread (if that feature ever shows up) would be useful
20:18:59dom96Most users won't want an email for every new thread
20:19:26dom96also I wonder if RSS doesn't cover that use case already
20:21:44shashlickpygments is simple enough
20:24:19FromGitter<data-man> Or to add new command src2html to the compiler :)
20:32:56*Vladar quit (Quit: Leaving)
20:34:10*BitPuffin quit (Remote host closed the connection)
20:36:10*ldlework quit (Ping timeout: 256 seconds)
20:43:18Araqdom96: if you add a column "markup" to every post it's easy to support both "real" markdown and RST
20:43:54dom96Araq: I'd rather fork the RST parser and make it support more markdown
20:44:02AraqI don't mind markdown, what I do mind is if the old posts don't continue to work
20:44:49Araqwhy fork it though, as long as it doesn't cause conflicts with RST most features you add would be welcome to Nim's doc generator too
20:45:02dom96yay, looks like httpclient is now broken thanks to the latest Nim string changes :(
20:45:32Araqlooks like it didn't have enough tests :P
20:45:57AraqI touched pretty much every stdlib module after these string changes. don't be so lazy and do the same.
20:46:16dom96This is concerning though
20:46:23dom96Everything will have this bug
20:46:38Araq--laxStrings:on for the transition
20:47:35dom96Here is what we should do: add a check for this case and print a nicer error message
20:47:38dom96in debug mode at least
20:47:45dom96and include the information about --laxStrings
20:48:06dom96That way we won't have to guess what the problem is
20:48:52Araqsince it was an unusual feature to begin with I'm not sure how much code outside of Nim's core is affected
20:49:37dom96You've taught me to rely on this so it undoubtedly rubbed off on others
20:49:43dom96it's worth to make the error message more user friendly
20:50:02*nsf quit (Quit: WeeChat 2.0.1)
20:50:22dom96can I do it?
20:50:39Araqmany don't parse strings at all or use the stdlib's parsers or "parse" via "split" (terrible)
20:51:04Araqbut sure do it.
20:51:35dom96where is the relevant proc?
20:52:16Araqthere is none, it's generic index checking, you would need to introduce one
20:52:28AraqchckIndex() compilerproc iirc
20:52:58dom96argh
20:53:21Araqlol
20:53:57Araqbtw soon --laxStrings:on will produce worse code :P
20:54:04AraqI mean
20:54:15Araqwon't see the new optimizations I'm working on
20:54:15*jrbrt quit (Quit: jrbrt)
20:55:55dom96These changes are soooo horrible https://github.com/nim-lang/Nim/commit/0fad659bf72a48d076978655dd23fe369c2d232e :'(
20:56:05dom96length checks everywhere
21:00:16*bwlang joined #nim
21:00:20Araqcould have introduced a shortcut but I was lazy
21:00:32Araqand mindlessly corrected everything instead
21:01:06FromGitter<xmonader> Day 6: https://github.com/xmonader/nistow writing stow in nim
21:01:08dom96Yay, can't wait for the imminent off-by-one errors
21:01:13Araqpersonally I would have used s{i} or something but I know how much #nim likes my own notations
21:01:27*jsomedon joined #nim
21:01:45dom96ugh, adding this friendly message is a PITA
21:02:01Araq"booh, that notation is new/Perlish/not-in-Python/not-in-C, can't be good"
21:02:41dom96oh well, maybe I'll end up wasting hours of my life trying to figure out a bug caused by this breaking change
21:02:54dom96Then I'll decide to add this friendly message... or maybe just rage quit
21:03:24Araqsorry I listen to my community.
21:03:39dom96btw the changelog entry for this should be under "breaking changes" not under "language changes"!
21:05:19*jjido joined #nim
21:06:21*Sembei quit (Ping timeout: 264 seconds)
21:08:54*jrbrt joined #nim
21:09:05shashlickyay, documentation for nimgen wrappers is finally up: e.g. http://nimgen.genotrance.com/nimssl/
21:11:59*Sembei joined #nim
21:17:42Araqshashlick: no NEP-1? :-(
21:18:06*jsomedon left #nim ("WeeChat 2.1")
21:26:14shashlickbaby steps :)
21:27:21shashlickthat website's actually code generated by c2nim of the .h files, are you talking about that?
21:31:07Araqc2nim without its --nep1 flag, yes
21:32:12shashlickoh I didn't know that existed
21:32:13Araqmuhahaha found a GC/codegen bug. one of these bugs which lurk in the code for a decade
21:32:18CodeVancenice work xmonader
21:32:42shashlickdoes the generated code completely change?
21:34:46shashlickwow, changes all the generated output
21:35:46shashlicki guess i'll leave this as is, else it is hard to refer to the upstream documentation. anyway I'm planning on writing convenience procs over the C api eventually for these wrappers
21:35:50*jrbrt quit (Quit: jrbrt)
21:36:02shashlickraw wrappers aren't easy to use with the c interop
21:38:15FromGitter<xmonader> @CodeVance thanks :)
21:38:26*jrbrt joined #nim
21:39:00CodeVancexmonader, where you get your idea?
21:39:36*jrbrt quit (Client Quit)
21:40:07FromGitter<xmonader> @CodeVance https://www.gnu.org/software/stow/ for some reason it stopped working for me and i rolled my own https://github.com/xmonader/dotman then thought i'd port it to nim
21:40:39*jrbrt joined #nim
21:40:52CodeVanceheh XD
21:41:03*natrys quit (Quit: natrys)
21:41:13CodeVanceI made a micro PR
21:42:14FromGitter<xmonader> and I merged super quickly xD
21:43:19shashlickmratsim: when you get a chance, do check out the docs for the nimgen wrappers
21:43:39shashlicklinked from https://github.com/genotrance/nimgen <= i'll update the individual repos in a few hours
21:44:26dom96httpbeast started 32 threads on travis :o
21:46:29*Hycryon quit (Ping timeout: 260 seconds)
21:51:44*bwlang quit (Quit: bwlang)
22:21:40*Ven`` joined #nim
22:23:08*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:41:29FromGitter<Varriount> Is that good?
22:42:09*shield joined #nim
22:42:36shieldhello
22:43:01shieldI have a question if anybody is willing to answer
22:43:11def-shield: hi. go ahead
22:44:13PMunchAraq, sorry I was playing borderlands. If you want something complete there's this: https://github.com/PMunch/protobuf-nim/blob/optionmessages/src/protobuf.nim#L648
22:44:44PMunchThat's he point where it calls the part of that macro that creates the . and .= macros
22:44:54PMunchshield, don't ask to ask, just fire away
22:46:28shieldoh thanks, well, is there a way to map objects by their types? as in, a table of objects that is hashed by the type of said objects
22:48:00shieldwhen you add an element it checks if the right sequence is initialized, if so it will append them, then when you need to pull objects of certain types you just write something like getObjects(T)
22:50:29shieldmainly to make creating sequences of objects automatic, when you add a new type of object it will create a new sequence to hold it
22:50:41def-shield: that sounds an awful lot like a dynamically-typed approach
22:51:29def-but with a getObjects[T]() you could use generics to achieve something like that
22:52:57def-if you want runtime-behaviour instead of compile-time though, you might want to go with some wrapper like JsonNodeKind: https://nim-lang.org/docs/json.html#JsonNodeKind
22:53:17FromGitter<mratsim> @yglukhov, sorry was away until now, !=0 will be faster but that’s like a super micro optimization
22:55:30shieldi'm not trying to fit different kinds of objects in the same array, just make a new array per object type, the equivalent for that in c# would be Dictionary<Type, List<Type>>
22:56:52*skrzyp1 is now known as skrzyp
22:57:29FromGitter<mratsim> so you will have an object that will hold one Table for each typekind you can have?
22:58:05FromGitter<mratsim> dictionary are Table in the tables module btw
22:58:06shieldyes
23:00:16PMunchhttps://stackoverflow.com/questions/38133424/any-types-in-tables-table-like-sets-in-nim
23:00:16FromGitter<mratsim> the fields of the object must be known at compile time, do you know how much type you will have to support? Also do you mind if they go unused (because it will still occupy at least a nil pointer of space even if you don’t associate a seq to it.)
23:00:25PMunchThat's pretty much what you'll end up with
23:02:14FromGitter<mratsim> yeah the object variant seems to be the cleanest solution
23:03:01*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:03:42shieldI don't mind having a nil pointer, this will only be used in a scene that will hold all kind of objects, i prefer if there was an automatic way to add new types and initialize the correct array for it
23:05:25*rockcavera quit (Read error: Connection reset by peer)
23:05:29shashlick@mratsim: got the docs up on all wrappers, hope it makes them a bit more useful
23:05:46*rockcavera joined #nim
23:08:49FromGitter<mratsim> @shield I’m not sure I understand if you need that at run-time or at compile-time
23:09:41FromGitter<mratsim> if types are known beforehand or come say from a DB query or a Json object
23:10:57shieldI want it at run-time, this is for a game so a scene will have to hold different types of objects at different times
23:12:18FromGitter<mratsim> just use a seq or table or whatever for each types you need in your context/world object
23:12:55FromGitter<mratsim> and have procs doFoo(scene: var Scene, obj1: YourCustomObject1) =
23:13:20FromGitter<mratsim> doFoo(scene: var Scene, obj2: YourCustomObject2) =
23:15:12dom96For games the natural architecture is to use inheritance with methods
23:15:53PMunchshield, if you want you could also do something like this: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/ticker.nim
23:15:55dom96I personally would just keep everything static though. Have multiple overloaded 'draw' calls, and multiple lists of objects if necessary.
23:16:23PMunchDepends on your use case of course, but what it does is register a procedure to call instead of an object to call it on
23:16:32shieldso I have to manually add a seq for every new class I add? or it's better to have a type field which I can use to cast to the correct type?
23:17:10PMunchThis is the same but for rendering: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/scenegraph.nim
23:18:40PMunchSince these only store procs you are able to nest them as well, so you could have a scenegraph with a scenegraph inside to create layers, or if you want to be able to hide all things of one kind for example.
23:19:29PMunchMight be practical for a particle effect. Create a renderer that draws a lot of particles, add it to the renderer, when they are all done you simply remove the one render proc.
23:22:59shieldi was dealing with collision with certain type of objects, checking the link, it seems that it escaped my radar, thanks!
23:24:34PMunchIf you're looking for collisions you could also take a llook at http://ix.io/19qw
23:24:44PMunchWoops: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/collisions.nim
23:25:28shieldrandom question, is dealing with proc references expensive performance wise?
23:26:11PMunchDon't think so, but I'm not entirely sure..
23:26:44*vegax87 quit (Ping timeout: 256 seconds)
23:27:27*pigmej quit (Ping timeout: 240 seconds)
23:29:49*pigmej joined #nim
23:32:05*leorize quit (Quit: WeeChat 2.1)
23:33:08PMunchFound this on C function pointers "I've looked into the difference of calling a function directly or via a pointer, and on the CPUs I looked at, the overhead was 1 cycle or even 0, meaning the overhead is negligible if any."
23:33:21PMunchSo if Nim just creates C function pointers it should be very fast
23:33:33PMunchThat quote is from here by the way: http://insanecoding.blogspot.no/2007/05/secrets-to-optimization-function.html
23:34:35PMunchBut then there's also this which is a valid point "The main performance impact when using a function pointer will be that the compiler will generally be unable to optimize the call, e.g. by inlining it."
23:34:42PMunchFrom here: https://www.reddit.com/r/C_Programming/comments/3nkcps/function_pointers_overhead/
23:35:13PMunchBut for this case I doubt that the compiler would be able to inline anything since these pointers can come and go at runtime.
23:38:55shieldI guess it's still useful, thanks for the help!
23:39:24PMunchNo problem, and feel free to look around in the SDLGamelib repo, even if you're not using SDL
23:39:38PMunchThere are a lot of generic solutions there that doesn't have anything to do with SDL
23:39:39*pigmej quit (Ping timeout: 260 seconds)
23:41:49shieldI am using it so this is a great find for me
23:43:02PMunchI unfortunately haven't been able to do much in it myself, apart from writing the library :P
23:43:08PMunchBut I did do this for a gamejam: https://github.com/PMunch/TromsoGameJam2017
23:43:43PMunchAlmost all of the game is in this file: https://github.com/PMunch/TromsoGameJam2017/blob/master/src/sgtest.nim
23:46:40*PMunch quit (Quit: leaving)
23:47:45shieldcool!
23:56:54*bwlang joined #nim
23:57:51*bwlang quit (Client Quit)
23:58:49*pigmej joined #nim
23:59:19*shield quit (Ping timeout: 260 seconds)