00:00:29 | FromDiscord | <demotomohiro> I think you need to C library manual/reference to see if that pointer points to single value or an array of values. |
00:10:34 | FromDiscord | <Elegantbeef> in assimp most types are pointer as such `ptr UncheckedArray[ptr Skeleton]` is right |
00:15:35 | * | flouer_ quit (Ping timeout: 264 seconds) |
00:17:41 | FromDiscord | <heysokam> kk ty |
00:47:44 | * | azimut quit (Ping timeout: 240 seconds) |
01:02:07 | * | flouer_ joined #nim |
01:15:53 | * | Jjp137 quit (Quit: Leaving) |
01:16:44 | * | Jjp137 joined #nim |
01:20:37 | * | Batzy quit (Server closed connection) |
01:20:40 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
01:20:53 | * | Batzy joined #nim |
01:23:30 | * | Lord_Nightmare joined #nim |
01:44:08 | termer | Ok I've got another trivial question about interfacing with C |
01:44:24 | termer | If I used .emit. to create a char array, how could I reference that in my Nim code |
01:44:37 | termer | static unsigned char pixmap_test [] = { 0, 0, 0 }; |
01:44:50 | termer | I tried |
01:44:54 | termer | var pixmap_test {.importc.}: cstring |
01:45:08 | termer | but that's leading to C errors |
01:48:43 | FromDiscord | <michaelb.eth> In reply to @termer "If I used .emit.": why not use an `UncheckedArray[cchar]` on the nim side, and pass it's `addr` to C? |
01:48:58 | FromDiscord | <michaelb.eth> as an alternative to emit, I mean |
01:49:02 | termer | Because I didn't know it existed lol |
01:49:15 | FromDiscord | <michaelb.eth> π |
01:49:17 | termer | but I'd also like to know how to do what I need to with emit as well |
01:49:32 | FromDiscord | <Elegantbeef> Why not just \`pixmapTest = cstring"\\0\\0"? |
01:49:52 | FromDiscord | <michaelb.eth> yeah, good point, cstring is basically the same thing |
01:50:02 | termer | because I'm trying to translate some C examples as literally as possible |
01:50:18 | FromDiscord | <michaelb.eth> In reply to @termer "but I'd also like": you may be aware, but if not, keep in mind that emit doesn't work at compile-time |
01:50:19 | termer | another dev and I are having a hell of a time interfacing with a C library |
01:50:34 | termer | That much is obvious |
01:50:44 | termer | it depends wholly on the C compiler lo |
01:50:45 | termer | *lol |
01:50:57 | FromDiscord | <michaelb.eth> (edit) "In reply to @termer "but I'd also like": you may be aware, but if not, keep in mind that emit doesn't work at ... compile-time" added "Nim" |
01:51:42 | termer | ok, so how would I use UncheckedArray |
01:52:07 | FromDiscord | <Elegantbeef> They're not stack allocatable so you wouldnt |
01:52:34 | FromDiscord | <Elegantbeef> why is `const a = ['\0', '\0', '\0']` out of the question aswell? |
01:52:45 | termer | because I need the address |
01:52:57 | termer | I did use a const initially |
01:54:33 | * | oldpcuser_ joined #nim |
01:55:57 | FromDiscord | <Elegantbeef> So then do `let a = ['\0', '\0', '\0']` and hope that Nim makes that a ptr to static memory \:d |
01:56:29 | * | oldpcuser quit (Ping timeout: 240 seconds) |
02:05:10 | * | oldpcuser_ quit (Ping timeout: 252 seconds) |
02:06:01 | FromDiscord | <kcvinker5420> I want to run `ffmpeg` in background with a command and get the outputs at real time. Also want to send a `"q"` when user press "stop" button. Where do I start ? Any guidance ? |
02:06:49 | FromDiscord | <Elegantbeef> I'd say use the bindings over cli, but you do you |
02:07:21 | termer | kcvinker5420, I wrote a library for this |
02:07:26 | FromDiscord | <Elegantbeef> `startProcess` inside osproc likely is what you want |
02:07:32 | termer | minus the q button |
02:07:55 | FromDiscord | <kcvinker5420> Great ! |
02:07:56 | termer | https://github.com/termermc/nim-ffmpeg-cli |
02:08:11 | termer | also has support for FFprobe and mostly complete representations of its output |
02:09:04 | termer | https://github.com/termermc/nim-ffmpeg-cli/blob/master/src/ffmpeg_cli/ffmpeg.nim |
02:09:07 | termer | There are runnable examples here |
02:09:15 | FromDiscord | <kcvinker5420> @termer Thanks. Let me check that. |
02:10:49 | termer | keep in mind that it depends on asyncdispatch |
02:11:03 | termer | Unfortunately I haven't added chronos support (yet?) |
02:11:21 | FromDiscord | <kcvinker5420> I don't know nothing about `asyncdispatch`. So no probs |
02:11:58 | termer | This should have everything need since it can terminate processes with cancel() |
02:12:42 | FromDiscord | <kcvinker5420> That's great. |
02:13:07 | FromDiscord | <kcvinker5420> Burning time codes to video is my requirement |
02:13:52 | termer | what're you trying to build |
02:14:30 | FromDiscord | <kcvinker5420> An application which help me to burn time code into video. |
02:15:05 | FromDiscord | <kcvinker5420> I have windows only gui lib. |
02:15:25 | FromDiscord | <kcvinker5420> So, I thought, I can write one |
02:16:13 | termer | fair enough |
02:16:18 | termer | let me know if you need any help with my lib |
02:16:24 | FromDiscord | <kcvinker5420> Sure |
02:16:30 | termer | I wrote it for a video converter queue for a website |
02:18:09 | FromDiscord | <kcvinker5420> Oh i see. |
02:18:25 | FromDiscord | <kcvinker5420> So I hope it will take custom commands |
02:18:41 | termer | yeah |
02:18:56 | termer | it has a bunch of presets for convenient construction of commands, but you can write in raw strings if you need |
02:19:40 | FromDiscord | <kcvinker5420> That's great ! |
02:54:52 | * | cedb quit (Ping timeout: 240 seconds) |
02:56:55 | * | cedb joined #nim |
03:10:47 | FromDiscord | <JeysonFlores> sent a long message, see http://ix.io/4z25 |
03:11:02 | FromDiscord | <JeysonFlores> (edit) "http://ix.io/4z25" => "http://ix.io/4z26" |
03:12:51 | FromDiscord | <Elegantbeef> `const myfile = staticread("myfile.txt")` |
03:15:10 | FromDiscord | <JeysonFlores> thanks |
03:55:17 | * | flouer_ quit (Remote host closed the connection) |
03:55:51 | * | flouer_ joined #nim |
04:12:59 | * | azimut joined #nim |
04:56:47 | * | flouer_ quit (Remote host closed the connection) |
04:59:15 | * | flouer_ joined #nim |
05:07:21 | FromDiscord | <JJ> is the `{.noreturn.}` pragma the closest thing to a proper bottom type that nim has? |
05:08:34 | FromDiscord | <Elegantbeef> I'll say sure cause bottom type means nothing to me |
05:13:54 | FromDiscord | <JJ> uh, a type that cannot be instantiated to a value |
05:14:10 | FromDiscord | <JJ> and is a subtype of every type but that doesn't mean much wrt. nim |
05:15:21 | FromDiscord | <JJ> i.e. `panic!()` in rust is actually of type `never`: `fn panic!() -> !` |
05:15:27 | FromDiscord | <Elegantbeef> `type MyType = distinct void` |
05:15:31 | FromDiscord | <JJ> hmm |
05:18:37 | FromDiscord | <huantian> Be careful, if you gaze into the distinct void, the beef gazes also into you. |
05:30:31 | FromDiscord | <Elegantbeef> Oh also @JJ I looked at your uxn repo and seen your `futurmacro` idea |
05:30:40 | FromDiscord | <Elegantbeef> makes more sense to do `of Opcode(a, b): body` |
05:38:17 | FromDiscord | <odexine> Void is not a bottom type |
05:38:32 | FromDiscord | <odexine> A bottom type signifies that the function never returns |
05:39:11 | FromDiscord | <odexine> Aka either literally never returns by looping in some form forever, or technically by crashing or ending the program |
05:39:37 | FromDiscord | <Elegantbeef> So a `raise`? |
05:39:55 | FromDiscord | <odexine> Or a while true |
05:40:34 | FromDiscord | <odexine> Quit also theoretically uses this bottom type |
05:41:06 | FromDiscord | <odexine> The expression value of a break or return also technically does use this bottom type IIRC |
06:06:59 | FromDiscord | <elamandeep> I'm stuck with this error https://media.discordapp.net/attachments/371759389889003532/1122407574663335946/image.png |
06:07:19 | FromDiscord | <Elegantbeef> The file is not named "holloworld" |
06:07:28 | FromDiscord | <elamandeep> (edit) removed "error" |
06:08:15 | FromDiscord | <elamandeep> In reply to @Elegantbeef "The file is not": lol. I made simpler mistakeπ
|
06:14:53 | * | ntat joined #nim |
06:31:35 | NimEventer | New thread by 3210jr: Introduction to Applied Linear Algebra series of blog posts, see https://forum.nim-lang.org/t/10298 |
06:32:17 | * | flouer_ quit (Remote host closed the connection) |
06:39:07 | * | flouer_ joined #nim |
06:44:08 | FromDiscord | <heysokam> is there a way to access the number of processors at compile time, similar to `std/cpuinfo.countProcessors()`? |
08:27:24 | FromDiscord | <jmgomez> In reply to @heysokam "<@726017160115126333> any tips on": I never wrapped a C one but I guess the approach it's kinda similar. If it's too complex you can do a facade in C++ first and start from there |
08:28:52 | FromDiscord | <heysokam> main issues is the syntax details, for how to access methods/etc |
08:28:58 | FromDiscord | <heysokam> (edit) "issues" => "issue" |
08:29:07 | FromDiscord | <jmgomez> Im not familiar with happyX. What I have done is to build the core of an app in pure Nim, share code with the server and multiple clients. i.e. one targetting low level, another mobile via js and another targeting the web. What I usually did is to ouput js and types in TS for it. and someone else used those types to build an interface |
08:29:38 | FromDiscord | <jmgomez> In reply to @heysokam "main issue is the": the docs are ok, but if you have any specific questions let me know |
08:32:28 | FromDiscord | <heysokam> @jmgomez i guess the confusion is all coming from all the wizardly `<'0>`, `#[#]` `@` things |
08:34:54 | FromDiscord | <jmgomez> It's quite simple when you get the hang of it, the first just mean the type in a template, the `#` is a param, its positional so `func(arg1, arg2: int) {.importcpp:"func(#, #)"` just mean arg1 and arg2 and the `@` means the rest of the params so it can be rewritten as `func(@)` or even `func(#,@)` |
08:37:16 | FromDiscord | <heysokam> i figure the #,# are needed to call for specific overloads? |
08:37:28 | FromDiscord | <heysokam> (edit) "call for" => "wrap" |
08:38:41 | FromDiscord | <jmgomez> not following, what do you mean with specific overloads |
08:41:28 | FromDiscord | <heysokam> In reply to @jmgomez "not following, what do": you could have `func(arg1, arg2)` and `func(arg1)`, so if you call for `importcpp: "func"` the compiler doesn't now which one specifically to wrap? |
08:41:46 | FromDiscord | <heysokam> but im just guessing, so it might be completely wrong |
08:42:53 | FromDiscord | <jmgomez> the compiler knows the number of arguments of the function that you are wrapping so it does know as the relation is 1 nim func to 1 cpp func |
08:46:18 | FromDiscord | <heysokam> In reply to @jmgomez "the compiler knows the": yeah but if there are two functions with the same name, and different arguments, what does it do if you only wrap with `importcpp: "functionName"`? |
08:46:37 | FromDiscord | <heysokam> (edit) "In reply to @jmgomez "the compiler knows the": yeah but if there are two ... functions" added "(or more)" |
08:48:04 | FromDiscord | <jmgomez> it will use the argument of the function you are wrapping, for each overload you will need to do `importcpp` again |
08:48:37 | FromDiscord | <heysokam> whats the use for `#` then? i thought it was to disambiguate π€ |
08:54:22 | * | mad_toothbrush joined #nim |
08:58:05 | FromDiscord | <jmgomez> to pick the param you want to pass over, as you can do `#2 #1` |
09:09:02 | * | mad_toothbrush quit (Ping timeout: 252 seconds) |
09:40:32 | * | azimut quit (Ping timeout: 240 seconds) |
10:21:01 | * | acidsys quit (Server closed connection) |
10:21:21 | * | acidsys joined #nim |
10:39:08 | FromDiscord | <wungussy> Is there a speed difference between declaring variables types manually and letting it be inferred in compilation? |
10:39:37 | FromDiscord | <wungussy> If so, is it big enough to justify specifying all variables as their type statically? |
10:48:03 | FromDiscord | <odexine> Speed in compilation maybe a little bit |
10:48:08 | FromDiscord | <odexine> Speed on run time no |
10:51:18 | FromDiscord | <wungussy> ok cool thanks |
11:09:16 | FromDiscord | <Phil> I'd proclaim that you're doing "superfluous" type annotations more for yourself than for the compiler. |
11:09:24 | FromDiscord | <Phil> (edit) "I'd proclaim that you're doing "superfluous" ... type" added "(those that can already be inferred)" |
11:31:47 | FromDiscord | <odysseus> Hello to all.β΅β΅May I ask a question regarding the Nim language? I am a completely newcomer, so please excuse my ignorence. |
11:33:30 | FromDiscord | <odysseus> sent a long message, see https://paste.rs/8lMhe |
11:33:45 | FromDiscord | <Andreas> In reply to @odysseus "Hello to all. ": welcome odysseus - guess you're on a intresting journey, as always - go ahead.. |
11:34:05 | FromDiscord | <odysseus> Thank you!β΅(@Andreas) |
11:37:48 | FromDiscord | <Zoom> Look at [`strutils.strip`](https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D) for stripping the quotes prior to parsing. Then you need to [handle](https://nim-lang.org/docs/manual.html#exception-handling) the `ValueError` exceptions in case the user provided an invalid input. |
11:38:11 | FromDiscord | <Zoom> Ask for clarifications if you need further help |
11:38:56 | FromDiscord | <odysseus> OK just a final one\: Why is "Jack" treated differently than "2001"? I mean the code is OK with either Jack or "Jack" and 2001 but upon inserting "2001" the problem appears |
11:39:18 | FromDiscord | <odysseus> Sorry if it is stupid question |
11:39:58 | FromDiscord | <odexine> In reply to @odysseus "OK just a final": you arent doing any parsing with the name, so any string will work, even "Jack without a closing quotation mark |
11:40:12 | FromDiscord | <odexine> with the number you are parsing, so it has to be exactly a number only |
11:40:14 | FromDiscord | <odexine> nothing else |
11:40:32 | FromDiscord | <odysseus> Oh I see... perfect ... thank you so muchβ΅(@odexine) |
11:41:07 | FromDiscord | <odysseus> Although, from my naive point of view, a string is a string -no matter what πββοΈ |
11:42:08 | FromDiscord | <Zoom> You're reading the data as it's entered - as a text, so the data is returned as a `string` type. To work with the numbers (such as doing the subtraction), you need to first convert the string `"2001"` to a numerical type - `int`. |
11:42:53 | FromDiscord | <odysseus> corrent...so I used .parseInt() ...but I guess here is your point |
11:45:19 | FromDiscord | <Zoom> Yea, you used it correctly, but this conversion can result in an error if the string can't be correctly converted to an integer (such as if it has quotes or any other characters besides digits and possibly a leading `-`). |
11:47:05 | FromDiscord | <Zoom> So you strip the string you got from the user from possible quotes, store the result in a `string` variable and try to parse the variable to an integer in a `try-except` block. If you do it successfully, you assign the result of the parsing to an `int` variable and do the further operations with it. |
11:47:59 | FromDiscord | <odysseus> I really thank you for both your time and kind/detailed explanation. |
12:11:51 | FromDiscord | <krisp0> sent a long message, see http://ix.io/4z3E |
12:20:35 | FromDiscord | <intellj_gamer> Is the file saved? Line 10 doesn't look to be an import |
12:20:42 | FromDiscord | <intellj_gamer> (edit) "Is the file saved? Line 10 doesn't look to be an import ... " added "relating to dimscord" |
12:26:31 | FromDiscord | <krisp0> yes |
12:29:02 | FromDiscord | <krisp0> I resaved it https://media.discordapp.net/attachments/371759389889003532/1122503719674724412/image.png |
12:30:19 | FromDiscord | <krisp0> and doing `dir ../dimscord` returns as usual https://media.discordapp.net/attachments/371759389889003532/1122504038148223017/image.png |
12:32:15 | FromDiscord | <intellj_gamer> `../dimscord/dimscord` maybe? |
12:32:32 | FromDiscord | <krisp0> oh nvm I get it why, it's trying to open a file but I linked it to a folder lol |
12:32:33 | FromDiscord | <intellj_gamer> Since its needs to import `dimscord.nim` that is in the dimscord folder |
12:32:42 | FromDiscord | <krisp0> it worked with that |
13:31:58 | * | ntat quit (Quit: Leaving) |
13:33:27 | FromDiscord | <djazz> sent a code paste, see https://paste.rs/zuO6U |
13:33:44 | FromDiscord | <djazz> retaining the type through to futhark would be optimal |
13:34:31 | FromDiscord | <djazz> https://github.com/boschsensortec/BME68x-Sensor-API/blob/master/bme68x_defs.h full header |
13:47:50 | FromDiscord | <pmunch> Hmm, that's going to be hard.. |
13:51:11 | FromDiscord | <pmunch> I wonder if it's possible to do something like `typeof(BME68X_CHIP_ID) random_ident = BME68X_CHIP_ID;` in C |
13:51:41 | FromDiscord | <pmunch> That would make it possible to spit out tiny dummy files to get these types |
13:57:48 | FromDiscord | <pmunch> Oh wait, that is valid C π |
13:58:00 | FromDiscord | <pmunch> (edit) "π" => "π€" |
14:00:59 | FromDiscord | <djazz> getting `addUsings: {"kind":"invalid","value":"unexposed?"}` when trying that hmm |
14:01:08 | FromDiscord | <djazz> Unknown node in addUsings |
14:13:19 | * | Hess joined #nim |
14:13:38 | * | Hess is now known as Arthur |
14:13:42 | * | Arthur is now known as Hess |
14:22:02 | * | Hess is now known as Arthur |
14:22:04 | FromDiscord | <djazz> I tried this but it doesnt get the value, futhark spits out a var: `static const auto aa = BME68X_CHIP_ID;` |
14:23:04 | FromDiscord | <djazz> without static: `@mtstdint.nim.c:(.text+0x200): undefined reference to `aa'` |
14:24:34 | FromDiscord | <djazz> no preprocessor im guessing? |
14:24:58 | FromDiscord | <spotlightkid> Short question\: is the path given to `staticRead()` always relative to the source file the call is in? |
14:26:53 | Amun-Ra | yes |
14:35:17 | FromDiscord | <pmunch> @djazz, what exactly did you try? I was thinking of making Opir spit out those files and then parse them again |
14:46:02 | FromDiscord | <oa3> Do you have any recommendation of libarys for ml? |
14:47:22 | * | Arthur quit (Quit: The Lounge running.on.hess.the.br) |
14:47:40 | * | Arthur joined #nim |
14:58:58 | * | junaid_ joined #nim |
14:59:32 | * | lucasta joined #nim |
15:08:45 | FromDiscord | <elamandeep> how i can see the actual c code? It's converting directly to exe? |
15:08:55 | FromDiscord | <elamandeep> (edit) "exe?" => "exe" |
15:11:00 | FromDiscord | <griffith1deadly> In reply to @elamandeep "how i can see": your system disk/Users/your user/nimcache/your project name_d or r |
15:12:17 | FromDiscord | <elamandeep> In reply to @griffith1deadly "your system disk/Users/your user/nimcache/your": I mean through command |
15:12:45 | FromDiscord | <elamandeep> (edit) "I mean through" => "Through" | "Throughcommand ... " added "?" |
15:13:00 | FromDiscord | <elamandeep> (edit) "?" => "how we can see actual c code?" |
15:14:05 | FromDiscord | <griffith1deadly> In reply to @griffith1deadly "your system disk/Users/your user/nimcache/your": always at compile time the C code is here |
15:14:19 | FromDiscord | <griffith1deadly> (edit) "C" => "C/Cpp" |
15:14:53 | FromDiscord | <griffith1deadly> even when it is compiled directly into an executable file |
15:16:06 | FromDiscord | <elamandeep> ok |
15:31:08 | FromDiscord | <pmunch> You can also set the cache folder with the `nimcache` switch, in case you dont want to hunt for your cache folder |
15:31:38 | * | azimut joined #nim |
15:34:02 | FromDiscord | <elamandeep> ok |
15:34:43 | FromDiscord | <elamandeep> In reply to @pmunch "You can also set": how to set cache folder? |
15:35:42 | FromDiscord | <elamandeep> (edit) "In reply to @pmunch "You can also set": how to set ... cache" added "the cache folder and is it possible to change it to default after setting the" |
15:39:27 | FromDiscord | <pmunch> As I said, with the `nimcache` switch: https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory |
15:40:14 | FromDiscord | <pmunch> Setting it is only valid for the current compilation. But you can set a system or project default by putting it in the respective config.nims file |
15:41:04 | FromDiscord | <gogolxdong666> Is nimbus-eth1 usable? |
15:43:09 | FromDiscord | <gogolxdong666> I cannot connect to static nodes. |
15:57:56 | * | junaid_ quit (Remote host closed the connection) |
16:08:19 | * | ntat joined #nim |
16:11:15 | * | lucas_ta joined #nim |
16:13:47 | * | lucasta quit (Ping timeout: 264 seconds) |
16:16:00 | FromDiscord | <voidwalker> Anyone experienced with serializing/deserializing libs ? Been using binarylang but it has some annoying limitations (have to use seq, for fixed length byte arrays) and it probably has some non negligeable overhead. I need something close to 0 cost, or 0 cost. Also many conversions from big endian needed. |
16:22:55 | * | lucas_ta quit (Quit: Leaving) |
16:43:15 | FromDiscord | <pmunch> Well, I wrote binaryparser which is the precursor to binarylang so I have some insight |
16:43:32 | FromDiscord | <pmunch> Capn proto seems like the closest fit |
16:46:50 | FromDiscord | <pmunch> Really depends on what you need though |
16:46:53 | FromDiscord | <voidwalker> Yeah I know it's derived from binaryparser. But both not really maintained (or very slowly). |
16:46:56 | FromDiscord | <_gumbercules> In reply to @voidwalker "Anyone experienced with serializing/deserializing": Protocol buffers are pretty rad if you don't mind having to produce a schema and are pretty similar to apache thrift. Avro I think is a better fit if you want your messages to be decodable by humans |
16:46:59 | FromDiscord | <voidwalker> https://github.com/sgmihai/torrentim/blob/master/protocol/udpTrackerStruct.nim https://github.com/sgmihai/torrentim/blob/master/protocol/peerMessageStruct.nim |
16:47:08 | FromDiscord | <voidwalker> nothing too fancy, these two files above, for torrent stuff |
16:47:18 | FromDiscord | <_gumbercules> Flatbuffers if you're prioritizing perf but they have some annoying limitations |
16:47:59 | FromDiscord | <pmunch> Binaryparser was mostly meant to read binary file formats. I wrote it to be able to handle PNG and some weird satellite data format I was working with at the time |
16:48:41 | * | xet7 quit (Remote host closed the connection) |
16:48:45 | FromDiscord | <voidwalker> Strings in binarylang have the annoying property of breaking on \00 char, so I had to use subparser to repeat u8 n times, which have the annoying property of not working with arrays as input when I want to serialize, have to conver to Seq, that and the other binarylang specific overheads, made me reconsider to go to something more lower level |
16:48:52 | FromDiscord | <_gumbercules> Flatbuffers are also more efficient if you https://github.com/kcchu/buffer-benchmarks |
16:48:58 | FromDiscord | <_gumbercules> (edit) removed "Flatbuffers are also more efficient if you" |
16:49:35 | FromDiscord | <pmunch> Oh yeah, binaryparser was never written to be fast |
16:50:07 | FromDiscord | <voidwalker> Was nice to have a declarative syntax for the protocol, that also did endian conversion, and not have to worry about it, but the limitations above make me reconsider it. And while reconsidering it, why not make sure I get the fastest possible performance. |
16:50:41 | FromDiscord | <voidwalker> Serde in rust is supposed to be 0 cost |
16:50:41 | FromDiscord | <pmunch> I mean another alternative is to contribute fixes to remove those limitations π€·ββοΈ |
16:51:01 | FromDiscord | <voidwalker> Nah, I am barely smart enough to use binarylang, never wrote a line of macro in my life : ) |
16:51:47 | FromDiscord | <_gumbercules> In reply to @voidwalker "Serde in rust is": everything in rust is supposed to be zero cost |
16:52:03 | FromDiscord | <_gumbercules> except for your brain exploding from programming in Rust |
16:52:18 | FromDiscord | <_gumbercules> and you flying into a fit of rage and destroying something |
16:52:22 | FromDiscord | <_gumbercules> both of those things Rust doesnt' claim are free |
16:52:37 | FromDiscord | <voidwalker> I found this, doesn't say it's 0 cost, just efficient, "serde-like" https://github.com/gabbhack/deser |
16:53:22 | FromDiscord | <voidwalker> yeah but you have 100x ? more coders than nim, better docs/tutorials |
16:55:31 | FromDiscord | <pmunch> So your issues with binarylang is unable to handle zeros in strings, and unable to serialize non-seq iterables? |
16:56:17 | FromDiscord | <voidwalker> yes, and that I don't know the performance overhead, which is not that low as protobuf etc, I imagine |
16:56:49 | FromDiscord | <voidwalker> the author made it quite clear that strings are not supposed to have 0's in them, so that's a non issue, as far the project is concerned. |
16:57:56 | FromDiscord | <voidwalker> The alternative is to use a subparser, that just repeats an u8 n times. But that can only work with seq data. I am not sure what the tradeoff would be for using seq for a data structure that is always fixed length. |
16:58:37 | FromDiscord | <voidwalker> Also it's annoying to have a subparser for every "string" in the structure |
17:00:43 | FromDiscord | <voidwalker> Also I don't have sub-byte/bit data, and it uses bitstreams to support that. That probably has some overhead as well |
17:03:50 | FromDiscord | <voidwalker> They're not that complex structures that I can't write a hand craft parser for, but I'd have wanted something more pretty/readable for the code. And I am not sure how to handle the endian conversion nicely/efficiently. |
17:05:04 | * | PMunch joined #nim |
17:05:16 | FromDiscord | <voidwalker> And well, since a torrent library is supposed to be fast, huge amount of data being processed eached second, I guess the performance is the number one priority |
17:05:27 | FromDiscord | <voidwalker> (edit) "eached" => "each" |
17:07:11 | FromDiscord | <voidwalker> And since I don't yet have any idea of how to engineer many things torrent-related, at least I can make sure the little bits I can write are very efficient : ) |
17:08:45 | PMunch | Well the string thing should be easily fixeable by just casting it to a `seq[char]` before handing it to the serializer |
17:09:11 | PMunch | `string` is a null terminated string in binaryparser and binarylang IIRC, while sequences are length-prefixed |
17:09:40 | PMunch | If you need to communicate with a specific protocol and a specific format though I'm not sure there are many alternatives to binaryparser/-lang |
17:11:26 | FromDiscord | <voidwalker> the `capn proto` is more for when you want to design your own binary protocol, right ? for rpc |
17:12:53 | FromDiscord | <voidwalker> not for wrapping existing tcp/udp protocol format |
17:15:17 | FromDiscord | <voidwalker> I think I tried with the `seq[char]` and it didn't work. Serializing worked with null bytes for some reason, but not deserializing |
17:16:01 | PMunch | Did you try to deserialize it as a string? |
17:16:08 | FromDiscord | <voidwalker> I want to use something else anyawy, 0 cost or diy |
17:16:16 | FromDiscord | <voidwalker> yeah, as a string |
17:16:26 | PMunch | Obviously that won't work.. |
17:17:05 | FromDiscord | <voidwalker> Yeah, anyways, I'm not gonna use it anymore, wanna redo this from scratch, with performance in mind. |
17:17:51 | FromDiscord | <voidwalker> It's a nice library for many purposes, when you don't want to get your hands dirty writing serializers, but not suited here for integrating into a performance critical library |
17:18:09 | PMunch | Have you actually benchmarked it? |
17:18:30 | FromDiscord | <voidwalker> Nope. I'd have to have a manual implementation to be able to benchmark it against something. |
17:19:05 | PMunch | Well you could take one or two of your structs, and then use capn proto, protobuf, and roll your own to compare against |
17:19:13 | PMunch | Shouldn't be that hard for just a couple fields |
17:19:57 | FromDiscord | <voidwalker> I can tell from its designed that it's not going to be the fastest, and I don't care much beyond that. |
17:20:04 | FromDiscord | <voidwalker> (edit) "designed" => "design" |
17:25:22 | FromDiscord | <spotlightkid> That is poor reasoning, imho. Anyway, what is your use-case for serialization? Messaging? Storage? Parsing? Do you need throughput or low-latency? Do you have RT requirements or not? Which datatypes do you need? Do you need custom data types? What value lengths do you need (e.g. for strings)? |
17:28:05 | FromDiscord | <voidwalker> @spotlightkid, I want to implement the torrent protocol messages. They're all for parsing messages, except the message that holds the actual data, that I would have to handle separately so I don't uselessly copy all the data that is meant to go to disk |
17:29:09 | PMunch | Ah, then you can't use a serialization library like capn proto |
17:29:11 | FromDiscord | <voidwalker> I have already implemented it with binarylang, and it works, now I am looking to make it better (no more memory copies than strictly needed, no overhead from the potentially inefficient parsing procedures) |
17:29:22 | PMunch | It's roll your own, or roll your own with binarylang/-parser |
17:29:39 | FromDiscord | <voidwalker> Yeah that's what I just realized. Is it the same for protobuf ? I haven't figured out protobuf yet |
17:29:51 | PMunch | Yes it's the same for protobuf |
17:30:06 | PMunch | binarylang/-parser is basically a way to more comfortably roll your own |
17:30:31 | PMunch | Writing parsers for binary data can be a chore, the whole idea of binarylang/-parser is to remove that chore |
17:32:14 | FromDiscord | <voidwalker> you mean this ? https://sealmove.github.io/binarylang/#extensions-operations |
17:32:41 | FromDiscord | <voidwalker> I mean this : https://sealmove.github.io/binarylang/#extensions-custom-parser-api |
17:32:46 | FromDiscord | <spotlightkid> If you want to optimize you existing implementation, you will need to bennchmark anyway, no? otherwise it will be just poking in the dark. |
17:33:38 | FromDiscord | <spotlightkid> If you want to optimize your existing implementation, you will need to benchmark it anyway, no? otherwise it will be just poking in the dark. |
17:34:12 | FromDiscord | <voidwalker> If I already know that it can be significantly better, then no, I don't need to benchmark my existing sub-optimal implementation |
17:34:42 | FromDiscord | <michaelb.eth> within a macro processing, say, a `body: untyped`, is it possible to determine the module of an `nnkIdent` or `nnkCall`, i.e. to which module the ident/call belongs? |
17:34:56 | FromDiscord | <michaelb.eth> (edit) "`nnkCall`," => "`nnkCall` in the bodywork ," |
17:35:06 | FromDiscord | <michaelb.eth> (edit) "bodywork ," => "body," |
17:35:58 | FromDiscord | <spotlightkid> Then how will you know how much "better" (faster) any new implementation will be? |
17:35:59 | PMunch | But how do you know it can be significantly better if you don't know how good it is? |
17:37:26 | FromDiscord | <heysokam> What is the real difference between `=` for seq and doing `copyMem` instead?β΅Is there any actual performance gain?β΅_(meaning actually tested, not the handwavy theoretically-should-be-fast type of "better")_ |
17:38:07 | PMunch | @voidwalker, I don't mean anything in particular about binarylang, never used it. But the whole idea behind binarylang/-parser is that they allow you to parse and serialize any format. They allow you to skip the actual job of writing a parser, and instead just explain the logic of the format and it will build the parser for you. Serialization libraries generally have their own format, and allow you to serialize/deserialize to/from that forma. |
17:38:44 | PMunch | @heysokam, I guess Nim might elide some copies, not entirely sure |
17:40:33 | PMunch | @michaelb.eth, check out lineInfoObj in the macros module |
17:40:41 | PMunch | It has the filename that it comes from |
17:41:54 | PMunch | Then you can use `getPackagePath` from nimbleutils if you want to get something you can import: https://github.com/PMunch/nimbleutils/blob/master/src/nimbleutils.nim#L139 |
17:54:58 | FromDiscord | <michaelb.eth> In reply to @PMunch "@michaelb.eth, check out lineInfoObj": thanks! I can put `lineInfoObj` to good use for some things. But it's giving me the module/line of the calling context, and what I'm wanting to do (maybe impossible?) is to figure out from which module the thing being referred to (nnkIdent) or thing being called (nnkCall) originates |
17:57:38 | PMunch | Ah yes, lineinfo can be a bit wonky to work with |
17:58:25 | PMunch | Oh wait, I was thinking of instantiationInfo |
17:58:33 | PMunch | lineInfo should be straightforward |
17:58:42 | PMunch | Not exactly sure what you mean then |
18:01:27 | FromDiscord | <michaelb.eth> I pass an untyped body to my macro, and in that macro there can be references to `foo` and invocations of `bar`, but I want to differentiate if `foo` and `bar` are the ones I defined (in a module I know about, e.g. I know its path) or something else (e.g. defined in the caller's module/s, so not my `foo` and `bar`) |
18:04:36 | PMunch | You can't to that with untyped |
18:04:40 | PMunch | Because they aren't typed yet |
18:04:46 | PMunch | So Nim doesn't know which one it is |
18:09:52 | FromDiscord | <djazz> @pmunch PR submitted for the stdint macros |
18:09:57 | FromDiscord | <djazz> parsing them for now |
18:10:11 | FromDiscord | <djazz> and a fix for uint64 values |
18:10:40 | FromDiscord | <djazz> json parser made them JString... since JInt is BiggestInt only |
18:13:36 | PMunch | Oh nice! |
18:13:47 | PMunch | I actually just had a breakthrough with this as well :) |
18:13:55 | FromDiscord | <djazz> π |
18:14:11 | FromDiscord | <djazz> `of '1'..'9': parseReturn(BiggestInt, def.replace("'", ""), kind); parseReturn(BiggestUInt, def.replace("'", ""), kind)`β΅if int fail, try uint lol! |
18:14:19 | PMunch | I think I've found a way to get Clang to do the parsing for me ;) |
18:14:26 | FromDiscord | <djazz> even better! |
18:15:05 | FromDiscord | <djazz> feel free to use any parts of my PR |
18:15:44 | PMunch | I just merged it wholesale, I mean with a proper test case an everything *chefs kiss* |
18:15:44 | FromDiscord | <djazz> i changed parseReturn so i can pass in a nim type kindIn |
18:15:53 | PMunch | Yeah I saw |
18:16:01 | FromDiscord | <djazz> π |
18:17:25 | FromDiscord | <djazz> now, I can continue to do what I came for... to access that sensor haha |
18:17:54 | PMunch | What framework are you using that Clang can parse by the way? |
18:18:05 | FromDiscord | <djazz> hm? |
18:18:12 | PMunch | Tried to let it loose on some AVR code and it freaked out.. |
18:18:44 | FromDiscord | <djazz> framework? |
18:19:45 | FromDiscord | <djazz> are you doing this? https://stackoverflow.com/a/58658020 |
18:20:07 | FromDiscord | <djazz> PPCallbacks |
18:20:19 | FromDiscord | <djazz> preprocessor interface |
18:20:34 | PMunch | Hmm, that is not what I'm doing |
18:20:39 | PMunch | But that seems very promising as well |
18:21:02 | FromDiscord | <djazz> found it earlier, although idk anything about clang |
18:23:46 | PMunch | Basically my idea was to get the expanded body, then write out a `typedef typeof(<macro body goes here>) t;` run that through Opir and get the type of t |
18:24:41 | PMunch | I ran into the same issue as you with the "unexposed?" thing, but I managed to fix it |
18:37:04 | FromDiscord | <yepoleb> In reply to @pmunch "Binaryparser was mostly meant": what was the weird satellite data format? |
18:39:51 | PMunch | That is a very good question |
18:40:19 | PMunch | It was some proprietary exchange format from an antenna interface box IIRC |
19:07:28 | FromDiscord | <heysokam> what does a Nim tuple map to in C? |
19:13:10 | FromDiscord | <auxym> you can check yourself but I'd assume it creates a struct |
19:16:13 | PMunch | Yeah I'd assume a struct as well |
19:24:42 | * | ntat quit (Quit: Leaving) |
20:02:09 | NimEventer | New thread by FP: GUI app with nim, see https://forum.nim-lang.org/t/10299 |
20:10:45 | FromDiscord | <nnsee> lol, PMunch's response was literally posted 1 second before i opened that thread |
20:10:46 | FromDiscord | <nnsee> neat |
20:11:37 | * | PMunch blows fingerguns |
20:11:45 | PMunch | Fastest commenter in the west |
20:13:12 | * | flouer_ quit (Remote host closed the connection) |
20:13:36 | * | flouer_ joined #nim |
20:18:27 | FromDiscord | <djazz> hmm, in C you can allocate a buffer on the stack like `int buffer[length];`, anything similar in nim without the need for a static length? Without using heap memory |
20:18:38 | FromDiscord | <djazz> im translating some C code |
20:19:07 | FromDiscord | <Elegantbeef> Nope you have `array[len, y]` |
20:19:09 | FromDiscord | <Elegantbeef> The alternative is `alloca` |
20:19:51 | FromDiscord | <Elegantbeef> Doesnt length need to be static in C? |
20:21:24 | FromDiscord | <djazz> ah thanks, looks like https://github.com/bpr/vla is a nice alloca wrapper |
20:22:53 | FromDiscord | <Elegantbeef> Not that nice it only does range checks with asserts |
20:23:26 | FromDiscord | <Elegantbeef> Those should be inside `when compileOption"checks":` |
20:24:56 | FromDiscord | <Elegantbeef> Also no backwards indexing |
20:25:16 | FromDiscord | <Elegantbeef> or items iterator! |
20:25:24 | FromDiscord | <Elegantbeef> This is a long list of things |
20:25:35 | FromDiscord | <djazz> π€ͺ |
20:25:53 | FromDiscord | <djazz> I dont need a seq's worth of features |
20:26:13 | FromDiscord | <Elegantbeef> Not with that attiude |
20:26:16 | FromDiscord | <Elegantbeef> But you said it was nice |
20:26:39 | FromDiscord | <djazz> nice as in better than just importcing alloca myself |
20:26:55 | FromDiscord | <Elegantbeef> I'm joking if it isnt abundantly obvious |
20:27:10 | FromDiscord | <djazz> yeah π |
20:49:28 | FromDiscord | <JJ> In reply to @Elegantbeef "makes more sense to": ooh |
20:54:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4z5z |
21:10:50 | FromDiscord | <superfish57> sent a code paste, see https://play.nim-lang.org/#ix=4z5I |
21:11:07 | FromDiscord | <superfish57> (edit) "https://play.nim-lang.org/#ix=4z5I" => "https://play.nim-lang.org/#ix=4z5J" |
21:13:12 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4z5M |
21:14:04 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=4z5M" => "https://play.nim-lang.org/#ix=4z5N" |
21:14:55 | FromDiscord | <superfish57> Awesome, that worked great, thanks. I'll probably end up using an array, just poking around for now |
21:15:07 | FromDiscord | <Andreas> In reply to @superfish57 "Awesome, that worked great,": have phun.. |
21:40:15 | FromDiscord | <Elegantbeef> Wow andreas it's the self propagation of knowledge, didnt I tell you how to do that a few days ago?! π |
21:41:12 | FromDiscord | <Andreas> In reply to @Elegantbeef "Wow andreas it's the": hi beef, no - some days ago you offered me some `static:` - magic... |
21:41:43 | FromDiscord | <Elegantbeef> Also object variants suffice for your problem? |
21:41:57 | FromDiscord | <Elegantbeef> I think that's what you said, but just curious how that's working out |
21:45:48 | FromDiscord | <Andreas> sent a long message, see http://ix.io/4z5T |
21:46:17 | FromDiscord | <Andreas> (edit) "http://ix.io/4z5T" => "https://paste.rs/0FihE" |
21:46:47 | FromDiscord | <Andreas> (edit) "http://ix.io/4z5V" => "http://ix.io/4z5U" |
21:52:29 | FromDiscord | <Elegantbeef> 6-byte close air support? |
21:53:13 | FromDiscord | <Andreas> In reply to @Elegantbeef "6-byte close air support?": what is that ? close-air support ? its either 1/2/4/8 -> 6 nope,, |
21:53:34 | FromDiscord | <Elegantbeef> CAS mean close air support to my milsim game playing mind |
21:53:37 | FromDiscord | <Elegantbeef> No clue what you mean it as |
21:53:59 | * | derpydoo quit (Ping timeout: 264 seconds) |
21:54:01 | FromDiscord | <Andreas> In reply to @Elegantbeef "No clue what you": its a atomic compareAndSet |
21:54:20 | FromDiscord | <Elegantbeef> What's your datatype again? |
21:54:29 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "No clue what you": its a atomic compareAndSet ... " added "a.k.a compareExchange" |
21:55:52 | FromDiscord | <Andreas> In reply to @Elegantbeef "What's your datatype again?": a 8-byte-pointer, but i'd like to limit the store-location to 6-byte - cos' thats the ptr-info in that - the upper 16-bit are zero.. |
21:56:31 | FromDiscord | <Andreas> (edit) "zero.." => "zero..β΅and thats were one can save some space, when you have millions of ptrs.." |
21:56:48 | FromDiscord | <Elegantbeef> I more mean what's type definition |
21:56:52 | FromDiscord | <Elegantbeef> I do not do well with words |
21:58:25 | FromDiscord | <Andreas> well, what i store is a `uint64` and if would store it a a `uint48` i'd still be able to cast the `uint` to my Trie-type |
21:58:45 | FromDiscord | <Andreas> (edit) "a" => "as" |
22:00:40 | FromDiscord | <Elegantbeef> And 56 bytes is not enough space saving I assume |
22:02:07 | FromDiscord | <Andreas> In reply to @Elegantbeef "And 56 bytes is": why 56-byte ? its 64-bit is save and 48-bit carry the full information... thats wasting 25-percent on every pointer i save.. |
22:02:21 | FromDiscord | <Andreas> (edit) "is" => "i" |
22:02:53 | FromDiscord | <Elegantbeef> bit i mean |
22:03:15 | FromDiscord | <Andreas> (edit) "save.." => "save..β΅so i test the trie with 5-25 million members thats 10-50MB space" |
22:03:30 | FromDiscord | <Elegantbeef> Any chance you could store this type information outside of te data type with a set? |
22:03:50 | FromDiscord | <Elegantbeef> I guess a set wouldnt work |
22:03:55 | FromDiscord | <Elegantbeef> It'd be a seq i suppose |
22:04:24 | FromDiscord | <Elegantbeef> You said you had what 3 or 4 types which means you could compact the type information into 2 entries per byte |
22:04:30 | FromDiscord | <Elegantbeef> Would be more efficient |
22:04:37 | FromDiscord | <Andreas> In reply to @Elegantbeef "Any chance you could": a std/set ? no, all needs to be lockless - i use `UncheckedArray` which i aliased to `Block` |
22:04:49 | FromDiscord | <Andreas> (edit) "lockless" => "lock-free" |
22:05:03 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "Any chance you could": a std/set ? no, all needs to be lock-free - i use `UncheckedArray` which i aliased to `Block` ... " added "-> basically raw-mem" |
22:05:21 | FromDiscord | <Elegantbeef> I mean you could have a sequence that holds the type information for each entry, then just use an index to access that type information |
22:05:54 | FromDiscord | <Elegantbeef> I have no clue what you're doing so I cannot suggest much else |
22:09:59 | FromDiscord | <Andreas> In reply to @Elegantbeef "I have no clue": the 2-3 type-thing was my silly bullshit. thats the size-member for the data-structure, telling me how many items are in.. and its a `uint64` and thats ok.. for smaller tries i could save 1 or byte using a `uint16` or `uint32`. But if i could manage to shorten the pointer-width of the contents of the data-structure from 7- to 6-byte and do safe compareExchange-operations, then i's save millions of b |
22:10:21 | FromDiscord | <Andreas> (edit) "byte" => "2-byte" |
22:10:33 | FromDiscord | <Elegantbeef> Yea so i'm going to not talk any further cause I have 0 clue what you're doing |
22:10:36 | FromDiscord | <Andreas> (edit) "7-" => "8-" |
22:12:25 | FromDiscord | <Andreas> In reply to @Elegantbeef "Yea so i'm going": think of a Table or Map-type, but not with a underlying-array to store the members, as in a clasical hast-table. All contents are heap-alloced pointers. |
22:12:41 | FromDiscord | <Andreas> (edit) "hast-table." => "hash-table." |
22:19:49 | FromDiscord | <Elegantbeef> I see, it's a tree based table, your issue is encoding whether a node is a branch or a leaf? |
22:20:00 | FromDiscord | <Elegantbeef> Or are you just trying to keep the smallest sized memory |
22:22:52 | FromDiscord | <Andreas> In reply to @Elegantbeef "Or are you just": it about reducing the mem-requirements |
22:23:04 | FromDiscord | <Elegantbeef> Yes i know that |
22:23:09 | FromDiscord | <Elegantbeef> I'm asking what's your present hiccup π |
22:23:34 | FromDiscord | <Elegantbeef> Like obviously you were using a variant/concept to solve something |
22:23:53 | FromDiscord | <Elegantbeef> from my recollection you divided it into 8, 16, 32, 64 bit values |
22:24:01 | FromDiscord | <Elegantbeef> Which sounds like you were wanting to make it use the smallest type required |
22:24:26 | FromDiscord | <Andreas> In reply to @Elegantbeef "I'm asking what's your": hiccup π should i try to 'compress' any pointer from 8 to 6-byte ? thats the question |
22:24:49 | FromDiscord | <Elegantbeef> Well if you want to save even more memory, yes you should |
22:29:21 | PMunch | Psst, @djazz: https://github.com/PMunch/futhark/tree/bettermacros |
22:29:22 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4z5Z |
22:29:55 | PMunch | That branch of Futhark should now properly handle way more macro stuff |
22:30:00 | PMunch | But it's very untested |
22:30:03 | FromDiscord | <djazz> interesting |
22:32:05 | FromDiscord | <djazz> haha, opir running opir |
22:32:13 | FromDiscord | <djazz> genius |
22:34:00 | PMunch | It basically uses `typeof` and creates dummy statements that it then passes back into Opir (now running in a light mode) which then is able to figure out the type and pass it back |
22:34:20 | PMunch | There might be a cleaner way of doing it, but I'm not quite sure what that would be |
22:34:37 | PMunch | Possibly running this Eval thing directly on the macro, but I'm not sure that would work |
22:34:53 | PMunch | And as I said, very untested. It might break horribly when you actually try it on real code :P |
22:46:03 | * | derpydoo joined #nim |
22:47:27 | PMunch | It's also quite possibly way slower.. |
23:06:15 | NimEventer | New thread by alexeypetrushin: Why slight change to macro breaks it?, see https://forum.nim-lang.org/t/10300 |
23:07:42 | * | PMunch quit (Quit: leaving) |
23:18:53 | FromDiscord | <djazz> @pmunch i whoopsied in my last pr, new pr with fix and updated test xD |
23:28:45 | FromDiscord | <djazz> ugh, short enums bit me again xD |
23:29:08 | FromDiscord | <djazz> was wondering why the init of sensor failed, turned out the struct size differed! |
23:29:30 | FromDiscord | <djazz> so it thought my callback pointers were null |
23:40:16 | FromDiscord | <djazz> yay, can read sensor now! |
23:42:07 | FromDiscord | <Elegantbeef> Congrats |
23:42:12 | * | lucasta joined #nim |
23:42:23 | FromDiscord | <djazz> only took like... ten hours XD |
23:45:07 | FromDiscord | <djazz> i didnt import that vla module, i made my own haha |