<< 26-05-2022 >>

00:01:26FromDiscord<!Patitotective> how should i cast a `seq[string]` to `seq[cstring]`? `cast[seq[cstring]](mySeq)` doesnt seem to work
00:01:59FromDiscord<Elegantbeef> You cannot
00:02:06FromDiscord<Elegantbeef> you need to make a new sequence of cstrings
00:02:18FromDiscord<Elegantbeef> remember `cstring` is a `ptr char` it's not an allocated collection
00:03:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YBr
00:03:24FromDiscord<Elegantbeef> That should atleast explain that `b` reuses `a`'s memory
00:13:07FromDiscord<luteva> Hi! I want to compare a DateTime, parsed from a string with a creationtime of a file, using getCreationTime.↵So the first returns a Datetime the other one returns a times.Time object. so what is the correct way to do that? converting from time to datetime? or the other way around? or use different procs to get the creation(date)time of a file?
00:14:07FromDiscord<Elegantbeef> `getCreationTime` returns `Time` and `parseTime` returns `Time`
00:15:25*noeontheend joined #nim
00:16:01FromDiscord<luteva> oh yes of course! there's the timezone in parseTime, alright. thank you!
00:16:17FromDiscord<Elegantbeef> No problem
00:22:14*noeontheend quit (Ping timeout: 255 seconds)
00:41:34FromDiscord<Elegantbeef> Ok i'm quite surprised that Nim didnt explode implementing a `Sentinel` type
00:41:36FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3YBt
00:42:02*vicfred joined #nim
00:44:00FromDiscord<huantian> static auto generic...
00:44:11FromDiscord<Elegantbeef> Yea i didnt expect it to work
00:44:43NimEventerNew question by itil memek cantik: Nim to use identifier names space, see https://stackoverflow.com/questions/72385515/nim-to-use-identifier-names-space
00:58:25*xet7 quit (Remote host closed the connection)
01:00:41FromDiscord<!Patitotective> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3YBt": _\visible confusion\_
01:04:26FromDiscord<Elegantbeef> It's like `std/options` but uses 0 extra memory
01:04:52FromDiscord<Elegantbeef> You specify an invalid value
01:06:00FromDiscord<demotomohiro> `Sentinel` is a distinct type and specified value is sentinel value.
01:08:11FromDiscord<demotomohiro> `distinctBase <https://nim-lang.org/docs/typetraits.html#distinctBase.t%2CT%2Cstaticbool>`_ is used.
01:08:27FromDiscord<demotomohiro> https://nim-lang.org/docs/typetraits.html#distinctBase.t%2CT%2Cstaticbool
01:11:03FromDiscord<!Patitotective> and why would i want a sentinel?
01:11:19FromDiscord<!Patitotective> (edit) "and why would i want a sentinel? ... " added "like when"
01:11:37FromDiscord<Elegantbeef> When you want option but dont want to take up extra memory
01:16:03FromDiscord<huantian> actually that would be kinda convenient if all the valid values were `Positive` and you could just have `-1` be the sentinel
01:16:19FromDiscord<Elegantbeef> You can do that with a overload 😄
01:16:30FromDiscord<huantian> yeah but it's not as ✨ fancy ✨
01:16:37FromDiscord<demotomohiro> !eval import options; echo sizeof(Option[int]), ", ", sizeof(int)
01:16:40NimBot16, 8
01:20:25FromDiscord<Elegantbeef> What do you mean huan?
01:20:38FromDiscord<Elegantbeef> `sentinal(100, Positive)`?
01:23:14arkanoidI'm looking into a native windows dll with a disassembler. Some exported functions are __cdecl, some other are __stdcall, I'm puzzled
01:24:07FromDiscord<huantian> In reply to @Elegantbeef "`sentinal(100, Positive)`?": sentinalVal would be -1 as `-1..high(int)` then the value it would hold would be a Positive↵but it seems like a kinda bad idea lol
01:25:25FromDiscord<Elegantbeef> you can just do range.low.prev or pred w/e it is
01:29:56FromDiscord<huantian> true, as long as the range isn't low(int)..high(int) you could automatically choose a sentinel for range types
01:30:14FromDiscord<Elegantbeef> This nerd thinking only with ints
01:30:24FromDiscord<Elegantbeef> Enums are the same
01:31:56FromDiscord<huantian> I meannnn enums are just fancy ints 😛
02:17:27FromDiscord<sken130> Hi, I registered my account in https://forum.nim-lang.org, but I still haven't received the confirmation after 23 hours. What should I do?
02:17:44FromDiscord<ambient> it's all a bunch of nand gates in the end
03:19:00FromDiscord<Elegantbeef> Ping dom96 is what most do 😄↵(@sken130)
03:19:41FromDiscord<sken130> @dom96 Hi, I registered my account in https://forum.nim-lang.org/, but I still haven't received the confirmation email after 23 hours. What should I do?
04:30:56*ltriant quit (Ping timeout: 258 seconds)
05:04:17FromDiscord<Elegantbeef> @treeform\: does pixie presently have a "Render to quad with a given font size, or shrink to best fit if too large" feature?
05:10:48*ltriant joined #nim
05:12:48FromDiscord<treeform> No it does not. You can probably make it one in like 10 lines
05:12:58FromDiscord<treeform> just compute layout on font you have
05:13:22FromDiscord<treeform> dec font size if it does not fit
05:13:24FromDiscord<treeform> and try again
06:27:45FromDiscord<my mom said 👇> how do i use parseopt to select a file
06:28:59FromDiscord<my mom said 👇> sent a code paste, see https://paste.rs/jUs
07:19:29FromDiscord<mbrc> Is the result of every typeof call known at compile time?
07:20:03FromDiscord<Elegantbeef> Yes
07:21:34FromDiscord<my mom said 👇> ik how to do the output part but not getting how to get the file
07:22:27FromDiscord<Elegantbeef> If you dont need options just use `os` `paramstr`s
07:29:47FromDiscord<Elegantbeef> To elaborate mbrc all types are known statically in Nim, so there is no way to have `typeof` run at runtime, types dont even exist there 😄
07:33:20FromDiscord<my mom said 👇> In reply to @Elegantbeef "If you dont need": damn how do i use it
07:33:31FromDiscord<my mom said 👇> the docs ain't helping
07:33:31FromDiscord<Elegantbeef> Do you read docs or just ask questions
07:33:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/os.html#paramStr%2Cint
07:33:56FromDiscord<my mom said 👇> In reply to @uncle jim "the docs ain't helping": this
07:33:59FromDiscord<Elegantbeef> Well formulate an actual question
07:34:47FromDiscord<my mom said 👇> sent a code paste, see https://play.nim-lang.org/#ix=3YCa
07:35:22FromDiscord<Elegantbeef> You do `let myFile = paramStr(1)`
07:35:26FromDiscord<Elegantbeef> Then you're done
07:36:02FromDiscord<my mom said 👇> In reply to @Elegantbeef "You do `let myFile": hmmmm got it thenks
07:36:46*jjido joined #nim
07:38:03FromDiscord<mbrc> I see, thanks for the clarification. I was getting confused by all the typeof calls in the template examples in the manual.
07:45:30*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:49:08*ltriant quit (Ping timeout: 246 seconds)
09:09:59FromDiscord<dom96> In reply to @Elegantbeef "Ping dom96 is what": Ping `@Moderator`. Any mod can activate accounts on the forum.
09:42:46FromDiscord<sken130> <@&371760044473319454> Hi, I registered my account in https://forum.nim-lang.org/, but I still haven't received the confirmation email after 23 hours. What should I do?
09:46:46FromDiscord<PMunch> It says your account is already a user
09:47:00FromDiscord<PMunch> Not sure if Dom already fixed it
09:55:37FromDiscord<dom96> yep, I fixed it
09:55:51FromDiscord<sken130> Oh, thanks a lot.
10:09:50*jjido joined #nim
10:11:03*ltriant joined #nim
10:44:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:06:44FromDiscord<Othello> sent a code paste, see https://paste.rs/Vrd
11:07:35FromDiscord<Othello> (edit) "https://play.nim-lang.org/#ix=3YCI" => "https://play.nim-lang.org/#ix=3YCH"
11:08:34FromDiscord<Othello> (edit) "https://play.nim-lang.org/#ix=3YCH" => "https://paste.rs/1ee"
11:08:46arkanoidI'm looking into a native windows dll with a disassembler. Some exported functions are __cdecl, some other are __stdcall, I'm puzzled
11:10:13arkanoidwhat would cause this? do I have to cimport them following this difference?
11:15:10FromDiscord<Andreas> @Othello your variant type-definition would help now or a minimal thing in the playground
11:16:06FromDiscord<Othello> Hi @Andreas ! Here the full variant-type definition. Sorry it's a bit long:
11:16:19FromDiscord<Othello> sent a code paste, see https://play.nim-lang.org/#ix=3YCN
11:16:28FromDiscord<Rika> That’s a chonker
11:16:47FromDiscord<Rika> When it’s an error from the C compiler it’s usually a compiler issue
11:19:50FromDiscord<Andreas> In reply to @Rika "When it’s an error": @Rika maybe better to ask at #internal ? sry @Othello u need more competence than i can provide
11:20:46FromDiscord<Rika> Othello’s error involves a C compiler error
11:22:27FromDiscord<Andreas> In reply to @Rika "Othello’s error involves a": so this a issue for #main or github ?
11:23:02FromDiscord<Rika> I mean a compiler issue in that issue means its dictionary definition
11:23:30FromDiscord<Rika> I have a suspicion it’s the var return and inline
11:24:27FromDiscord<Othello> Thanks @Rika and @Andreas! Shall I open an issue on Github then? Or should we move this to #internal?
11:26:07FromDiscord<Othello> I have a hard time pinning down the bug to a small reproducible example
11:49:19FromDiscord<Othello> Removing the `{.inline.}` pragma on `append` doesn't fix it
12:04:10FromDiscord<konsumlamm> In reply to @Othello "Thanks <@259277943275126785> and <@7542845173168865": this is a bug and the github issue teacker is for bug reports, so yes, open an issue
12:15:03*arkurious joined #nim
12:48:44*djanatyn1 quit (Ping timeout: 250 seconds)
12:49:08*djanatyn1 joined #nim
13:32:57*rockcavera quit (Remote host closed the connection)
13:40:03FromDiscord<Othello> Thanks @konsumlamm , @Rika and @Andreas . I have submitted a Gihub issue over there: https://github.com/nim-lang/Nim/issues/19833↵↵I have managed to distill the problem down to the following minimal reproducible example (also posted on the GH issue): https://play.nim-lang.org/#ix=3YDf
13:46:39FromDiscord<Othello> In the meantime, would you have a recommendation to circumvent the issue?
13:47:12FromDiscord<Yardanico> @Othello don't use `discardable`, your example in the github issue works without that
13:47:26FromDiscord<Yardanico> or as an alternative - just don't return the var string itself after changing it
13:49:30FromDiscord<Othello> Thanks @Yardanico! Indeed, it does fix it, thanks a lot! I just wanted to be able to chain the calls - would you recommend mechanism other than returning the var string to achieve that?
13:49:50FromDiscord<Yardanico> oh, if you want to chain, then you have to do it this way I guess
13:50:15FromDiscord<Othello> `discard`ing explicitly is a lesser evil, will definitely work for now!
14:12:11om3gaHi everybody! do we have something that frees allocated heap? I created signal handler where all shared ram being freed, but valgrind still reports that there is something in ram
14:13:01FromDiscord<Yardanico> no, Nim trusts the OS to clean up all the unfreed stuff on program exit, that's why it doesn't free things like global variables
14:13:17FromDiscord<Yardanico> "something in ram" is probably global variables or something, it's nothing to worry about
14:13:55FromDiscord<Yardanico> of course it might be a leak, but you need to check what exactly valgrind is saying
14:16:44FromDiscord<John0> Is the email verification for nim forum broken?
14:16:55FromDiscord<John0> (edit) removed "the"
14:17:00om3gaYardanico, thanks for explanation. I don't had before too much experience with shared, so I hope freeShared will do it's job
14:17:40FromDiscord<Yardanico> In reply to @John0 "Is email verification for": it's not broken, but in a lot of cases the emails don't get past the email providers checks
14:17:46FromDiscord<Yardanico> what's your username? i can activate you manually
14:17:47om3gaI mean in handler, since last time I used custom handlers in C, it was strong pain
14:17:58FromDiscord<John0> Jon
14:19:04FromDiscord<Yardanico> In reply to @John0 "Jon": activated
14:19:17FromDiscord<John0> In reply to @Yardanico "activated": Thanks
14:27:16FromDiscord<stoneface> how do you get a command line switch in nimscript? Like how do I check `cc` is `vcc`?
14:30:23FromDiscord<Yardanico> In reply to @stoneface "how do you get": one way is https://nim-lang.org/docs/nimscript.html#getCommand
14:30:32FromDiscord<Yardanico> or you can just check `if defined` i think
14:30:39FromDiscord<Yardanico> but not sure, lemme dig a bit more, I don't use nimscript that much
14:34:35FromDiscord<stoneface> getCommand doesn't give you the switches though
14:35:16FromDiscord<Yardanico> there is https://nim-lang.org/docs/compilesettings.html but I'm not sure if it works for Nimscript
14:35:46FromDiscord<Yardanico> In reply to @stoneface "getCommand doesn't give you": if you mean `define`, you can probably check them in nimscript with the usual `when defined`
14:41:47FromDiscord<stoneface> like `when defined(cc):`?
14:42:19FromDiscord<stoneface> tried that and it evaluates to false for `cc` and `vcc`
14:43:20FromDiscord<stoneface> I could parse `os.commandLineParams` but I'd rather not do that if I don't have to
14:49:10*haliucinas quit (Ping timeout: 260 seconds)
15:04:35FromDiscord<stoneface> just trying to pass `/nologo` when building a static library with vcc since nim doesn't
15:09:50FromDiscord<Yardanico> In reply to @stoneface "just trying to pass": you can just add an option specifically to vcc
15:10:26FromDiscord<Yardanico> check the main nim config, it has a lot of this stuff https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg
15:10:46FromDiscord<Yardanico> In reply to @stoneface "just trying to pass": also it does seem to pass /nologo to VCC so it's weird https://media.discordapp.net/attachments/371759389889003532/979401209725218816/unknown.png
15:11:57FromDiscord<stoneface> yeah it only doesn't pass it for `--app:staticLib`
15:14:56FromDiscord<stoneface> in the nimcache json, it uses `lib` as the linkcmd instead of `vccexe.exe` and also doesn't use any of the flags passed via --passL
15:15:26FromDiscord<stoneface> so I'm not sure if tweaking the config will help
15:32:16*soileh joined #nim
15:48:56FromDiscord<demotomohiro> In general, a program that links object files and generate an exetuable file and a program that link object files and generate static link file is different. So you cannot simply pass linker options to `ar` or `lib` commands.
15:49:59FromDiscord<demotomohiro> We might need additional option for `ar` or `lib`.
15:56:57FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/blob/d81edcacc6740a99b0360cf31ddc2f2a1626006c/compiler/extccomp.nim#L156↵Sending a PR that just adds `/nologo` option to this line would be easiest way.
16:03:34FromDiscord<demotomohiro> It seems currently there is no way to pass additional options to `ar` or `lib` command excepts editing `compiler/extccomp.nim`. Probably we dont need to pass additional options to these commands in most case.
16:13:56FromDiscord<stoneface> ah right it's an archiver not a linker, passL doesn't make sense for this context
16:15:23FromDiscord<stoneface> so a `--passA:<flags>` option would be nice but yeah I don't think most people will need that
16:57:04*rockcavera joined #nim
16:57:05*rockcavera quit (Changing host)
16:57:05*rockcavera joined #nim
17:15:30*noeontheend joined #nim
17:19:30*noeontheend quit (Ping timeout: 240 seconds)
17:58:09*jjido joined #nim
18:38:09*xet7 joined #nim
18:39:44FromDiscord<RootofFear> Anyone know of a functioning audio library capable of playing on a device of choice, and multiple devices at the same time(with or without threading). Other things that would be dope are the ability to playback a wav file on only one channel of an audio device. As well as easily integrated audio control.
18:43:00FromDiscord<RootofFear> I had been trying to use OpenAL but it had lots of issues with devices.
18:43:53om3ganoob questuon, I need to close socket, and use proc from std/net. but compiler warns that close(file) is choosen
18:44:02om3gawhat can I do :D
18:51:56FromDiscord<Yardanico> wdym "warns" ?
18:52:09FromDiscord<Yardanico> it can't choose a close for a file if you're closing a socket, they have different types
18:52:12FromDiscord<Yardanico> @om3ga
18:52:29FromDiscord<Yardanico> is your socket an actual socket or a file descriptor?
18:55:57FromDiscord<stoneface> In reply to @RootofFear "Anyone know of a": check out https://miniaud.io
18:56:34FromDiscord<stoneface> don't think there's any nim bindings but it's a header only C library so it shouldn't be too difficult to interface with it
18:56:41om3gaYardanico, real socket
18:56:52FromDiscord<Yardanico> if it's a nim socket, just call `close` on it no problem
18:56:58FromDiscord<Yardanico> i mean if you created it in nim
18:57:08om3gaah, no,it's cint
18:57:35om3gaor I can try to cast it to that type
18:59:19FromDiscord<Yardanico> you just close the socket as a file descriptor then
19:11:30om3gait segfaults, but close from std/posix worked
19:15:50om3gaswesome, found the way how to unblock FCGX_Accept_r and gracefully shutdown all the threads
19:16:58om3gaI think it would be great if some easy mechanism will exist for thread termination. maybe based on signals or something
20:30:36*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:31:47*xet7 quit (Remote host closed the connection)
21:19:24*jjido joined #nim
22:16:53*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:22:54*ehmry quit (Ping timeout: 250 seconds)
22:31:51*krux02 joined #nim
22:33:25FromDiscord<ripluke> How can I use Nim to make a file and write some lines to it
22:33:54FromDiscord<dom96> `writeFile("filename.txt", "file contents")`
22:42:53*xet7 joined #nim
22:47:55FromDiscord<Elegantbeef> You can use the streams API depending
23:47:44FromDiscord<commander_c> https://play.nim-lang.org/#ix=3YFy
23:47:55FromDiscord<commander_c> Hi all, looking for assist with indentation error here. No clue...
23:48:02FromDiscord<commander_c> (New to Nim)
23:48:27FromDiscord<Elegantbeef> `"Date: ", line` is invalid code
23:48:41FromDiscord<Elegantbeef> do you mean `"Date: " & line`?
23:49:03FromDiscord<commander_c> Oh is & needed for concatenation? I'm assuming line is a regular string I guess.
23:49:17FromDiscord<Elegantbeef> `&` is collection concatenation yes
23:49:33FromDiscord<commander_c> Thank you bot, what is a collection?
23:49:43FromDiscord<Elegantbeef> sequence, string
23:49:49FromDiscord<Elegantbeef> I'm not a bot!
23:50:05FromDiscord<commander_c> Cool, thanks & apologies
23:50:09FromDiscord<Elegantbeef> Do you have an example of the file btw?
23:50:27FromDiscord<commander_c> I could put one together. Let me see.
23:51:39FromDiscord<Andreas> https://play.nim-lang.org/#ix=3YFz
23:51:45FromDiscord<Elegantbeef> also line 34 isnt updating the date
23:51:52FromDiscord<Elegantbeef> line 34 is declaring a new variable
23:52:00FromDiscord<Elegantbeef> Ah andreas got it
23:52:34FromDiscord<commander_c> Oh cool. Thanks to Andreas, I'm just putting this demo file together rn
23:52:45FromDiscord<commander_c> Is there a way to see a diff or should I manage that here
23:52:47FromDiscord<Elegantbeef> worth noting also line 21 does nothing
23:53:04FromDiscord<Elegantbeef> You'll have to diff it yourself
23:54:05FromDiscord<commander_c> https://pastebin.com/NhBF5Uda
23:54:08FromDiscord<commander_c> There's the demo file.
23:55:17FromDiscord<Elegantbeef> is `+billed` always at the end?
23:55:18FromDiscord<commander_c> OK, so what I'm learning today is that collections are a thing, that they are concatted with &, and that I need to watch that I'm not declaring vars where I mean to assign values to them.
23:55:38FromDiscord<commander_c> No, +billed can be anywhere
23:55:56FromDiscord<commander_c> Once it's found we're not working with current timesheet data anymore.
23:56:17FromDiscord<commander_c> Like, "below this point in the file was already billed"
23:57:08FromDiscord<Elegantbeef> Ah was going to mention the `endswith` and `startswith` procedures
23:57:41FromDiscord<commander_c> Oh, line 21 isn't needed? Weird, I swear I got that from some example. So "line in lines" takes care of opening that?
23:58:04FromDiscord<Elegantbeef> Yep `lines` opens the file and iterates all it's lines
23:59:08FromDiscord<commander_c> Oh, those procedures would be great, I'll check them out.
23:59:55FromDiscord<commander_c> I don't like contains..."### 20" at all but I'll be retired by the time we hit the year 2100 hopefully