<< 08-12-2024 >>

02:38:34FromDiscord<tsoj> when using `--mm:none` how do I know if I accidentally use something from the stdlib which uses the GC? Do I have to just check for leaks using sanitizers, or is there a more direct way to know?
02:43:41FromDiscord<nervecenter> In reply to @tsoj "when using `--mm:none` how": If you don't get a response here, might also be a good question for #internals
02:44:04FromDiscord<ElegantBeef> Ah bridge fun
02:44:13FromDiscord<tsoj> no, i prefer chess
02:44:18FromDiscord<ElegantBeef> The compiler has a warning
02:44:26FromDiscord<Elegantbeef> The compiler has a warning
02:44:26FromDiscord<ElegantBeef> Stop using no gc though
02:44:26FromDiscord<Elegantbeef> But really stop using `none`
02:44:31FromDiscord<ElegantBeef> Ah there it is
02:45:27FromDiscord<tsoj> In reply to @elegantbeef "Stop using no gc": its for a challenge with some arbitrary size limits, so I will be writing unusual code :)
02:45:28FromDiscord<Elegantbeef> `Warning: 'add(a, "hmm")' uses GC'ed memory [GcMem]` so you can do `--warningAsError:GcMem: on` if you want
02:45:34FromDiscord<Elegantbeef> So what?
02:45:46FromDiscord<Elegantbeef> Arc is practically free and does not bloat the GC
02:45:55FromDiscord<Elegantbeef> bloat with the GC\
02:48:41FromDiscord<tsoj> it seems to crash when I enable arc with all the other flags I have set
02:48:58FromDiscord<Elegantbeef> A simple program that concatenates a string is 40 bytes larger when compiled with `-d:danger -d:lto --cc:clang --opt:size -d:strip -d:useMalloc` with arc enabled 😄
02:48:58FromDiscord<tsoj> i will check, could be of course that my code does something wrong
02:49:25FromDiscord<Elegantbeef> If it crashes with arc enabled you're likely doing some UB
02:49:58FromDiscord<Elegantbeef> Arc is likely modifying your stack which is showing an issue that you have in your logic
02:50:55FromDiscord<tsoj> oh, do closures rely on the GC?
02:51:01FromDiscord<Elegantbeef> Yes
02:51:11FromDiscord<Elegantbeef> Closures allocate their environment on the heap
02:51:42FromDiscord<tsoj> yeah that makes sense, haven't been thinking about that
02:51:54FromDiscord<Elegantbeef> They also can be cyclical
02:52:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QrkDryiA
02:53:05FromDiscord<Elegantbeef> Should be `proc(args: T){.nimcall.}`
02:53:29FromDiscord<Elegantbeef> Actually should be `var T` 😄
02:57:37*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
02:58:01*SchweinDeBurg joined #nim
03:01:06FromDiscord<tsoj> what the heck, now the binary size increases by 4000 bytes when using --mm:none instead of --mm:arc
03:01:51FromDiscord<Elegantbeef> None uses the old runtime iirc so it's not as efficient
03:03:13FromDiscord<nervecenter> In reply to @tsoj "what the heck, now": Also keep in mind the default for dynamic types is a hidden unique pointer, so the GC will only activate if you use an explicit `ref`. Not sure if LTO cuts out the GC routines.
03:05:12FromDiscord<Elegantbeef> Well that's not exactly true since we're talking about arc 😄
03:05:18FromDiscord<Elegantbeef> The GC is arc
03:05:46FromDiscord<Elegantbeef> It inserts destructor calls so there is no "activate"
03:08:53FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#pasty=Dpneyrbw
03:09:05FromDiscord<Elegantbeef> No clue
04:55:17*tiorock joined #nim
04:55:17*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
04:55:17*tiorock is now known as rockcavera
04:57:24*tiorock joined #nim
04:57:24*rockcavera is now known as Guest8049
04:57:24*Guest8049 quit (Killed (osmium.libera.chat (Nickname regained by services)))
04:57:24*tiorock is now known as rockcavera
06:31:16*disso-peach joined #nim
06:34:03*tiorock joined #nim
06:34:03*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
06:34:03*tiorock is now known as rockcavera
07:03:38*kenran joined #nim
07:47:55FromDiscord<TFed> How to sort sequence? and which lib i need to import
07:48:13FromDiscord<TFed> to sort from small to the biggest
07:48:28FromDiscord<TFed> to sort from the smallest one to the biggest
08:03:58FromDiscord<Elegantbeef> `std/algorithm`
08:04:52FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=kouLpurR
08:05:41FromDiscord<Elegantbeef> That's a hell of an error
08:05:43FromDiscord<TFed> it says that seq isn't an openArray
08:06:42FromDiscord<johnsley> sent a long message, see https://pasty.ee/NZlmUQnd
08:06:55FromDiscord<Elegantbeef> It's not a openarray it converts to one
08:06:57FromDiscord<TFed> .....
08:07:35FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=jlujVvwK
08:07:46FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=KjOOJASD
08:08:11FromDiscord<Elegantbeef> stop converting it
08:09:50FromDiscord<TFed> sent a code paste, see https://play.nim-lang.org/#pasty=SzfMoZRu
08:10:05FromDiscord<Elegantbeef> `'getFirst(list)' is immutable, not 'var'`
08:10:10FromDiscord<Elegantbeef> you want `sorted`
08:11:25FromDiscord<TFed> finally works, thanks
08:15:56*ntat joined #nim
09:06:02*tiorock joined #nim
09:06:02*rockcavera is now known as Guest1076
09:06:02*tiorock is now known as rockcavera
09:08:09*tiorock joined #nim
09:08:09*rockcavera is now known as Guest1832
09:08:09*tiorock is now known as rockcavera
09:09:55*Guest1076 quit (Ping timeout: 244 seconds)
09:10:57*Guest1832 quit (Ping timeout: 244 seconds)
09:13:49FromDiscord<k0ts> https://nim-lang.org/docs/theindex.html#sort
09:13:52FromDiscord<k0ts> https://nim-lang.org/docs/manual.html#types-open-arrays
10:29:49*disso-peach quit (Quit: Leaving)
11:04:14*ntat quit (Quit: Leaving)
13:03:01*tiorock joined #nim
13:03:02*tiorock quit (Changing host)
13:03:02*tiorock joined #nim
13:03:02*rockcavera is now known as Guest6611
13:03:02*Guest6611 quit (Killed (calcium.libera.chat (Nickname regained by services)))
13:03:02*tiorock is now known as rockcavera
13:06:33*nils` quit (Ping timeout: 244 seconds)
13:33:16*kenran quit (Remote host closed the connection)
14:14:33*rockcavera is now known as Guest8661
14:14:33*tiorock joined #nim
14:14:33*Guest8661 quit (Killed (osmium.libera.chat (Nickname regained by services)))
14:14:33*tiorock is now known as rockcavera
14:16:39*tiorock joined #nim
14:16:39*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
14:16:39*tiorock is now known as rockcavera
15:00:52*ntat joined #nim
15:12:02*kotrcka joined #nim
15:53:04FromDiscord<nervecenter> In reply to @Elegantbeef "It inserts destructor calls": I guess I need to get clarification from Araq, are destructors always managed by the GC? Or can they be done without invoking it?
15:53:44FromDiscord<nervecenter> If something is destroyed by leaving scope, I guess...maybe it needs to run to do compaction and avoid fragmentation?
16:11:35FromDiscord<wug.s> is there some kind of defaultdict thing in nim
16:11:36FromDiscord<wug.s> like in python?
16:11:45FromDiscord<wug.s> that seems really useful idk
16:19:02FromDiscord<bostonboston> In reply to @wug.s "is there some kind": `getOrDefault()`
16:19:30FromDiscord<bostonboston> https://nim-lang.org/docs/tables.html#getOrDefault,Table[A,B],A
16:33:25FromDiscord<0ffh> If you want to avoid using getOrDefault everywhere in your code, you can always just write a thing wrapper for the standard dict.
16:33:39FromDiscord<0ffh> If you want to avoid using getOrDefault everywhere in your code, you can always just write a thin wrapper for the standard dict.
16:34:21FromDiscord<0ffh> Or, rather, table.
16:44:23FromDiscord<wug.s> In reply to @0ffh "If you want to": wdym?
16:44:25FromDiscord<wug.s> sorry im like
16:44:28FromDiscord<wug.s> super super new to nim
16:44:31FromDiscord<wug.s> im trying to learn it via the AOC
16:56:47FromDiscord<requiresupport> have a windows api function that returns a list of pointers to an object, how would i convert that pointer value to the list of `ptr object`
17:20:32*rockcavera is now known as Guest3273
17:20:32*tiorock joined #nim
17:20:32*Guest3273 quit (Killed (mercury.libera.chat (Nickname regained by services)))
17:20:32*tiorock is now known as rockcavera
17:22:39*tiorock joined #nim
17:22:39*rockcavera is now known as Guest5883
17:22:39*tiorock is now known as rockcavera
17:25:22*Guest5883 quit (Ping timeout: 252 seconds)
17:48:23*krux02 joined #nim
17:52:37FromDiscord<bostonboston> sent a long message, see https://pasty.ee/dtaSdrkw
17:54:36FromDiscord<bostonboston> So you could make your own `[]` that uses mixin to find your own defined default, which I would call the fastest but least robust way to do it.↵↵Alternatively you could make your own object that contains a table field and a default field that you write all your own operators for. I'm sure someone else has better solutions than mine
18:15:53*kotrcka quit (Remote host closed the connection)
18:30:58*nils` joined #nim
18:44:04*krux02 quit (Quit: Leaving)
18:48:40*def- quit (Quit: -)
18:50:21*def- joined #nim
18:53:25*def- quit (Client Quit)
18:58:44*tiorock joined #nim
18:58:44*rockcavera quit (Killed (lithium.libera.chat (Nickname regained by services)))
18:58:44*tiorock is now known as rockcavera
19:00:51*tiorock joined #nim
19:00:51*rockcavera is now known as Guest355
19:00:51*tiorock is now known as rockcavera
19:01:17*def- joined #nim
19:03:47*Guest355 quit (Ping timeout: 244 seconds)
21:22:14*fallback quit (Read error: Connection reset by peer)
21:46:22*fallback joined #nim
21:51:21FromDiscord<bostonboston> I got home and tried to make a quick example but I dont know how to program and it doesnt work↵↵https://play.nim-lang.org/#pasty=WhzYYusD
21:53:31FromDiscord<Elegantbeef> The issue is the `lent` it's not capable of borrowing
21:55:28FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=LhivQNaC works around that in a odd way
21:56:25FromDiscord<bostonboston> https://tenor.com/view/why-didnt-i-think-of-that-gif-27711265
21:56:41FromDiscord<bostonboston> Thank you
22:01:52*ntat quit (Quit: Leaving)
23:18:53*attah quit (Ping timeout: 252 seconds)
23:21:45*attah joined #nim