<< 25-06-2023 >>

00:00:29FromDiscord<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:34FromDiscord<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:41FromDiscord<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:08termerOk I've got another trivial question about interfacing with C
01:44:24termerIf I used .emit. to create a char array, how could I reference that in my Nim code
01:44:37termerstatic unsigned char pixmap_test [] = { 0, 0, 0 };
01:44:50termerI tried
01:44:54termervar pixmap_test {.importc.}: cstring
01:45:08termerbut that's leading to C errors
01:48:43FromDiscord<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:58FromDiscord<michaelb.eth> as an alternative to emit, I mean
01:49:02termerBecause I didn't know it existed lol
01:49:15FromDiscord<michaelb.eth> πŸ™‚
01:49:17termerbut I'd also like to know how to do what I need to with emit as well
01:49:32FromDiscord<Elegantbeef> Why not just \`pixmapTest = cstring"\\0\\0"?
01:49:52FromDiscord<michaelb.eth> yeah, good point, cstring is basically the same thing
01:50:02termerbecause I'm trying to translate some C examples as literally as possible
01:50:18FromDiscord<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:19termeranother dev and I are having a hell of a time interfacing with a C library
01:50:34termerThat much is obvious
01:50:44termerit depends wholly on the C compiler lo
01:50:45termer*lol
01:50:57FromDiscord<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:42termerok, so how would I use UncheckedArray
01:52:07FromDiscord<Elegantbeef> They're not stack allocatable so you wouldnt
01:52:34FromDiscord<Elegantbeef> why is `const a = ['\0', '\0', '\0']` out of the question aswell?
01:52:45termerbecause I need the address
01:52:57termerI did use a const initially
01:54:33*oldpcuser_ joined #nim
01:55:57FromDiscord<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:01FromDiscord<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:49FromDiscord<Elegantbeef> I'd say use the bindings over cli, but you do you
02:07:21termerkcvinker5420, I wrote a library for this
02:07:26FromDiscord<Elegantbeef> `startProcess` inside osproc likely is what you want
02:07:32termerminus the q button
02:07:55FromDiscord<kcvinker5420> Great !
02:07:56termerhttps://github.com/termermc/nim-ffmpeg-cli
02:08:11termeralso has support for FFprobe and mostly complete representations of its output
02:09:04termerhttps://github.com/termermc/nim-ffmpeg-cli/blob/master/src/ffmpeg_cli/ffmpeg.nim
02:09:07termerThere are runnable examples here
02:09:15FromDiscord<kcvinker5420> @termer Thanks. Let me check that.
02:10:49termerkeep in mind that it depends on asyncdispatch
02:11:03termerUnfortunately I haven't added chronos support (yet?)
02:11:21FromDiscord<kcvinker5420> I don't know nothing about `asyncdispatch`. So no probs
02:11:58termerThis should have everything need since it can terminate processes with cancel()
02:12:42FromDiscord<kcvinker5420> That's great.
02:13:07FromDiscord<kcvinker5420> Burning time codes to video is my requirement
02:13:52termerwhat're you trying to build
02:14:30FromDiscord<kcvinker5420> An application which help me to burn time code into video.
02:15:05FromDiscord<kcvinker5420> I have windows only gui lib.
02:15:25FromDiscord<kcvinker5420> So, I thought, I can write one
02:16:13termerfair enough
02:16:18termerlet me know if you need any help with my lib
02:16:24FromDiscord<kcvinker5420> Sure
02:16:30termerI wrote it for a video converter queue for a website
02:18:09FromDiscord<kcvinker5420> Oh i see.
02:18:25FromDiscord<kcvinker5420> So I hope it will take custom commands
02:18:41termeryeah
02:18:56termerit has a bunch of presets for convenient construction of commands, but you can write in raw strings if you need
02:19:40FromDiscord<kcvinker5420> That's great !
02:54:52*cedb quit (Ping timeout: 240 seconds)
02:56:55*cedb joined #nim
03:10:47FromDiscord<JeysonFlores> sent a long message, see http://ix.io/4z25
03:11:02FromDiscord<JeysonFlores> (edit) "http://ix.io/4z25" => "http://ix.io/4z26"
03:12:51FromDiscord<Elegantbeef> `const myfile = staticread("myfile.txt")`
03:15:10FromDiscord<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:21FromDiscord<JJ> is the `{.noreturn.}` pragma the closest thing to a proper bottom type that nim has?
05:08:34FromDiscord<Elegantbeef> I'll say sure cause bottom type means nothing to me
05:13:54FromDiscord<JJ> uh, a type that cannot be instantiated to a value
05:14:10FromDiscord<JJ> and is a subtype of every type but that doesn't mean much wrt. nim
05:15:21FromDiscord<JJ> i.e. `panic!()` in rust is actually of type `never`: `fn panic!() -> !`
05:15:27FromDiscord<Elegantbeef> `type MyType = distinct void`
05:15:31FromDiscord<JJ> hmm
05:18:37FromDiscord<huantian> Be careful, if you gaze into the distinct void, the beef gazes also into you.
05:30:31FromDiscord<Elegantbeef> Oh also @JJ I looked at your uxn repo and seen your `futurmacro` idea
05:30:40FromDiscord<Elegantbeef> makes more sense to do `of Opcode(a, b): body`
05:38:17FromDiscord<odexine> Void is not a bottom type
05:38:32FromDiscord<odexine> A bottom type signifies that the function never returns
05:39:11FromDiscord<odexine> Aka either literally never returns by looping in some form forever, or technically by crashing or ending the program
05:39:37FromDiscord<Elegantbeef> So a `raise`?
05:39:55FromDiscord<odexine> Or a while true
05:40:34FromDiscord<odexine> Quit also theoretically uses this bottom type
05:41:06FromDiscord<odexine> The expression value of a break or return also technically does use this bottom type IIRC
06:06:59FromDiscord<elamandeep> I'm stuck with this error https://media.discordapp.net/attachments/371759389889003532/1122407574663335946/image.png
06:07:19FromDiscord<Elegantbeef> The file is not named "holloworld"
06:07:28FromDiscord<elamandeep> (edit) removed "error"
06:08:15FromDiscord<elamandeep> In reply to @Elegantbeef "The file is not": lol. I made simpler mistakeπŸ˜…
06:14:53*ntat joined #nim
06:31:35NimEventerNew 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:08FromDiscord<heysokam> is there a way to access the number of processors at compile time, similar to `std/cpuinfo.countProcessors()`?
08:27:24FromDiscord<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:52FromDiscord<heysokam> main issues is the syntax details, for how to access methods/etc
08:28:58FromDiscord<heysokam> (edit) "issues" => "issue"
08:29:07FromDiscord<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:38FromDiscord<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:28FromDiscord<heysokam> @jmgomez i guess the confusion is all coming from all the wizardly `<'0>`, `#[#]` `@` things
08:34:54FromDiscord<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:16FromDiscord<heysokam> i figure the #,# are needed to call for specific overloads?
08:37:28FromDiscord<heysokam> (edit) "call for" => "wrap"
08:38:41FromDiscord<jmgomez> not following, what do you mean with specific overloads
08:41:28FromDiscord<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:46FromDiscord<heysokam> but im just guessing, so it might be completely wrong
08:42:53FromDiscord<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:18FromDiscord<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:37FromDiscord<heysokam> (edit) "In reply to @jmgomez "the compiler knows the": yeah but if there are two ... functions" added "(or more)"
08:48:04FromDiscord<jmgomez> it will use the argument of the function you are wrapping, for each overload you will need to do `importcpp` again
08:48:37FromDiscord<heysokam> whats the use for `#` then? i thought it was to disambiguate πŸ€”
08:54:22*mad_toothbrush joined #nim
08:58:05FromDiscord<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:08FromDiscord<wungussy> Is there a speed difference between declaring variables types manually and letting it be inferred in compilation?
10:39:37FromDiscord<wungussy> If so, is it big enough to justify specifying all variables as their type statically?
10:48:03FromDiscord<odexine> Speed in compilation maybe a little bit
10:48:08FromDiscord<odexine> Speed on run time no
10:51:18FromDiscord<wungussy> ok cool thanks
11:09:16FromDiscord<Phil> I'd proclaim that you're doing "superfluous" type annotations more for yourself than for the compiler.
11:09:24FromDiscord<Phil> (edit) "I'd proclaim that you're doing "superfluous" ... type" added "(those that can already be inferred)"
11:31:47FromDiscord<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:30FromDiscord<odysseus> sent a long message, see https://paste.rs/8lMhe
11:33:45FromDiscord<Andreas> In reply to @odysseus "Hello to all. ": welcome odysseus - guess you're on a intresting journey, as always - go ahead..
11:34:05FromDiscord<odysseus> Thank you!↡(@Andreas)
11:37:48FromDiscord<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:11FromDiscord<Zoom> Ask for clarifications if you need further help
11:38:56FromDiscord<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:18FromDiscord<odysseus> Sorry if it is stupid question
11:39:58FromDiscord<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:12FromDiscord<odexine> with the number you are parsing, so it has to be exactly a number only
11:40:14FromDiscord<odexine> nothing else
11:40:32FromDiscord<odysseus> Oh I see... perfect ... thank you so much↡(@odexine)
11:41:07FromDiscord<odysseus> Although, from my naive point of view, a string is a string -no matter what πŸ™Žβ€β™‚οΈ
11:42:08FromDiscord<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:53FromDiscord<odysseus> corrent...so I used .parseInt() ...but I guess here is your point
11:45:19FromDiscord<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:05FromDiscord<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:59FromDiscord<odysseus> I really thank you for both your time and kind/detailed explanation.
12:11:51FromDiscord<krisp0> sent a long message, see http://ix.io/4z3E
12:20:35FromDiscord<intellj_gamer> Is the file saved? Line 10 doesn't look to be an import
12:20:42FromDiscord<intellj_gamer> (edit) "Is the file saved? Line 10 doesn't look to be an import ... " added "relating to dimscord"
12:26:31FromDiscord<krisp0> yes
12:29:02FromDiscord<krisp0> I resaved it https://media.discordapp.net/attachments/371759389889003532/1122503719674724412/image.png
12:30:19FromDiscord<krisp0> and doing `dir ../dimscord` returns as usual https://media.discordapp.net/attachments/371759389889003532/1122504038148223017/image.png
12:32:15FromDiscord<intellj_gamer> `../dimscord/dimscord` maybe?
12:32:32FromDiscord<krisp0> oh nvm I get it why, it's trying to open a file but I linked it to a folder lol
12:32:33FromDiscord<intellj_gamer> Since its needs to import `dimscord.nim` that is in the dimscord folder
12:32:42FromDiscord<krisp0> it worked with that
13:31:58*ntat quit (Quit: Leaving)
13:33:27FromDiscord<djazz> sent a code paste, see https://paste.rs/zuO6U
13:33:44FromDiscord<djazz> retaining the type through to futhark would be optimal
13:34:31FromDiscord<djazz> https://github.com/boschsensortec/BME68x-Sensor-API/blob/master/bme68x_defs.h full header
13:47:50FromDiscord<pmunch> Hmm, that's going to be hard..
13:51:11FromDiscord<pmunch> I wonder if it's possible to do something like `typeof(BME68X_CHIP_ID) random_ident = BME68X_CHIP_ID;` in C
13:51:41FromDiscord<pmunch> That would make it possible to spit out tiny dummy files to get these types
13:57:48FromDiscord<pmunch> Oh wait, that is valid C 😊
13:58:00FromDiscord<pmunch> (edit) "😊" => "πŸ€”"
14:00:59FromDiscord<djazz> getting `addUsings: {"kind":"invalid","value":"unexposed?"}` when trying that hmm
14:01:08FromDiscord<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:04FromDiscord<djazz> I tried this but it doesnt get the value, futhark spits out a var: `static const auto aa = BME68X_CHIP_ID;`
14:23:04FromDiscord<djazz> without static: `@mtstdint.nim.c:(.text+0x200): undefined reference to `aa'`
14:24:34FromDiscord<djazz> no preprocessor im guessing?
14:24:58FromDiscord<spotlightkid> Short question\: is the path given to `staticRead()` always relative to the source file the call is in?
14:26:53Amun-Rayes
14:35:17FromDiscord<pmunch> @djazz, what exactly did you try? I was thinking of making Opir spit out those files and then parse them again
14:46:02FromDiscord<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:45FromDiscord<elamandeep> how i can see the actual c code? It's converting directly to exe?
15:08:55FromDiscord<elamandeep> (edit) "exe?" => "exe"
15:11:00FromDiscord<griffith1deadly> In reply to @elamandeep "how i can see": your system disk/Users/your user/nimcache/your project name_d or r
15:12:17FromDiscord<elamandeep> In reply to @griffith1deadly "your system disk/Users/your user/nimcache/your": I mean through command
15:12:45FromDiscord<elamandeep> (edit) "I mean through" => "Through" | "Throughcommand ... " added "?"
15:13:00FromDiscord<elamandeep> (edit) "?" => "how we can see actual c code?"
15:14:05FromDiscord<griffith1deadly> In reply to @griffith1deadly "your system disk/Users/your user/nimcache/your": always at compile time the C code is here
15:14:19FromDiscord<griffith1deadly> (edit) "C" => "C/Cpp"
15:14:53FromDiscord<griffith1deadly> even when it is compiled directly into an executable file
15:16:06FromDiscord<elamandeep> ok
15:31:08FromDiscord<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:02FromDiscord<elamandeep> ok
15:34:43FromDiscord<elamandeep> In reply to @pmunch "You can also set": how to set cache folder?
15:35:42FromDiscord<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:27FromDiscord<pmunch> As I said, with the `nimcache` switch: https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory
15:40:14FromDiscord<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:04FromDiscord<gogolxdong666> Is nimbus-eth1 usable?
15:43:09FromDiscord<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:00FromDiscord<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:15FromDiscord<pmunch> Well, I wrote binaryparser which is the precursor to binarylang so I have some insight
16:43:32FromDiscord<pmunch> Capn proto seems like the closest fit
16:46:50FromDiscord<pmunch> Really depends on what you need though
16:46:53FromDiscord<voidwalker> Yeah I know it's derived from binaryparser. But both not really maintained (or very slowly).
16:46:56FromDiscord<_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:59FromDiscord<voidwalker> https://github.com/sgmihai/torrentim/blob/master/protocol/udpTrackerStruct.nim https://github.com/sgmihai/torrentim/blob/master/protocol/peerMessageStruct.nim
16:47:08FromDiscord<voidwalker> nothing too fancy, these two files above, for torrent stuff
16:47:18FromDiscord<_gumbercules> Flatbuffers if you're prioritizing perf but they have some annoying limitations
16:47:59FromDiscord<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:45FromDiscord<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:52FromDiscord<_gumbercules> Flatbuffers are also more efficient if you https://github.com/kcchu/buffer-benchmarks
16:48:58FromDiscord<_gumbercules> (edit) removed "Flatbuffers are also more efficient if you"
16:49:35FromDiscord<pmunch> Oh yeah, binaryparser was never written to be fast
16:50:07FromDiscord<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:41FromDiscord<voidwalker> Serde in rust is supposed to be 0 cost
16:50:41FromDiscord<pmunch> I mean another alternative is to contribute fixes to remove those limitations πŸ€·β€β™‚οΈ
16:51:01FromDiscord<voidwalker> Nah, I am barely smart enough to use binarylang, never wrote a line of macro in my life : )
16:51:47FromDiscord<_gumbercules> In reply to @voidwalker "Serde in rust is": everything in rust is supposed to be zero cost
16:52:03FromDiscord<_gumbercules> except for your brain exploding from programming in Rust
16:52:18FromDiscord<_gumbercules> and you flying into a fit of rage and destroying something
16:52:22FromDiscord<_gumbercules> both of those things Rust doesnt' claim are free
16:52:37FromDiscord<voidwalker> I found this, doesn't say it's 0 cost, just efficient, "serde-like" https://github.com/gabbhack/deser
16:53:22FromDiscord<voidwalker> yeah but you have 100x ? more coders than nim, better docs/tutorials
16:55:31FromDiscord<pmunch> So your issues with binarylang is unable to handle zeros in strings, and unable to serialize non-seq iterables?
16:56:17FromDiscord<voidwalker> yes, and that I don't know the performance overhead, which is not that low as protobuf etc, I imagine
16:56:49FromDiscord<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:56FromDiscord<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:37FromDiscord<voidwalker> Also it's annoying to have a subparser for every "string" in the structure
17:00:43FromDiscord<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:50FromDiscord<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:16FromDiscord<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:27FromDiscord<voidwalker> (edit) "eached" => "each"
17:07:11FromDiscord<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:45PMunchWell the string thing should be easily fixeable by just casting it to a `seq[char]` before handing it to the serializer
17:09:11PMunch`string` is a null terminated string in binaryparser and binarylang IIRC, while sequences are length-prefixed
17:09:40PMunchIf 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:26FromDiscord<voidwalker> the `capn proto` is more for when you want to design your own binary protocol, right ? for rpc
17:12:53FromDiscord<voidwalker> not for wrapping existing tcp/udp protocol format
17:15:17FromDiscord<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:01PMunchDid you try to deserialize it as a string?
17:16:08FromDiscord<voidwalker> I want to use something else anyawy, 0 cost or diy
17:16:16FromDiscord<voidwalker> yeah, as a string
17:16:26PMunchObviously that won't work..
17:17:05FromDiscord<voidwalker> Yeah, anyways, I'm not gonna use it anymore, wanna redo this from scratch, with performance in mind.
17:17:51FromDiscord<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:09PMunchHave you actually benchmarked it?
17:18:30FromDiscord<voidwalker> Nope. I'd have to have a manual implementation to be able to benchmark it against something.
17:19:05PMunchWell you could take one or two of your structs, and then use capn proto, protobuf, and roll your own to compare against
17:19:13PMunchShouldn't be that hard for just a couple fields
17:19:57FromDiscord<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:04FromDiscord<voidwalker> (edit) "designed" => "design"
17:25:22FromDiscord<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:05FromDiscord<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:09PMunchAh, then you can't use a serialization library like capn proto
17:29:11FromDiscord<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:22PMunchIt's roll your own, or roll your own with binarylang/-parser
17:29:39FromDiscord<voidwalker> Yeah that's what I just realized. Is it the same for protobuf ? I haven't figured out protobuf yet
17:29:51PMunchYes it's the same for protobuf
17:30:06PMunchbinarylang/-parser is basically a way to more comfortably roll your own
17:30:31PMunchWriting parsers for binary data can be a chore, the whole idea of binarylang/-parser is to remove that chore
17:32:14FromDiscord<voidwalker> you mean this ? https://sealmove.github.io/binarylang/#extensions-operations
17:32:41FromDiscord<voidwalker> I mean this : https://sealmove.github.io/binarylang/#extensions-custom-parser-api
17:32:46FromDiscord<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:38FromDiscord<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:12FromDiscord<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:42FromDiscord<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:56FromDiscord<michaelb.eth> (edit) "`nnkCall`," => "`nnkCall` in the bodywork ,"
17:35:06FromDiscord<michaelb.eth> (edit) "bodywork ," => "body,"
17:35:58FromDiscord<spotlightkid> Then how will you know how much "better" (faster) any new implementation will be?
17:35:59PMunchBut how do you know it can be significantly better if you don't know how good it is?
17:37:26FromDiscord<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:07PMunch@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:44PMunch@heysokam, I guess Nim might elide some copies, not entirely sure
17:40:33PMunch@michaelb.eth, check out lineInfoObj in the macros module
17:40:41PMunchIt has the filename that it comes from
17:41:54PMunchThen 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:58FromDiscord<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:38PMunchAh yes, lineinfo can be a bit wonky to work with
17:58:25PMunchOh wait, I was thinking of instantiationInfo
17:58:33PMunchlineInfo should be straightforward
17:58:42PMunchNot exactly sure what you mean then
18:01:27FromDiscord<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:36PMunchYou can't to that with untyped
18:04:40PMunchBecause they aren't typed yet
18:04:46PMunchSo Nim doesn't know which one it is
18:09:52FromDiscord<djazz> @pmunch PR submitted for the stdint macros
18:09:57FromDiscord<djazz> parsing them for now
18:10:11FromDiscord<djazz> and a fix for uint64 values
18:10:40FromDiscord<djazz> json parser made them JString... since JInt is BiggestInt only
18:13:36PMunchOh nice!
18:13:47PMunchI actually just had a breakthrough with this as well :)
18:13:55FromDiscord<djazz> πŸ™‚
18:14:11FromDiscord<djazz> `of '1'..'9': parseReturn(BiggestInt, def.replace("'", ""), kind); parseReturn(BiggestUInt, def.replace("'", ""), kind)`↡if int fail, try uint lol!
18:14:19PMunchI think I've found a way to get Clang to do the parsing for me ;)
18:14:26FromDiscord<djazz> even better!
18:15:05FromDiscord<djazz> feel free to use any parts of my PR
18:15:44PMunchI just merged it wholesale, I mean with a proper test case an everything *chefs kiss*
18:15:44FromDiscord<djazz> i changed parseReturn so i can pass in a nim type kindIn
18:15:53PMunchYeah I saw
18:16:01FromDiscord<djazz> 😘
18:17:25FromDiscord<djazz> now, I can continue to do what I came for... to access that sensor haha
18:17:54PMunchWhat framework are you using that Clang can parse by the way?
18:18:05FromDiscord<djazz> hm?
18:18:12PMunchTried to let it loose on some AVR code and it freaked out..
18:18:44FromDiscord<djazz> framework?
18:19:45FromDiscord<djazz> are you doing this? https://stackoverflow.com/a/58658020
18:20:07FromDiscord<djazz> PPCallbacks
18:20:19FromDiscord<djazz> preprocessor interface
18:20:34PMunchHmm, that is not what I'm doing
18:20:39PMunchBut that seems very promising as well
18:21:02FromDiscord<djazz> found it earlier, although idk anything about clang
18:23:46PMunchBasically 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:41PMunchI ran into the same issue as you with the "unexposed?" thing, but I managed to fix it
18:37:04FromDiscord<yepoleb> In reply to @pmunch "Binaryparser was mostly meant": what was the weird satellite data format?
18:39:51PMunchThat is a very good question
18:40:19PMunchIt was some proprietary exchange format from an antenna interface box IIRC
19:07:28FromDiscord<heysokam> what does a Nim tuple map to in C?
19:13:10FromDiscord<auxym> you can check yourself but I'd assume it creates a struct
19:16:13PMunchYeah I'd assume a struct as well
19:24:42*ntat quit (Quit: Leaving)
20:02:09NimEventerNew thread by FP: GUI app with nim, see https://forum.nim-lang.org/t/10299
20:10:45FromDiscord<nnsee> lol, PMunch's response was literally posted 1 second before i opened that thread
20:10:46FromDiscord<nnsee> neat
20:11:37*PMunch blows fingerguns
20:11:45PMunchFastest commenter in the west
20:13:12*flouer_ quit (Remote host closed the connection)
20:13:36*flouer_ joined #nim
20:18:27FromDiscord<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:38FromDiscord<djazz> im translating some C code
20:19:07FromDiscord<Elegantbeef> Nope you have `array[len, y]`
20:19:09FromDiscord<Elegantbeef> The alternative is `alloca`
20:19:51FromDiscord<Elegantbeef> Doesnt length need to be static in C?
20:21:24FromDiscord<djazz> ah thanks, looks like https://github.com/bpr/vla is a nice alloca wrapper
20:22:53FromDiscord<Elegantbeef> Not that nice it only does range checks with asserts
20:23:26FromDiscord<Elegantbeef> Those should be inside `when compileOption"checks":`
20:24:56FromDiscord<Elegantbeef> Also no backwards indexing
20:25:16FromDiscord<Elegantbeef> or items iterator!
20:25:24FromDiscord<Elegantbeef> This is a long list of things
20:25:35FromDiscord<djazz> πŸ€ͺ
20:25:53FromDiscord<djazz> I dont need a seq's worth of features
20:26:13FromDiscord<Elegantbeef> Not with that attiude
20:26:16FromDiscord<Elegantbeef> But you said it was nice
20:26:39FromDiscord<djazz> nice as in better than just importcing alloca myself
20:26:55FromDiscord<Elegantbeef> I'm joking if it isnt abundantly obvious
20:27:10FromDiscord<djazz> yeah πŸ˜„
20:49:28FromDiscord<JJ> In reply to @Elegantbeef "makes more sense to": ooh
20:54:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4z5z
21:10:50FromDiscord<superfish57> sent a code paste, see https://play.nim-lang.org/#ix=4z5I
21:11:07FromDiscord<superfish57> (edit) "https://play.nim-lang.org/#ix=4z5I" => "https://play.nim-lang.org/#ix=4z5J"
21:13:12FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4z5M
21:14:04FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4z5M" => "https://play.nim-lang.org/#ix=4z5N"
21:14:55FromDiscord<superfish57> Awesome, that worked great, thanks. I'll probably end up using an array, just poking around for now
21:15:07FromDiscord<Andreas> In reply to @superfish57 "Awesome, that worked great,": have phun..
21:40:15FromDiscord<Elegantbeef> Wow andreas it's the self propagation of knowledge, didnt I tell you how to do that a few days ago?! πŸ˜„
21:41:12FromDiscord<Andreas> In reply to @Elegantbeef "Wow andreas it's the": hi beef, no - some days ago you offered me some `static:` - magic...
21:41:43FromDiscord<Elegantbeef> Also object variants suffice for your problem?
21:41:57FromDiscord<Elegantbeef> I think that's what you said, but just curious how that's working out
21:45:48FromDiscord<Andreas> sent a long message, see http://ix.io/4z5T
21:46:17FromDiscord<Andreas> (edit) "http://ix.io/4z5T" => "https://paste.rs/0FihE"
21:46:47FromDiscord<Andreas> (edit) "http://ix.io/4z5V" => "http://ix.io/4z5U"
21:52:29FromDiscord<Elegantbeef> 6-byte close air support?
21:53:13FromDiscord<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:34FromDiscord<Elegantbeef> CAS mean close air support to my milsim game playing mind
21:53:37FromDiscord<Elegantbeef> No clue what you mean it as
21:53:59*derpydoo quit (Ping timeout: 264 seconds)
21:54:01FromDiscord<Andreas> In reply to @Elegantbeef "No clue what you": its a atomic compareAndSet
21:54:20FromDiscord<Elegantbeef> What's your datatype again?
21:54:29FromDiscord<Andreas> (edit) "In reply to @Elegantbeef "No clue what you": its a atomic compareAndSet ... " added "a.k.a compareExchange"
21:55:52FromDiscord<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:31FromDiscord<Andreas> (edit) "zero.." => "zero..↡and thats were one can save some space, when you have millions of ptrs.."
21:56:48FromDiscord<Elegantbeef> I more mean what's type definition
21:56:52FromDiscord<Elegantbeef> I do not do well with words
21:58:25FromDiscord<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:45FromDiscord<Andreas> (edit) "a" => "as"
22:00:40FromDiscord<Elegantbeef> And 56 bytes is not enough space saving I assume
22:02:07FromDiscord<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:21FromDiscord<Andreas> (edit) "is" => "i"
22:02:53FromDiscord<Elegantbeef> bit i mean
22:03:15FromDiscord<Andreas> (edit) "save.." => "save..↡so i test the trie with 5-25 million members thats 10-50MB space"
22:03:30FromDiscord<Elegantbeef> Any chance you could store this type information outside of te data type with a set?
22:03:50FromDiscord<Elegantbeef> I guess a set wouldnt work
22:03:55FromDiscord<Elegantbeef> It'd be a seq i suppose
22:04:24FromDiscord<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:30FromDiscord<Elegantbeef> Would be more efficient
22:04:37FromDiscord<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:49FromDiscord<Andreas> (edit) "lockless" => "lock-free"
22:05:03FromDiscord<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:21FromDiscord<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:54FromDiscord<Elegantbeef> I have no clue what you're doing so I cannot suggest much else
22:09:59FromDiscord<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:21FromDiscord<Andreas> (edit) "byte" => "2-byte"
22:10:33FromDiscord<Elegantbeef> Yea so i'm going to not talk any further cause I have 0 clue what you're doing
22:10:36FromDiscord<Andreas> (edit) "7-" => "8-"
22:12:25FromDiscord<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:41FromDiscord<Andreas> (edit) "hast-table." => "hash-table."
22:19:49FromDiscord<Elegantbeef> I see, it's a tree based table, your issue is encoding whether a node is a branch or a leaf?
22:20:00FromDiscord<Elegantbeef> Or are you just trying to keep the smallest sized memory
22:22:52FromDiscord<Andreas> In reply to @Elegantbeef "Or are you just": it about reducing the mem-requirements
22:23:04FromDiscord<Elegantbeef> Yes i know that
22:23:09FromDiscord<Elegantbeef> I'm asking what's your present hiccup πŸ˜„
22:23:34FromDiscord<Elegantbeef> Like obviously you were using a variant/concept to solve something
22:23:53FromDiscord<Elegantbeef> from my recollection you divided it into 8, 16, 32, 64 bit values
22:24:01FromDiscord<Elegantbeef> Which sounds like you were wanting to make it use the smallest type required
22:24:26FromDiscord<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:49FromDiscord<Elegantbeef> Well if you want to save even more memory, yes you should
22:29:21PMunchPsst, @djazz: https://github.com/PMunch/futhark/tree/bettermacros
22:29:22FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4z5Z
22:29:55PMunchThat branch of Futhark should now properly handle way more macro stuff
22:30:00PMunchBut it's very untested
22:30:03FromDiscord<djazz> interesting
22:32:05FromDiscord<djazz> haha, opir running opir
22:32:13FromDiscord<djazz> genius
22:34:00PMunchIt 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:20PMunchThere might be a cleaner way of doing it, but I'm not quite sure what that would be
22:34:37PMunchPossibly running this Eval thing directly on the macro, but I'm not sure that would work
22:34:53PMunchAnd 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:27PMunchIt's also quite possibly way slower..
23:06:15NimEventerNew 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:53FromDiscord<djazz> @pmunch i whoopsied in my last pr, new pr with fix and updated test xD
23:28:45FromDiscord<djazz> ugh, short enums bit me again xD
23:29:08FromDiscord<djazz> was wondering why the init of sensor failed, turned out the struct size differed!
23:29:30FromDiscord<djazz> so it thought my callback pointers were null
23:40:16FromDiscord<djazz> yay, can read sensor now!
23:42:07FromDiscord<Elegantbeef> Congrats
23:42:12*lucasta joined #nim
23:42:23FromDiscord<djazz> only took like... ten hours XD
23:45:07FromDiscord<djazz> i didnt import that vla module, i made my own haha