<< 15-12-2024 >>

00:00:15*Onionhammer quit (Client Quit)
00:00:36*Onionhammer joined #nim
00:11:02FromDiscord<whorf> sent a code paste, see https://play.nim-lang.org/#pasty=BEpNBnXY
00:14:55FromDiscord<Elegantbeef> `iterator` is a closure so nope you have to convert to a closure
01:58:56FromDiscord<bosinski2023> why is it that when i need to pass a `ptr nim-obj` to c-lib, which then mutates, that i need to declare the nim-obj as `var` ? And what happens ( what does the c-lib see) when it's not decalred `var`. Cos it silently works and the obj returns unchanged ?
01:59:15FromDiscord<bosinski2023> (edit) "decalred" => "declared"
02:00:20FromDiscord<Elegantbeef> You dont
02:01:20FromDiscord<bosinski2023> In reply to @Elegantbeef "You dont": well i did - and it puzzles me - sure `var` makes sense, but what happens when forgotten ?
02:02:39FromDiscord<bosinski2023> (edit) "In reply to @Elegantbeef "You dont": well i did - and it puzzles me - sure `var` makes sense, but what happens when forgotten ? ... " added "i thought the lib is broken,,"
02:22:44FromDiscord<bostonboston> a var ptr object would be someStruct in C
02:41:51FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=pWvYklSf
02:42:37FromDiscord<bostonboston> the .addr call smells fishy
02:42:46FromDiscord<bostonboston> whats the signature for the c function
02:43:24FromDiscord<Elegantbeef> Well there's your problem if `Tree` is \< sizeof(float) \ 3 it passes by copy
02:43:37FromDiscord<Elegantbeef> Or of course if you annotate `Tree` `{.bycopy.}`
02:46:25FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=hkEouVjN
02:47:39FromDiscord<Elegantbeef> Right so of course you need `var`
02:47:43FromDiscord<Elegantbeef> You should use it regardless
02:47:55FromDiscord<Elegantbeef> You're mutating something, you use `var`
02:53:39FromDiscord<bosinski2023> In reply to @Elegantbeef "You're mutating something, you": right, question was - no error/segfault when used as `t :Tree` - the c-lib does nothing and nim does nothing ..?
02:55:17FromDiscord<Elegantbeef> Why would it error?
02:55:25FromDiscord<Elegantbeef> It's a valid operation
03:00:20FromDiscord<bosinski2023> In reply to @Elegantbeef "It's a valid operation": when i pass `artTree.insert( t.addr, val.int32 )` to C and my proc is `proc insert( t :Tree ..` then the `t` comes back unchanged - no mutation and no segfault. but `proc insert( t :var Tree ..` returns a mutated `t` - somebody once said, just pass a ptr to C var or not does not matter - it does..
03:01:49FromDiscord<Elegantbeef> Your `Tree` is copied when you pass it to `insert` so it only mutates it inside the procedure `insert`
03:02:06FromDiscord<Elegantbeef> There is no error here it's predictable behaviour and is what would happen in C
03:06:03FromDiscord<bosinski2023> In reply to @Elegantbeef "There is no error": ah, thx, can i make the `Tree object` a `ref object` somehow ? on the c-side i have a constructor und destructor ? i do nothing with the `Tree object` other than passing, calling and finalizing via `=destroy`?
03:07:26FromDiscord<Elegantbeef> Leave it as object
03:08:55FromDiscord<Elegantbeef> If you want to mutate it declare it as `var` and pass it as `var` it's not complicated
03:09:01FromDiscord<Elegantbeef> `ref` is not an alternative to `var`
04:16:46*xet7_ joined #nim
04:17:49*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
04:18:29*SchweinDeBurg joined #nim
04:19:19*xet7 quit (Ping timeout: 252 seconds)
05:17:33*xet7_ quit (Remote host closed the connection)
05:18:58*xet7 joined #nim
06:57:26*krux02_ quit (Remote host closed the connection)
07:31:39*nils` quit (Ping timeout: 260 seconds)
08:02:16*nils` joined #nim
08:07:47*coldfeet joined #nim
08:20:22FromDiscord<grumblygibson> Can't they also use `{.byref.}` to enforce pass by ref behavior without var, if passing out to a C function for mutation? Not recommended, but possible.
08:20:29FromDiscord<grumblygibson> (edit) "possible." => "possible?"
08:26:10FromDiscord<Elegantbeef> They could but now you have a mutation happening through a immutable parameter
08:26:29FromDiscord<Elegantbeef> Don't avoid Nim's safeties cause you don't like writing `var`
08:38:51*SchweinDeBurg quit (Remote host closed the connection)
08:41:44*SchweinDeBurg joined #nim
10:44:58*ntat joined #nim
11:44:14*ntat quit (Quit: Leaving)
12:46:05*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
13:16:23*SchweinDeBurg joined #nim
13:58:50FromDiscord<System64 ~ Flandre Scarlet> Is Nim used a lot in the industry?
13:59:27FromDiscord<fabric.input_output> define a lot :P (no)
14:01:25FromDiscord<System64 ~ Flandre Scarlet> Is Nim used by a lot of enterprises and big projects ?↵And is the support as good as like, Go, Java, C#, C++ and so on?
14:02:10FromDiscord<bostonboston> No
14:02:24FromDiscord<System64 ~ Flandre Scarlet> Oh alright, thanks
14:07:18*nils` quit (Ping timeout: 276 seconds)
14:17:24FromDiscord<zumi.dxy> The one perk is there actually is a reason for "rolling your own" 😛
14:58:28FromDiscord<ieltan> In reply to @sys64 "Is Nim used by": It's used by reddit so there's that
14:59:41FromDiscord<ieltan> to get support I feel like basically only araq and the regulars here can do it
15:04:42*ntat joined #nim
15:08:36FromDiscord<bostonboston> There are some large companies and small companies that have adopted it in some ways, but say for example reddit, theres going to be people who work at reddit and have never heard of Nim
15:11:57FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "It's used by reddit": Quite interesting↵Because I'm currently hesiting between Nim and Go for my new project
15:13:02FromDiscord<fabric.input_output> I've heard ffi in golang is painful 😉
15:13:35FromDiscord<ieltan> In reply to @sys64 "Quite interesting Because I'm": I don't really know which one you should pick, depends on the project
15:13:40FromDiscord<System64 ~ Flandre Scarlet> Not that much imo
15:14:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "I don't really know": Wavetable (so audio samples) generator, but it's not really realtime
15:14:29FromDiscord<fabric.input_output> I've found nim to be a significantly more comfortable language
15:15:38FromDiscord<ieltan> Well yeah, ime as long as it doesn't require you to deal with threads you'll be good with Nim
15:16:57FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "Well yeah, ime as": I only use threads for file export
15:17:25FromDiscord<fabric.input_output> threads shouldn't be an issue if you decide to do a lil bit of manual memory management
15:18:00FromDiscord<System64 ~ Flandre Scarlet> I see my old friend named "Segmentation Fault" coming
15:19:27FromDiscord<fabric.input_output> make sure you don't copy `Thread` objects, because for some reason the `=copy` hook is not `{.error.}` and you'll get the old copy destroy the underlying OS thread which both copies share
15:19:51FromDiscord<ieltan> In reply to @fabric.input_output "threads shouldn't be an": C style threading is error prone and u need to ensure u have no gc memory
15:20:51FromDiscord<fabric.input_output> you only need to ensure that gc memory stays in thread boundaries
15:21:29FromDiscord<System64 ~ Flandre Scarlet> What if I pass a serialized object as string and I unserialize it in the other thread?
15:22:58FromDiscord<fabric.input_output> should work. values passed by copy are safe. for shared values I keep an `Arc[T]` like in rust that allocates the data on shared memory
15:24:29FromDiscord<ieltan> In reply to @fabric.input_output "should work. values passed": Does the Arc[T] work with -mm:orc tho
15:25:25FromDiscord<fabric.input_output> I haven't tried. but if `createShared`/`allocShared0` and `deallocShared0` work, then it should work
15:26:23FromDiscord<ieltan> In reply to @sys64 "What if I pass": Thats message passing, it's a good default but maybe you'll need to actually share memory between your threads 🤷🏿‍♂️
15:52:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @ieltan "Thats message passing, ": Should do the job for file export
15:57:41*ntat quit (Remote host closed the connection)
15:58:04*ntat joined #nim
15:58:15*coldfeet quit (Quit: Lost terminal)
16:07:53*krux02 joined #nim
16:11:58*nils` joined #nim
16:15:46FromDiscord<System64 ~ Flandre Scarlet> And I guess Nim has better performances than Go?
16:31:49*nils` quit (Ping timeout: 260 seconds)
16:34:32FromDiscord<leorize> it depends
16:34:47FromDiscord<leorize> if your workload is I/O bound, Go might be ahead by quite a bit
16:35:46FromDiscord<System64 ~ Flandre Scarlet> In reply to @leorize "if your workload is": I think the only I/O task I do is file export
17:18:06*ntat quit (Ping timeout: 265 seconds)
17:33:43FromDiscord<rakgew> sent a long message, see https://pasty.ee/vlLBsctV
17:39:08FromDiscord<patitotective> In reply to @rakgew "hm, I am currently": it should be `seq[(T, T)]`
17:43:44FromDiscord<rakgew> @patitotective \:↵ah ok - thank you so much! \:)
17:53:20FromDiscord<patitotective> sent a code paste, see https://play.nim-lang.org/#pasty=byseFDqs
17:55:04*ntat joined #nim
18:03:41FromDiscord<Emma Okeyson Okeyson> sent a long message, see https://pasty.ee/RiiMKNKd
18:14:47FromDiscord<bostonboston> <@&371760044473319454> what can you do, he said no scam
18:15:21FromDiscord<Phil> Not sure, they also said free signals and the last time I read signals I started learning angular!
18:16:35FromDiscord<Phil> Got to let mjolnir do its thing now
18:16:44Amun-RaI feel sorry for you (regarding Angular) ;)
18:20:56FromDiscord<rakgew> oh nice - yes, that is more elegant than my earlier buggy version. thank you! \:-D↵(@patitotective)
18:22:23FromDiscord<Phil> In reply to @Amun-Ra "I feel sorry for": Ironically Angular is pretty decent, been a far better experience than React native (and likely would also be better than React for me)
18:25:20Amun-RaPhil: wait, I confused Angular with React… :/
19:23:39FromDiscord<System64 ~ Flandre Scarlet> Does Nim compiled programs still have problems with antivirusses?
19:27:36FromDiscord<rakgew> I would say it is the other way around - the snakeoil programs on win have problems with nim binaries - but yes.
19:28:01FromDiscord<rakgew> sometimes even ridiculously simple and obviously harmless cli apps (e.g. iterate over a dir, do regex check on file name and echo file name) get flagged as malicious.
19:30:33FromDiscord<rakgew> had that a few times at work.
19:30:55FromDiscord<System64 ~ Flandre Scarlet> In reply to @rakgew "sometimes even ridiculously simple": Quite concerning, because I don't want people to think it's a virus
19:35:11FromDiscord<bostonboston> My compiled apps and libs generally don't have a problem, just the nim.exe binary and the finish.exe that ships with it
19:36:29FromDiscord<System64 ~ Flandre Scarlet> Oh, it's fine then
19:40:14FromDiscord<bostonboston> I will note that I don't come close to utilizing all or most of nim, so your experience may vary
19:43:12Amun-Rahmm, has anyone tested whether the issue is present when nim exe is upx compressed?
19:47:11FromDiscord<rakgew> would that be a compile flag for upx compression?
19:47:16FromDiscord<Elegantbeef> Mingw compiled C hello world also gets flagged
19:47:57FromDiscord<Elegantbeef> https://www.virustotal.com/gui/file/323f01cf10ab9889d374391028e3809c71c069269fcb76f98d81eb436a6f7cca/summary for citation 😄
19:50:33FromDiscord<System64 ~ Flandre Scarlet> Flagged for you? It's just a simple Dear ImGUI app https://media.discordapp.net/attachments/371759389889003532/1317941887474335755/kurumi_xp.exe?ex=67608488&is=675f3308&hm=965090fad87db962ca6173c6a6d496484074cec02f2f1eddf177493c9f792991& https://media.discordapp.net/attachments/371759389889003532/1317941888224858172/image.png?ex=67608488&is=675f3308&hm=81927e098664051ae3aa0d955549061ccda5f38c126eab737857261391b84906&
19:51:02FromDiscord<System64 ~ Flandre Scarlet> Virustotal says there is nothing
19:51:14FromDiscord<System64 ~ Flandre Scarlet> https://www.virustotal.com/gui/file/b1df6c15f9b96140724f46bc74aaa490e827fd794f17d62239b320e125234f2e
19:52:36FromDiscord<rakgew> uhm, under the "behavior" tab there, do I read it right, that the helloworld supposedly - among many other things - deleted a bunch of files and accessed the registry?
19:53:11FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Mingw compiled C hello": Which Nim version?
19:53:56FromDiscord<rakgew> oh and supposedly also dns resolution and network traffic?
19:54:44FromDiscord<rakgew> Elegantbeef \: that is some impressive helloworld \:-D
20:19:01*tokyovigilante quit (Ping timeout: 252 seconds)
20:28:26FromDiscord<Elegantbeef> C↵(@System64 ~ Flandre Scarlet)
20:32:34FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "C (<@380360389377916939>)": Oh, my bad, missread↵Well it's just Windows being dumb then
20:32:52FromDiscord<Elegantbeef> Nah it's more anti virus vendors
20:33:19FromDiscord<System64 ~ Flandre Scarlet> a simple Hello World program bruh↵They're so dumb
20:37:07FromDiscord<System64 ~ Flandre Scarlet> Is Nimsuggest still crashy or does it work well now?
20:39:13*nils` joined #nim
20:52:02Amun-Rarakgew: no, it's a third party tool
21:12:47FromDiscord<pmunch> I'm gonna take a bet that they're lying↵(@bostonboston)
21:13:26FromDiscord<fabric.input_output> In reply to @pmunch "I'm gonna take a": why would they lie on the internet?
21:14:41FromDiscord<bostonboston> They seem super super trustworthy
21:48:07*ntat quit (Quit: Leaving)