<< 22-05-2021 >>

00:09:59*notchris quit ()
00:12:02*azed joined #nim
00:13:41ForumUpdaterBotNew thread by Masiarek2: Squeeze the sequence: remove empty strings, see https://forum.nim-lang.org/t/8011
00:28:23*johnnynitwits quit (Read error: Connection reset by peer)
00:29:14*johnnynitwits joined #nim
00:45:04FromDiscord<ajusa> Anyone know any alternatives to iface for interface implementations? Methods can be a bit ugly
00:45:27*smitop joined #nim
00:45:52*smitop quit (Client Quit)
00:47:09FromDiscord<ElegantBeef> pointer functions
00:55:28*nphg joined #nim
00:58:01*nphg1 quit (Ping timeout: 265 seconds)
01:04:07FromDiscord<ajusa> Hm, okay. I really like iface to be honest but the face that it isn't on Nimble is a little worrying for the future
01:04:17FromDiscord<ajusa> (edit) "future" => "future, like it's pre alpha"
01:08:29FromDiscord<ElegantBeef> I mean the API seems rather concrete so far so i wouldnt be overly concerned
01:09:17FromDiscord<ElegantBeef> You could always look at my devel variation using new concepts, but that's in an even worse state than iface πŸ˜„
01:10:04*johnnynitwits quit (Read error: Connection reset by peer)
01:10:22*johnnynitwits joined #nim
01:10:54FromDiscord<ElegantBeef> I dont see why it matters if it's on nimble or not, since you can still depend upon it using a nimble package, the nice part about our decentralized package management
01:14:37FromDiscord<ajusa> Yeah, but even the author said that they don't like the API on the forums lol. I'll use it, worst comes to worst with a literal git commit URL in .nimble
01:15:00FromDiscord<ElegantBeef> Yea new concepts can empower a cooler version imo
01:15:29FromDiscord<ElegantBeef> Though i dont know about my method https://github.com/beef331/constructor/blob/master/tests/timplements.nim
01:57:14*oculux joined #nim
01:58:29*oculuxe quit (Ping timeout: 246 seconds)
02:01:48FromDiscord<Hi02Hi> is the capacity of a seq accessible?
02:03:32FromDiscord<Rika> not that i know of, why do you need it?
02:03:47FromDiscord<Rika> technically you can access it by changing the capacity to a known value
02:04:37FromDiscord<Hi02Hi> i was trying to see if setLen sets it exactly or not
02:05:30leorize[m]setLen set it exactly if the capacity is lower
02:05:43leorize[m]the current capacity is lower than what you specify*
02:05:51leorize[m]otherwise the capacity won't change
02:06:32FromDiscord<Hi02Hi> if it is greater, is the capacity changed exactly or with extra?
02:07:12leorize[m]exactly
02:07:22FromGitter<bung87> hi, am working on webframework , I have question about http parser, what if the client send wrong content-length to server?
02:07:27FromDiscord<Hi02Hi> ok thx
02:07:45leorize[m]@bung87 wdym wrong content-length?
02:09:00FromGitter<bung87> `proc remainLen(parser: MultipartParser): int {.inline.} = ⏎ parser.contentLength - parser.read`
02:10:07FromGitter<bung87> my parser depends on it , what if client send very big content -length , that just contains smaller body ?
02:10:22leorize[m]then it means you don't get enough data
02:10:29leorize[m]i believe the spec talks about this
02:12:21leorize[m]https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4
02:12:33leorize[m]spec said must be exactly the value or bust
02:13:43leorize[m]https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2
02:13:55leorize[m]^ read that since it's more up to date
02:17:04*arkurious quit (Quit: Leaving)
02:17:09FromGitter<bung87> ah ,when I can't get needed length just responds 400 , thanks!
02:31:23*noeontheend quit (Ping timeout: 246 seconds)
02:33:09FromDiscord<Casey.McMahon> for the compiler, if I use `--os:any` , do i need to include a `panicoverride.nim` file?
02:33:54FromDiscord<ElegantBeef> I dont recall if that's a requirement for `--os:standalone` or `--os:any`
02:35:06FromDiscord<Casey.McMahon> i noticed that it is mentioned in the 0.20 version of the compiler user guide, but the 1.5 version of the guide has it removed
02:35:23FromDiscord<ElegantBeef> I mean the compiler tells you when you need it
02:35:45FromDiscord<Casey.McMahon> https://nim-lang.org/0.20.0/nimc.html#nim-for-embedded-systems↡https://nim-lang.github.io/Nim/nimc.html#nim-for-embedded-systems
02:36:01FromDiscord<Casey.McMahon> so i guess not anymore?
02:37:23FromDiscord<ElegantBeef> Any does replace standalone so it seems yea not required
02:37:48FromDiscord<slymilano> Just wanted to share that we're going to start using Nim at https://papa.co πŸ˜ƒ We use Elixir for all of our services but we're going to use Nim to calculate some risk assessment scores for our members for our "Care Navigation" platform. Can't wait!
02:38:51FromDiscord<ElegantBeef> Nice, consider adding it to the list of "Companies that use Nim" on the wiki πŸ˜„
02:39:41FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim if curious where that is
02:40:25FromDiscord<slymilano> nice once we have a tangible implementation i'll add us there
02:40:40*azed quit (Quit: WeeChat 3.1)
02:43:33FromDiscord<Casey.McMahon> In reply to @ElegantBeef "Nice, consider adding it": I just realized your beef331 on github. I was asking that for the pico project.
02:44:09FromDiscord<ElegantBeef> I assumed that was you but didnt want to bring it up since i was 90% certain the panic override wasnt needed further
02:44:47FromDiscord<ElegantBeef> If you remove the nim file and the compiler doesnt complain it's fine πŸ˜„
02:45:19FromDiscord<Casey.McMahon> yeah the compiler didn't complain so I guess were all clear without it!
02:45:27*noeontheend joined #nim
02:45:49FromDiscord<ElegantBeef> And hopefully i didnt annoy you too much with my suggestions/view πŸ˜›
02:48:18FromDiscord<ElegantBeef> Seems we can also tick the file modification on windows by calling `copy /b FILENAME +,,` where `FILENAME` is the path to the cmakelist.txt
02:49:06FromDiscord<Casey.McMahon> no it all makes sense, although i looked into setting up a pico build environment on windows (i don't have windows so never was a problem) and it seems a little more complicated to get up and running then on linux. So i just mentioned some guides in the readme. Do you have a windows install?
02:49:36FromDiscord<ElegantBeef> I do have a windows OS installation, but i do not touch it for anything but gaming
02:51:41FromDiscord<Casey.McMahon> cool cool. Also are you okay with changing the hello world program to blink? or is there another reason for choosing that particular program?
02:52:01FromDiscord<Casey.McMahon> I guess not all board would have an led?
02:52:03FromDiscord<ElegantBeef> I named almost all the examples based off the pico-sdk
02:52:15FromDiscord<ElegantBeef> (edit) "I named almost all the examples based off the pico-sdk ... " added "examples"
02:52:41FromDiscord<ElegantBeef> It can be blink i guess, thought it was named hello_world LD
02:52:44FromDiscord<ElegantBeef> (edit) removed "LD"
02:53:19FromDiscord<Casey.McMahon> i guess not the hello world program itself (in the examples repo) , i just meant the program that comes with the template
02:54:12FromDiscord<ElegantBeef> Well the name doesnt really matter, so yea
02:54:56FromDiscord<ElegantBeef> It can be named "finglefangledringledrap.nim" for all i care
02:55:14FromDiscord<Rika> misread that as finger fangled death trap
02:59:28FromDiscord<ElegantBeef> So rika i changed the api drastically for my hseq, so now it's basically completely unrelated to it, i'm a great developer
03:00:02FromDiscord<Rika> nice
03:00:12FromDiscord<Rika> i dont actually have anything mean to say now
03:00:55FromDiscord<ElegantBeef> Lol, it now uses case statements and unpacks the variant value into an `it` so yea pretty similar but just meant for variants all together
03:01:20FromDiscord<Rika> right now im fixing some dude's SVD codegen for nim
03:02:28FromDiscord<ElegantBeef> svd codegen?
03:02:51FromDiscord<Rika> https://github.com/Birkemosen/svd2nim/
03:05:55FromDiscord<Rika> ngl i kinda wish we had more complex case objects
03:11:52FromDiscord<ElegantBeef> In what way?
03:13:02FromDiscord<Rika> like↡`when a.kind in {...}: ... elif a.kind == ...: ...` etc etc
03:13:22FromDiscord<ElegantBeef> Ah so what my library enables πŸ˜„
03:13:23FromDiscord<Rika> where one element in {...} is also the element in the elif branch
03:13:56FromDiscord<Rika> so more of `when a.kind in {x, ...}: ... elif a.kind == x: ...`
03:14:01FromDiscord<ElegantBeef> Although it only does it for types, similar logic could be expanded for a new case statement macro
03:14:07FromDiscord<Rika> ah, not elif, i guess its another when
03:14:26FromDiscord<Rika> `when a.kind in {x, ...}: ... ; when a.kind == x: ...`
03:15:01FromDiscord<Rika> i'd like to do this without another library though
03:15:44FromDiscord<ElegantBeef> Well i mean mine doesnt enable that, but yea casestmt macros are here though experimental
03:16:14FromDiscord<Rika> not really a case though is it? and case objects dont allow for duplicated fields across its branches
03:17:14FromDiscord<Rika> because the way that would need to be implemented would be like `case a.kind: of {...}: f1 f2 f3; of x: f1 f2 f3 f4 f5` which is illegal
03:17:43FromDiscord<ElegantBeef> How is that illegal?
03:17:48FromDiscord<Rika> have you tried it
03:20:27FromDiscord<ElegantBeef> would the dots be actual values or dots? πŸ˜„
03:22:15FromDiscord<Rika> values of course
03:22:24FromDiscord<Rika> enum values
03:22:50FromDiscord<Rika> f1... are fields with corresponding names and types (f1 == f1 everywhere)
03:23:28FromDiscord<ElegantBeef> Something like this could work https://play.nim-lang.org/#ix=3nwt
03:24:52FromDiscord<Rika> internet slow
03:25:12FromDiscord<Rika> im assuming its a proc thats called f1 and the different branches have different names for f1
03:25:28FromDiscord<Rika> no, f1 and others are fields in the object
03:26:13FromDiscord<ElegantBeef> Yea i'm too out of it to follow along today, so my bad ideas are even worse
03:26:26FromDiscord<Rika> lmao its fine
03:26:41FromDiscord<Rika> ive been slowly descending into madness because of the code im trying to fix
03:29:30*spiderstew_ joined #nim
03:29:34*spiderstew quit (Ping timeout: 245 seconds)
03:42:14*noeontheend quit (Ping timeout: 240 seconds)
03:42:14*rockcavera quit (Read error: Connection reset by peer)
03:43:43*rockcavera joined #nim
03:54:00*rockcavera quit (Remote host closed the connection)
04:09:19FromGitter<bung87> hmm , could anyone give some web framework design rules? I feel trouble with exception, not sure whether raise or handled by framework
04:09:50FromGitter<bung87> eg. from user side `let j = await request.json()`
04:10:12FromDiscord<Rika> usually handled by framework, unless in a try block?
04:10:26FromGitter<bung87> my framework internal ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60a8843245c2185a5ee1b270]
04:11:12FromGitter<bung87> there are lots of kinds exceptions , I have to decide one by one , that's bad to me
04:13:08FromGitter<bung87> another problem , in this case user can't custom how error responded, eg. they may want response a json with error message
04:13:53FromDiscord<Rika> you bubble the exception up past the programmer code, then handle it when its not caught by the programmer
04:16:17FromGitter<bung87> ```try: ⏎ await scorper.callback(req) ⏎ except: ⏎ discard``` [https://gitter.im/nim-lang/Nim?at=60a8859145c2185a5ee1b527]
04:16:34FromGitter<bung87> so I catch here cover all kinds of exception ?
04:17:04FromDiscord<Rika> pretty much yeah, i believe so
04:17:45FromDiscord<ElegantBeef> Yea an except like that will disregard all errors as if nothing happened
04:18:50FromGitter<bung87> ah ,seems good ! if end user catch I'll do nothing , if not I can response error msg with plain text
04:20:39FromDiscord<ElegantBeef> Feel like i should make a template entitled `doNotCrash` that takes a body and emits a try except πŸ˜„
04:24:57*hyiltiz quit (Ping timeout: 260 seconds)
04:25:20*hyiltiz joined #nim
04:25:20*hyiltiz quit (Changing host)
04:25:21*hyiltiz joined #nim
04:31:07FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60a8890b801b07264e6136f9]
04:31:39FromGitter<bung87> Thanks ! seems fine to me now.
04:33:04FromGitter<bung87> I may have own error json format respect to request accept header I think.
04:47:47FromDiscord<Casey.McMahon> In reply to @ElegantBeef "Seems we can also": is all the procs in the nimscipt module platform independent? could I just use this proc instead? ↡https://nim-lang.org/docs/nimscript.html#cpFile%2Cstring%2Cstring
04:48:23FromDiscord<ElegantBeef> Yea they should be platform independant
04:48:43FromDiscord<Casey.McMahon> cool
04:49:05FromDiscord<ElegantBeef> I've got to be the worst person to maintain the pico stuff since i dont have much reason to use the pico πŸ˜„
04:50:17FromDiscord<Casey.McMahon> well I kinda want to learn how to make bindings, so i guess this might be a good project to learn? I don't know how complex the SDK truly is...
04:50:36FromDiscord<ElegantBeef> the reason for the touch is to tick the time of file creation, idk if any of the procedures will do that
04:50:51FromDiscord<ElegantBeef> The pico-sdk is relatively simple, tinyusb is rather annoyingly complex
04:51:53FromDiscord<Casey.McMahon> haha i forgot to init the submodule the other day, and was running into cryptic error messages down the line that did not point to tinyusb as the cause
04:52:19FromDiscord<ElegantBeef> I'm sure you've looked at the actual stdlib so it should be rather easy wrap it
04:55:45*vicfred quit (Ping timeout: 260 seconds)
04:56:12FromDiscord<ElegantBeef> my attempt was to make it a more idiomatic Nim library but you could always just try c2nim with it if you wanted a usable version πŸ˜„
04:57:14FromDiscord<Casey.McMahon> I'm a fan of idiomatic, it's all about the learning process haha.
04:58:33FromDiscord<ElegantBeef> One of the big detractors is i dont really have the knowledge/physical parts to test the code
04:59:33FromDiscord<Casey.McMahon> my biggest project so far has been trying to create an eeprom programmer. If I had choosen arduino i wouldn't have even had to do anything, would have been done a long time ago. BUT i decided to go with a new microcontroller (limited libraries) and a niche programming language haha.
04:59:39FromDiscord<Casey.McMahon> https://media.discordapp.net/attachments/371759389889003532/845526291490013184/IMG_20210427_142558_1.jpg
05:00:12FromDiscord<ElegantBeef> Shit that's possible with the small amount of code i wrapped?
05:00:36FromDiscord<Casey.McMahon> thus far...
05:01:11FromDiscord<Casey.McMahon> i had to write a custom shiftout module
05:01:16FromDiscord<Casey.McMahon> kinda like this one: https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout/
05:01:38FromDiscord<Casey.McMahon> the led's represent the EEPROM in this case haha
05:02:42FromDiscord<ElegantBeef> Wonder if that is in the pico-sdk and i just didnt wrap it
05:03:06FromDiscord<Casey.McMahon> i did some hard googling, couldn't find it
05:04:47FromDiscord<ElegantBeef> Anywho if you do find some C code you want to use but need to wrap it i can help with it, more fearful of the inability to test if the code is working properly
05:05:03FromDiscord<ElegantBeef> I do mean to get back to tinyusb and get it working but it's an annoying api
05:06:52FromDiscord<Casey.McMahon> one day haha, no rush.
05:12:36FromDiscord<Casey.McMahon> do you know how i would place a variable inside a exec command? like,↡`exec("cmake {var} ..")`
05:12:53FromDiscord<Casey.McMahon> guess i could make the string beforehand...
05:13:05FromDiscord<ElegantBeef> `import std/strformat` `exec(fmt"cmake {var} ..")`
05:13:19FromDiscord<Casey.McMahon> thx!
05:28:13*sixtyten joined #nim
05:35:53*sixtyten quit (Quit: Leaving)
06:27:51*njoseph joined #nim
06:28:36*njoseph quit (Client Quit)
07:33:47*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
07:43:50*Gustavo6046 joined #nim
07:45:28*Jesin quit (Ping timeout: 265 seconds)
07:50:49*hyiltiz quit (Ping timeout: 240 seconds)
07:52:16*hyiltiz joined #nim
07:52:17*hyiltiz quit (Changing host)
07:52:17*hyiltiz joined #nim
08:09:33*Vladar joined #nim
08:15:15FromDiscord<carpal> js >>> operator in nim?
08:15:26FromDiscord<carpal> right shift
08:15:47FromDiscord<carpal> 'shr`?
08:15:49FromDiscord<carpal> (edit) "'shr`?" => "`shr`?"
08:16:43FromDiscord<Rika> `>>>` ? three?
08:16:47FromDiscord<Rika> >> is shr
08:17:19FromDiscord<demotomohiro> If it is bit right shift, shr is
08:17:49FromDiscord<demotomohiro> https://nim-lang.org/docs/system.html#shr,int,SomeInteger
08:18:54FromDiscord<carpal> In reply to @Rika "`>>>` ? three?": in js <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift>, at this point is it the same of shr?
08:18:58FromDiscord<carpal> (edit) "shr?" => "`shr`?"
08:18:59FromDiscord<Rika> there is no equivalent
08:19:25FromDiscord<Rika> ah
08:19:28FromDiscord<Rika> no
08:19:28FromDiscord<Rika> there is
08:19:36FromDiscord<Rika> its just shr yes
08:19:47FromDiscord<Rika> but you must ensure that the number you're shifting is a uint
08:30:18*vegai1 quit (*.net *.split)
08:30:18*robertmeta quit (*.net *.split)
08:30:18*fowl quit (*.net *.split)
08:30:18*skelett quit (*.net *.split)
08:30:18*siinamon quit (*.net *.split)
08:30:18*Yardanico quit (*.net *.split)
08:31:10*vegai1 joined #nim
08:31:10*robertmeta joined #nim
08:31:10*fowl joined #nim
08:31:10*skelett joined #nim
08:31:10*siinamon joined #nim
08:31:10*Yardanico joined #nim
08:31:14ForumUpdaterBotNew thread by Masiarek2: Error: cannot open file: fusion, see https://forum.nim-lang.org/t/8012
08:33:58*Benjamin[m]1 quit (Ping timeout: 246 seconds)
08:34:07*CodeBitCookie[m] quit (Ping timeout: 245 seconds)
08:34:07*Gambit[m] quit (Ping timeout: 245 seconds)
08:34:09*altarrel quit (Ping timeout: 245 seconds)
08:34:09*zuckerberg[m] quit (Ping timeout: 245 seconds)
08:34:09*Avahe[m] quit (Ping timeout: 245 seconds)
08:34:23*leorize[m] quit (Ping timeout: 246 seconds)
08:34:31*ee7[m] quit (Ping timeout: 245 seconds)
08:34:31*stisa quit (Ping timeout: 245 seconds)
08:34:31*reversem3 quit (Ping timeout: 245 seconds)
08:34:40*goblinslayer[m] quit (Ping timeout: 246 seconds)
08:34:40*screamapiller[m] quit (Ping timeout: 246 seconds)
08:35:22*bfgcoding[m] quit (Ping timeout: 246 seconds)
08:35:23*alri[m] quit (Ping timeout: 245 seconds)
08:35:23*Clonkk[m] quit (Ping timeout: 246 seconds)
08:35:23*BitPuffin quit (Ping timeout: 245 seconds)
08:35:24*gemath[m] quit (Ping timeout: 245 seconds)
08:35:24*cheer[m] quit (Ping timeout: 245 seconds)
08:35:39*customer[m] quit (Ping timeout: 258 seconds)
08:36:08*jfondren[m] quit (Ping timeout: 276 seconds)
08:37:25*fbpyr[m] quit (Ping timeout: 276 seconds)
08:38:19*vegai1 quit (Ping timeout: 260 seconds)
08:39:06*wanr[m] quit (Ping timeout: 245 seconds)
08:39:06*dithpri[m] quit (Ping timeout: 245 seconds)
08:39:22*Hasnep[m] quit (Ping timeout: 276 seconds)
08:39:23*lnxw37d4 quit (Ping timeout: 276 seconds)
08:39:23*cadmium[m] quit (Ping timeout: 276 seconds)
08:39:23*Edoardo[m]1 quit (Ping timeout: 276 seconds)
08:39:23*DannyHpy[m] quit (Ping timeout: 276 seconds)
08:39:23*Zoom[m] quit (Ping timeout: 276 seconds)
08:39:23*Avatarfighter[m] quit (Ping timeout: 276 seconds)
08:39:32*MTRNord quit (Ping timeout: 245 seconds)
08:39:52*Guest007[m]1 quit (Ping timeout: 258 seconds)
08:42:50*reversem3 joined #nim
08:44:14*ee7[m] joined #nim
08:44:26*stisa joined #nim
08:44:29*hyiltiz quit (Ping timeout: 246 seconds)
08:46:07*goblinslayer[m] joined #nim
08:47:16*hyiltiz joined #nim
08:47:17*hyiltiz quit (Changing host)
08:47:17*hyiltiz joined #nim
08:51:10*customer[m] joined #nim
08:52:39*leorize[m] joined #nim
08:54:14*Clonkk[m] joined #nim
08:56:29*Benjamin[m]1 joined #nim
08:57:49*BitPuffin joined #nim
09:00:23*altarrel joined #nim
09:01:16*zuckerberg[m] joined #nim
09:01:17*cheer[m] joined #nim
09:01:17*gemath[m] joined #nim
09:01:42*bfgcoding[m] joined #nim
09:01:42*screamapiller[m] joined #nim
09:01:43*CodeBitCookie[m] joined #nim
09:01:47*Gambit[m] joined #nim
09:01:48*Avahe[m] joined #nim
09:02:14*alri[m] joined #nim
09:19:40*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
09:23:22*pbb joined #nim
09:24:02*jfondren[m] joined #nim
09:24:03*fbpyr[m] joined #nim
09:25:28*vegai1 joined #nim
09:32:27*Avatarfighter[m] joined #nim
09:33:54*lnxw37d4 joined #nim
09:34:02*Zoom[m] joined #nim
09:34:02*cadmium[m] joined #nim
09:34:31*Hasnep[m] joined #nim
09:34:34*Edoardo[m]1 joined #nim
09:42:03*dithpri[m] joined #nim
09:42:34*wanr[m] joined #nim
09:45:03*Jesin joined #nim
09:45:43*Guest007[m]1 joined #nim
09:47:30*MTRNord joined #nim
09:52:58*DannyHpy[m] joined #nim
09:53:34*Vladar quit (Quit: Leaving)
10:03:32ForumUpdaterBotNew thread by B3liever: Distinct ptr[T] supports destructors, is it a feature or bug?, see https://forum.nim-lang.org/t/8013
10:19:17*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
10:20:52*pbb joined #nim
10:27:35ForumUpdaterBotNew thread by Bung: Looking for collaborators on open source webview based GUI Framework, see https://forum.nim-lang.org/t/8014
10:44:08*Arrrrrrrr joined #nim
11:23:48*PMunch joined #nim
12:14:57*noeontheend joined #nim
12:18:30*Arrrrrrrr quit (Remote host closed the connection)
12:34:23*natrys joined #nim
12:34:46FromDiscord<zetashift> @treeform in chroma how would I go about converting an `Color` object to a `ColorRGBX` object?
12:37:12*arkurious joined #nim
12:39:55FromDiscord<zetashift> nvm I got it πŸ˜›
12:41:43PMunchHmm, is there a way to expand a non RootObj in Nim?
12:42:26PMunchLike have one type with some fields, and then have another type which expands the first type with more fields
12:42:30PMunchWithout having to re-type all the fields
12:43:01PMunchThis is for micro-controller stuff, so I don't want the overhead of RootObj..
12:43:30PMunchHmm, I guess I could just have the first type as a field..
12:52:50PMunchHmm, any way to make this work? `proc setupTransmit*[P: static[Pin]](pin: P): ManchesterTxOnly[P]`
12:53:29PMunchThe goal is to be able to do `var transmitter = txPin.setupTransmit()` where txPin is a static Pin
13:09:03*PMunch quit (Quit: leaving)
13:10:01ForumUpdaterBotNew thread by Margin: Making Concepts more smooth?, see https://forum.nim-lang.org/t/8015
13:17:26FromDiscord<0ffh> In reply to @Goat "<@!812269866366140427> thanks both of": Yes, just don't forget shuffling the whole deck is O(cards_in_deck) work while just sampling from and reducing the deck is O(cards_drawn).
13:19:32*NimBot joined #nim
13:28:17FromGitter<glyh> Hi guys, can anyone tell me how to maintain polymorphism in nim?
13:29:04FromGitter<glyh> For example, the following codes ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ How can make it runnable? [https://gitter.im/nim-lang/Nim?at=60a9072043fc4a24c5bc2e22]
13:29:45FromGitter<glyh> Thanks a lot!
13:35:08noeontheendMaking them both ref objects runs as written: https://play.nim-lang.org/#ix=3nxJ1~
13:36:07FromGitter<glyh> That fixs it, thanks!
13:50:16*sagax quit (Quit: Konversation terminated!)
13:50:38*sagax joined #nim
14:12:19FromDiscord<mlokis> Is nim compiling packages that depend on same module concurrently?
14:12:33FromDiscord<mlokis> (edit) "Is nim compiling packages that depend on same ... module" added "common"
14:12:41FromDiscord<mlokis> (edit) "packages" => "modules"
14:17:56FromDiscord<haxscramper> I think nim compilation is single-threaded regardless of the module dependency graph
14:18:25FromDiscord<mlokis> so nim compiles on single thread
14:18:44FromDiscord<mlokis> it makes sense when we have static blocks
14:19:11FromDiscord<mlokis> well then i dont have to worry about race conditions in static blocks
14:20:18FromDiscord<mlokis> though it would be logical to compile modules with no relations concurently
14:22:18FromDiscord<haxscramper> I don't think it makes sense really - IC will remove the need to recompile unchanged modules, and writing multhithreaded compiler is probably very difficuly
14:22:52FromDiscord<mlokis> In reply to @haxscramper "I don't think it": you have a point there
14:47:51FromDiscord<zetashift> erhm, say I have a uint32, how would I select/split it and get the 4 bytes separetly returned?
14:51:15FromGitter<jorjun_gitlab> If I want to load up an array from an external file at compile time? I get compiler error: 'Error: cannot 'importc' variable at compile time; fopen' is there a technique I should know about plz?
14:51:28nphgzetashift: dirty solution https://play.nim-lang.org/#ix=3ny2
14:51:56FromDiscord<zetashift> oh damn hahah
14:52:20nphgI'm sure there are better ways
14:59:29nphgA combination of `shr` and `and`: https://play.nim-lang.org/#ix=3ny5
15:02:26*noeontheend quit (Ping timeout: 240 seconds)
15:06:16*lain quit (Ping timeout: 265 seconds)
15:12:27*Vladar joined #nim
15:17:16*lain joined #nim
15:30:52*noeontheend joined #nim
15:55:06*noeontheend quit (Ping timeout: 240 seconds)
15:57:12FromDiscord<zetashift> In reply to @nphg "A combination of `shr`": Oh sweet
16:03:16*natrys quit (Quit: natrys)
16:39:22FromGitter<jorjun_gitlab> I know I will annotate it into nim..
16:43:17*tane joined #nim
16:43:28FromDiscord<Goat> In reply to @0ffh "Yes, just don't forget": I implemented your solution with keepIf from sequtils
16:44:57FromDiscord<Goat> Works fine
16:46:55FromDiscord<treeform> In reply to @zetashift "nvm I got it": In pixie we have a converter that does that automatically.
16:48:48FromDiscord<geekrelief> In reply to @jorjun_gitlab "If I want to": I'm not sure, but you might have to recompile the compiler to get that. In `compiler\vmgen.nim` there's a check for `compiletimeFFI`.
17:01:06FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3nyH
17:02:42*noeontheend joined #nim
17:11:58FromDiscord<exelotl> huh, no you can just use `staticRead` right?
17:12:09FromDiscord<apahl> In reply to @jorjun_gitlab "If I want to": Did you have a look at `staticRead`? (https://nim-lang.org/docs/system.html#staticRead,string)
17:12:38FromDiscord<Casey.McMahon> for NimScript, is it possible to have a single line prompt such as `choose option: ` where the cursor is on the same line and not on a newline? `write(stdout, "Choose Option: ")` doesn't work in NimScript
17:50:46FromDiscord<Casey.McMahon> sent a code paste, see https://play.nim-lang.org/#ix=3nyR
17:52:22FromDiscord<Casey.McMahon> (edit) "https://paste.rs/SoY" => "https://play.nim-lang.org/#ix=3nyS"
17:54:44FromDiscord<mlokis> Why does all serious libraries use object oriented staff? I was searching for a image loading library but they all use inheritance with ref objects. Is that some kind of a good practice? Or is there some good reason to do so.
18:09:07FromDiscord<dom96> which serious libraries did you check?
18:09:18FromDiscord<dom96> Nim tends to discourage OO
18:21:22FromDiscord<mlokis> In reply to @dom96 "which serious libraries did": nimPNG and nimage
18:21:34FromDiscord<dom96> well, that's not a big sample size πŸ™‚
18:22:19FromDiscord<mlokis> but the there is also some opengl abstraction that objectifies everything
18:22:27FromDiscord<mlokis> i have OO
18:22:34FromDiscord<mlokis> (edit) "have" => "hate"
18:22:54FromDiscord<krab4t> any auto-completion support for sublime 4 in nimlime? πŸ™‚ it doesnt work here
18:24:23FromDiscord<mlokis> Why does the nim have OO in first place? Some backwards compatibility issue? I would match rather have interfaces instead
18:24:27FromDiscord<ElegantBeef> It highly depends on what they're doing, pointer procs can also be used if you arent adding logic in children
18:25:49FromDiscord<mlokis> (edit) "match" => "much"
18:34:25FromDiscord<exelotl> nimPNG is pretty bewildering tbh
18:34:51FromDiscord<exelotl> immensely useful library, but not particularly easy to use
18:43:07*fifth joined #nim
18:43:42*noeontheend quit (Ping timeout: 260 seconds)
18:47:13*fossapup64_19401 joined #nim
18:58:02*fossapup64_19401 left #nim ("Leaving")
19:02:21*motersen quit (Remote host closed the connection)
19:03:04*motersen joined #nim
19:04:09Prestigethis does look useful
19:08:54*arecaceae quit (Remote host closed the connection)
19:12:14*arecaceae joined #nim
19:26:15FromDiscord<treeform> In reply to @mlokis "Why does all serious": Pixie can load images and does not use OOP.
19:27:02FromDiscord<treeform> Pixie is much faster then nimPNG at loading pngs.
19:28:05FromDiscord<treeform> Pixie's PNG loading is just 500 lines in a single nim file, hopefully not that hard to understand: https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/png.nim
19:28:24FromDiscord<treeform> it uses the zippy library though (which is also very fast)
19:31:17FromDiscord<treeform> Pixie also can do a ton of other things that you would want to do with images after you load them: https://github.com/treeform/pixie
19:33:00FromDiscord<exelotl> oh that looks very nice
19:38:39FromDiscord<geekrelief> In reply to @exelotl "huh, no you can": You're right. I forgot about `staticRead` I came across that `importc` issue before, so I was looking to fix that issue instead.
19:40:07FromDiscord<exelotl> it's very cool to see that compile time FFI is possible though, I didn't know about it
20:25:39FromDiscord<mlokis> In reply to @treeform "Pixie can load images": nice, i ll probably just paste that code and modify it little, all i need is image loading
20:38:18FromDiscord<treeform> In reply to @mlokis "nice, i ll probably": Sounds good, I think only half deal with image reading (the rest is image writing)
20:51:56FromDiscord<slymilano> Do we have a jobs area in the Discord server? I can't find one - where should I post?
20:52:31FromDiscord<willyboar> Ping Dom or yardanico
20:59:36FromDiscord<slymilano> @Yardanico @dom96 ^ I'm hiring across disciplines but we're going to be using Nim for some projects internally too. Would love to share my job information on this server
21:03:08ForumUpdaterBotNew thread by Stbalbach: How to escape colon in the '&' macro in strformat ?, see https://forum.nim-lang.org/t/8017
21:12:51FromDiscord<dom96> In reply to @slymilano "<@!177365113899057152> <@!132595483838251008> ^ I'm": Awesome. I created a #jobs channel, feel free to post about it there
21:19:20FromDiscord<slymilano> It seems I don't have permissions to post there
21:25:38FromDiscord<brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=3nzO
21:25:41FromDiscord<brainproxy> How can I hunt this down?
21:32:49Prestige@dom96 ^
21:39:25FromDiscord<brainproxy> so I found a workaround: if in module B I create a constant by the same name as the constant table exported by module A, with A's table assigned to the constant in B, then there's no compiler error and the compiled executable runs correctly
21:39:34FromDiscord<brainproxy> but that seems like a compiler bug to me
21:48:34FromDiscord<ajusa> How do folks do tests in Nim nowadays? I've seen `unittest`, `unittest2`, `balls`, and `ptest`. What I would like are tests that are within the source code of my project itself, is there a project that does that already?
21:49:13FromDiscord<ajusa> (edit) "How do folks do tests in Nim nowadays? I've seen `unittest`, `unittest2`, `balls`, and `ptest`. What I would like are tests that are within the source code of my project itself, is there a project that does that already? ... " added "Should I just put tests inside of a "when main module" block?"
21:49:27FromDiscord<juan_carlos> `runnableExamples`
21:50:24FromDiscord<ajusa> In reply to @juan_carlos "`runnableExamples`": How do I make sure that only it is ran then? Do I just normally do `nim c -r source.nim` or is there an additional flag?
21:50:59FromDiscord<juan_carlos> Let CI do `nim doc`.
21:51:33FromDiscord<juan_carlos> And you get docs too.
21:51:38FromDiscord<mlokis> In reply to @slymilano "<@!177365113899057152> <@!132595483838251008> ^ I'm": what made you choose nim? One can argue that its not trusted enough for company to use
21:56:24FromDiscord<mlokis> I mean, i love the language. I can recomand it to anyone with no shame. But from a business standpoint, rust or go is an obvious choice. Thats at least the opinion i percieve.
21:57:37FromDiscord<InventorMatt> There are already a few companies that use nim. Status is a major for example
22:01:48*lain quit (Ping timeout: 246 seconds)
22:01:55FromDiscord<slymilano> sent a long message, see https://paste.rs/3pg
22:02:30FromDiscord<slymilano> I really believe it's a "secret weapon" we can leverage, but I do wish it was more popular, it certainly should be!
22:02:56FromDiscord<slymilano> @dom96 I cant post in #jobs btw
22:05:33FromDiscord<Casey.McMahon> currently for a project template we are asking the user to find their `nimbase.h` and place it next to some compiled C code. Rather than doing that, is it sufficient to check the user's Nim version and grab the appropriate `nimbase.h` file from the Nim github repo (like here: https://github.com/nim-lang/Nim/blob/version-1-4/lib/nimbase.h). ↡↡I see that every major release has it's own branch. But do breaking changes within the `
22:10:29FromDiscord<ElegantBeef> casey we can just query the nim version on creation and if they have choosenim if so automatically copy that version's nimbase.h into the directory
22:11:05FromDiscord<ElegantBeef> I have started on the CLI using my commander library, but think it'll result in me needing go back to work on commander
22:13:12*lain joined #nim
22:14:04*Vladar quit (Quit: Leaving)
22:14:18*GreaseMonkey left #nim ("HYDRA IRC LOL")
22:31:21FromDiscord<treeform> In reply to @slymilano "We are 100% an": Do you have a link to your company to learn more about what you do?
22:40:20FromDiscord<ElegantBeef> I've got a link from yesterday https://www.papa.co/
22:59:35*tane quit (Quit: Leaving)
23:06:38FromDiscord<Rika> In reply to @ElegantBeef "I have started on": is it on an online repo?
23:06:47FromDiscord<ElegantBeef> yea
23:06:52FromDiscord<Rika> lonk
23:06:58FromDiscord<Rika> im lazy xd
23:07:01FromDiscord<ElegantBeef> Needs work still but https://github.com/beef331/commander
23:07:42FromDiscord<Rika> i will work on it :ChigusaPeekLeft:
23:07:52FromDiscord<Rika> ah a cli tool
23:08:15FromDiscord<ElegantBeef> Yea, casey also seems to be interested in working on it, nothing to fancy really
23:08:50FromDiscord<ElegantBeef> Has some minor issues with me needing to reason about things like `nim c args file args`
23:08:57FromDiscord<Rika> ?
23:09:02FromDiscord<Rika> whats the issue there
23:09:24FromDiscord<ElegantBeef> i presently dont have a way to easily capture all args after the present one
23:09:50FromDiscord<Rika> ...why not
23:09:54FromDiscord<ElegantBeef> Shouldnt be too difficult just using an ordered table instead of a table to store the commands
23:09:57FromDiscord<ElegantBeef> I never got around to it
23:10:24FromDiscord<Rika> wait why are you using a table? afaik both a table and a seq are used for stuff like these
23:11:30FromDiscord<ElegantBeef> So i can generate a LUT for parsing the commands
23:11:36FromDiscord<ElegantBeef> Like i said it needs work πŸ˜„
23:11:58FromDiscord<Rika> i might just fork this and put my ideas into it then just call me if you want to steal something xd
23:12:13FromDiscord<ElegantBeef> Lol
23:12:28FromDiscord<ElegantBeef> Feel free to it's MIT licensed and betterment of software is betterment of everything πŸ˜„
23:12:59FromDiscord<Rika> im still debating whether if i want to ngl
23:13:34FromDiscord<Rika> gotta be better than doing that svd parser thing so maybe yeah
23:13:35FromDiscord<ElegantBeef> Yea i mean it was just created after seeing a comment timothee left about nimgrep docs, and i felt like "hey this isnt too hard to make"
23:14:27FromDiscord<ElegantBeef> Got the basis down then started dog fooding a small choosenim alternative with it, then killed it and threw it in a ditch
23:15:17leorize[m]reminds me of nim-argparse
23:15:44FromDiscord<ElegantBeef> Seems similar
23:15:57FromDiscord<Rika> didnt know you were fine with killing dogs
23:17:08FromDiscord<Rika> okay so maybe i wont work on it, i thought it was another kind of tool
23:17:27FromDiscord<Rika> ive not much use of a cli tool creator
23:17:41FromDiscord<ElegantBeef> Ah
23:20:11FromDiscord<ElegantBeef> It's actually very similar to arg-parse, might as well kill off commander πŸ˜„
23:22:41FromDiscord<Rika> lol
23:23:23FromDiscord<ElegantBeef> Now for someone to point out there is a better implementation of all my libraries
23:24:04FromDiscord<Rika> "btw i made a library thats newer than urs but better"
23:25:19FromDiscord<ElegantBeef> Although it doesnt seem argparse lets you run code on successful parsing of arguments, so you have to manually check it after calling parse
23:28:11FromDiscord<ElegantBeef> I still need a name for my ex hseq library, thinking `Varbear` but that only makes sense if you pronounce `var` like in variant
23:28:25FromDiscord<Rika> VaryAnt
23:28:29FromDiscord<Rika> xd
23:28:35FromDiscord<ElegantBeef> VeryAunt
23:29:19FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3nAu
23:29:39FromDiscord<ajusa> specifically the multiple definition part for the linker - how do I even start to figure out why that's happening
23:29:54FromDiscord<ElegantBeef> have you declared anything named `tab`?
23:30:29FromDiscord<ajusa> nope
23:30:55FromDiscord<ajusa> but `iface` does declare a global called `tab` in its source code
23:31:19FromDiscord<ElegantBeef> Cant reason much outside that πŸ˜„
23:32:03FromDiscord<ajusa> am I somehow importing it twice? I don't think that's even possible though
23:32:15FromDiscord<ElegantBeef> Even if you did that shouldnt be an issue
23:34:29saemShould it be possible to do something equivalent to `type Foo[T] = when T is string: int else: T`?
23:35:04saemRather, I'd like to and how might I go about doing something like that because the above doesn't work.
23:37:10saemI have distinct NimNode types, and I want a Maybe[T], that specializes to a distinct typedef based on T. This way I can create procs that operate on various sub-groups of NimNodes in a type safe manner.
23:37:43FromDiscord<ajusa> In reply to @ElegantBeef "Even if you did": so when I changed how I imported the module the problem went away... no clue how I managed to do that though. I think it may have been some weird circular import that caused the linker to fail? This was running in a when main module thing, so maybe that's why Nim didn't catch it?
23:38:39FromDiscord<Rika> nim should have caught it before the linker did even in a when branch
23:39:54FromDiscord<ElegantBeef> Saem if you wrap the when in `()` it compiles but doesnt do what you want, presently when statements in generics always evaluates to the else branch
23:40:03FromDiscord<ajusa> In reply to @Rika "nim should have caught": Hm, I'll try making a MWE then
23:40:19FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3nAw example of it "working"
23:40:50FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/issues/17840
23:40:50FromDiscord<ajusa> in general, are most things that cause `ld` to fail or `gcc` considered Nim bugs? Unless there is some emit or unsafe shenanigans going on
23:41:41saemhmm, I guess the other thing to consider is that a single field object is equivalent to the field itself in C/C++ IIRC. So maybe I can wrap it under an `object` and call it good?
23:42:01FromDiscord<dom96> In reply to @slymilano "<@!132595483838251008> I cant post": ahh, sorry about that. I changed the permissions, can you give it another try? πŸ™‚
23:42:33FromDiscord<ElegantBeef> Yea an object with a single field is the same as an distinct alias internally afaik
23:43:37FromDiscord<Rika> it is?
23:44:01FromDiscord<ElegantBeef> Well it takes the same size as the field of the first object, and it doesnt work with any procedures
23:44:06FromDiscord<ElegantBeef> I dont mean in Nim i mean in C
23:44:17FromDiscord<Rika> xd
23:44:41FromDiscord<ElegantBeef> Anywho as you know saem generics are.... special
23:45:58FromDiscord<ElegantBeef> Anyone want to mark that issue i linked above as a `generics` issue, thanks
23:48:20saemso something like this should work I think... `type Foo[T] = distinct object when T is SpecialNode: n: SpecialNode elif T is NimNode: n : T else: {.error: "nope".}`
23:48:40FromDiscord<ElegantBeef> Except it'll only error
23:49:02saemWait... doesn't that cause issue for Option?
23:49:12saemhttps://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/options.nim#L69
23:49:28FromDiscord<ElegantBeef> I misread the code as a single line
23:49:45FromDiscord<Rika> bruh
23:49:46FromDiscord<ElegantBeef> Wait why the fuck does that work, but not in a single line
23:49:47saemyeah, sorry
23:50:20FromDiscord<ElegantBeef> Excuse me whilst i go abuse myself to resolve the first thing you wanted not working
23:50:38saemhehe
23:51:13FromDiscord<ElegantBeef> For some reason seming when statements for types just defaults to the last tree
23:51:31FromDiscord<ElegantBeef> So it's probably just something messing up the indexing there or actual behaviour
23:52:02FromDiscord<ElegantBeef> Also saem your extension works lovely with onivim2 πŸ˜„
23:52:59saemIn fairness the RHS doesn't provide a type but rather a type expression... so maybe this is all sorta silly.
23:53:22saemProbably should be a `where`, because other languages, future direction notes, and all that.
23:53:43saemElegantBeef: glad to hear that it works well with it.
23:54:04FromDiscord<ElegantBeef> Yea i suppose it's an expression that's sem'd without T context
23:54:30FromDiscord<ElegantBeef> As such it goes to else
23:54:47saemYeah, when is a compile time expression, but not really a type time expression which is what one would want and that's a whole thing.
23:55:06FromDiscord<ElegantBeef> We'll you've saved my self harm, thanks
23:55:08saemBut that gets all muddy.
23:55:21saemoh yeah, how so?
23:55:45FromDiscord<ElegantBeef> You made me talk more about it and realize it's working "properly", so it'd require a large amount of compiler work to "fix"
23:56:16saemAh, yeah that.
23:56:32FromDiscord<ElegantBeef> I'm a numpty i cant even do a small amount of compiler work πŸ˜„
23:56:52saemThere is nothing small about it in the way things are.
23:57:01saemThere is a reason why I'm poking at this AST stuff.
23:57:04FromDiscord<ElegantBeef> have you continued writing that new generics/type system proposal?
23:57:34saemNo, I burned out a bit lately so not trying to do anything that I feel even the slightest amount of resistance doing.
23:58:32FromDiscord<ElegantBeef> Yea i've been wanting to work on a game but instead made 2 libraries, so i'm uhh a great game dev πŸ˜„
23:58:37saemI really do want sum types, type expressions, etc... for this stuff I'm doing right now though. Including that enum type inference you poked at.
23:59:06saemWhat are you finding keeps you looking elsewhere?
23:59:37FromDiscord<ElegantBeef> I think i've pointed that RFC too much at enums since that's all people seem to talk about πŸ˜„