<< 18-12-2017 >>

00:22:54*ftsf quit (Quit: Leaving)
00:28:16*yglukhov joined #nim
00:29:12*vlad1777d quit (Quit: Leaving)
00:32:40*yglukhov quit (Ping timeout: 265 seconds)
00:48:28*tefter quit (Remote host closed the connection)
00:48:59*yglukhov joined #nim
00:49:48*MJCaley joined #nim
00:53:41*yglukhov quit (Ping timeout: 272 seconds)
01:10:44*MJCaley quit (Quit: MJCaley)
01:11:58*dddddd quit (Read error: Connection reset by peer)
01:16:41*xkapastel joined #nim
01:29:48*xkapastel quit (Ping timeout: 240 seconds)
01:42:55*xkapastel joined #nim
02:01:41*xkapastel quit ()
02:08:48*chemist69 quit (Ping timeout: 240 seconds)
02:13:02*skrylar joined #nim
02:17:00FromGitter<Varriount> IRC is like, the eternal chat protocol.
02:17:44FromGitter<Varriount> It was around 20 years ago, it's around today, and it will probably be around 20 years from now.
02:18:35skrylari watch matrix cautiously
02:19:12skrylarthe curmudgeon response is that matrix is pointless and you should just write an extension to IRC to recall unread history from the server.
02:20:12FromGitter<Varriount> Hm, reminds me of Quassel
02:20:14skrylarthere is very little wrong with irc, which is solved with Not IRC, and its mostly around 1) pretty chat, a UX problem for clients and 2) authentication, which could again be a UX solution over a nickserv spec
02:20:40skrylarchat history you missed is a big one and as mentioned, you could easily make a short RFC for it
02:21:22skrylarbut this requires legwork and the people who did that (Slack) are better served by not publishing it /shrugs
02:22:42*chemist69 joined #nim
02:35:52*astronavt quit (Remote host closed the connection)
02:41:35*marenz__ quit (Ping timeout: 248 seconds)
02:43:24*astronavt joined #nim
02:47:08*yglukhov joined #nim
02:51:43*yglukhov quit (Ping timeout: 248 seconds)
03:01:40*ieatnerds joined #nim
03:02:21ieatnerdsHello
03:04:44*ieatnerds left #nim (#nim)
03:06:58*ieatnerds joined #nim
03:09:02*astronavt quit (Remote host closed the connection)
03:10:33*astronavt joined #nim
03:11:15*astronavt quit (Remote host closed the connection)
03:12:44skrylarhello ieatnerds
03:14:23ieatnerdsHow's it going?
03:14:43skrylarseems to be flu season :(
03:17:02ieatnerdsI was sick the past couple of days. Feeling good enough today to do some coding.
03:30:48*SenasOzys_ quit (Read error: Connection reset by peer)
03:31:01*SenasOzys joined #nim
03:31:59ieatnerdsHey SenasOzys
03:46:36*ftsf joined #nim
03:56:09*ieatnerds quit (Ping timeout: 265 seconds)
04:04:12*themagician joined #nim
04:04:55*yglukhov joined #nim
04:09:41*yglukhov quit (Ping timeout: 260 seconds)
04:32:03skrylarpondering about some kind of adapter for the unittest module to get junit/xml/something output
04:33:14skrylarhave no particular love of those output formats but they do get used by the big build systems for people's pretty dashboards :|
05:02:10skrylarqqtop: did you ever end up using that firebird wrapper
05:07:47*nsf joined #nim
05:08:42Xeskrylar: why not TAP?
05:12:39*qih left #nim (#nim)
05:19:48*yglukhov joined #nim
05:24:45*yglukhov quit (Ping timeout: 272 seconds)
05:40:35*BitPuffin|osx joined #nim
05:50:07skrylarXe: it doesn't particularly matter what the format is imo
05:50:13skrylarjenkins has a tap plugin it seems
05:51:09skrylarhttps://wiki.jenkins.io/display/JENKINS/TAP+Plugin
05:51:42skrylarright now i just build and run examples, if the unittest code fails then the build fails, although at "some point" test infrastructure will become a thing
05:54:38*yglukhov joined #nim
05:58:55*yglukhov quit (Ping timeout: 248 seconds)
06:30:43*yglukhov joined #nim
06:35:09*yglukhov quit (Ping timeout: 264 seconds)
06:56:31*couven92 quit (Ping timeout: 260 seconds)
07:10:13skrylari guess that reply was phrased too harshly
07:10:26skrylartap is probably fine too
07:30:35*yglukhov joined #nim
07:31:36*solitudesf joined #nim
07:47:52*rauss quit (Quit: WeeChat 2.0)
07:53:20*gokr joined #nim
08:10:59*PMunch joined #nim
08:11:05*PMunch quit (Remote host closed the connection)
08:11:16*PMunch joined #nim
08:11:35*xet7 quit (Quit: Leaving)
08:11:48*xet7 joined #nim
08:11:51*vlad1777d joined #nim
08:12:48FromGitter<alehander42> Unittest has already a xml formatter
08:12:52FromGitter<alehander42> Look at
08:13:05FromGitter<alehander42> Junittesformatter iirc
08:15:00*solitudesf quit (Quit: solitudesf)
08:18:24skrylarWell. Neat.
08:19:05*solitudesf joined #nim
08:28:12*Arrrr joined #nim
08:29:57*Vladar joined #nim
08:35:56*floppydh joined #nim
08:41:44*claudiuinberlin joined #nim
09:02:28*gmpreussner quit (Ping timeout: 240 seconds)
09:03:34*shiftwreck joined #nim
09:05:09*gmpreussner joined #nim
09:05:21*shiftwreck left #nim (#nim)
09:06:36*Vladar quit (Remote host closed the connection)
09:10:16*Vladar joined #nim
09:46:15*Vladar quit (Quit: Leaving)
09:49:46*yglukhov quit (Remote host closed the connection)
09:50:30*yglukhov joined #nim
09:50:34*yglukhov quit (Remote host closed the connection)
09:50:52*yglukhov joined #nim
09:56:12*Vladar joined #nim
10:04:56*Yardanico joined #nim
10:12:59*Vladar quit (Remote host closed the connection)
10:17:05FromGitter<alehander42> @Araq is changelog.md supposed to be md or rst ? there are some `.. code-block:: nim` there
10:17:34Araq.md
10:19:07FromGitter<alehander42> ok, should I add the asyncjs entry in `Changes affecting backwards compatibility` or in a new section ?
10:19:50Araqwell we will clean up this thing before the release
10:20:24Yardanicowell also not all new things are in changelog
10:21:13FromGitter<alehander42> ok, so I'll just add an entry there (and maybe eventually a link to the updated reference page before release)
10:21:34Araqhere is an example of the sections we used to have
10:21:35Araqhttps://nim-lang.org/blog/2017/05/17/version-0170-released.html
10:21:55AraqYardanico, dom96 has a script that generates a changelog from the commit log
10:22:06Yardanicothere are also minor (if you can call them like that) changes - `using` is not experimental; `with` and `without` are not keywords, `finish.exe` supports paths with whitespaces, `unittest` module now performs short-circuit evaluation
10:22:29YardanicoAraq, it will be quite big :P
10:22:34FromGitter<alehander42> Yeah, so I'll add also an entry for the `codegenDecl` addition for js, as it's related to the async one
10:22:35Araqnot sure how this automated changelog + manual changelog will work out...
10:23:45FromGitter<alehander42> ok, can I also at least fix the code-block:: nim to a normal markdown block as now the whole document renders weirdly (a comment becomes a header etc)
10:24:06*Vladar joined #nim
10:24:47Yardanicochangelog.md 3 months ago: https://gist.github.com/Yardanico/8faf0bffbf28928b8d1a69f60f5b4d96 :D
10:25:49*yglukhov quit (Read error: Connection reset by peer)
10:26:25*yglukhov joined #nim
10:30:54skrylari remember mantis had a cute changelog generator
10:31:02skrylarthey based it on tickets closed
10:31:48skrylarif you closed a ticket as "everything explodes on the 42nd day" you could go ask it for a changelog and it understood product versions, so it'd say something like "version 3.14: [BUG] everything exploded on the 42nd day".
10:33:21*dddddd joined #nim
10:33:29FromGitter<alehander42> I think automation is good for bugs changelog, but for new features/additions, a more manual approach is better
10:34:46*yglukhov quit (Read error: Connection reset by peer)
10:34:53skrylari liked mantis doing all of it, kind of. centralized comments on particular features as well
10:35:08skrylaralthoug this was in the days before phabricator, so
10:35:22*yglukhov joined #nim
10:36:08skrylarhave tried phab, taiga and kanboard. they are. hm
10:36:36*NopeDK joined #nim
10:37:45skrylarMantis was apparently fiddled with to run production for the movie Happy Feet, so that's amusing
10:38:12NopeDKusing the FFI with C, if a C struct has named its fields as ".name" how can it be used in Nim?
10:38:57skrylaruse tildes: `.stuff`
10:39:16skrylaralternatively, rename the field and change it back via importc: stuff {.importc: ".stuff".}
10:39:28*vlad1777d quit (Ping timeout: 240 seconds)
10:39:35skrylarthis does work at the field level (i have done it)
10:40:17skrylarit goes between the name and type assigment, so stuff {..}: cint instead of stuff: cint {..}
10:45:34AraqC struct field names cannot start with a dot
10:45:41Araqyou're looking at an intializer
10:45:55Araqthe fieldname is that thing without the dot
10:47:20skrylarthey can however end with an underscore which nim hates
10:48:11Araqyeah well, it's not my fault the C programmers do not even understand what a "separator" is
10:49:26NopeDKThank you both, took another look at the 5k+ lines in the .h and the fields do indeed have no dot in their names.
10:52:09NopeDKWhat if the struct accepts a function name, do I need to "exportc" the function and use the compatible types or is "extern" enough?
10:52:54Araqyou need to use compatible types and the right calling convention
10:53:05Araqname mangling and visibility are irrelevant
10:54:04Araqmy DFA computation runs into endless loops, now what?
10:55:01NopeDKWhat do you mean by "right calling convention"?
10:56:57skrylar{.cdecl.}
10:57:36skrylarOn nixes, cdecl is basically always used. I think some things use fastcall or pascal call internally, but cdecl is de facto. On windows, there's wincall and that crap.
10:57:54skrylarif you don't specify one then the one you get is Magic
10:59:11*Yardanico quit (Ping timeout: 260 seconds)
11:00:17NopeDKThank you Araq and skrylar, time to get coding.
11:01:49FromGitter<mratsim> Pascal call? Is that even a thing
11:01:57Araqskrylar, actually Nim's default is .fastcall on Unix too iirc
11:02:05Araqnot sure about that though :P
11:02:18Araqmratsim: Pascal is 'stdcall'
11:03:02skrylarmratsim: pascal did many cheeky things that were probably better in the end, but also resulted in some of its own problems
11:03:16skrylari seem to recall the infamous lack of varargs was because pascal's calling conventions didn't support it
11:03:37FromGitter<mratsim> Oh I see, well for now I never had any issue when calling external libs (apart from some noconv needed here and there) so I didn't dive into calling conventions.
11:03:46skrylarthey also did some fun things with their vtables that were much faster than C++ (at the time) but also completely broke things like DLLs that weren't built along with the software
11:04:40Araqmost functions do not take varargs and it's inefficient to pretend they do
11:04:48skrylarsomeone did a whitepaper on c++ calls and they found that all the vtable obsessed code was like 30-40% slower than C, although that was a comparison of forcing GCC to virtualize all calls vs. a heavy use of static calls with some virtuals
11:05:15Araqcosts at least one instruction per call
11:06:07FromGitter<mratsim> How is that related to the new "fno-no-plt" flag in GCC 7?
11:06:37Araqof course, in C where every function call checks for 'if error: goto errorHandler' anyway which is ~5 cycles
11:06:55*Yardanico joined #nim
11:07:40Araq"C is a language strongly optimized for liars and people who go by guesswork and ignorance."
11:08:11skrylarexceptions still have to do the testing
11:08:32Araqnah, they unwind the stack in the error case and are free when not thrown
11:08:46skrylarthe code which throws it has to test the condition
11:09:00skrylarso aren't you just saving the time between a couple manual gotos and a longjmp
11:09:23PMunchskrylar, you have to check twice though when not using exceptions
11:09:24*yglukhov quit (Remote host closed the connection)
11:09:46PMunchOnce to determine if you need to set the error flag, and then once more to check if the error flag was set
11:10:23skrylari did settle on exceptions for the firebird module.
11:10:33skrylarcross-language exceptions don't tend to work though :|
11:11:41*bvld joined #nim
11:14:35*sendell joined #nim
11:14:46Araqskrylar, this was extensively evaluated at Microsoft for their toy OS with I name I forgot
11:14:59skrylarlonghorn?
11:15:22Araqexceptions were 5-10% faster than ifs on their largish code-base
11:15:46sendellAraq: thx for your response about var param capture yesterday, I was in a train with an unstable connexion but got your response in the logs today :)
11:15:54Araqit's easy to test with exceptions, all you need to do is the to change the codegen strategy
11:16:22skrylarsome old lisp docs said having a GC makes exceptions even simpler
11:16:28Araqof course if you write these 'ifs' manually you can never do any reliable benchmark ...
11:17:20*yglukhov joined #nim
11:18:05*mishugana joined #nim
11:18:10mishuganaHello!
11:18:35mishuganaI had not updated my Nim git repo in some time. I updated it today and ran the build instructions
11:18:52Yardanicomishugana, so what's the error? :)
11:18:58mishuganaHowever, the last step : "./koch boot -d:releases" gave an error - lib/pure/json.nim(1907, 9) Error: type mismatch: got (NimNode, proc (bl: typed, op: string): NimNode{.noSideEffect.}, void)
11:19:04Yardanicohm
11:19:06mishuganaHowever, the version still got updated to 0.17.0
11:19:10mishuganais this alright?
11:19:23Yardanico100% way to compile it
11:19:24mishuganaNim Compiler Version 0.17.0 (2017-05-18) [MacOSX: amd64] Copyright (c) 2006-2017 by Andreas Rumpf git hash: d3f0f87e81e262ee25fd528aae5b6
11:19:28Yardanicoclone csources
11:19:30mishuganafrom "nim --version"
11:19:41YardanicoI mean - run ALL build instructions
11:19:49Yardanicoso clone csources too (they contain 0.17.2)
11:19:54mishuganaI thought I did... I already had the repo cloned
11:19:59mishuganaand I did a clean of the csources
11:20:06mishuganaand then install.sh etc.
11:20:11mishuganaDid I miss something?
11:20:17Yardanicowell csources contain 0.17.2, not 0.17.0
11:20:21mishuganaOhhh
11:20:23skrylarcsources is usually checked out with --depth 1, so you have to delete it and do a new checkout
11:20:34mishuganaI thought csources was part of the nim repo?
11:20:38skrylarits not
11:20:40mishuganaAh, okay... I see!
11:20:47mishugana@skrylar
11:20:58mishuganaLet me try that out and get back.. thanks for the quick help, guys! :-)
11:21:21skrylaryou can also use the nim in your distros package manager (unless its arch :|) in some cases
11:21:50Yardanicoskrylar, what's bad about arch?
11:21:59skrylarYardanico, they ship a broken build
11:22:05Yardanico??
11:22:13Yardanicoit worked for me
11:22:24skrylarit gives some error about the os module if you try to compile with it, and it did so for the six months or so i was an archer
11:22:57Yardanicomaybe it's fixed in 0.17.2 ?
11:23:02skrylarit could be
11:27:05mishuganaWoohoo! Success! Nim Compiler Version 0.17.3 [MacOSX: amd64] Copyright (c) 2006-2017 by Andreas Rumpf git hash: 90345526bae261fdade6ef8cebc26984f3abed80 active boot switches: -d:release
11:27:15mishuganaThanks, guys! :-)
11:27:28mishuganaBtw, I removed the --depth 1 and cloned the whole csources repo
11:27:31mishuganathat should be fine, right?
11:27:40mishuganajust some extra space on my computer I presume?
11:28:27skrylara lot more bandwidth used and more space yes
11:28:40Araqremove the csources now
11:28:43Yardanico?
11:28:49mishuganaOkay, I can live with that! :-)
11:28:57Araqonce you have a working nim, updating nim doesn't require csources
11:29:06Yardanicoah yes, I know about that too
11:29:07mishuganaI had not touched it for so long ,it was my mistake not seeing that line about csources
11:29:09AraqI never compile from csources
11:29:18Yardanicobecause you always have nim installed :)
11:29:19skrylarmy jenkins uses the debian/sid release of nim against the devel branch. works fine
11:29:22mishugana@Araq what about when I update the repo next time?
11:29:29Yardanicomishugana, just "git pull" and then
11:29:30Yardaniconim c koch
11:29:35Yardanico./koch boot -d:release
11:29:37Araqgit pull && koch boot -d:release
11:29:50Yardanicoexcept if your nim would be really old
11:29:57mishugana@Yardanico I had done that today after git pull and I got that error message!
11:29:57Yardanicolike 2 releases behind devel
11:30:04Yardanicomishugana, because you had 0.17.0 :)
11:30:14mishuganaOh man... I need to keep up with the goings on! :D
11:30:19skrylaryou could probably stairstep release tags if you needed
11:30:21Araqyeah well, it *should* work since 0.16
11:30:34Yardanicojust recompile nim every month and it would be fine :)
11:30:45mishuganaOkay, I get the picture now (somewhat!)... thanks again for the quick help, guys! You're awesome! :-)
11:30:55mishuganaHave a great day/night all! :-)
11:31:12skrylarhaving mixed thoughts about not using wx
11:31:38Yardanicobtw, git-discord bridge runs on azure VPS with arch linux installed :P
11:31:40*mishugana quit (Quit: Page closed)
11:31:43Yardanico*irc-discord
11:31:54skrylari liked pacman over apt, and the AUR was nice
11:32:03skrylarit just kept nuking my laptop every few months
11:32:12Yardanicoluckily didn't happen for me yet :)
11:32:26skrylardebian stable nuked my laptop too but that's eh
11:33:31skrylarThe +1 is that using wx has a prettier UI. The -2 is that using wx means you get all the fun bloat of both C++ and GTK
11:34:27*PMunch quit (Ping timeout: 240 seconds)
11:36:28*PMunch joined #nim
11:41:54Yardanicoattention (possible) discord members: I'll reboot VPS with discord bridge now
11:41:54*GitDisc quit (Remote host closed the connection)
11:42:38Yardanicook it's back
11:42:42*GitDisc joined #nim
11:53:21NopeDKYardanico, how frequently does the irc-discord bridge run?
11:53:34YardanicoNopeDK, always :)
11:53:41YardanicoI mean it had a ~3 month uptime
11:53:49Yardanicojust installed updates from package manager and rebooted it
11:54:10NopeDKi meant how fast messages would propagate between the two?
11:54:15YardanicoNopeDK, pretty fast
11:54:33Yardanicoyou can try yourself
11:54:53Yardanicohttps://discord.gg/ezDFDw2
11:55:22NopeDKAwesome, as I am using Discord normally I can now have the benefit of both irc logs and using my existing program.
11:55:36GitDisc<NopeDK> Testing bridge speed
11:55:50GitDisc<Yardanico> well it's pretty fast
11:56:17*bvld quit (Ping timeout: 255 seconds)
11:56:34NopeDKHot damn, the message was here before I switched apps, and that is like sub 500ms
11:57:37Yardanicowell this VPS is located in west europe (azure), internet is pretty fast on it
11:57:44Yardanicoand discord server is located in europe too
11:57:54Yardanicowestern europe :)
11:58:34NopeDKAnd I am located there as well. Thank you for this service :)
11:58:53Yardanicowell it costs nothing for me
12:02:34NopeDKSome kind of free tier?
12:02:48YardanicoNopeDK, no, friend shared azure bizspark with me :)
12:03:04NopeDKnice
12:03:11Yardanicoyou get $150 every month
12:03:17Yardanicofor any azure services
12:03:25Yardanicobut azure prices are very high
12:05:06NopeDKEven with higher than normal prices, $150 is pretty decent
12:05:20skrylari ran a webiste off a 5$ prgmr box for a while
12:05:29skrylarit was a very acceptable, if small, xen instance
12:05:30YardanicoNopeDK, you can only get a 4-core 8gbram 30gb hdd VPS for ~that price
12:05:35Yardanicoon Azure
12:09:22NopeDKA quick price check gives the same for AWS and 4c 8gb is no slouch of a machine when you get it "for free"
12:14:27*bvld joined #nim
12:14:55*arecaceae quit (Remote host closed the connection)
12:15:14*arecaceae joined #nim
12:15:21radagastwhat's a nice way to assert a block of code in compile time?
12:15:42Araqstatic: assert()
12:15:57*PMunch_ joined #nim
12:16:19skrylarstaticexec("rm -rf ~/")
12:16:27skrylarthat being possible is atrocious :|
12:16:34skrylardont actually do it
12:18:48Araqskrylar, that's just your OS though. at least staticExec can't install device drivers without 'sudo'
12:18:51*PMunch quit (Ping timeout: 256 seconds)
12:19:40AraqIMO it shouldn't be called "security", Unix implements some other concept instead. like "admin friendly, users be fucked"
12:25:33*PMunch_ is now known as PMunch
12:37:07enthus1a1tskrylar: npm install; pip install; pacman, apt, is as evil as staticexec. Too many shells everywhere....
12:40:26FromGitter<mratsim> Insert obligatory toy story meme here <-----
12:40:40Arrrrfor example?
12:42:01PMunchenthus1a1t, I would say staticExec is less evil. At least a programmer is expected to glance at code before compiling things
12:42:15FromGitter<mratsim> https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRvvG2S2WygiGYDzDDhFf03M43KHx5TwrYT6Sqi4p05SRrijjzX
12:42:20PMunchMost people (myself included) install packages without putting much thought into it
12:43:43skrylarheh
12:43:52FromGitter<mratsim> I look at the readme for gotcha and at compile-time flags but I can't read the 100k lines of say Nim before compiling it.
12:44:21skrylarin this particular foot-gun you can run the-silver-searcher on the folder for staticexec
12:44:30skrylarnot so true if nimble decides to install a chain of shit
12:44:59skrylarif you use phab (nobody does) you can also have a herald rule for it
12:45:58FromGitter<alehander42> tools as `https://github.com/p-e-w/maybe` are way more useful than an optimistic grep
12:46:23FromGitter<alehander42> (but as an additional step ofc)
12:47:29FromGitter<RedBeard0531> I'm not sure why there is so much focus on the security impact of staticExec specifically, given that you will generally *run* the program after compiling it.
12:48:13FromGitter<RedBeard0531> If you don't trust the author enough to compile their code, why are you running their compiled code...
12:48:33*NopeDK_WhoStoleM joined #nim
12:50:18skrylarwell you don't expect opening a jpeg to bomb your computer either
12:51:13FromGitter<RedBeard0531> true, but opening a jpeg seems more like viewing the source code. I'd be very concerned if that executed code...
12:51:28FromGitter<RedBeard0531> Actually, does nimsuggest do staticExec?
12:52:23ArrrrYou can't know for sure if it is only doing that if you don't read the source code
12:52:33*NopeDK quit (Ping timeout: 264 seconds)
12:53:43FromGitter<alehander42> reading the source code is not really reasonable advice: nobody has time to read bigger libraries/projects or each little dependency, and a clever hack can be easily missed, even if you read/grep it
12:53:56FromGitter<RedBeard0531> Sure, but if nimsuggest/nim check do staticExec, then just opening the code in your editor could cause it to execute
12:54:34*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
12:54:43FromGitter<alehander42> I guess some combo of trust based on knowing the author/existing userbase and running in some kind of simulated/sandboxed env-s are the only more general solutions
12:54:53FromGitter<alehander42> yeah, I was talking in principle
12:55:40FromGitter<RedBeard0531> I was replying to @Arrrr. I agree with your statement.
12:56:34FromGitter<mratsim> I reminds me of the "man" Easter egg. At midnight it used to return "Abba, Abba, Abba" (for their "It's raining men after midnight")
12:56:43FromGitter<mratsim> It*
12:56:55Arrrrhah
12:57:16FromGitter<mratsim> Someone had a very hard to debug production bug because of it.
12:57:22FromGitter<andreaferretti> (gimme gimme gimme (a man after midnigth))
12:57:31FromGitter<mratsim> Oh right
12:57:39FromGitter<andreaferretti> :-)
12:57:48Arrrrlol
13:21:37*NopeDK_WhoStoleM quit (Ping timeout: 248 seconds)
13:24:35*Arrrr1 joined #nim
13:24:35*Arrrr quit (Disconnected by services)
13:24:39*Arrrr1 quit (Client Quit)
13:25:51FromGitter<mratsim> There is no Flatbuffers lib for Nim right? I'm narrowing down the serialization format for Arraymancer and it seems like only cap'n proto and Flatbuffers are left in the ring.
13:25:59FromGitter<ephja> skrylar: what syscall integer is that?
13:27:31FromGitter<andreaferretti> is cap'n'proto available?
13:27:42FromGitter<andreaferretti> never knew that
13:27:54FromGitter<andreaferretti> by the way, great work you are doing with ArrayMancer!
13:28:14Yardanicohttps://github.com/zielmicha/capnp.nim
13:28:25Yardanicoit's on capnproto website btw: https://capnproto.org/otherlang.html
13:28:41FromGitter<andreaferretti> cool!
13:29:22*Arrrr joined #nim
13:29:22*Arrrr quit (Changing host)
13:29:22*Arrrr joined #nim
13:29:47FromGitter<mratsim> @andreaferretti thanks :). Hopefully I can get a 99% accuracy MNIST Deep Learning model running by Jan. 1
13:32:02FromGitter<alehander42> ha I didnt know capn proto is by the author of protobuf
13:40:55FromGitter<mratsim> And @andreaferretti how about you, still swamped?
13:41:51*Vladar quit (Remote host closed the connection)
13:44:15FromGitter<andreaferretti> Yeah, a little
13:44:26FromGitter<andreaferretti> Hopefully I will be back on new year
13:46:24Yardanicobtw fmt is much faster than `%` from strutils
13:46:41Yardanicoit has roughly the same speed as concatenation
13:48:57*Jesin quit (Quit: Leaving)
13:51:43*Vladar joined #nim
14:02:35*Arrrr quit (Read error: Connection reset by peer)
14:06:24skrylarmratsim: there does not appear to be one. i am considering writing flatbuffers
14:06:45skrylarephja: syscall integer?
14:06:53*MJCaley joined #nim
14:08:03skrylaralso the big flop with capnproto is that they rely on a certain kind of packing/alignment for structs, which is documented as "a list of principles" but then says the exact algorithm is unspecified and don't worry about it morty just trust the c++
14:10:04skrylarflatbuffers also seem to have the mysterious "doesn't compress as well as json" that many things have
14:10:39skrylarthough flatbuffers are very easy and simple to use and implement; it's "just" integer offsets in a buffer, so the actual latitude you have for working space is huge
14:11:11FromGitter<mratsim> The issue with Flatbuffers is that Google has a tendency to opensource stuff and then leave it alone, also from a HN post, the team that implemented FlatBuffers is completely different from the protobuf team. So they can't have the same XP as the cap'n proto guy.
14:11:37skrylarI read the flatbuffer spec front to back. there is nothing to "do" to it
14:12:24FromGitter<mratsim> Also I saw cap'n proto in use in Rust Deep Learning lib Leaf/Juice: https://github.com/spearow/juice
14:12:27skrylaryou have fixed size ints that say "the table starts at byte N" and that points at an integer that says "the vtable is at byte N-X"
14:13:08skrylarthe vtable is a list of integers, sequential, that are either zero or the byte offset from the table start to the actual data
14:13:14skrylarthat's the entire format.
14:13:23FromGitter<mratsim> Well if you implement a standalone Flatbuffers I'll give it a spin :)
14:14:24skrylarthe main diffs i saw is that capnproto doesn't use an index, it uses a deterministic struct packing rule (i think i can derive said rule easily, but its unspecified, so it makes me unhappy) and flatbuffer does use an index; there is also support for jumping to antoher buffer mid-stream in capnproto which flatbuffer doesn't do
14:16:23skrylarnow there is a minor advantage towards flatbuffers, in that you can use arbitrary structs in RAM and still blit them to the output stream, because you tell it your byte offsets whereas capnproto wants to own your struct layout
14:16:55FromGitter<mratsim> Also Flatbuffers was apparently developed for serializing game resources with hard performance constraints so that's a big win and potentially very interesting to a lot of Nim dev.
14:17:37skrylarwell you can basically store your gamestate in a single arena alloc, add some vtables in the corner, and blit said gamestate on demand as a flatbuffer
14:18:04skrylarthat doesn't benefit from sparsity, but its valid
14:20:38FromGitter<zacharycarter> I've been looking at some larger, more fully featured game engines written in C++ and I think one area I haven't really explored how to do in Nim, which is probably going to be complex with the low latency GC, is job scheduling
14:20:58skrylarin the AI sense?
14:21:25FromGitter<zacharycarter> No, like being able to schedule a task to load a resource
14:21:38skrylarpumps
14:22:14FromGitter<zacharycarter> I've never worked with the concept before
14:22:35FromGitter<zacharycarter> like message pumps?
14:23:03skrylarmhmm
14:23:14FromGitter<zacharycarter> what's the communication mechanism though? channels?
14:24:07skrylarchannels are one option; another is to allocate a shared block of memory with a fixed space, push messages to it, and wipe the buffer's counter when events are done
14:24:13*ieatnerds joined #nim
14:25:19skrylarABUSE used that method; their custom lisp's malloc just incremented a pointer in a fixed arena, and then at end of frame they zeroed the pointer
14:26:16FromGitter<zacharycarter> I'll have to play around with an implementation of that
14:26:35*MJCaley quit (Quit: MJCaley)
14:27:12skrylardepending on how your textures are managed, you could avoid string passing entirely and communicate by offsets in the archive as well
14:27:28skrylar"load texture from offset 500 to handle 7"
14:28:41*sendell quit (Remote host closed the connection)
14:52:15*ieatnerds left #nim (#nim)
14:52:22*ieatnerds joined #nim
14:53:07*Snircle joined #nim
14:55:34*Jesin joined #nim
15:03:19*bvld quit (Quit: Leaving.)
15:07:58*MJCaley joined #nim
15:08:37*bvld joined #nim
15:13:05*bvld quit (Ping timeout: 240 seconds)
15:20:28radagastDoes this happen to anyone else? 1. Compile with GCC, see it crash. 2. Compile with Clang and it works. 3. Compile in GCC again, works!
15:21:51FromGitter<Yardanico> Probably you need to clear nimcache folder
15:23:05radagastCheck this out, I think the playground crashes too https://play.nim-lang.org/?gist=1a2028a38b9e4ea7898730e0687ed524
15:24:24*nsf quit (Quit: WeeChat 1.9.1)
15:24:32PMunchCompiles and runs fine here
15:24:47Yardanicoradagast, are you sure playground crashes?
15:24:50PMunch(in the playground)
15:24:52Yardanicoplayground works fine for me
15:24:57Yardanicowith this code
15:25:15Yardanicoalso works fine on windows + mingw 7.1
15:25:47GitDisc<NopeDK> When FFI'ing with a "uint16_t" should I use "ptr cushort" or "UncheckedArray[cushort]"?
15:26:07FromGitter<zacharycarter> neither?
15:26:11Yardanicotry c2nim
15:26:18Yardanicoit will almost always give the best result :P
15:26:23PMunchAnd on Linux with GCC here
15:26:55radagastIt kept loading last time I tried ¯\_(ツ)_/¯
15:27:12PMunchNopeDK, with uint16_t you could just use a uint16 in Nim..
15:27:13Yardanicoradagast, maybe you have some strange browser?
15:28:01PMunchIn fact cushort is just an alias for uint16
15:28:35radagastNope, Nightly. Here's a history of my local machine: https://pastebin.com/1sBj7rgj
15:28:50Yardanicoah
15:28:56Yardanicoyou're compiling with c++ for some reason
15:29:09Yardanicobut it works with c++ for me too
15:29:17Yardanicotry to clear nimcache
15:30:13radagastwill do
15:32:40Yardanicogenerally you should clean nimcache if you compiled to c and want to compile too cpp
15:32:43Yardanico*to cpp
15:32:48GitDisc<NopeDK> My bad, I meant a "uint16_t *"
15:33:17Yardanicoptr uint16?
15:33:43FromGitter<RedBeard0531> "Use the --forceBuild"
15:33:57Yardanicoyeah, or this
15:34:45GitDisc<NopeDK> Will try to install c2nim and see what it says, otherwise going with ptr. Thanks
15:35:05Yardanicowell as I found in c2nim issues it seems uint16_t isn't supported
15:35:12Yardanicobut it's really like "ptr uint16"
15:35:26FromGitter<zacharycarter> uint16_t isn't a real type
15:35:31FromGitter<zacharycarter> I'm pretty sure it's an alias
15:35:48Yardanicoyes it is
15:36:19*rauss joined #nim
15:36:32*d10n-work joined #nim
15:38:01FromGitter<RedBeard0531> c2nim should probably just translate uint16_t to nim's uint16 (ditto the other [u]intXX_t types)
15:39:39FromGitter<RedBeard0531> which would ideally be defined in terms of the same c types in nimbase.h, to ensure correct overload resolution with c++
15:40:02FromGitter<zacharycarter> you can do this already
15:40:33FromGitter<zacharycarter> you can define aliases at the top of a header file for c2nim
15:41:35FromGitter<RedBeard0531> Oh, it looks like nimbase.h already uses those types if they are available: https://github.com/nim-lang/Nim/blob/2775cda6e1eaa9e64ccf1f5cd48e2447e059f2b9/lib/nimbase.h#L311-L320
15:41:35FromGitter<zacharycarter> I know you mean it should do it automatically, but since those types are usually compiler specific, I'm not so sure I agree
15:42:21FromGitter<RedBeard0531> @zacharycarter through that magic, it means that nim's intXX is the same as c's intXX_t
15:42:39FromGitter<RedBeard0531> whatever real type your c compiler defines that to be
15:43:26GitDisc<NopeDK> Well, c2nim won't build so I will just go with the "ptr cushort"
15:44:26*Vladar quit (Quit: Leaving)
15:46:21Yardanicowhat do you mean by "won't build" btw?
15:46:24Yardanicoc2nim is easy to isntall
15:46:27Yardanico"nimble install c2nim"
15:48:50GitDisc<NopeDK> I get the same issues as #113 and some of the alternatives described in the issue doesn't work either. I get the ~"PNode but expected rendermodule".
15:49:03Yardanicowhat's your nim version?
15:50:04Yardanicoif you have latest devel
15:50:05Yardanicodo this:
15:50:06Yardanico"nimble install compiler@#head c2nim@#head"
15:50:59GitDisc<NopeDK> 0.17.2, hash 811fbda snip 5860b38620 [Linux: arm]
15:51:24Yardanicowow, you're on ARM? :)
15:52:06Yardanicowell you can still try "nimble install compiler@#head c2nim@#head"
15:52:08GitDisc<NopeDK> Yup, working on my Pi
15:52:16Yardanicofirst gen?
15:53:59GitDisc<NopeDK> 3rd
15:54:18ieatnerdsmodel b?
15:55:43YardanicoI was just asking because pi 3 supports arm64 and nim does too :)
15:55:55Yardanicobut you can always build a devel nim version
15:55:57Yardanicoit's very easy
15:56:10GitDisc<NopeDK> Don't think the Pi 3 exists in other than B model and I think I just downloaded a stable release to get started
15:56:24*Vladar joined #nim
15:56:40Yardanicodid you try "nimble install compiler@#head c2nim@#head"?
15:58:03GitDisc<NopeDK> Not yet, no
15:58:42*PMunch quit (Quit: Leaving)
15:58:58GitDisc<NopeDK> Slowly porting a giant .h file manually to get to learn what I need to build my server.
15:59:58Yardanicowhy are you doing it manually? :)
16:00:18Yardanicousually you try to run c2nim on it, and if it doesn't work, you change some lines in header file by hand
16:01:06GitDisc<NopeDK> There is hardly any documentation so it is to both learn porting and get to know the library
16:03:52skrylarso basically firebird all over again :b
16:04:09GitDisc<NopeDK> And I want to start with a minimal port, there is in excess of 5k lines in the header and trying to fix the bugs from c2nim with that amount of lines plus no knowledge of either...
16:04:45skrylari recommend keeping a handy regex tool nearby, or even some elisp
16:06:27skrylarif you do it right you can get it down to maybe one keypress per line, so you can hit the button and verify that it didn't butcher the code, and move to the next one.
16:08:35GitDisc<NopeDK> I believe my editor has regex support but for now I will slowly work my way through it manually and perhaps for the full port begin using the available tools for automation.
16:20:40*Jesin quit (Quit: Leaving)
16:22:51*miran joined #nim
16:26:19*Jesin joined #nim
16:38:22*Vladar quit (Read error: Connection reset by peer)
16:44:23*bvld joined #nim
16:51:38*Trustable joined #nim
16:53:40FromGitter<Varriount> NopeDK: How macro-heavy is the file?
16:55:17FromGitter<Varriount> You could always run the file through http://www.muppetlabs.com/~breadbox/software/cppp.html , and GCC preprocessor to strip out the unneeded things
16:56:14Yardanicoah, yes, gcc preprocessor makes things a lot easier
16:57:11skrylarmratsim: primitives for writing flatbuffers are done
16:57:23FromGitter<mratsim> :O so fast
16:57:49FromGitter<Varriount> so beautiful! 
16:57:55FromGitter<mratsim> so furious
17:02:55*SenasOzys quit (Ping timeout: 248 seconds)
17:03:21FromGitter<Varriount> Yardanico: Here's a pipeline I used: Use regex to comment out macros to keep -> Run partial C preprocessor -> Run GCC Preprocessor -> Uncomment macros
17:03:57FromGitter<Varriount> That was for Windows source code.
17:04:04FromGitter<Varriount> Er, Windows SDK source code.
17:05:05Yardanicowow
17:05:19FromGitter<Varriount> ?
17:05:47YardanicoWell did you use c2nim afterwards?
17:06:00FromGitter<Varriount> Yes.
17:06:27Yardanicoso c2nim is very good if it can handle windows sdk code
17:06:35FromGitter<Varriount> Oh, I also had a regex find/replace stage too.
17:06:36FromGitter<ephja> skrylar: yeah, syscall for that bomb thing
17:07:00FromGitter<Varriount> Yardanico: Well, it can handle Windows SDK code *after* the preprocessor has been run on it.
17:07:08skrylarephja: i was being dramatic. although it is possible to run commands which do stupid things
17:07:09Yardanicowell it's amazing anyway
17:07:32skrylarcrm114 is also kind of fun
17:07:40skrylarprogrammable regex machine
17:13:31*ieatnerds quit (Ping timeout: 256 seconds)
17:14:26*Vladar joined #nim
17:16:38*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
17:17:47*MJCaley quit (Quit: MJCaley)
17:22:30GitDisc<NopeDK> Have ported most of what I need to test but thanks for the tip Varriount.
17:22:45*ieatnerds joined #nim
17:30:16FromGitter<dandevelo> How to do a forward type declaration in Nim? I see this was asked in this thread: https://forum.nim-lang.org/t/3376 but it looks like it never got an answer
17:30:50*MJCaley joined #nim
17:31:49FromGitter<zacharycarter> I don't think you can do forward type declaration
17:32:06FromGitter<zacharycarter> you can declare dependent types within the same type block
17:33:20FromGitter<zacharycarter> you can have forward declared procedures and variables, but not types AFAIK
17:34:33FromGitter<dandevelo> Thanks @zacharycarter that is what I also thought but that thread got me wondering. Looking for a way to handle circular dependency here
17:35:27FromGitter<zacharycarter> @dandevelo generally this requires some careful design and thinking about your types
17:35:38FromGitter<zacharycarter> alternatively you can just have a types file that you define types in
17:39:32FromGitter<dandevelo> @zacharycarter when using a types file, can I still access private fields?
17:40:21FromGitter<dandevelo> I mean from the implementation file
17:41:50FromGitter<zacharycarter> You can only access those fields that are exposed with the * access modifier
17:42:19FromGitter<dandevelo> :( Isn't there another way?
17:44:10FromGitter<zacharycarter> not to my knowledge, I'm not sure exactly what design problem you're facing, but to my knowledge the only way(s) you can avoid circular dependencies are to refactor your code so that you don't have them, or to place types into a types file
17:47:10GitDisc<treeform> Does any one know how to create a type that only supports 1 value - null? Some sort of null type?
17:47:18GitDisc<NopeDK> What is the Nim FFI equivalent of "extern struct structType structVariable;"?
17:48:21GitDisc<treeform> Nim does not have an FFI, it just outputs code. So {.emit: "extern struct structType structVariable;" .} ?
17:48:51GitDisc<treeform> Or at least not an FFI that other languages have.
17:49:19*bvld quit (Ping timeout: 248 seconds)
17:49:48*d10n-work quit (Quit: Connection closed for inactivity)
17:50:33FromGitter<zacharycarter> Only a ref object can be assigned nil I believe
17:50:45GitDisc<NopeDK> Hmm, while Emit works, the manual do mention that its usage is highly discouraged. I will go with it for now and stand by for other input. Thanks treeform.
17:54:59GitDisc<treeform> There is probably other ways to do what you want, I find emit a good stop gap to get stuff working.
17:55:26GitDisc<treeform> There are probably some forms of {.cdecl, exportc, dynlib.} that will produce what you want.
17:55:39GitDisc<treeform> I would just experiment with that till you can see it generates the C code you want.
17:56:46*claudiuinberlin joined #nim
18:03:46FromGitter<data-man> Need for Nim a built-in int128 & uint128 types? (For C/С++ x64. For JS and x32 a custom type can be implemented)
18:05:04FromGitter<RedBeard0531> type int128 = object {.externc: "__int128".}
18:05:27FromGitter<RedBeard0531> You'll need to define the all the ops on it too
18:07:20FromGitter<data-man> Yes, but I mean full support for these types by the compiler and the stdlib
18:09:29*floppydh quit (Quit: WeeChat 1.9.1)
18:13:16FromGitter<Varriount> Nopedk: exportc is how you should export a type
18:13:57*Trustable quit (Remote host closed the connection)
18:23:33Araqpackage level types allow forwarding
18:24:00Araqnew in devel, somebody needs to use it for non-toys
18:24:51*xet7 quit (Quit: Leaving)
18:30:17*xet7 joined #nim
18:43:02FromGitter<data-man> Oh, I forgot when I last played :)
18:44:08*xet7 quit (Quit: Leaving)
18:45:19FromGitter<mratsim> I’m starting to get strange manual allocation/deallocation errors: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a380cbf5355812e57ee7736]
18:46:15FromGitter<mratsim> The strange thing is that I can comment a completely unrelated test in my test suite and everything compiles happily
18:46:25FromGitter<mratsim> Or comment this test and same thing :/
18:49:36FromGitter<Yardanico> maybe some race condition?
18:52:38*xet7 joined #nim
18:53:17*solitudesf quit (Quit: solitudesf)
18:53:35*yglukhov quit (Remote host closed the connection)
18:55:16FromGitter<zacharycarter> or memory corruption?
18:55:55FromGitter<mratsim> I think it’s memory corruption because it’s using alloc0 allocation
18:57:39skrylarmratsim: let there be read primitives \o/
19:00:49FromGitter<mratsim> Actually the GC is crashing at the last line ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ But only in my “load” test, and only because i added an unrelated test. hum ... [https://gitter.im/nim-lang/Nim?at=5a381061c65707ba2b6993dd]
19:01:30*BitPuffin|osx quit (Remote host closed the connection)
19:03:14FromGitter<mratsim> Ah, I have an idea
19:03:28FromGitter<mratsim> (https://files.gitter.im/nim-lang/Nim/Kygg/2017-12-18_20-03-09.png)
19:06:06*solitudesf joined #nim
19:08:42FromGitter<zacharycarter> @mratsim - I think this is the kind of tutorial that arraymancer needs: https://www.pyimagesearch.com/2017/12/18/keras-deep-learning-raspberry-pi/
19:08:47FromGitter<zacharycarter> something similar
19:10:09FromGitter<tim-st> Is there a type like object or struct that I can make constant?
19:10:33*Vladar quit (Quit: Leaving)
19:11:07FromGitter<zacharycarter> what do you mean?
19:12:22FromGitter<tim-st> Or does it only not work for `type X = object of RootObj` --> `const x = X()`
19:14:12FromGitter<zacharycarter> consts are evaluated at compile time
19:14:13FromGitter<zacharycarter> https://nim-lang.org/docs/manual.html#statements-and-expressions-const-section
19:14:21FromGitter<tim-st> seems to work for `type X = object` but I want inheritance
19:17:21FromGitter<tim-st> Ok thanks, so object can never be const, is someother way like namedtuple that can be constant?
19:20:12skrylarinteresting. we have a beanstalkd thing in nimble but not gearman
19:21:36FromGitter<RedBeard0531> On a related note, anyone know how to get the compiler to emit generated tables into the .rodata section that you take the address of? I tried https://github.com/RedBeard0531/advent_of_code_2017/blob/master/16/a16_2_sse_brute.nim#L23-L42 and the compiler clearly evaluated it at compile time, but it generated a ton of stores into the array in NimMain rather than a c array literal. I need to be able to get the
19:21:36FromGitter... address (using unsafeAddr) since the point of the tables is to be loaded into SIMD registers. But the compiler complains when I use unsafeAddr on a const.
19:21:50FromGitter<zacharycarter> @tim-st : https://play.nim-lang.org/?gist=5000481a5ca58c80d933519f71d80437
19:22:57*nsf joined #nim
19:23:13FromGitter<zacharycarter> @RedBeard0531 shuffles is not a pointer thus unsafeAddr won't work on it
19:23:16FromGitter<tim-st> @zacharycarter Yes, I tried that. And the same works for `object` but not for `object of ...` and I prefered a type that I could use for inheritance, so I thought I made something wrong, but now it seems to me that only plain `object` type can be const
19:24:41FromGitter<RedBeard0531> @zacharycarter unsafeAddr works fine as long as shuffles is a `let` rather than a `const`: https://github.com/RedBeard0531/advent_of_code_2017/blob/master/16/a16_2_sse_brute.nim#L79
19:25:14FromGitter<tim-st> Ah, I now got from the compiler warning that `object` type is defined as a "final object" type and because it works for const. Other object types arent final
19:27:20FromGitter<zacharycarter> @RedBeard0531 I misspoke - I'm not sure why const breaks unsafeAddr
19:27:27FromGitter<mratsim> @zacharycarter I like pyimagesearch toto yes, but I don’t even have the first building block “Loading a deep learning model from disk” since I don’t have any serialization ;)
19:29:26FromGitter<mratsim> I should be able to do something like that soon however: https://www.pyimagesearch.com/2016/08/01/lenet-convolutional-neural-network-in-python/
19:31:56skrylarmratsim: well the primitives are done
19:33:25FromGitter<mratsim> @RedBeard0531 Can you do unsafeAddr(yourarray[0]) ? But afaik, const are not real value, they are substituted everywhere they are used in the program.
19:33:44FromGitter<mratsim> @skrylar, cool, it’s on a repo?
19:33:49*ieatnerds quit (Ping timeout: 265 seconds)
19:33:54skrylarnot on github yet
19:34:18skrylaryou still have to manually write and read, it's just the base code for resolving vtable offsets and boring stuff
19:34:38skrylarthere is also the option of using sksbox and json
19:35:13*fvs joined #nim
19:35:54fvshi, getting the following error on exit from a program that calls a dll:
19:35:57fvsError in `./ames2': double free or corruption (!prev):
19:36:36FromGitter<RedBeard0531> @mratsim thats what I was doing. I'm wondering if nim has the concept of data that is needed in the program image, but should be const at runtime.
19:37:25fvsis nim trying to free space generated by the dll?
19:38:45*nsf quit (Quit: WeeChat 1.9.1)
19:43:14*nsf joined #nim
19:48:55FromGitter<zacharycarter> fvs - perhaps share some code?
19:49:11*jjido joined #nim
19:52:09FromGitter<Varriount> fvs: it wouldn't be Nim that frees space from the DLL, it would be the OS
19:55:17fvsnp, valgrind to the rescue :)
19:58:42FromGitter<mratsim> @Varriount, @Yardanico, solved my corruption issue, I was issue 0 .. N instead of 0..< N … combined that with UncheckedArray I think I was overwriting memory I shouldn’t have.
19:59:03FromGitter<mratsim> using not issue
19:59:39GitDisc<NopeDK> First a question, can the "emit" pragma be combined with an "importc"?
19:59:39GitDisc<NopeDK> I am currently doing it kinda hacky like this
19:59:41GitDisc<NopeDK> ```{.emit: """
19:59:42GitDisc<NopeDK> #include header.h
19:59:43GitDisc<NopeDK> extern struct StructFromHeader varName;
19:59:44GitDisc<NopeDK> """.}```
19:59:46GitDisc<NopeDK> Any way to import the "StructFromHeader" without resolving to the above code?
20:00:51FromGitter<mratsim> @RedBeard0531 I now I could use the .data segment with a global var: array[1337, int] and take its address
20:03:48FromGitter<mratsim> @NopeDK, maybe include? that’s what i use in Arraymancer: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/incl_higher_order_cuda.nim
20:04:23FromGitter<mratsim> Look here: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_kernels_interface_cuda.nim
20:04:54FromGitter<mratsim> I have a template that emits the code and then create the bindings
20:05:03FromGitter<mratsim> with importcpp (no need for include sorry)
20:05:44FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a381f98a2be466828b91224]
20:10:22*radagast quit (Quit: radagast)
20:11:37*radagast joined #nim
20:11:52FromGitter<tim-st> I now tried different things to have types B and C which have different fields and should have a same upper type A and should be const initialized, that's not possible in nim isn't it?
20:13:08FromGitter<mratsim> Can be done with concepts, but with inheritance it’s not possible in any language because you need ref object and ref object are managed on the heap, and you can’t allocate on the heap at compile-time
20:13:43FromGitter<zacharycarter> skrylar: I wonder if this might be useful in writing a job scheduling system - https://github.com/mogud/nimfiber
20:14:51FromGitter<tim-st> @mratsim Thanks for your answer. Objects A, B and C are final, I don't change them later. I think in theory it is possible to build such a constant/final type, but than I will have to use object of .. and init them at runtime
20:15:01*xkapastel joined #nim
20:15:51FromGitter<mratsim> @zacharycarter fibers are not for multithreading if you want multithreading. Though you can probably put that on top of a threadpool.
20:15:54FromGitter<RedBeard0531> @mratsim It was in .data, but filled in NimMain. Check the NimMain() func in the generated c file and see if it is filling in the array there. Also, not that it is a huge deal, but I was hoping for .rodata since it should never be written to at runtime.
20:15:57FromGitter<mratsim> would be nifty :)
20:16:48FromGitter<zacharycarter> @mratsim was reading about : http://twvideo01.ubm-us.net/o1/vault/gdc2015/presentations/Gyrling_Christian_Parallelizing_The_Naughty.pdf
20:16:52FromGitter<mratsim> @tim-st, just use `let` then?
20:17:49FromGitter<tim-st> @mratsim I use `let` already but I want to import these initialized objects from other modules, I tried that and it gave me empty default values
20:18:04GitDisc<NopeDK> mratsim, am I blind or do you not have any actual includes within the emits in the file you linked? And while I see how it works for variables (getting the r-value inside emit), how would I pass a type which should get the type info from the Nim code?
20:18:50FromGitter<mratsim> Otherwise put a feature request, maybe for a pragma. both you and @RedBeard0531 wants more compile-time const features in Nim today :D
20:19:35FromGitter<mratsim> @NopeDK, getting the Nim type is broken
20:20:05FromGitter<tim-st> @mratsim So would you say that an inheritated type which will never changed in future could be possible and const?
20:20:14GitDisc<NopeDK> Alright, I will just keep the hack for now and open a feature request. Thanks.
20:20:27FromGitter<mratsim> @nopedk probably relevant: https://github.com/nim-lang/Nim/issues/6415
20:21:00FromGitter<mratsim> @tim-st I think @Araq is the best man to ask ;)
20:21:01*ieatnerds joined #nim
20:21:38GitDisc<NopeDK> That template seems to be from cpp to Nim where I am looking for the opposite.
20:21:41FromGitter<mratsim> but concepts are probably the best way to do that
20:22:49FromGitter<tim-st> I don't know how this works. Otherwise, I could use one object type, add all nine fields (5 from A and 4 from B) and one enum type that identifizes the object and than I can use this object as a const object for two different types...
20:23:16*arthurz joined #nim
20:23:26FromGitter<mratsim> @NopeDK, I think I never found out how, if you find how, it would be helpful for me as well to simplify Arraymancer <-> Cuda interface ;)
20:23:50*sz0 joined #nim
20:24:06arthurzHi there, I'm curious why I am getting error at `except dbError(db: DbConn):
20:24:06arthurz echo "Connection failed!"` testpg.nim(8, 15) Error: type expected
20:24:16FromGitter<mratsim> @tim-st that sounds like an object variant no?
20:26:09FromGitter<zacharycarter> arthurz: please share some code
20:26:17*miran quit (Quit: Konversation terminated!)
20:26:24arthurzimport db_postgres
20:26:24arthurzvar
20:26:24arthurz db: DbConn
20:26:24arthurztry:
20:26:24arthurz echo "Attempting to open the local PG db..."
20:26:24arthurz db = open("localhost", "postgres", "1234", "SandBox")
20:26:26arthurzexcept dbError(db: DbConn):
20:26:30arthurz echo "Connection failed!"
20:26:32arthurzfinally:
20:26:34arthurz db.close()
20:26:36arthurz echo "Closed the database"
20:26:47FromGitter<tim-st> @mratsim Hm, could be possible, will try it, thanks!
20:27:27Yardanicoarthurz, probably because you have "except dbError(db: DbConn)
20:27:43Yardanicoand I strongly suggest you to use gist/pastebin/nim playground for code sharing
20:27:43FromGitter<zacharycarter> arthurz: for future reference you can paste code snippets between triple backticks
20:27:48arthurzwhat is the proper use @Yardanico ?
20:28:09Yardanicoarthurz, just "except dbError:"
20:28:15Yardanicoah wait
20:28:28Yardanicoyes
20:28:43FromGitter<zacharycarter> http://ourmachinery.com/post/a-year-in-review/ - lots of good reading here
20:28:44Yardanicoit should work
20:31:11arthurzI tried that before posting Yardanico, got ```testpg.nim(8, 8) Error: type expected```
20:35:24arthurzfound what it is, a typo must be ```except DbError```
20:42:20FromGitter<tim-st> @mratsim doesn't work too for const init, thanks though!
20:42:37FromGitter<mratsim> :/
20:43:45*ieatnerds quit (Ping timeout: 248 seconds)
20:45:08*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
20:52:49GitDisc<NopeDK> Must parameters be named when declaring a proc? If not, how do you do unnamed typed parameters?
20:53:09FromGitter<tim-st> @mratsim I got it working using the idea I described (9 fields), that will have a bit overhead, but not much and is const. I also found out that the empty default values came because I didn't had the fields public using *
20:54:15YardanicoNopeDK they must be named, why would you want unnamed params?
20:54:24Yardanicowell your proc can accept an openarray
20:54:25Yardanicoor varargs
20:54:51*marenz__ joined #nim
20:54:58GitDisc<NopeDK> It was for usage with importc when the header has unnamed parameters.
20:55:00GitDisc<NopeDK> Thanks
21:04:37*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
21:16:04*nsf quit (Quit: WeeChat 1.9.1)
21:19:18FromGitter<zacharycarter> Is it just me or does the new firefox crash quite often?
21:21:44Yardanicoplot twist: the reason is that new firefox uses components written in rust :D
21:29:35*qih joined #nim
21:30:25*Yardanico quit (Read error: Connection reset by peer)
21:36:31FromGitter<SolitudeSF> never crashed for me, and i have it open almost all day
21:38:40FromGitter<zacharycarter> It's locked up for me at least three times today while just browsing hackernews, reddit, etc...
21:39:57*MJCaley quit (Quit: MJCaley)
22:01:20GitDisc<NopeDK> When trying to compile I get the following error https://pastebin.com/XbCXG6cC but I am at a complete loss as to why...
22:02:28*vlad1777d joined #nim
22:02:31FromGitter<ephja> it's a code generation bug
22:04:14GitDisc<NopeDK> As in a Nim bug or code bug?
22:04:45Araqmore likely your own bug
22:05:44Araqyou wrapped something in a wrong way
22:06:55GitDisc<NopeDK> Hmm...
22:09:50FromGitter<ephja> I missed some context
22:13:58FromGitter<mratsim> @zacharycarter there is a huge bug on MacOS with the new Firefox
22:14:37FromGitter<mratsim> https://www.reddit.com/r/firefox/comments/7g6k9n/firefox_quantum_is_eating_your_cpu_help_us_debug/
22:23:16FromGitter<Yardanico> Not only on macos it seems
22:26:03FromGitter<Yardanico> I imagine that this is a nightmare for developers if you can't hunt down a huge bug so you need to ask users directly
22:28:53*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
22:33:55*solitudesf quit (Ping timeout: 272 seconds)
22:39:49*Jesin quit (Quit: Leaving)
22:46:32GitDisc<NopeDK> Had anyone wrapped a C struct that has fields for functions (which are called internally)? I have no idea why my wrapper isn't working and would like some inspiration.
22:46:33GitDisc<NopeDK> Something like this:
22:46:35GitDisc<NopeDK> ```struct SomeThing {
22:46:36GitDisc<NopeDK> int (*on_init) (char *, int);
22:46:37GitDisc<NopeDK> };```
22:46:39GitDisc<NopeDK> Where you instantiate the struct as an object after wrapping and something internally calls your generated structs function.
23:09:37*SenasOzys joined #nim
23:13:55FromGitter<zacharycarter> NopeDK: I'm guessing you mean a function pointer?
23:14:46GitDisc<NopeDK> Probably, yeah
23:15:53FromGitter<zacharycarter> I have
23:15:58FromGitter<zacharycarter> please refer to the following
23:18:18FromGitter<zacharycarter> never mind, I took a closer look at my code and it's not doing what you're describing
23:18:49FromGitter<zacharycarter> NopeDK: can you make a small reproducible example and create a gist?
23:18:59FromGitter<zacharycarter> or I can try if you're unsure how
23:19:42FromGitter<zacharycarter> i'm fairly certain what you're trying to do works without issue
23:19:48FromGitter<zacharycarter> so it's probably down to implementation
23:21:58GitDisc<NopeDK> I am writing some test code currently, to check if my syntax and method is correct. It's slow going due to tech but when if I encounter the issue, I will Gist it and ping you. Thanks for the offer :)
23:27:13FromGitter<Yardanico> New era for Nim time module :P https://github.com/nim-lang/Nim/pull/6552
23:37:40*niv quit (Quit: The Lounge - https://thelounge.github.io)
23:39:03*niv joined #nim
23:39:49FromGitter<kinokasai> Hey folks
23:40:06FromGitter<kinokasai> Is there any way to get the size of a data structure at runtime?
23:41:04skrylar.sizeof doesn't work?
23:41:12skrylarmratsim: https://github.com/Skrylar/skflatbuffers not super usable yet
23:42:30*qih left #nim (#nim)
23:43:08FromGitter<kinokasai> I mean, l
23:43:39FromGitter<kinokasai> I mean, like having the memory used by something like a tree-like structure as a whole
23:44:12FromGitter<kinokasai> `sizeof` just gives the size of the struct, right?
23:48:05FromGitter<mratsim> yes
23:48:21FromGitter<mratsim> it doesn’t account for memory on the heap
23:48:50FromGitter<mratsim> but the GC has some allocation statistics, or you compute it by hand
23:49:53FromGitter<kinokasai> Hm.
23:50:12FromGitter<RedBeard0531> what would it even mean to get the size of an object when it is one of many that hold a ref to the same large object?
23:50:58FromGitter<mratsim> @skrylar wow, if the spec is just that, that sure is dead simple
23:52:52skrylarmratsim: yup, its basically just offsets and blitting
23:52:53FromGitter<mratsim> you could filter to count size only once per ref
23:52:54FromGitter<kinokasai> Say I'm writing a compressing digital trie - I want to calculate, at runtime, the size of the trie representing a given index
23:53:21FromGitter<kinokasai> Just recurse and sizeof * number of instances ?
23:54:22FromGitter<mratsim> are all references unique?
23:54:23FromGitter<RedBeard0531> If it is a pure tree, not a DAG or anything with cycles, that will be accurate (as long as you also do string.len)
23:54:48FromGitter<kinokasai> Yeah, it's a tree
23:55:14FromGitter<RedBeard0531> But it is probably easier to just keep a size int and just update it as you add/remove nodes
23:55:44FromGitter<RedBeard0531> the incs are free and that makes fullSize a free O(1) rather than an expensive O(n)
23:56:33FromGitter<kinokasai> Hm.
23:56:43FromGitter<kinokasai> True, thanks.
23:57:55FromGitter<mratsim> (@RedBeard0531, they are almost free, I tried to implement atomic refcount and I could see inc/dec having something like 3~7% overhead in loops)
23:58:58FromGitter<mratsim> unless you were talking about free in terms of memory
23:59:06FromGitter<RedBeard0531> @mratsim key word there is *atomic*. Those cost ~10-20 cycles. non-atomc incs are free because you basically always have a free ALU hanging around.
23:59:38FromGitter<mratsim> oh interesting point of view
23:59:39FromGitter<kinokasai> Off-topic, but is there any resource on efficient nim coding ? something about common pitfalls and such