<< 08-04-2022 >>

00:44:39*SamuelMarks quit (Ping timeout: 256 seconds)
01:10:10*SamuelMarks joined #nim
01:15:05*SamuelMarks quit (Ping timeout: 248 seconds)
01:24:32FromDiscord<Alea> possibly stupid question, but would int stringification or using an int to access a table of strings be faster?
01:27:04FromDiscord<Elegantbeef> the latter is faster
01:27:30FromDiscord<Elegantbeef> Depending on the range an array is even faster
01:29:42FromDiscord<Elegantbeef> A `Hash` is afterall just an `int`
01:30:24FromDiscord<Alea> touché, array is the way to go
01:31:55FromDiscord<Elegantbeef> Not to say that it's a straight operation, the integer is still hashed, but it's a relatively cheap operation to hashing a string
01:33:30*yoyojambo joined #nim
01:37:40*SamuelMarks joined #nim
01:42:26*SamuelMarks quit (Ping timeout: 246 seconds)
01:46:47FromDiscord<Rika> An int hash is the int itself, there is no transformation I believe
01:54:26*SamuelMarks joined #nim
01:59:21*SamuelMarks quit (Ping timeout: 248 seconds)
02:07:55*arkurious quit (Quit: Leaving)
02:19:17FromDiscord<demotomohiro> !eval import hashes; echo hash(123)
02:19:20NimBot-639173177476267748
02:29:01FromDiscord<Rika> Might have been changed from what I remember recently
02:29:10FromDiscord<Rika> When I read the code there was no transformation
02:32:48FromDiscord<xflywind> There is a `-d:nimIntHash1` option to keep backward compatibility.
02:34:31*zeus-supreme joined #nim
02:37:42*zeus-supreme1 quit (Read error: Connection reset by peer)
02:59:33FromDiscord<demotomohiro> If I remember correctly, using int keys without hashing it cause many collision if lower half bits of input ints were same.
03:02:49FromDiscord<Rika> Huh why so
03:13:35FromDiscord<demotomohiro> Putting date in table is like internalSeq[hash(key) & (internalSeq.len - 1)] = data (internalSeq.len is power of 2).
03:33:45*rockcavera quit (Remote host closed the connection)
03:41:32termeris there any way to disable staticExec in the nim compiler?
03:41:45termerit bothers me a lot that any library can run any command on my computer during compilation
03:45:58FromDiscord<Rika> Not as of now I don’t think, chroot jail if you’re paranoid
03:46:20FromDiscord<Elegantbeef> i think you can disable vmops with a flag
03:47:00termerI don't think I should have to setup a chroot jail to compile software but I suppose that's the state of nim
03:47:23termerElegantBeef where would that be documented?
03:47:57yoyojamboI think it is in the compiler user guide
03:48:32yoyojambohttps://nim-lang.org/docs/nimc.html
03:49:26termerthanks
03:49:52FromDiscord<Elegantbeef> It seems there is no way of doing it to the compiler's VM presently
03:50:05termerthat's worrying
03:50:23FromDiscord<Elegantbeef> Eh araq isnt opposed to it, just hasnt done it
03:50:29FromDiscord<Elegantbeef> It's hardly an issue, imo
03:50:37FromDiscord<Elegantbeef> After you compile code, you generally want to run it
03:50:40termerit's not an issue when you trust every library you use
03:51:14FromDiscord<Elegantbeef> Sure except you generally run code after compiling
03:51:23yoyojamboif you don't trust it, why use it in your code?
03:51:48termerexecution during runtime and development are 2 different things
03:52:01termerfor example, I might build something in a different environment than when it's run
03:52:13FromDiscord<Rika> If you don’t trust it to be safe during compilation why do you trust it to be safe during run time
03:52:37FromDiscord<Elegantbeef> I mean the argument is "I have untrustworthy code that is evaluated at compile time and runtime"
03:52:43FromDiscord<Elegantbeef> I mean i dont disagree that it should be able to
03:52:52FromDiscord<Rika> Me neither, it’s just not there yet
03:53:00termerdevelopment on your own machine is a big reason why
03:53:06termeryou may only be compiling something
03:53:25termeror if you're wanting to cross compile something for a device you view as more secure than your compilation environment
03:53:27FromDiscord<Elegantbeef> And then whatever you pass the binary to is going to trust the malicious code
03:53:37FromDiscord<Rika> Then what, throw the binary away? If something nukes a computer during development I’m sure as hell not deploying that binary
03:53:39termerright but here's a real world example
03:53:49termerI have a virtual server that's very locked down
03:54:03termerif it had malware on it, there wouldn't be much it could do
03:54:14termerbut I've compiled software on a build server to place into that server
03:54:54yoyojambothat sounds very hypothetical
03:55:12termerit's not hypothetical cause I've done it
03:55:13yoyojambobut I guess the feature wouldn't hurt
03:55:23FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pull/16943#ref-issue-932085919
03:55:28FromDiscord<Elegantbeef> Bump that i guess
03:56:31FromDiscord<Rika> It would be nice to have yes
03:56:53termerpeople just don't usually expect that ability for source code to run arbitrary commands at compile time
03:57:27termerand for the people who are aware of it and want to close another possible vector for attack, it would be helpful
03:57:55FromDiscord<Elegantbeef> We all said it should exist, so yes
03:59:02FromDiscord<Rika> https://forum.nim-lang.org/t/5315
04:00:31termerreading right npw
04:00:32termernow
04:02:23Amun-RaElegantbeef: I finally made a short test case, https://github.com/nim-lang/Nim/issues/19698
04:06:13FromDiscord<Elegantbeef> Ah interesting bug
04:11:56*slowButPresent quit (Quit: leaving)
04:15:41FromDiscord<Elegantbeef> Seems it generates some runtime code for the static code, but it results in C attempting to access `T7_`
04:22:14Amun-RaT7_, T14_, T21_ etc.
04:22:39FromDiscord<Elegantbeef> Yea it doesnt make much sense why it does
04:45:31*yoyojambo quit (Ping timeout: 260 seconds)
05:29:21*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
05:34:29*SamuelMarks joined #nim
05:39:17*SamuelMarks quit (Ping timeout: 272 seconds)
05:49:18*kayabaNerve joined #nim
05:53:46*wyrd quit (Quit: leaving)
05:54:05*wyrd joined #nim
05:58:49*kayabaNerve quit (Ping timeout: 248 seconds)
06:27:13FromDiscord<Elegantbeef> @Girvo\: hey if you're about wanna help me with the cmake stuff? 😄
06:47:44FromDiscord<Elegantbeef> Well if anyone has any clue how with CMake to link library names stored in another file and wants to tell me, that'd be great
06:52:52FromDiscord<demotomohiro> I used CMake long time ago. CMake has some command that run other CMake files in subdirectly.
06:56:23*ltriant quit (Ping timeout: 246 seconds)
06:59:58FromDiscord<Elegantbeef> Ah i think i'm cheesing it with a cmake function, but it works so alas i'm happy
07:01:47FromDiscord<demotomohiro> Here is my old CMAKE sample code to build a library and use it. https://github.com/demotomohiro/testCMakePackage
07:02:35FromDiscord<demotomohiro> add_subdirectory command loads CMake fild in subdirectly.
07:02:57FromDiscord<Elegantbeef> This is just for the rpi pico library for auto linking libraries
07:03:06FromDiscord<Elegantbeef> So it's mostly just me injecting my code there
07:11:28FromDiscord<Valdar> So, I'm assuming that if I compare 2 strings via `if someString == someOtherString:` it will compare lengths first to return a quick false: That sound right?
07:11:40FromDiscord<Elegantbeef> Yes
07:12:19FromDiscord<Valdar> Thx, I just didn't want to explicitly compare and have stupid looking code 🙂
07:23:52*ltriant joined #nim
07:47:18Amun-RaElegantbeef: hmm, read file contents and store it in a variable: file(READ filaneme variable)
07:50:30FromDiscord<mratsim> @termer @Rika @ElegantBeef , I agree with termer, staticExec is both very nice and a security hole.↵↵We've had long and heated discussions about this 3 years ago, see IRC logs linked at: https://github.com/nim-lang/Nim/issues/12125
07:57:14FromDiscord<Rika> I didn’t say I disagree
07:57:19FromDiscord<Rika> It should be part
08:00:38FromDiscord<Elegantbeef> Yea no one said it shouldnt be, it's more just a case of whether it's an overly concerning way of running malicious code
08:12:23FromDiscord<demotomohiro> Even if you disable staticExec, malicious code can be placed in procedures in the library.
08:14:06FromDiscord<Rika> Their argument is that the runner is well armoured but their builder is not
08:14:11FromDiscord<Rika> Which imo is a design flaw
08:15:05FromDiscord<demotomohiro> I see
08:17:58FromDiscord<Solitude> you still have file system access from nimscript and can do all the damage staticExec does without it
08:18:14FromDiscord<Solitude> almost all
08:26:53FromDiscord<demotomohiro> Maybe `staticRead` reads some secret file and send it to somewhere via internet at runtime.
08:28:05*PMunch joined #nim
09:04:44*zeus-supreme1 joined #nim
09:07:00FromDiscord<planetis> What does '`Error: [] must have some form of array type` mean? And how do I fix this\: https://play.nim-lang.org/#ix=3UB8
09:07:37*zeus-supreme quit (Ping timeout: 248 seconds)
09:07:43FromDiscord<Elegantbeef> Well you cannot take an address of consts
09:08:36*koltrast quit (Quit: ZNC - http://znc.in)
09:10:35FromDiscord<Elegantbeef> May want to do https://play.nim-lang.org/#ix=3UBa
09:10:39FromDiscord<Elegantbeef> I dont know really though
09:11:09FromDiscord<planetis> cool thanks ElegantBeef
09:11:37FromDiscord<planetis> it's very similar to what I am trying to rewrite https://github.com/raysan5/raylib/blob/master/examples/others/embedded_files_loading.c#L51
09:11:54FromDiscord<planetis> but I guess that would try to free static memory
09:12:06FromDiscord<planetis> so I don't think I can port this
09:12:40FromDiscord<Elegantbeef> There is no point in nim
09:13:08FromDiscord<Elegantbeef> We can just use static load and dont need the same api
09:13:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UBd
09:14:16FromDiscord<planetis> right that's easier anyway
09:14:59FromDiscord<Elegantbeef> Yea their image data is static anyway so you could use the codegen if you really wanted to
09:16:00PMunchHmm, this reminds me of loading sprites onto the Arduboy on compile-time :P
09:17:17*koltrast joined #nim
09:23:23*lumo_e joined #nim
09:56:40FromDiscord<bryankrn> are pragmas commonly used
09:58:00FromDiscord<Rika> Yes, why do you ask
09:59:06FromDiscord<bryankrn> because im learning nim and theres like 200 pragmas in these sections combined and i dont wanna go over them https://media.discordapp.net/attachments/371759389889003532/961928160390299678/unknown.png
10:02:09FromDiscord<Rika> You don’t have to go over all of them
10:09:16*ozzz joined #nim
10:10:09*ozzz is now known as om3ga
10:10:25FromDiscord<exelotl> there are a bunch of useful ones but it really depends what you're doing (which, come to think of it, is exactly why they're pragmas)
10:10:46FromDiscord<Phil> In reply to @bryankrn "because im learning nim": Pragmas are a "look at them when you have a need"↵One I'd generally recommend keeping in mind is the compileTime pragma
10:11:45FromDiscord<Phil> (edit) "need"↵One" => "need" kind of thing↵One"
10:12:03PMunch@bryankrn, in general you don't have to think about pragmas. But if you ever feel like you're in a corner case and want to nudge Nim in some other direction then a pragma is probably what you want. The exception is the async pragma which you're going to use whenever you use async
10:12:29FromDiscord<Solitude> or ffi
10:12:58PMunchI was considering that an edge case, in a perfect world someone else has already written a wrapper for you so you don't have to think about it
10:13:10PMunch(or you use Futhark and don't have to think about it regardless)
10:14:18FromDiscord<exelotl> In reply to @Isofruit "Pragmas are a "look": hmm I'm not so sure about that, you're best off using https://nim-lang.github.io/Nim/macrocache.html so that your code works with IC when that arrives
10:14:26FromDiscord<exelotl> unless it's a `compileTime` variable that _cannot_ be influenced by anyone who's calling into your module
10:14:55FromDiscord<Rika> Macro cache is relatively new so most of us aren’t very familiar with it yet
10:14:59*jmdaemon quit (Ping timeout: 260 seconds)
10:15:48FromDiscord<Phil> In reply to @exelotl "hmm I'm not so": I use that thing for compile-time checks on my own code for the most part
10:15:48FromDiscord<Solitude> In reply to @exelotl "unless it's a `compileTime`": he probably means compiletime on procs
10:15:55FromDiscord<exelotl> ohhh
10:15:56FromDiscord<Phil> Mostly to drive beef mad
10:16:08FromDiscord<exelotl> yeah compileTime on procs is good
10:16:16FromDiscord<Phil> That's a lie, I find writing compile time procs easier than writing concepts
10:16:28FromDiscord<Phil> (edit) "lie," => "lie (me wanting to make beef mad9,"
10:16:34FromDiscord<Phil> (edit) "mad9," => "mad),"
10:17:01FromDiscord<Solitude> yeah, we already heard that you're a weird fella
10:17:11FromDiscord<bryankrn> would be strangely cool if there was a nim to brainfuck transpiler
10:17:15FromDiscord<Rika> Especially after that Java-esque fiasco
10:17:18FromDiscord<Phil> You're just biased against your code screaming at you, your opinion is invalid
10:17:56FromDiscord<Rika> In reply to @bryankrn "would be strangely cool": You’re gonna have a bit of difficulty
10:19:02FromDiscord<exelotl> In reply to @Rika "Macro cache is relatively": yeah, I was totally confused, until yardanico added examples to the docs x)
10:21:23FromDiscord<Rika> It’s basically just a table though
10:27:39FromDiscord<Phil> I guess that's very useful when you calculate something at compile time that you would otherwise be recalculating over and over again?
10:28:07FromDiscord<Phil> Feels like the kind of feature that becomes useful at somewhat large-scale projects
10:28:58FromDiscord<Rika> It’s also useful for “compile time plugins” like I don’t know registering a command or so
10:29:23FromDiscord<Rika> Since it’s a “setting values propagates immediately to all readers” kinda thing
10:29:27*gsalazar joined #nim
10:53:24*Guest67 joined #nim
10:53:32*Guest67 quit (Client Quit)
10:53:54FromDiscord<Phil> Hmm what's the type of thing you'd throw into a compile-time plugin?
11:16:15*xet7 quit (Remote host closed the connection)
11:19:22*xet7 joined #nim
11:56:47*gsalazar quit (Ping timeout: 260 seconds)
11:59:45FromDiscord<mratsim> In reply to @Isofruit "Hmm what's the type": a domain specific language for example
12:08:56*gsalazar joined #nim
12:09:26*slowButPresent joined #nim
12:14:30FromDiscord<Phil> Ohhhh yeah that's pretty valid#
12:14:54FromDiscord<Phil> I'm fairly sure you could do my entire generic repository nonsense in a domain specific language and throw that in as a plugin for e.g. prologue
12:16:06FromDiscord<Phil> Though it'd have to be significantly simpler... hmm... might not make sense as its own language but more as still a set of helper procs or sth
12:16:22FromDiscord<Phil> I'll eventually have to get around to make a package and have a good long hard think on all of this
12:18:18FromDiscord<exelotl> I have a vtable macro that I use as a lightweight replacement for Nim methods. It uses a `CacheSeq` to record all the vtables that got defined over the course of the program, then when a finalize macro is called at the end of the main module it goes and generates a pointer for each one (mainly to allow you to check which vtable a particular object instance is using)
12:19:38*gsalazar quit (Ping timeout: 268 seconds)
12:37:16*v9fk joined #nim
12:51:33*rockcavera joined #nim
12:51:33*rockcavera quit (Changing host)
12:51:33*rockcavera joined #nim
13:04:21*arkurious joined #nim
13:14:32FromDiscord<mratsim> In reply to @exelotl "I have a vtable": Did someone ever collect all the VTables impl in Nim "Awesome VTables in Nim" :p
13:39:09FromDiscord<exelotl> haha
13:42:40*gsalazar joined #nim
13:44:56NimEventerNew thread by Krakengore: Possible workarounds for subclassing a c++ class and overriding a virtual method, see https://forum.nim-lang.org/t/9089
14:03:22*PMunch quit (Quit: Leaving)
14:10:27FromDiscord<hmmm> broskis I kinda want to add a check for updates button on my app, I think I must use some api for the github releases page? hmm how do I do eet?
14:10:57FromDiscord<hmmm> I think I need to use puppy to do the fetching but I don't know where to fetch
14:20:09*hellstabber joined #nim
14:21:10*SamuelMarks joined #nim
14:30:17*SamuelMarks quit (Ping timeout: 256 seconds)
14:36:02FromDiscord<Solitude> read github docs
14:38:10*SamuelMarks joined #nim
14:39:40FromDiscord<hmmm> found it! it was GET /repos/:owner/:repo/releases
14:40:55FromDiscord<hmmm> dear, @treeform puppy is awesome ty very much 😃
15:04:36*lumidify quit (Ping timeout: 240 seconds)
15:10:31*SamuelMarks quit (Ping timeout: 256 seconds)
15:27:21FromDiscord<kulumani> hi i am learning nim. and i have a problem. I installed vscode plugin but auto indent doesn't work. is there a way to achieve this?
15:27:31FromDiscord<kulumani> https://media.discordapp.net/attachments/371759389889003532/962010812648661042/indent.mov
15:28:09FromDiscord<aph> I'm using saem's extension, idk if it makes a difference
15:28:14FromDiscord<aph> ¯\\_(ツ)\_/¯
15:28:36FromDiscord<aph> (edit) "extension," => "extension (the second one from marketplace),"
15:28:43*LuxuryMode joined #nim
15:29:11FromDiscord<huantian> It does work for me, do try saem’s version of the extension if you aren’t using it
15:30:45FromDiscord<kulumani> wow thanks it works
15:31:27FromDiscord<kulumani> why there are two extension
15:31:38*Gustavo6046 joined #nim
15:31:51FromDiscord<kulumani> an unpleasant start
15:32:07FromDiscord<huantian> The old one is no longer maintained by the original creator
15:32:19FromDiscord<huantian> So a fork was created
15:32:38FromDiscord<huantian> I don’t think we can really remove the old one from vscode store
15:34:06FromDiscord<huantian> Wonder if we could somehow
15:34:14*zeus-supreme joined #nim
15:34:21FromDiscord<kulumani> but it seems to be in the first place and more popular. bad experience for newcomers.
15:35:04FromDiscord<kulumani> The community needs to take this seriously.
15:35:41FromDiscord<Generic> the official links are to my knowledge already updated
15:35:52FromDiscord<Generic> just the ranking in the extension market place is done by ms
15:35:55FromDiscord<xflywind> The newer one is written in Nim. And the first one works for me.
15:36:25FromDiscord<kulumani> https://media.discordapp.net/attachments/371759389889003532/962013049164791858/Ekran_Resmi_2022-04-08_18.36.18.png
15:36:26FromDiscord<Generic> yeah the auto indent after a : should have already worked with the old extension
15:36:51FromDiscord<kulumani> first one auto indent and intellisense doesn't work for me
15:37:13FromDiscord<Phil> I am chaotic neutral
15:37:17FromDiscord<Phil> I have both installed on vscodium
15:37:17*zeus-supreme1 quit (Read error: Connection reset by peer)
15:37:43FromDiscord<Rika> In reply to @kulumani "The community needs to": how would we fix this?
15:37:44FromDiscord<Phil> intellisense will always be a tough one @kulumani , it'll work to a degree but be slow as all hell very often
15:37:49FromDiscord<hmmm> I'm lawful good and that's why I'm on sublime text 🤔
15:38:05FromDiscord<huantian> In reply to @Rika "how would we fix": We can go yell at MS a bit that seems fun
15:38:10FromDiscord<Solitude> In reply to @hmmm "I'm lawful good and": did you pay for it?
15:38:57FromDiscord<hmmm> hmmmm I kinda found a code lying around
15:39:14FromDiscord<Solitude> In reply to @hmmm "hmmmm I kinda found": and you call yourself lawful?
15:39:25FromDiscord<hmmm> as soon as I get rich I pay 4 two I swear 😅
15:39:33FromDiscord<Phil> true neutral I say
15:41:33*lumidify joined #nim
15:43:30FromDiscord<huantian> What’s neutral evil, Visual Studio?
15:45:53FromDiscord<kulumani> Sublime Text LSP support is not at a good level. so i am using vscode.
15:46:18FromDiscord<K.io.S> I was reading the discussion earlier today, does the vm currently default to running sandboxed?↵There are two links posted earlier that deal with this.
15:53:58FromDiscord<hmmm> In reply to @kulumani "Sublime Text LSP support": well at least auto ident works on sublime text 😄
15:55:01FromDiscord<Rika> In reply to @Atlas "I was reading the": there is no sandboxing as of now
15:56:11FromDiscord<Phil> In reply to @huantian "What’s neutral evil, Visual": neutral evil is gedit
15:58:08FromDiscord<Rika> chaotic evil is ed
15:58:37FromDiscord<Phil> Sidenote, if there's one thing I'm mildly annoyed by it's that proc-aliases are shown in their alias and not back-resolved into the actual signature you'd want.↵So like:
15:59:35FromDiscord<Phil> sent a long message, see http://ix.io/3UCZ
16:01:18FromDiscord<Phil> Though I'd also love if it could show me which one of the procs is mismatching, for these cases it doesn't tell me sadly
16:02:08FromDiscord<Phil> (edit) "me" => "me," | "me,sadly ... " added "enough"
16:15:24*gsalazar quit (Ping timeout: 240 seconds)
16:17:52*vicecea quit (Remote host closed the connection)
16:18:22*vicecea joined #nim
16:30:58FromDiscord<treeform> In reply to @hmmm "dear, <@107140179025735680> puppy is": you welcome
16:37:55FromDiscord<jmgomez> hey guys, cant you switch the backend via config.nims with a switch?
16:41:27FromDiscord<treeform> I don't think so, but you can use -d:js to trick your IDE into thinking its JS mode. But it does not force js mode by itself.
16:41:58FromDiscord<jmgomez> ouch
16:42:13FromDiscord<jmgomez> okay, what about the default nimble test? I want it to run in cpp
16:43:00FromDiscord<treeform> that is not possible, to work around this we put all of our tests in one file, usually tests/all.nim and run nim cpp on that.
16:43:20FromDiscord<treeform> See here: https://github.com/treeform/pixie/blob/master/.github/workflows/build.yml#L21
16:43:31FromDiscord<jmgomez> umm, can you do something like include test..nim from another file and call that?
16:43:46FromDiscord<treeform> I don't think so.
16:44:01FromDiscord<treeform> this is what we do: https://github.com/treeform/pixie/blob/master/tests/all.nim
16:44:16FromDiscord<jmgomez> ahh well, that isnt too bad
16:44:21FromDiscord<jmgomez> thanks!
16:44:31FromDiscord<treeform> its the best we came up with at the moment
16:44:41FromDiscord<treeform> if you find a better solution please let us know
16:45:04FromDiscord<jmgomez> okay, I dont think so since I started doing nim a two days ago lol
16:45:06FromDiscord<treeform> maybe we should make a morenimble tool that does nimble + cpp/js
16:45:21FromDiscord<jmgomez> (edit) removed "a"
16:45:37FromDiscord<treeform> In reply to @jmgomez "okay, I dont think": Cool!
16:46:27FromDiscord<xflywind> In reply to @treeform "I don't think so,": you can probably define "--b:js" to enfore js
16:46:35FromDiscord<xflywind> (edit) "enfore" => "enforce"
16:46:39FromDiscord<treeform> what is --b?
16:46:52FromDiscord<treeform> to nimble or in the .nims file?
16:46:59FromDiscord<xflywind> in .nims file
16:47:19FromDiscord<xflywind> It is an abbreviation for backend
16:47:40FromDiscord<treeform> oh interesting
16:47:51FromDiscord<treeform> does nimble support --b?
16:48:42FromDiscord<jmgomez> sent a code paste, see https://paste.rs/u8X
16:49:59FromDiscord<treeform> I tried `--b:js`in .nims file ... does not work
16:50:16FromDiscord<treeform> is there an approrate nim compile command that does not mean c backend?
16:50:37FromDiscord<treeform> `nim c -b:js .\src\biggy.nim` this works
16:50:48FromDiscord<treeform> `nim c .\src\biggy.nim` does not
16:50:51FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3UD7
16:51:15FromDiscord<treeform> oh `switch("backend", "js")` does work for me
16:51:43FromDiscord<treeform> `nim c .\src\biggy.nim` -> `out: C:\p\biggy\src\biggy.js` thanks!
16:52:07FromDiscord<xflywind> It is ususually combined with tun option: `nim r --b:js"
16:52:23FromDiscord<treeform> Everyone @xflywind is really cool!
16:55:01FromDiscord<jmgomez> In reply to @flywind "switch("backend", "cpp")": I had it like that before and didnt work :/ (at least for test)
16:55:50FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UD8
16:57:55FromDiscord<xflywind> In reply to @treeform "Everyone @xflywind is really": It all thanks to @timotheecour's hard work => https://github.com/nim-lang/Nim/pull/14278
17:00:30FromDiscord<xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3UDa
17:07:23*xet7 quit (Remote host closed the connection)
17:10:43*xet7 joined #nim
17:16:58*pro joined #nim
17:24:28*pro quit (Quit: pro)
17:50:22FromDiscord<eyecon> It's me with a possible compiler bug again
17:50:44FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3UDo
17:51:10FromDiscord<eyecon> Am I going crazy or is the exact same expression doesn't work when wrapped in a proc?
17:51:32FromDiscord<eyecon> (edit) "is" => "does"
17:51:41FromDiscord<eyecon> (edit) "doesn't" => "not"
17:51:52*hellstabber quit (Quit: Textual IRC Client: www.textualapp.com)
17:56:34FromDiscord<jmgomez> When importing headers, the compiler seems to be evaluating macros. Is there a way to initialize them from nim?
17:56:50FromDiscord<jmgomez> (edit) "When importing headers, the compiler seems to be evaluating ... macros." added "cpp"
18:00:42FromDiscord<kulumani> https://nimble.directory/pkg/gifenc
18:00:56FromDiscord<kulumani> wtf
18:01:08FromDiscord<kulumani> this is c language repo
18:04:23FromDiscord<Phil> In reply to @eyecon "Look at this code": itertools are a module of your own?
18:09:33FromDiscord<eyecon> In reply to @Isofruit "itertools are a module": No, it's https://github.com/narimiran/itertools
18:11:11FromDiscord<kulumani> SIGBUS: Illegal storage access.
18:14:00FromDiscord<Phil> In reply to @eyecon "No, it's https://github.com/narimiran/itertools": Check, well from what it looks like it really doesn't like the itertools being used in procs like this, strangely enough
18:14:23FromDiscord<eyecon> In reply to @Isofruit "Check, well from what": Thank you! So it's not just me
18:15:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UDy
18:16:44FromDiscord<eyecon> When you say "given the line before", do you mean the one before `while`?
18:17:08FromDiscord<Solitude> you should reduce the snippet so it doesnt import itertools and submit a bugreport
18:17:36FromDiscord<eyecon> In reply to @Solitude "you should reduce the": Sure, I can, I just wanted to make sure I'm not doing something stupid
18:17:50FromDiscord<Phil> Try to play around whether you can trigger this behaviour without itertools
18:18:17FromDiscord<Phil> Gut feeling says it's something fancy done in the itertools that's the issue but I'm barely beyond a novice in the language anyway
18:18:25FromDiscord<Solitude> if itertools doesnt use emit, error from c compiler is nims fault
18:18:39FromDiscord<eyecon> In reply to @Solitude "if itertools doesnt use": It doesn't, from what I can see
18:18:58FromDiscord<eyecon> Imma go simplify the snippet
18:19:43NimEventerNew thread by Jmgomez: Defining C++ Macros from Nim, see https://forum.nim-lang.org/t/9091
18:20:29FromDiscord<kulumani> https://github.com/rxi/gifwriter
18:21:13FromDiscord<kulumani> sent a code paste, see https://paste.rs/PYn
18:21:33*pro joined #nim
18:21:52FromDiscord<kulumani> /Users/has/.nimble/pkgs/gifwriter-0.1.0/gifwriter.nim(58) newGif↵SIGBUS: Illegal storage access. (Attempt to read from nil?)↵Error: execution of an external program failed: '/Users/haz/Desktop/merhaba-nim/main '↵[Finished in 0.2s with exit code 1]
18:22:10FromDiscord<kulumani> what is this?
18:22:35FromDiscord<kulumani> (edit) "'/Users/haz/Desktop/merhaba-nim/main" => "'/Users/has/Desktop/merhaba-nim/main"
18:28:30*LuxuryMode quit (Quit: Connection closed for inactivity)
18:36:26FromDiscord<Solitude> its a broken library
18:41:00FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3UDF
18:44:12FromDiscord<hmmm> I remember using itertools for something, I'll go check if it still compiles 🤔
18:46:21FromDiscord<hmmm> yep works, or at least combinations works 😄
18:51:20FromDiscord<luteva> Hi! Is there a nim wrapper for arangoDB?↵https://github.com/arangodb/arangodb
19:05:49FromDiscord<ITR> Why can't I use ..< when defining a type?
19:15:47FromDiscord<eyecon> The iterators themselves do not seem to play a role, just the fact that they are iterators
19:16:05FromDiscord<eyecon> Is it maybe `toSeq` that is emitting anti-proc magic?
19:18:05FromDiscord<Solitude> In reply to @eyecon "The iterators themselves do": if you change openArray to seq - it works
19:18:15FromDiscord<ITR> hmm
19:18:35FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3UDR
19:19:36FromDiscord<eyecon> In reply to @Solitude "if you change openArray": Wut...
19:20:07*pro quit (Quit: pro)
19:20:16FromDiscord<eyecon> So it does
19:20:23FromDiscord<eyecon> Curioser and curioser
19:20:43FromDiscord<eyecon> It is not even the return type
19:28:21FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3UDS
19:29:24FromDiscord<Rika> what if you use `proc(a: int): int = a` instead of sugar's =>
19:29:36FromDiscord<Solitude> it still breaks
19:30:50FromDiscord<Solitude> you broke the hecking gensym facilities
19:31:35FromDiscord<eyecon> 😄
19:32:02FromDiscord<Solitude> this looks like it could break at any moment https://media.discordapp.net/attachments/371759389889003532/962072344552165406/unknown.png
19:34:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @Solitude "this looks like it": Oh nice theme
19:42:53*vicfred joined #nim
19:43:05FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=3UDX
19:43:21FromDiscord<eyecon> Should I file a bug or does anyone have an idea what more I can try?
19:43:26*vicfred quit (Remote host closed the connection)
19:43:31FromDiscord<Solitude> file a bug
19:43:53FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3UDY
19:44:16FromDiscord<Solitude> i can change inner iterator to seq and it will still break
19:44:25FromDiscord<Solitude> but pairwise needs to be openArray to not work
19:45:01*vicfred joined #nim
19:46:02FromDiscord<TryAngle> In reply to @Solitude "this looks like it": What theme u using 😳
19:46:02FromDiscord<eyecon> OK, I'm including your code if it is OK for you @Solitude
19:46:20FromDiscord<Solitude> In reply to @TryAngle "What theme u using": srcery
19:46:28FromDiscord<TryAngle> ty
19:47:18FromDiscord<TryAngle> Do you guys also get no code completion and "to source/definition" click not working anymore on VSC?
19:47:31FromDiscord<Yardanico> works fine for me
19:47:36FromDiscord<Yardanico> try restarting VSC :)
19:47:41FromDiscord<Yardanico> because that'll restart nimsuggest
19:47:47FromDiscord<Yardanico> or maybe nimsuggest breaks because of some code in your project
19:48:00FromDiscord<TryAngle> I'm having this problem for a while now
19:48:06FromDiscord<TryAngle> I'm using nimsaem
19:48:33FromDiscord<Yardanico> well everyone's using it nowadays basically
19:48:33FromDiscord<TryAngle> Maybe it's a WSL issue 🤔 gonna test it on my new Linux setup later today
19:49:17FromDiscord<Yardanico> In reply to @TryAngle "Maybe it's a WSL": works for me with both WSL/native Windows/native Linux
19:49:24FromDiscord<Yardanico> (edit) "both" => "all of"
19:50:09FromDiscord<TryAngle> Right now I'm basically sitting with 2 vscs open and cloned all the repos of packages I work with search with VSC workspace search lmao
19:51:48FromDiscord<Ayy Lmao> Is using Nim on top of a large c++ framework a silly thing to do? I'm wondering if there are success stories. I'm interested in making audio plugins and something like this seems good https://github.com/iPlug2/iPlug2
19:52:09FromDiscord<Generic> it depends on a bunch of things
19:52:35FromDiscord<Generic> like how depedent is it on templaty stuff
19:53:05FromDiscord<Generic> and stuff like where you would need to inherit stuff
19:53:30FromDiscord<Generic> it's the easiest if it's mostly just plain classes you instance and invoke methods of
19:53:42FromDiscord<eyecon> @Solitude including your example code in the bug report is OK, right?
19:54:00FromDiscord<eyecon> Also the reference to the discussion here
19:56:34FromDiscord<Ayy Lmao> In reply to @Generic "and stuff like where": Yeah I haven't found a lot of good examples of c++ interop. I don't really know how to interop with classes that inherit stuff other than doing hacky emit pragma stuff.
19:58:26FromDiscord<Ayy Lmao> There's a relatively short example here of what user code would look like https://github.com/iPlug2/iPlug2/blob/master/Examples/IPlugEffect/IPlugEffect.cpp
19:59:42FromDiscord<Generic> I don't think you could get around emit in this case
19:59:56FromDiscord<Generic> but I think you can hide most of the dirtiness with macros
20:00:36FromDiscord<Generic> I haven't tried this, though I think you could use https://nim-lang.org/docs/macros.html#signatureHash%2CNimNode
20:00:45FromDiscord<Generic> to get the mangeled name of Nim procs
20:01:12FromDiscord<Generic> then you could insert calls to Nim functions in C++ code generated with emit
20:01:27FromDiscord<Generic> (edit) "generated with" => "strings in" | "strings inemit ... " added "pragmas"
20:05:34FromDiscord<Ayy Lmao> I suppose something like that could work if I only had to do it to glue the c++ and nim code together. Then there is the problem of building the code, since it seems like you have to build with either visual studio or xcode. Figuring out a good way to build the nim code into the project seems complicated.
20:08:50FromDiscord<Generic> if it's some kind of plugin, does it need to be a dll in the end?
20:10:02FromDiscord<Ayy Lmao> In reply to @Generic "if it's some kind": Yeah it ends up being a .dll or other thing depending on the backend you choose. I think standalone apps are possible too but I'm mostly interested in plugins.
20:10:22FromDiscord<Ayy Lmao> There are unfortunately many different formats of audio plugins in the industry.
20:11:42FromDiscord<Ayy Lmao> I was able to get it to compile from the command line with `msbuild.exe`, I wonder if it is sustainable to do a nimscript or something to build the nim code and then call that.
20:17:41FromDiscord<Generic> that really makes things more complicated
20:17:56FromDiscord<Generic> build systems can be the worst to deal with
20:27:06FromDiscord<Ayy Lmao> Maybe I'm better off just using VST2.4 in that case and not trying to use a huge c++ framework
20:30:57nrds<Prestige99> Anyone looking at approving https://github.com/nim-lang/irc/pull/25 ?
20:49:25NimEventerNew post on r/nim by lf_araujo: Nimlsp in Neovim's builtin lsp, see https://reddit.com/r/nim/comments/tzczjq/nimlsp_in_neovims_builtin_lsp/
21:00:36nrds<Prestige99> What does that post mean, like go to definition?
21:06:59FromDiscord<sealmove> @Yardanico what do you suggest for bytes -> asciistring instead?
21:07:09FromDiscord<Yardanico> not sure what you mean by "asciistring"
21:07:11*jmdaemon joined #nim
21:07:17FromDiscord<Yardanico> nim strings don't have an encoding anyway
21:07:32FromDiscord<Yardanico> so you can just do cast[string](yourseq)
21:07:36FromDiscord<Yardanico> if it's seq[byte] or seq[char]
21:08:01FromDiscord<Yardanico> or if you want a copy instead of a view, you can of course do it with a loop or `newString` + `copyMem`
21:10:03FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=3UEd
21:10:28FromDiscord<sealmove> so a cast is safe?
21:10:29FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "this is what I": well if it's a different encoding then you'll have to encode it of course
21:10:34FromDiscord<creikey> In reply to @รєคɭ๓๏שє "this is what I": my understanding was that strings are just seq[byte] assumed to be in utf-8?
21:10:36FromDiscord<Yardanico> but for ascii specifically it's just copying the memory
21:10:43FromDiscord<Yardanico> In reply to @creikey "my understanding was that": well, not really
21:10:50FromDiscord<Yardanico> Nim doesn't know about utf-8
21:11:01FromDiscord<Yardanico> unicode handling in nim is done with std/unicode and similar
21:11:04FromDiscord<sealmove> I think I only use it for ascii, let me check
21:11:17FromDiscord<creikey> In reply to @Yardanico "unicode handling in nim": interesting
21:11:28FromDiscord<Yardanico> std/strutils is for ASCII only
21:11:38FromDiscord<creikey> is string just `type string = seq[byte]` or is it more complicated
21:11:55FromDiscord<Yardanico> In reply to @creikey "is string just `type": if you mean how it's laid out in memory, yes, but of course there are differences
21:12:00FromDiscord<Yardanico> in implementation/algorithm
21:12:02FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=3UEe
21:12:42FromDiscord<Yardanico> In reply to @รєคɭ๓๏שє "well, it's used in": I don't think it's only ascii
21:12:51FromDiscord<Yardanico> https://github.com/kaitai-io/kaitai_struct/issues/810
21:12:56FromDiscord<Yardanico> etc
21:13:27FromDiscord<Yardanico> so really you can just special-case ASCII instead, if that's the only thing that doesn't work on Window
21:13:28FromDiscord<Yardanico> (edit) "Window" => "Windows"
21:14:34FromDiscord<sealmove> sent a code paste, see https://play.nim-lang.org/#ix=3UEf
21:15:19FromDiscord<sealmove> i wonder if iConv works with this label (`"us-ascii"` instead of `"ascii"`)
21:24:35*xet7 quit (Remote host closed the connection)
21:25:01*SamuelMarks joined #nim
21:25:53*neurocyte8614492 joined #nim
21:29:21*xet7 joined #nim
21:33:30*SamuelMarks quit (Ping timeout: 246 seconds)
21:43:15*wyrd quit (Ping timeout: 240 seconds)
21:50:10*wyrd joined #nim
21:52:29FromDiscord<Pixtum> is there any way to use bookends or braces in nim instead of `:` I personally find it hard to read
21:53:13FromDiscord<Elegantbeef> nope though you can use `()` due to how statement's work
21:57:40*SamuelMarks joined #nim
21:59:37FromDiscord<Pixtum> sent a code paste, see https://paste.rs/hz8
22:00:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UEl
22:00:11FromDiscord<Pixtum> even better!
22:00:45FromDiscord<Elegantbeef> Though it's generally just a "hey it exists" not many use it, and you're probably best to ween yourself into whitespace
22:00:58FromDiscord<Elegantbeef> If you dont already setup indention raninbows and indention lines in your editor
22:03:03FromDiscord<Elegantbeef> Personally i find those make the argument of "Whitespace hard to read" go away
22:03:51*SamuelMarks quit (Ping timeout: 260 seconds)
22:04:51*zeus-supreme1 joined #nim
22:06:54*lumo_e quit (Remote host closed the connection)
22:07:17*lumo_e joined #nim
22:07:53*zeus-supreme quit (Ping timeout: 248 seconds)
22:15:34*SamuelMarks joined #nim
22:21:08FromDiscord<treeform> people who are good at C, if I have an nim object of 3 c floats - a Vec3... and I just want to slam that into C++ struct btVector3 of 3 c floats, is there a cast in C that I can emit that will just do it?
22:24:16FromDiscord<Generic> if you need a pointer of btVector3, you can just cast the pointer
22:24:43FromDiscord<Generic> with a normal C cast or reinterpret_cast if you're fancy
22:24:55FromDiscord<treeform> I don't need a pointer
22:25:00FromDiscord<treeform> its stack allocated
22:25:14FromDiscord<Generic> do you have a Nim definition of the C++ type?
22:25:15FromDiscord<Elegantbeef> Doesnt a C cast just work there
22:25:17FromDiscord<Elegantbeef> Or a reinterpretcast
22:25:33FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3UEt
22:25:58FromDiscord<Generic> ah so you don't have a definition of the C++ type in Nim?
22:25:59FromDiscord<treeform> looking for a better way
22:26:05FromDiscord<treeform> I don't have the C++ type in nim
22:26:17FromDiscord<treeform> I don't know how to get it into nim, its a C++ class.
22:26:27FromDiscord<Generic> you don't need the full type
22:26:29*kayabaNerve joined #nim
22:26:35FromDiscord<Generic> just the name basically
22:26:40FromDiscord<Generic> then you can use a union object
22:26:55FromDiscord<Elegantbeef> `(myType)(v.arr)` no ?
22:26:56FromDiscord<treeform> can you show me how?
22:26:59FromDiscord<treeform> https://github.com/bulletphysics/bullet3/blob/master/src/LinearMath/btVector3.h#L80
22:27:40FromDiscord<treeform> to pass the C++ types around I been calling them `distinct pointer`
22:27:51FromDiscord<Elegantbeef> Guess it might be `(myType)(&v.arr)`
22:28:02FromDiscord<Generic> yeah that could work too
22:29:00FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=3UEu
22:29:05FromDiscord<Generic> (edit)
22:29:50FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3UEv
22:29:58FromDiscord<Generic> it should be btVector3
22:30:29FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3UEw
22:30:36FromDiscord<treeform> is that efficient?
22:30:40FromDiscord<treeform> its not allocating anything new
22:30:44FromDiscord<treeform> (edit) "new" => "new?"
22:30:48FromDiscord<Generic> it's breaks aliasing rules
22:31:01FromDiscord<Generic> though usually compilers can cope with this pretty well
22:31:17FromDiscord<Generic> the union thing isn't really that legal either
22:31:31FromDiscord<Generic> also I'm not sure how Nim and C++ semantics work together with
22:31:44FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=
22:31:51FromDiscord<treeform> I could not find good docs on wrapping C++ stuff.
22:31:55FromDiscord<Generic> (edit)
22:32:01FromDiscord<Generic> bah stupid escaping rules
22:32:13FromDiscord<Elegantbeef> Isnt that just an elaborate `cat[btvector3](myData`?
22:32:13FromDiscord<Elegantbeef> `cast[btvector3](myData)`
22:32:18FromDiscord<Generic> the thing is that in C, v.arr should be already a pointer
22:32:47FromDiscord<Elegantbeef> It's a C cast
22:32:50FromDiscord<Elegantbeef> Just like Nim's `cast`
22:33:02FromDiscord<Generic> no I'm talking about your previous suggestion
22:33:08FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3UEz
22:33:11FromDiscord<Generic> yeah that should be better
22:33:13FromDiscord<treeform> does not expose the .arr on v (which might change)
22:33:21FromDiscord<Generic> though I would definitely just try the Nim cast
22:33:28FromDiscord<Generic> to see what the Nim compiler tries to do
22:35:04*lumo_e quit (Ping timeout: 268 seconds)
22:35:45FromDiscord<Elegantbeef> The Nim compiler will do what I did 😄
22:36:22FromDiscord<Generic> it sometimes also uses an union
22:36:40FromDiscord<Generic> like e.g. when taking the raw bits of a float
22:36:49FromDiscord<Elegantbeef> It's a retinterp cast in C++ or just a C cast in C afaik
22:38:12*lumo_e joined #nim
22:39:19FromDiscord<treeform> hmm nim cast does not work `var vv: btVector3 = cast[btVector3](v)` with `btVector3 {.importc.} = object`
23:01:02FromDiscord<Pixtum> how do I set the output file name with nim?
23:01:21FromDiscord<Elegantbeef> `--out:binname`
23:01:25FromDiscord<Pixtum> like `nim foo.nim -o bar`
23:02:10FromDiscord<Elegantbeef> compiler argumenets come beforre the nim file
23:02:19FromDiscord<Elegantbeef> Otherwise it assumes you wanted to run and pass CLI arguments
23:02:38FromDiscord<Pixtum> (edit) "like `nim ... foo.nim" added "c"
23:07:19*noeontheend joined #nim
23:07:46FromDiscord<Pixtum> https://media.discordapp.net/attachments/371759389889003532/962126633450483732/unknown.png
23:08:21FromDiscord<Elegantbeef> `-o:bar`
23:20:50FromDiscord<Pixtum> how can I silence hints from the nim output?
23:21:08FromDiscord<Elegantbeef> `--hint:hintName:off`
23:21:39FromDiscord<exelotl> or `--verbosity:0` if you want to silence everything
23:22:03FromDiscord<exelotl> well not everything
23:22:18FromDiscord<exelotl> but it reduces noise
23:32:25*noeontheend quit (Ping timeout: 268 seconds)
23:43:44*lumo_e quit (Quit: Quit)