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:00 | FromGitter | <Varriount> IRC is like, the eternal chat protocol. |
02:17:44 | FromGitter | <Varriount> It was around 20 years ago, it's around today, and it will probably be around 20 years from now. |
02:18:35 | skrylar | i watch matrix cautiously |
02:19:12 | skrylar | the 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:12 | FromGitter | <Varriount> Hm, reminds me of Quassel |
02:20:14 | skrylar | there 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:40 | skrylar | chat history you missed is a big one and as mentioned, you could easily make a short RFC for it |
02:21:22 | skrylar | but 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:21 | ieatnerds | Hello |
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:44 | skrylar | hello ieatnerds |
03:14:23 | ieatnerds | How's it going? |
03:14:43 | skrylar | seems to be flu season :( |
03:17:02 | ieatnerds | I 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:59 | ieatnerds | Hey 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:03 | skrylar | pondering about some kind of adapter for the unittest module to get junit/xml/something output |
04:33:14 | skrylar | have no particular love of those output formats but they do get used by the big build systems for people's pretty dashboards :| |
05:02:10 | skrylar | qqtop: did you ever end up using that firebird wrapper |
05:07:47 | * | nsf joined #nim |
05:08:42 | Xe | skrylar: 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:07 | skrylar | Xe: it doesn't particularly matter what the format is imo |
05:50:13 | skrylar | jenkins has a tap plugin it seems |
05:51:09 | skrylar | https://wiki.jenkins.io/display/JENKINS/TAP+Plugin |
05:51:42 | skrylar | right 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:13 | skrylar | i guess that reply was phrased too harshly |
07:10:26 | skrylar | tap 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:48 | FromGitter | <alehander42> Unittest has already a xml formatter |
08:12:52 | FromGitter | <alehander42> Look at |
08:13:05 | FromGitter | <alehander42> Junittesformatter iirc |
08:15:00 | * | solitudesf quit (Quit: solitudesf) |
08:18:24 | skrylar | Well. 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:05 | FromGitter | <alehander42> @Araq is changelog.md supposed to be md or rst ? there are some `.. code-block:: nim` there |
10:17:34 | Araq | .md |
10:19:07 | FromGitter | <alehander42> ok, should I add the asyncjs entry in `Changes affecting backwards compatibility` or in a new section ? |
10:19:50 | Araq | well we will clean up this thing before the release |
10:20:24 | Yardanico | well also not all new things are in changelog |
10:21:13 | FromGitter | <alehander42> ok, so I'll just add an entry there (and maybe eventually a link to the updated reference page before release) |
10:21:34 | Araq | here is an example of the sections we used to have |
10:21:35 | Araq | https://nim-lang.org/blog/2017/05/17/version-0170-released.html |
10:21:55 | Araq | Yardanico, dom96 has a script that generates a changelog from the commit log |
10:22:06 | Yardanico | there 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:29 | Yardanico | Araq, it will be quite big :P |
10:22:34 | FromGitter | <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:35 | Araq | not sure how this automated changelog + manual changelog will work out... |
10:23:45 | FromGitter | <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:47 | Yardanico | changelog.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:54 | skrylar | i remember mantis had a cute changelog generator |
10:31:02 | skrylar | they based it on tickets closed |
10:31:48 | skrylar | if 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:29 | FromGitter | <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:53 | skrylar | i liked mantis doing all of it, kind of. centralized comments on particular features as well |
10:35:08 | skrylar | althoug this was in the days before phabricator, so |
10:35:22 | * | yglukhov joined #nim |
10:36:08 | skrylar | have tried phab, taiga and kanboard. they are. hm |
10:36:36 | * | NopeDK joined #nim |
10:37:45 | skrylar | Mantis was apparently fiddled with to run production for the movie Happy Feet, so that's amusing |
10:38:12 | NopeDK | using the FFI with C, if a C struct has named its fields as ".name" how can it be used in Nim? |
10:38:57 | skrylar | use tildes: `.stuff` |
10:39:16 | skrylar | alternatively, rename the field and change it back via importc: stuff {.importc: ".stuff".} |
10:39:28 | * | vlad1777d quit (Ping timeout: 240 seconds) |
10:39:35 | skrylar | this does work at the field level (i have done it) |
10:40:17 | skrylar | it goes between the name and type assigment, so stuff {..}: cint instead of stuff: cint {..} |
10:45:34 | Araq | C struct field names cannot start with a dot |
10:45:41 | Araq | you're looking at an intializer |
10:45:55 | Araq | the fieldname is that thing without the dot |
10:47:20 | skrylar | they can however end with an underscore which nim hates |
10:48:11 | Araq | yeah well, it's not my fault the C programmers do not even understand what a "separator" is |
10:49:26 | NopeDK | Thank 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:09 | NopeDK | What 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:54 | Araq | you need to use compatible types and the right calling convention |
10:53:05 | Araq | name mangling and visibility are irrelevant |
10:54:04 | Araq | my DFA computation runs into endless loops, now what? |
10:55:01 | NopeDK | What do you mean by "right calling convention"? |
10:56:57 | skrylar | {.cdecl.} |
10:57:36 | skrylar | On 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:54 | skrylar | if you don't specify one then the one you get is Magic |
10:59:11 | * | Yardanico quit (Ping timeout: 260 seconds) |
11:00:17 | NopeDK | Thank you Araq and skrylar, time to get coding. |
11:01:49 | FromGitter | <mratsim> Pascal call? Is that even a thing |
11:01:57 | Araq | skrylar, actually Nim's default is .fastcall on Unix too iirc |
11:02:05 | Araq | not sure about that though :P |
11:02:18 | Araq | mratsim: Pascal is 'stdcall' |
11:03:02 | skrylar | mratsim: pascal did many cheeky things that were probably better in the end, but also resulted in some of its own problems |
11:03:16 | skrylar | i seem to recall the infamous lack of varargs was because pascal's calling conventions didn't support it |
11:03:37 | FromGitter | <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:46 | skrylar | they 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:40 | Araq | most functions do not take varargs and it's inefficient to pretend they do |
11:04:48 | skrylar | someone 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:15 | Araq | costs at least one instruction per call |
11:06:07 | FromGitter | <mratsim> How is that related to the new "fno-no-plt" flag in GCC 7? |
11:06:37 | Araq | of 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:40 | Araq | "C is a language strongly optimized for liars and people who go by guesswork and ignorance." |
11:08:11 | skrylar | exceptions still have to do the testing |
11:08:32 | Araq | nah, they unwind the stack in the error case and are free when not thrown |
11:08:46 | skrylar | the code which throws it has to test the condition |
11:09:00 | skrylar | so aren't you just saving the time between a couple manual gotos and a longjmp |
11:09:23 | PMunch | skrylar, you have to check twice though when not using exceptions |
11:09:24 | * | yglukhov quit (Remote host closed the connection) |
11:09:46 | PMunch | Once to determine if you need to set the error flag, and then once more to check if the error flag was set |
11:10:23 | skrylar | i did settle on exceptions for the firebird module. |
11:10:33 | skrylar | cross-language exceptions don't tend to work though :| |
11:11:41 | * | bvld joined #nim |
11:14:35 | * | sendell joined #nim |
11:14:46 | Araq | skrylar, this was extensively evaluated at Microsoft for their toy OS with I name I forgot |
11:14:59 | skrylar | longhorn? |
11:15:22 | Araq | exceptions were 5-10% faster than ifs on their largish code-base |
11:15:46 | sendell | Araq: 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:54 | Araq | it's easy to test with exceptions, all you need to do is the to change the codegen strategy |
11:16:22 | skrylar | some old lisp docs said having a GC makes exceptions even simpler |
11:16:28 | Araq | of 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:10 | mishugana | Hello! |
11:18:35 | mishugana | I had not updated my Nim git repo in some time. I updated it today and ran the build instructions |
11:18:52 | Yardanico | mishugana, so what's the error? :) |
11:18:58 | mishugana | However, 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:04 | Yardanico | hm |
11:19:06 | mishugana | However, the version still got updated to 0.17.0 |
11:19:10 | mishugana | is this alright? |
11:19:23 | Yardanico | 100% way to compile it |
11:19:24 | mishugana | Nim Compiler Version 0.17.0 (2017-05-18) [MacOSX: amd64] Copyright (c) 2006-2017 by Andreas Rumpf git hash: d3f0f87e81e262ee25fd528aae5b6 |
11:19:28 | Yardanico | clone csources |
11:19:30 | mishugana | from "nim --version" |
11:19:41 | Yardanico | I mean - run ALL build instructions |
11:19:49 | Yardanico | so clone csources too (they contain 0.17.2) |
11:19:54 | mishugana | I thought I did... I already had the repo cloned |
11:19:59 | mishugana | and I did a clean of the csources |
11:20:06 | mishugana | and then install.sh etc. |
11:20:11 | mishugana | Did I miss something? |
11:20:17 | Yardanico | well csources contain 0.17.2, not 0.17.0 |
11:20:21 | mishugana | Ohhh |
11:20:23 | skrylar | csources is usually checked out with --depth 1, so you have to delete it and do a new checkout |
11:20:34 | mishugana | I thought csources was part of the nim repo? |
11:20:38 | skrylar | its not |
11:20:40 | mishugana | Ah, okay... I see! |
11:20:47 | mishugana | @skrylar |
11:20:58 | mishugana | Let me try that out and get back.. thanks for the quick help, guys! :-) |
11:21:21 | skrylar | you can also use the nim in your distros package manager (unless its arch :|) in some cases |
11:21:50 | Yardanico | skrylar, what's bad about arch? |
11:21:59 | skrylar | Yardanico, they ship a broken build |
11:22:05 | Yardanico | ?? |
11:22:13 | Yardanico | it worked for me |
11:22:24 | skrylar | it 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:57 | Yardanico | maybe it's fixed in 0.17.2 ? |
11:23:02 | skrylar | it could be |
11:27:05 | mishugana | Woohoo! 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:15 | mishugana | Thanks, guys! :-) |
11:27:28 | mishugana | Btw, I removed the --depth 1 and cloned the whole csources repo |
11:27:31 | mishugana | that should be fine, right? |
11:27:40 | mishugana | just some extra space on my computer I presume? |
11:28:27 | skrylar | a lot more bandwidth used and more space yes |
11:28:40 | Araq | remove the csources now |
11:28:43 | Yardanico | ? |
11:28:49 | mishugana | Okay, I can live with that! :-) |
11:28:57 | Araq | once you have a working nim, updating nim doesn't require csources |
11:29:06 | Yardanico | ah yes, I know about that too |
11:29:07 | mishugana | I had not touched it for so long ,it was my mistake not seeing that line about csources |
11:29:09 | Araq | I never compile from csources |
11:29:18 | Yardanico | because you always have nim installed :) |
11:29:19 | skrylar | my jenkins uses the debian/sid release of nim against the devel branch. works fine |
11:29:22 | mishugana | @Araq what about when I update the repo next time? |
11:29:29 | Yardanico | mishugana, just "git pull" and then |
11:29:30 | Yardanico | nim c koch |
11:29:35 | Yardanico | ./koch boot -d:release |
11:29:37 | Araq | git pull && koch boot -d:release |
11:29:50 | Yardanico | except if your nim would be really old |
11:29:57 | mishugana | @Yardanico I had done that today after git pull and I got that error message! |
11:29:57 | Yardanico | like 2 releases behind devel |
11:30:04 | Yardanico | mishugana, because you had 0.17.0 :) |
11:30:14 | mishugana | Oh man... I need to keep up with the goings on! :D |
11:30:19 | skrylar | you could probably stairstep release tags if you needed |
11:30:21 | Araq | yeah well, it *should* work since 0.16 |
11:30:34 | Yardanico | just recompile nim every month and it would be fine :) |
11:30:45 | mishugana | Okay, I get the picture now (somewhat!)... thanks again for the quick help, guys! You're awesome! :-) |
11:30:55 | mishugana | Have a great day/night all! :-) |
11:31:12 | skrylar | having mixed thoughts about not using wx |
11:31:38 | Yardanico | btw, git-discord bridge runs on azure VPS with arch linux installed :P |
11:31:40 | * | mishugana quit (Quit: Page closed) |
11:31:43 | Yardanico | *irc-discord |
11:31:54 | skrylar | i liked pacman over apt, and the AUR was nice |
11:32:03 | skrylar | it just kept nuking my laptop every few months |
11:32:12 | Yardanico | luckily didn't happen for me yet :) |
11:32:26 | skrylar | debian stable nuked my laptop too but that's eh |
11:33:31 | skrylar | The +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:54 | Yardanico | attention (possible) discord members: I'll reboot VPS with discord bridge now |
11:41:54 | * | GitDisc quit (Remote host closed the connection) |
11:42:38 | Yardanico | ok it's back |
11:42:42 | * | GitDisc joined #nim |
11:53:21 | NopeDK | Yardanico, how frequently does the irc-discord bridge run? |
11:53:34 | Yardanico | NopeDK, always :) |
11:53:41 | Yardanico | I mean it had a ~3 month uptime |
11:53:49 | Yardanico | just installed updates from package manager and rebooted it |
11:54:10 | NopeDK | i meant how fast messages would propagate between the two? |
11:54:15 | Yardanico | NopeDK, pretty fast |
11:54:33 | Yardanico | you can try yourself |
11:54:53 | Yardanico | https://discord.gg/ezDFDw2 |
11:55:22 | NopeDK | Awesome, as I am using Discord normally I can now have the benefit of both irc logs and using my existing program. |
11:55:36 | GitDisc | <NopeDK> Testing bridge speed |
11:55:50 | GitDisc | <Yardanico> well it's pretty fast |
11:56:17 | * | bvld quit (Ping timeout: 255 seconds) |
11:56:34 | NopeDK | Hot damn, the message was here before I switched apps, and that is like sub 500ms |
11:57:37 | Yardanico | well this VPS is located in west europe (azure), internet is pretty fast on it |
11:57:44 | Yardanico | and discord server is located in europe too |
11:57:54 | Yardanico | western europe :) |
11:58:34 | NopeDK | And I am located there as well. Thank you for this service :) |
11:58:53 | Yardanico | well it costs nothing for me |
12:02:34 | NopeDK | Some kind of free tier? |
12:02:48 | Yardanico | NopeDK, no, friend shared azure bizspark with me :) |
12:03:04 | NopeDK | nice |
12:03:11 | Yardanico | you get $150 every month |
12:03:17 | Yardanico | for any azure services |
12:03:25 | Yardanico | but azure prices are very high |
12:05:06 | NopeDK | Even with higher than normal prices, $150 is pretty decent |
12:05:20 | skrylar | i ran a webiste off a 5$ prgmr box for a while |
12:05:29 | skrylar | it was a very acceptable, if small, xen instance |
12:05:30 | Yardanico | NopeDK, you can only get a 4-core 8gbram 30gb hdd VPS for ~that price |
12:05:35 | Yardanico | on Azure |
12:09:22 | NopeDK | A 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:21 | radagast | what's a nice way to assert a block of code in compile time? |
12:15:42 | Araq | static: assert() |
12:15:57 | * | PMunch_ joined #nim |
12:16:19 | skrylar | staticexec("rm -rf ~/") |
12:16:27 | skrylar | that being possible is atrocious :| |
12:16:34 | skrylar | dont actually do it |
12:18:48 | Araq | skrylar, 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:40 | Araq | IMO 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:07 | enthus1a1t | skrylar: npm install; pip install; pacman, apt, is as evil as staticexec. Too many shells everywhere.... |
12:40:26 | FromGitter | <mratsim> Insert obligatory toy story meme here <----- |
12:40:40 | Arrrr | for example? |
12:42:01 | PMunch | enthus1a1t, I would say staticExec is less evil. At least a programmer is expected to glance at code before compiling things |
12:42:15 | FromGitter | <mratsim> https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRvvG2S2WygiGYDzDDhFf03M43KHx5TwrYT6Sqi4p05SRrijjzX |
12:42:20 | PMunch | Most people (myself included) install packages without putting much thought into it |
12:43:43 | skrylar | heh |
12:43:52 | FromGitter | <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:21 | skrylar | in this particular foot-gun you can run the-silver-searcher on the folder for staticexec |
12:44:30 | skrylar | not so true if nimble decides to install a chain of shit |
12:44:59 | skrylar | if you use phab (nobody does) you can also have a herald rule for it |
12:45:58 | FromGitter | <alehander42> tools as `https://github.com/p-e-w/maybe` are way more useful than an optimistic grep |
12:46:23 | FromGitter | <alehander42> (but as an additional step ofc) |
12:47:29 | FromGitter | <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:13 | FromGitter | <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:18 | skrylar | well you don't expect opening a jpeg to bomb your computer either |
12:51:13 | FromGitter | <RedBeard0531> true, but opening a jpeg seems more like viewing the source code. I'd be very concerned if that executed code... |
12:51:28 | FromGitter | <RedBeard0531> Actually, does nimsuggest do staticExec? |
12:52:23 | Arrrr | You 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:43 | FromGitter | <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:56 | FromGitter | <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:43 | FromGitter | <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:53 | FromGitter | <alehander42> yeah, I was talking in principle |
12:55:40 | FromGitter | <RedBeard0531> I was replying to @Arrrr. I agree with your statement. |
12:56:34 | FromGitter | <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:43 | FromGitter | <mratsim> It* |
12:56:55 | Arrrr | hah |
12:57:16 | FromGitter | <mratsim> Someone had a very hard to debug production bug because of it. |
12:57:22 | FromGitter | <andreaferretti> (gimme gimme gimme (a man after midnigth)) |
12:57:31 | FromGitter | <mratsim> Oh right |
12:57:39 | FromGitter | <andreaferretti> :-) |
12:57:48 | Arrrr | lol |
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:51 | FromGitter | <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:59 | FromGitter | <ephja> skrylar: what syscall integer is that? |
13:27:31 | FromGitter | <andreaferretti> is cap'n'proto available? |
13:27:42 | FromGitter | <andreaferretti> never knew that |
13:27:54 | FromGitter | <andreaferretti> by the way, great work you are doing with ArrayMancer! |
13:28:14 | Yardanico | https://github.com/zielmicha/capnp.nim |
13:28:25 | Yardanico | it's on capnproto website btw: https://capnproto.org/otherlang.html |
13:28:41 | FromGitter | <andreaferretti> cool! |
13:29:22 | * | Arrrr joined #nim |
13:29:22 | * | Arrrr quit (Changing host) |
13:29:22 | * | Arrrr joined #nim |
13:29:47 | FromGitter | <mratsim> @andreaferretti thanks :). Hopefully I can get a 99% accuracy MNIST Deep Learning model running by Jan. 1 |
13:32:02 | FromGitter | <alehander42> ha I didnt know capn proto is by the author of protobuf |
13:40:55 | FromGitter | <mratsim> And @andreaferretti how about you, still swamped? |
13:41:51 | * | Vladar quit (Remote host closed the connection) |
13:44:15 | FromGitter | <andreaferretti> Yeah, a little |
13:44:26 | FromGitter | <andreaferretti> Hopefully I will be back on new year |
13:46:24 | Yardanico | btw fmt is much faster than `%` from strutils |
13:46:41 | Yardanico | it 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:24 | skrylar | mratsim: there does not appear to be one. i am considering writing flatbuffers |
14:06:45 | skrylar | ephja: syscall integer? |
14:06:53 | * | MJCaley joined #nim |
14:08:03 | skrylar | also 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:04 | skrylar | flatbuffers also seem to have the mysterious "doesn't compress as well as json" that many things have |
14:10:39 | skrylar | though 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:11 | FromGitter | <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:37 | skrylar | I read the flatbuffer spec front to back. there is nothing to "do" to it |
14:12:24 | FromGitter | <mratsim> Also I saw cap'n proto in use in Rust Deep Learning lib Leaf/Juice: https://github.com/spearow/juice |
14:12:27 | skrylar | you 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:08 | skrylar | the 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:14 | skrylar | that's the entire format. |
14:13:23 | FromGitter | <mratsim> Well if you implement a standalone Flatbuffers I'll give it a spin :) |
14:14:24 | skrylar | the 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:23 | skrylar | now 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:55 | FromGitter | <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:37 | skrylar | well 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:04 | skrylar | that doesn't benefit from sparsity, but its valid |
14:20:38 | FromGitter | <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:58 | skrylar | in the AI sense? |
14:21:25 | FromGitter | <zacharycarter> No, like being able to schedule a task to load a resource |
14:21:38 | skrylar | pumps |
14:22:14 | FromGitter | <zacharycarter> I've never worked with the concept before |
14:22:35 | FromGitter | <zacharycarter> like message pumps? |
14:23:03 | skrylar | mhmm |
14:23:14 | FromGitter | <zacharycarter> what's the communication mechanism though? channels? |
14:24:07 | skrylar | channels 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:19 | skrylar | ABUSE 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:16 | FromGitter | <zacharycarter> I'll have to play around with an implementation of that |
14:26:35 | * | MJCaley quit (Quit: MJCaley) |
14:27:12 | skrylar | depending on how your textures are managed, you could avoid string passing entirely and communicate by offsets in the archive as well |
14:27:28 | skrylar | "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:28 | radagast | Does 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:51 | FromGitter | <Yardanico> Probably you need to clear nimcache folder |
15:23:05 | radagast | Check 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:32 | PMunch | Compiles and runs fine here |
15:24:47 | Yardanico | radagast, are you sure playground crashes? |
15:24:50 | PMunch | (in the playground) |
15:24:52 | Yardanico | playground works fine for me |
15:24:57 | Yardanico | with this code |
15:25:15 | Yardanico | also works fine on windows + mingw 7.1 |
15:25:47 | GitDisc | <NopeDK> When FFI'ing with a "uint16_t" should I use "ptr cushort" or "UncheckedArray[cushort]"? |
15:26:07 | FromGitter | <zacharycarter> neither? |
15:26:11 | Yardanico | try c2nim |
15:26:18 | Yardanico | it will almost always give the best result :P |
15:26:23 | PMunch | And on Linux with GCC here |
15:26:55 | radagast | It kept loading last time I tried ¯\_(ツ)_/¯ |
15:27:12 | PMunch | NopeDK, with uint16_t you could just use a uint16 in Nim.. |
15:27:13 | Yardanico | radagast, maybe you have some strange browser? |
15:28:01 | PMunch | In fact cushort is just an alias for uint16 |
15:28:35 | radagast | Nope, Nightly. Here's a history of my local machine: https://pastebin.com/1sBj7rgj |
15:28:50 | Yardanico | ah |
15:28:56 | Yardanico | you're compiling with c++ for some reason |
15:29:09 | Yardanico | but it works with c++ for me too |
15:29:17 | Yardanico | try to clear nimcache |
15:30:13 | radagast | will do |
15:32:40 | Yardanico | generally you should clean nimcache if you compiled to c and want to compile too cpp |
15:32:43 | Yardanico | *to cpp |
15:32:48 | GitDisc | <NopeDK> My bad, I meant a "uint16_t *" |
15:33:17 | Yardanico | ptr uint16? |
15:33:43 | FromGitter | <RedBeard0531> "Use the --forceBuild" |
15:33:57 | Yardanico | yeah, or this |
15:34:45 | GitDisc | <NopeDK> Will try to install c2nim and see what it says, otherwise going with ptr. Thanks |
15:35:05 | Yardanico | well as I found in c2nim issues it seems uint16_t isn't supported |
15:35:12 | Yardanico | but it's really like "ptr uint16" |
15:35:26 | FromGitter | <zacharycarter> uint16_t isn't a real type |
15:35:31 | FromGitter | <zacharycarter> I'm pretty sure it's an alias |
15:35:48 | Yardanico | yes it is |
15:36:19 | * | rauss joined #nim |
15:36:32 | * | d10n-work joined #nim |
15:38:01 | FromGitter | <RedBeard0531> c2nim should probably just translate uint16_t to nim's uint16 (ditto the other [u]intXX_t types) |
15:39:39 | FromGitter | <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:02 | FromGitter | <zacharycarter> you can do this already |
15:40:33 | FromGitter | <zacharycarter> you can define aliases at the top of a header file for c2nim |
15:41:35 | FromGitter | <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:35 | FromGitter | <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:21 | FromGitter | <RedBeard0531> @zacharycarter through that magic, it means that nim's intXX is the same as c's intXX_t |
15:42:39 | FromGitter | <RedBeard0531> whatever real type your c compiler defines that to be |
15:43:26 | GitDisc | <NopeDK> Well, c2nim won't build so I will just go with the "ptr cushort" |
15:44:26 | * | Vladar quit (Quit: Leaving) |
15:46:21 | Yardanico | what do you mean by "won't build" btw? |
15:46:24 | Yardanico | c2nim is easy to isntall |
15:46:27 | Yardanico | "nimble install c2nim" |
15:48:50 | GitDisc | <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:03 | Yardanico | what's your nim version? |
15:50:04 | Yardanico | if you have latest devel |
15:50:05 | Yardanico | do this: |
15:50:06 | Yardanico | "nimble install compiler@#head c2nim@#head" |
15:50:59 | GitDisc | <NopeDK> 0.17.2, hash 811fbda snip 5860b38620 [Linux: arm] |
15:51:24 | Yardanico | wow, you're on ARM? :) |
15:52:06 | Yardanico | well you can still try "nimble install compiler@#head c2nim@#head" |
15:52:08 | GitDisc | <NopeDK> Yup, working on my Pi |
15:52:16 | Yardanico | first gen? |
15:53:59 | GitDisc | <NopeDK> 3rd |
15:54:18 | ieatnerds | model b? |
15:55:43 | Yardanico | I was just asking because pi 3 supports arm64 and nim does too :) |
15:55:55 | Yardanico | but you can always build a devel nim version |
15:55:57 | Yardanico | it's very easy |
15:56:10 | GitDisc | <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:40 | Yardanico | did you try "nimble install compiler@#head c2nim@#head"? |
15:58:03 | GitDisc | <NopeDK> Not yet, no |
15:58:42 | * | PMunch quit (Quit: Leaving) |
15:58:58 | GitDisc | <NopeDK> Slowly porting a giant .h file manually to get to learn what I need to build my server. |
15:59:58 | Yardanico | why are you doing it manually? :) |
16:00:18 | Yardanico | usually you try to run c2nim on it, and if it doesn't work, you change some lines in header file by hand |
16:01:06 | GitDisc | <NopeDK> There is hardly any documentation so it is to both learn porting and get to know the library |
16:03:52 | skrylar | so basically firebird all over again :b |
16:04:09 | GitDisc | <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:45 | skrylar | i recommend keeping a handy regex tool nearby, or even some elisp |
16:06:27 | skrylar | if 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:35 | GitDisc | <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:40 | FromGitter | <Varriount> NopeDK: How macro-heavy is the file? |
16:55:17 | FromGitter | <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:14 | Yardanico | ah, yes, gcc preprocessor makes things a lot easier |
16:57:11 | skrylar | mratsim: primitives for writing flatbuffers are done |
16:57:23 | FromGitter | <mratsim> :O so fast |
16:57:49 | FromGitter | <Varriount> so beautiful! |
16:57:55 | FromGitter | <mratsim> so furious |
17:02:55 | * | SenasOzys quit (Ping timeout: 248 seconds) |
17:03:21 | FromGitter | <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:57 | FromGitter | <Varriount> That was for Windows source code. |
17:04:04 | FromGitter | <Varriount> Er, Windows SDK source code. |
17:05:05 | Yardanico | wow |
17:05:19 | FromGitter | <Varriount> ? |
17:05:47 | Yardanico | Well did you use c2nim afterwards? |
17:06:00 | FromGitter | <Varriount> Yes. |
17:06:27 | Yardanico | so c2nim is very good if it can handle windows sdk code |
17:06:35 | FromGitter | <Varriount> Oh, I also had a regex find/replace stage too. |
17:06:36 | FromGitter | <ephja> skrylar: yeah, syscall for that bomb thing |
17:07:00 | FromGitter | <Varriount> Yardanico: Well, it can handle Windows SDK code *after* the preprocessor has been run on it. |
17:07:08 | skrylar | ephja: i was being dramatic. although it is possible to run commands which do stupid things |
17:07:09 | Yardanico | well it's amazing anyway |
17:07:32 | skrylar | crm114 is also kind of fun |
17:07:40 | skrylar | programmable 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:30 | GitDisc | <NopeDK> Have ported most of what I need to test but thanks for the tip Varriount. |
17:22:45 | * | ieatnerds joined #nim |
17:30:16 | FromGitter | <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:49 | FromGitter | <zacharycarter> I don't think you can do forward type declaration |
17:32:06 | FromGitter | <zacharycarter> you can declare dependent types within the same type block |
17:33:20 | FromGitter | <zacharycarter> you can have forward declared procedures and variables, but not types AFAIK |
17:34:33 | FromGitter | <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:27 | FromGitter | <zacharycarter> @dandevelo generally this requires some careful design and thinking about your types |
17:35:38 | FromGitter | <zacharycarter> alternatively you can just have a types file that you define types in |
17:39:32 | FromGitter | <dandevelo> @zacharycarter when using a types file, can I still access private fields? |
17:40:21 | FromGitter | <dandevelo> I mean from the implementation file |
17:41:50 | FromGitter | <zacharycarter> You can only access those fields that are exposed with the * access modifier |
17:42:19 | FromGitter | <dandevelo> :( Isn't there another way? |
17:44:10 | FromGitter | <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:10 | GitDisc | <treeform> Does any one know how to create a type that only supports 1 value - null? Some sort of null type? |
17:47:18 | GitDisc | <NopeDK> What is the Nim FFI equivalent of "extern struct structType structVariable;"? |
17:48:21 | GitDisc | <treeform> Nim does not have an FFI, it just outputs code. So {.emit: "extern struct structType structVariable;" .} ? |
17:48:51 | GitDisc | <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:33 | FromGitter | <zacharycarter> Only a ref object can be assigned nil I believe |
17:50:45 | GitDisc | <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:59 | GitDisc | <treeform> There is probably other ways to do what you want, I find emit a good stop gap to get stuff working. |
17:55:26 | GitDisc | <treeform> There are probably some forms of {.cdecl, exportc, dynlib.} that will produce what you want. |
17:55:39 | GitDisc | <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:46 | FromGitter | <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:04 | FromGitter | <RedBeard0531> type int128 = object {.externc: "__int128".} |
18:05:27 | FromGitter | <RedBeard0531> You'll need to define the all the ops on it too |
18:07:20 | FromGitter | <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:16 | FromGitter | <Varriount> Nopedk: exportc is how you should export a type |
18:13:57 | * | Trustable quit (Remote host closed the connection) |
18:23:33 | Araq | package level types allow forwarding |
18:24:00 | Araq | new 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:02 | FromGitter | <data-man> Oh, I forgot when I last played :) |
18:44:08 | * | xet7 quit (Quit: Leaving) |
18:45:19 | FromGitter | <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:15 | FromGitter | <mratsim> The strange thing is that I can comment a completely unrelated test in my test suite and everything compiles happily |
18:46:25 | FromGitter | <mratsim> Or comment this test and same thing :/ |
18:49:36 | FromGitter | <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:16 | FromGitter | <zacharycarter> or memory corruption? |
18:55:55 | FromGitter | <mratsim> I think it’s memory corruption because it’s using alloc0 allocation |
18:57:39 | skrylar | mratsim: let there be read primitives \o/ |
19:00:49 | FromGitter | <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:14 | FromGitter | <mratsim> Ah, I have an idea |
19:03:28 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/Kygg/2017-12-18_20-03-09.png) |
19:06:06 | * | solitudesf joined #nim |
19:08:42 | FromGitter | <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:47 | FromGitter | <zacharycarter> something similar |
19:10:09 | FromGitter | <tim-st> Is there a type like object or struct that I can make constant? |
19:10:33 | * | Vladar quit (Quit: Leaving) |
19:11:07 | FromGitter | <zacharycarter> what do you mean? |
19:12:22 | FromGitter | <tim-st> Or does it only not work for `type X = object of RootObj` --> `const x = X()` |
19:14:12 | FromGitter | <zacharycarter> consts are evaluated at compile time |
19:14:13 | FromGitter | <zacharycarter> https://nim-lang.org/docs/manual.html#statements-and-expressions-const-section |
19:14:21 | FromGitter | <tim-st> seems to work for `type X = object` but I want inheritance |
19:17:21 | FromGitter | <tim-st> Ok thanks, so object can never be const, is someother way like namedtuple that can be constant? |
19:20:12 | skrylar | interesting. we have a beanstalkd thing in nimble but not gearman |
19:21:36 | FromGitter | <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:36 | FromGitter | ... 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:50 | FromGitter | <zacharycarter> @tim-st : https://play.nim-lang.org/?gist=5000481a5ca58c80d933519f71d80437 |
19:22:57 | * | nsf joined #nim |
19:23:13 | FromGitter | <zacharycarter> @RedBeard0531 shuffles is not a pointer thus unsafeAddr won't work on it |
19:23:16 | FromGitter | <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:41 | FromGitter | <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:14 | FromGitter | <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:20 | FromGitter | <zacharycarter> @RedBeard0531 I misspoke - I'm not sure why const breaks unsafeAddr |
19:27:27 | FromGitter | <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:26 | FromGitter | <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:56 | skrylar | mratsim: well the primitives are done |
19:33:25 | FromGitter | <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:44 | FromGitter | <mratsim> @skrylar, cool, it’s on a repo? |
19:33:49 | * | ieatnerds quit (Ping timeout: 265 seconds) |
19:33:54 | skrylar | not on github yet |
19:34:18 | skrylar | you still have to manually write and read, it's just the base code for resolving vtable offsets and boring stuff |
19:34:38 | skrylar | there is also the option of using sksbox and json |
19:35:13 | * | fvs joined #nim |
19:35:54 | fvs | hi, getting the following error on exit from a program that calls a dll: |
19:35:57 | fvs | Error in `./ames2': double free or corruption (!prev): |
19:36:36 | FromGitter | <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:25 | fvs | is 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:55 | FromGitter | <zacharycarter> fvs - perhaps share some code? |
19:49:11 | * | jjido joined #nim |
19:52:09 | FromGitter | <Varriount> fvs: it wouldn't be Nim that frees space from the DLL, it would be the OS |
19:55:17 | fvs | np, valgrind to the rescue :) |
19:58:42 | FromGitter | <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:03 | FromGitter | <mratsim> using not issue |
19:59:39 | GitDisc | <NopeDK> First a question, can the "emit" pragma be combined with an "importc"? |
19:59:39 | GitDisc | <NopeDK> I am currently doing it kinda hacky like this |
19:59:41 | GitDisc | <NopeDK> ```{.emit: """ |
19:59:42 | GitDisc | <NopeDK> #include header.h |
19:59:43 | GitDisc | <NopeDK> extern struct StructFromHeader varName; |
19:59:44 | GitDisc | <NopeDK> """.}``` |
19:59:46 | GitDisc | <NopeDK> Any way to import the "StructFromHeader" without resolving to the above code? |
20:00:51 | FromGitter | <mratsim> @RedBeard0531 I now I could use the .data segment with a global var: array[1337, int] and take its address |
20:03:48 | FromGitter | <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:23 | FromGitter | <mratsim> Look here: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_kernels_interface_cuda.nim |
20:04:54 | FromGitter | <mratsim> I have a template that emits the code and then create the bindings |
20:05:03 | FromGitter | <mratsim> with importcpp (no need for include sorry) |
20:05:44 | FromGitter | <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:52 | FromGitter | <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:08 | FromGitter | <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:43 | FromGitter | <zacharycarter> skrylar: I wonder if this might be useful in writing a job scheduling system - https://github.com/mogud/nimfiber |
20:14:51 | FromGitter | <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:51 | FromGitter | <mratsim> @zacharycarter fibers are not for multithreading if you want multithreading. Though you can probably put that on top of a threadpool. |
20:15:54 | FromGitter | <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:57 | FromGitter | <mratsim> would be nifty :) |
20:16:48 | FromGitter | <zacharycarter> @mratsim was reading about : http://twvideo01.ubm-us.net/o1/vault/gdc2015/presentations/Gyrling_Christian_Parallelizing_The_Naughty.pdf |
20:16:52 | FromGitter | <mratsim> @tim-st, just use `let` then? |
20:17:49 | FromGitter | <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:04 | GitDisc | <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:50 | FromGitter | <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:35 | FromGitter | <mratsim> @NopeDK, getting the Nim type is broken |
20:20:05 | FromGitter | <tim-st> @mratsim So would you say that an inheritated type which will never changed in future could be possible and const? |
20:20:14 | GitDisc | <NopeDK> Alright, I will just keep the hack for now and open a feature request. Thanks. |
20:20:27 | FromGitter | <mratsim> @nopedk probably relevant: https://github.com/nim-lang/Nim/issues/6415 |
20:21:00 | FromGitter | <mratsim> @tim-st I think @Araq is the best man to ask ;) |
20:21:01 | * | ieatnerds joined #nim |
20:21:38 | GitDisc | <NopeDK> That template seems to be from cpp to Nim where I am looking for the opposite. |
20:21:41 | FromGitter | <mratsim> but concepts are probably the best way to do that |
20:22:49 | FromGitter | <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:26 | FromGitter | <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:06 | arthurz | Hi there, I'm curious why I am getting error at `except dbError(db: DbConn): |
20:24:06 | arthurz | echo "Connection failed!"` testpg.nim(8, 15) Error: type expected |
20:24:16 | FromGitter | <mratsim> @tim-st that sounds like an object variant no? |
20:26:09 | FromGitter | <zacharycarter> arthurz: please share some code |
20:26:17 | * | miran quit (Quit: Konversation terminated!) |
20:26:24 | arthurz | import db_postgres |
20:26:24 | arthurz | var |
20:26:24 | arthurz | db: DbConn |
20:26:24 | arthurz | try: |
20:26:24 | arthurz | echo "Attempting to open the local PG db..." |
20:26:24 | arthurz | db = open("localhost", "postgres", "1234", "SandBox") |
20:26:26 | arthurz | except dbError(db: DbConn): |
20:26:30 | arthurz | echo "Connection failed!" |
20:26:32 | arthurz | finally: |
20:26:34 | arthurz | db.close() |
20:26:36 | arthurz | echo "Closed the database" |
20:26:47 | FromGitter | <tim-st> @mratsim Hm, could be possible, will try it, thanks! |
20:27:27 | Yardanico | arthurz, probably because you have "except dbError(db: DbConn) |
20:27:43 | Yardanico | and I strongly suggest you to use gist/pastebin/nim playground for code sharing |
20:27:43 | FromGitter | <zacharycarter> arthurz: for future reference you can paste code snippets between triple backticks |
20:27:48 | arthurz | what is the proper use @Yardanico ? |
20:28:09 | Yardanico | arthurz, just "except dbError:" |
20:28:15 | Yardanico | ah wait |
20:28:28 | Yardanico | yes |
20:28:43 | FromGitter | <zacharycarter> http://ourmachinery.com/post/a-year-in-review/ - lots of good reading here |
20:28:44 | Yardanico | it should work |
20:31:11 | arthurz | I tried that before posting Yardanico, got ```testpg.nim(8, 8) Error: type expected``` |
20:35:24 | arthurz | found what it is, a typo must be ```except DbError``` |
20:42:20 | FromGitter | <tim-st> @mratsim doesn't work too for const init, thanks though! |
20:42:37 | FromGitter | <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:49 | GitDisc | <NopeDK> Must parameters be named when declaring a proc? If not, how do you do unnamed typed parameters? |
20:53:09 | FromGitter | <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:15 | Yardanico | NopeDK they must be named, why would you want unnamed params? |
20:54:24 | Yardanico | well your proc can accept an openarray |
20:54:25 | Yardanico | or varargs |
20:54:51 | * | marenz__ joined #nim |
20:54:58 | GitDisc | <NopeDK> It was for usage with importc when the header has unnamed parameters. |
20:55:00 | GitDisc | <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:18 | FromGitter | <zacharycarter> Is it just me or does the new firefox crash quite often? |
21:21:44 | Yardanico | plot 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:31 | FromGitter | <SolitudeSF> never crashed for me, and i have it open almost all day |
21:38:40 | FromGitter | <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:20 | GitDisc | <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:31 | FromGitter | <ephja> it's a code generation bug |
22:04:14 | GitDisc | <NopeDK> As in a Nim bug or code bug? |
22:04:45 | Araq | more likely your own bug |
22:05:44 | Araq | you wrapped something in a wrong way |
22:06:55 | GitDisc | <NopeDK> Hmm... |
22:09:50 | FromGitter | <ephja> I missed some context |
22:13:58 | FromGitter | <mratsim> @zacharycarter there is a huge bug on MacOS with the new Firefox |
22:14:37 | FromGitter | <mratsim> https://www.reddit.com/r/firefox/comments/7g6k9n/firefox_quantum_is_eating_your_cpu_help_us_debug/ |
22:23:16 | FromGitter | <Yardanico> Not only on macos it seems |
22:26:03 | FromGitter | <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:32 | GitDisc | <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:33 | GitDisc | <NopeDK> Something like this: |
22:46:35 | GitDisc | <NopeDK> ```struct SomeThing { |
22:46:36 | GitDisc | <NopeDK> int (*on_init) (char *, int); |
22:46:37 | GitDisc | <NopeDK> };``` |
22:46:39 | GitDisc | <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:55 | FromGitter | <zacharycarter> NopeDK: I'm guessing you mean a function pointer? |
23:14:46 | GitDisc | <NopeDK> Probably, yeah |
23:15:53 | FromGitter | <zacharycarter> I have |
23:15:58 | FromGitter | <zacharycarter> please refer to the following |
23:18:18 | FromGitter | <zacharycarter> never mind, I took a closer look at my code and it's not doing what you're describing |
23:18:49 | FromGitter | <zacharycarter> NopeDK: can you make a small reproducible example and create a gist? |
23:18:59 | FromGitter | <zacharycarter> or I can try if you're unsure how |
23:19:42 | FromGitter | <zacharycarter> i'm fairly certain what you're trying to do works without issue |
23:19:48 | FromGitter | <zacharycarter> so it's probably down to implementation |
23:21:58 | GitDisc | <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:13 | FromGitter | <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:49 | FromGitter | <kinokasai> Hey folks |
23:40:06 | FromGitter | <kinokasai> Is there any way to get the size of a data structure at runtime? |
23:41:04 | skrylar | .sizeof doesn't work? |
23:41:12 | skrylar | mratsim: https://github.com/Skrylar/skflatbuffers not super usable yet |
23:42:30 | * | qih left #nim (#nim) |
23:43:08 | FromGitter | <kinokasai> I mean, l |
23:43:39 | FromGitter | <kinokasai> I mean, like having the memory used by something like a tree-like structure as a whole |
23:44:12 | FromGitter | <kinokasai> `sizeof` just gives the size of the struct, right? |
23:48:05 | FromGitter | <mratsim> yes |
23:48:21 | FromGitter | <mratsim> it doesn’t account for memory on the heap |
23:48:50 | FromGitter | <mratsim> but the GC has some allocation statistics, or you compute it by hand |
23:49:53 | FromGitter | <kinokasai> Hm. |
23:50:12 | FromGitter | <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:58 | FromGitter | <mratsim> @skrylar wow, if the spec is just that, that sure is dead simple |
23:52:52 | skrylar | mratsim: yup, its basically just offsets and blitting |
23:52:53 | FromGitter | <mratsim> you could filter to count size only once per ref |
23:52:54 | FromGitter | <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:21 | FromGitter | <kinokasai> Just recurse and sizeof * number of instances ? |
23:54:22 | FromGitter | <mratsim> are all references unique? |
23:54:23 | FromGitter | <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:48 | FromGitter | <kinokasai> Yeah, it's a tree |
23:55:14 | FromGitter | <RedBeard0531> But it is probably easier to just keep a size int and just update it as you add/remove nodes |
23:55:44 | FromGitter | <RedBeard0531> the incs are free and that makes fullSize a free O(1) rather than an expensive O(n) |
23:56:33 | FromGitter | <kinokasai> Hm. |
23:56:43 | FromGitter | <kinokasai> True, thanks. |
23:57:55 | FromGitter | <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:58 | FromGitter | <mratsim> unless you were talking about free in terms of memory |
23:59:06 | FromGitter | <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:38 | FromGitter | <mratsim> oh interesting point of view |
23:59:39 | FromGitter | <kinokasai> Off-topic, but is there any resource on efficient nim coding ? something about common pitfalls and such |