<< 05-12-2022 >>

00:18:02*wallabra_ joined #nim
00:20:24*wallabra quit (Ping timeout: 268 seconds)
00:20:25*wallabra_ is now known as wallabra
00:40:19*wallabra_ joined #nim
00:40:58*wallabra quit (Ping timeout: 256 seconds)
00:41:49*wallabra_ is now known as wallabra
01:21:52FromDiscord<voidwalker> https://github.com/z-------------/nim-bencode/blob/master/src/bencodepkg/types.nim#L15 - how do I declare a ref var of that type ? :\
01:22:35FromDiscord<albassort> x = new type
01:23:40FromDiscord<voidwalker> oh so new makes it implicitly ref. ok. any other syntax without new, using the ref keyword?
01:28:58FromDiscord<b1rdf00d> Like this? `let w = (ref Vec2)(x: 1.0, y: 0.0)`
01:30:58FromDiscord<voidwalker> hm nope that doesn't work for me. ` let tDict = (ref BencodeObj)(BencodeObj(kind:bkDict))` type mismatch: got 'BencodeObj' for 'BencodeObj(kind: bkDict)' but expected 'ref BencodeObj'
01:32:11FromDiscord<Elegantbeef> drop the `BenCodeObj`
01:32:18FromDiscord<Elegantbeef> it's `(ref BenCodeObj)(kind: ...)`
01:34:54FromDiscord<voidwalker> oh ok, that makes sense.
01:35:20*wallabra quit (Ping timeout: 260 seconds)
01:35:26FromDiscord<voidwalker> The author of this lib recently changed the object to value from ref.. and I have to rewrite my code if I want to use it as such.
01:35:37FromDiscord<voidwalker> https://github.com/z-------------/nim-bencode/commit/86f8fd266e0f377c5fad908c30c67aec32d86881 - what do you think is more suitable for a librafy, ref or value ?
01:35:50FromDiscord<voidwalker> (edit) "https://github.com/z-------------/nim-bencode/commit/86f8fd266e0f377c5fad908c30c67aec32d86881 - what do you think is more suitable for ... alibrary," added "such" | "librafy," => "library,"
01:36:03FromDiscord<Elegantbeef> There is no single answer
01:36:23FromDiscord<Elegantbeef> You use `ref` for reference semantics
01:36:29FromDiscord<Elegantbeef> If you dont need reference semantics you use value
01:36:29FromDiscord<albassort> In reply to @Elegantbeef "it's `(ref BenCodeObj)(kind: ...)`": didn't know about this snyta
01:36:32FromDiscord<albassort> (edit) "snyta" => "snytax"
01:36:37FromDiscord<voidwalker> I guess if it's value, you can always make a ref to it.
01:39:23FromDiscord<b1rdf00d> Yeah I'd say if it doesn't need to be `ref` then value makes more sense as a default
02:10:31NimEventerNew thread by demotomohiro: Can wasMoved be overloaded?, see https://forum.nim-lang.org/t/9694
03:15:59FromDiscord<Tuatarian> I'm curious why this doesn't compile?
03:16:19FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hLa
03:16:22FromDiscord<Tuatarian> I tried to do what beef said, but this doesn't seem to work
03:18:05FromDiscord<Tuatarian> so creating an `apply` template for `HvNum` makes that work, but `HvVal` is still broken
03:20:34FromDiscord<Elegantbeef> No else branch
03:21:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hLb
03:21:37FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hLc
03:22:14FromDiscord<πτ (pi man)> what I'm seing is that HvNum has no field `val`
03:22:23FromDiscord<Tuatarian> this is exhaustive right?
03:22:29FromDiscord<πτ (pi man)> (edit) "what I'm seing is that HvNum has no field `val` ... " added "(`v.nVal.val`)"
03:22:35FromDiscord<πτ (pi man)> (edit) "HvNum" => "`HvNum`"
03:22:39FromDiscord<Elegantbeef> Yes `else` is exhaustive
03:22:42FromDiscord<Elegantbeef> I mean case 😄
03:22:46FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hLe
03:23:02FromDiscord<πτ (pi man)> shouldn't that `when` be `if`?
03:23:45FromDiscord<Tuatarian> it can't be right?
03:23:51FromDiscord<Tuatarian> since it's a template/comptime
03:24:03FromDiscord<πτ (pi man)> you did it on `apply`
03:24:10FromDiscord<Elegantbeef> Again this doesnt work tuatara
03:24:17FromDiscord<Tuatarian> I'm extremely confused
03:24:25FromDiscord<Elegantbeef> All your code has to be typed the same
03:24:36FromDiscord<Elegantbeef> `h` is only known to be a `int` or `float` at runtime
03:24:54FromDiscord<πτ (pi man)> the template may be compile time, but `h.isInt` is only known at runtime
03:25:13FromDiscord<Tuatarian> I'm still really confused
03:25:15FromDiscord<πτ (pi man)> (unless `h` is a `const` I guess)
03:25:27FromDiscord<Tuatarian> if I change the `when` to be an `if` it gives a different set of compile errors
03:25:39FromDiscord<Elegantbeef> Of course
03:25:41FromDiscord<Tuatarian> again I think static typing related
03:25:45FromDiscord<Elegantbeef> You need the `if`
03:25:49FromDiscord<Elegantbeef> Cause it's runtime delimited
03:26:07FromDiscord<Tuatarian> I'm definitely not understanding this
03:26:30FromDiscord<Elegantbeef> An expression has a single return type
03:26:36FromDiscord<Tuatarian> so which variant of the type we're dealing with is not known until runtime
03:26:39FromDiscord<πτ (pi man)> in order to use `when` you have to know what the value is before you compile
03:26:59FromDiscord<πτ (pi man)> In reply to @iWonderAboutTuatara "so which variant of": not which variant, but what the value is
03:27:06FromDiscord<Tuatarian> yeah I'm aware I'm basically trying to cheat static typing here
03:27:11FromDiscord<πτ (pi man)> (edit) "In reply to @iWonderAboutTuatara "so which variant of": not which variant, but what the value is ... " added "(specifically of `isInt`)"
03:27:31FromDiscord<Tuatarian> but isn't this more or less necessary when working with a tagged union (unless you want to really laboriously check every little thing at runtime everywhere)?
03:28:26FromDiscord<πτ (pi man)> that's the catch with dynamic typing, everything is runtime
03:28:51FromDiscord<Tuatarian> yeah
03:29:09FromDiscord<Tuatarian> I'm aware I lose some comptime type safety here, but I'm trying to make code like this work
03:29:22FromDiscord<Tuatarian> avoid code like this
03:29:34FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hLj
03:30:11FromDiscord<Tuatarian> I want to be able to just write something like `apply(a, b, func)`
03:30:41FromDiscord<Elegantbeef> You cannot do much to reduce the tedium
03:32:05FromDiscord<Elegantbeef> You can import `std/lenient` ops
03:32:16FromDiscord<Elegantbeef> and remove the silly `return`
03:32:39FromDiscord<Tuatarian> right, but I still need to know which ones of `fVal`, `iVal` etc exist
03:33:04FromDiscord<Tuatarian> so this could reduce the number of explicit conversions, but the messy part (the if statement) is still there
03:33:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hLl
03:33:07FromDiscord<Tuatarian> yeah
03:33:11FromDiscord<Tuatarian> that's not that much better
03:33:23FromDiscord<Tuatarian> could I at least write a general `val` which grabs the value?
03:33:28FromDiscord<Elegantbeef> Nope
03:33:35FromDiscord<Tuatarian> that's unfortunate
03:33:39FromDiscord<Elegantbeef> That's dynamic typing
03:33:42FromDiscord<Elegantbeef> Nim is statically typed
03:36:56FromDiscord<πτ (pi man)> how do I get a section of a string defined by indices?
03:36:59FromDiscord<Tuatarian> I know, I am effectively trying to circumvent static typing here
03:37:29FromDiscord<Elegantbeef> `str[a..b]` or `str.toOpenArray(a, b)`↵(@πτ (pi man))
03:37:35FromDiscord<Elegantbeef> You cannot circumvent it
03:38:10FromDiscord<πτ (pi man)> `a..b` :mood: imo this is ugly syntax but if it works it works I guess
03:38:39FromDiscord<Elegantbeef> It's ugly?
03:39:04FromDiscord<Elegantbeef> I mean you can always alias it
03:39:33FromDiscord<πτ (pi man)> I'd rather do `str.substr(a, b)` tbh
03:39:45FromDiscord<Elegantbeef> Meh
03:40:02FromDiscord<Elegantbeef> `str[a..^b]` and `str[a..b]` mirror `seq[T]` access aswell
03:40:02FromDiscord<πτ (pi man)> I'm not a fan of index operators
03:40:18FromDiscord<Elegantbeef> Well welcome to Nim
03:40:23FromDiscord<πτ (pi man)> same with `[^1]` i'd rather do `.end()`
03:40:30FromDiscord<πτ (pi man)> (edit) "`.end()`" => "`.last()`"
03:40:32FromDiscord<huantian> what if you need the second to last one
03:40:37FromDiscord<huantian> `.secondToLast()`?
03:40:59FromDiscord<πτ (pi man)> `list[list.size - 2]`
03:41:22FromDiscord<πτ (pi man)> I don't think I've ever needed to do that though tbh
03:41:55FromDiscord<Elegantbeef> Well it's relatively common
03:44:38FromDiscord<πτ (pi man)> sent a code paste, see https://play.nim-lang.org/#ix=4hLp
03:45:16FromDiscord<πτ (pi man)> I mean sure those index operators are useful, but idk, using `[]` to select multiple element just feels wrong
03:45:23FromDiscord<πτ (pi man)> (edit) "element" => "elements"
03:46:00FromDiscord<Elegantbeef> Well you're wrong! 😜
03:47:27FromDiscord<πτ (pi man)> lol, I'm "wrong" with a lot of things
03:47:46FromDiscord<Elegantbeef> Doesnt C++ use `[]` for bitsets?
03:48:19FromDiscord<πτ (pi man)> wdym
03:48:50FromDiscord<πτ (pi man)> `std::vector<bool>` is stored as a bit array instead of a char array if that's what you mean
03:49:05FromDiscord<Elegantbeef> No
03:49:13FromDiscord<Elegantbeef> `std::bitset` uses `a[0] = true`
03:49:15FromDiscord<Elegantbeef> for instance
03:50:41FromDiscord<πτ (pi man)> that's still only accessing one bit at a time though
03:53:07FromDiscord<πτ (pi man)> though theoretically you could make something like `Foo subrange = customArrayClass[range(0, 16)];`
03:54:12FromDiscord<Rika> In reply to @πτ (pi man) "that's still only accessing": Think his point is that sets and arrays use the same syntax when they’re different concepts
03:55:08FromDiscord<πτ (pi man)> huh, is `a..b` inclusive on both ends?
03:55:13FromDiscord<huantian> yesh
03:55:21FromDiscord<πτ (pi man)> wha......
03:55:26FromDiscord<huantian> `a..<b` is exclusive for b
03:55:44FromDiscord<πτ (pi man)> :BlobNotLikeThis: why does nothing ever make sense
03:56:03FromDiscord<Rika> Why wouldn’t .. be inclusive…?
03:56:22FromDiscord<πτ (pi man)> because ranges typically are exclusive for the last element
03:56:44FromDiscord<Rika> But that makes no sense if you don’t consider “common use”
03:56:51FromDiscord<πτ (pi man)> but that is common use?
03:57:03FromDiscord<huantian> I feel like when `..` is used for range it's usually inclusive on both sides
03:57:28FromDiscord<huantian> actually I can't think of anything else other than rust that uses `..` right now
03:57:40FromDiscord<πτ (pi man)> In reply to @huantian "actually I can't think": C# does
03:57:44FromDiscord<huantian> oh yeah
03:57:50FromDiscord<πτ (pi man)> but I don't use C# either
03:58:13FromDiscord<Elegantbeef> Isnt the `..` in math inclusive?
03:58:25FromDiscord<πτ (pi man)> I mostly use C and C++ and a bit of Java (1.8)
03:58:30FromDiscord<πτ (pi man)> In reply to @Elegantbeef "Isnt the `..` in": in math?
03:58:58FromDiscord<huantian> yeah when you use `...` in math it's inclusive
03:59:36FromDiscord<πτ (pi man)> you mean something like `1/2 + 1/4 + ... + 1/n`?
04:00:31FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/1049173396757413938/IMG_9894.png
04:00:55FromDiscord<Rika> Nim got the syntax from Pascal
04:01:21FromDiscord<Elegantbeef> And `..` in Nim is consistent across all types
04:01:35FromDiscord<Elegantbeef> For ranges, sets, slices it's inclusive
04:02:06FromDiscord<Tuatarian> if I'm trying to do something like this
04:02:16FromDiscord<Tuatarian> will this work as expected?
04:02:16FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4hLx
04:02:25FromDiscord<Tuatarian> since nim can't guarantee at comptime that `nVal` exists
04:30:40FromDiscord<demotomohiro> All return type must be same unless you use when statement.
04:31:59*jmdaemon joined #nim
04:39:30*arkurious quit (Quit: Leaving)
04:52:48FromDiscord<j-james> heyo - does anyone know where i could find a series of idiomatic, permissively-licensed code snippets?
04:52:48FromDiscord<j-james> o
04:57:36madpropsstackoverflow?
04:58:05madpropsah im in #nim
04:58:15FromDiscord<Elegantbeef> Indeed
04:58:26FromDiscord<Elegantbeef> Best is to look at packages and use that MIT license 😄
04:58:47madpropsMit is such a nice guy
06:05:06*ltriant quit (Ping timeout: 256 seconds)
06:30:36FromDiscord<Slava0135> In reply to @huantian "actually I can't think": Kotlin
06:32:37*ltriant joined #nim
06:35:25FromDiscord<Elegantbeef> no
06:35:37FromDiscord<Elegantbeef> Oh that was a quote
06:35:38FromDiscord<Elegantbeef> Shit
06:35:53FromDiscord<Elegantbeef> We only got 'kotlin' with 0 context here in matrix land
06:38:36*ltriant quit (Ping timeout: 264 seconds)
06:42:25FromDiscord<Rika> In reply to @Elegantbeef "*We only got 'kotlin'": Kotlin
06:42:39FromDiscord<Elegantbeef> Hey that reply worked
06:57:22FromDiscord<Cheeseinator> Is there a way to disable warnings for a file without it affecting other files that `include` said file?
06:58:09FromDiscord<Elegantbeef> You can turn specific warnings off for a block of code
06:58:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hMg
06:58:56FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#compiler-usage-list-of-warnings
06:59:31FromDiscord<Cheeseinator> I tried that and vscode still complained
06:59:44FromDiscord<Cheeseinator> ~~I probably shouldn't use vscode~~
07:23:30*kenran joined #nim
07:30:07*kenran quit (Remote host closed the connection)
07:31:54FromDiscord<albassort> wit nimyaml
07:31:57FromDiscord<albassort> can i just parse yaml
07:32:03FromDiscord<albassort> i dont really want to make a type for this
07:32:27FromDiscord<albassort> (edit) "wit" => "with"
07:33:02*PMunch joined #nim
07:34:33PMunchWell this ain't great: https://forum.nim-lang.org/t/9685
07:35:31FromDiscord<albassort> what is
07:35:50FromDiscord<albassort> ;what is great? nothing
07:37:07FromDiscord<Rika> https://nimyaml.org/api.html#the-document-object-model
07:37:11FromDiscord<albassort> i found it
07:37:13FromDiscord<albassort> sm
07:37:14FromDiscord<albassort> (edit) "sm" => "smh"
07:37:18FromDiscord<albassort> like 30s before
07:37:32FromDiscord<albassort> now to look for it in the test
07:38:22FromDiscord<Rika> https://nimyaml.org/api/dom.html#loadDom
07:38:48FromDiscord<Rika> says deprecated, replacement in docs
07:39:03FromDiscord<Rika> https://nimyaml.org/api/serialization.html#loadAs,string
07:39:08FromDiscord<albassort> yep
07:39:31FromDiscord<albassort> what
07:39:37FromDiscord<albassort> whatever i'll do tojson
07:40:24FromDiscord<Slava0135> does anyone know how can I configure VSCode plugin to use snake_case instead of camelCase?
07:40:52FromDiscord<Elegantbeef> You cannot
07:42:32FromDiscord<albassort> we stan camelCase here
07:42:59FromDiscord<albassort> whats up with this https://media.discordapp.net/attachments/371759389889003532/1049229385917534238/image.png
07:43:02FromDiscord<Elegantbeef> Well it's not too complicated to add to the saem extension
07:43:06FromDiscord<albassort> these guys taking up my memory
07:43:23FromDiscord<Elegantbeef> I did have a proof of concept, but it needed more work
07:43:58FromDiscord<Elegantbeef> What do you expect it to to use for a JS object equivlent
07:44:00FromDiscord<albassort> these json objets are pretty disgusting memory hogs huh
07:45:01FromDiscord<Elegantbeef> Well arbitrary representing a dynamically typed data type isnt the cheapest thing
07:48:15FromDiscord<albassort> on second thought i'll make the stinky object
07:48:19FromDiscord<albassort> though it might not work
08:09:28FromDiscord<untoreh> trying to use nimporter, getting "cannot dynamically load position-independent executable"
08:13:49FromDiscord<Slava0135> In reply to @albassort "we stan camelCase here": 💀
08:17:11Amun-RaSlava0135: that's not possible atm, vscode uses nimsuggest, nimsuggest does not support snake case :/
08:17:53FromDiscord<Elegantbeef> Sure but vscode does process nimsuggest output
08:18:01FromDiscord<Elegantbeef> So you can always suggest symbols that are camel case
08:18:29FromDiscord<Elegantbeef> As i said i had a proof of concept working and it was relatively simple
08:18:34Amun-Rahmm
08:20:07FromDiscord<Elegantbeef> Yea i think you can insert a "toSnakeCase" here https://github.com/saem/vscode-nim/blob/main/src/nimSuggest.nim#L91
08:44:43FromDiscord<albassort> i dunno if we should encourage using casing which would make you an odd one out
08:45:28FromDiscord<Elegantbeef> Literally the entire point of style insensitivity
08:46:04FromDiscord<salt> i've been using camelCase on nim projects mostly because of ide, i wouldn't mind being able to snake_case again, but also when in rome
08:47:23FromDiscord<Elegantbeef> meanwhile style insensitivity exists
08:50:23FromDiscord<salt> the style insensitivity seems to be pretty polarizing when i show people nim
08:51:02FromDiscord<salt> i'm pretty neutral on it, but wonder what opinion is at large
08:51:16FromDiscord<Slava0135> ~~cool kids use rust and it's snake case~~
08:51:29FromDiscord<salt> is rust snake_case too?
08:51:34FromDiscord<Elegantbeef> Nim programmers like it
08:51:39FromDiscord<Elegantbeef> People that dont use Nim dislike it
08:52:05FromDiscord<salt> i'm mostly just into whitespace
08:52:22Amun-RaI prefer snake case, I use camel case in nim code, unfortunatelly
08:54:03FromDiscord<Slava0135> In reply to @Elegantbeef "Yea i think you": but will it also affect type names?
08:54:51FromDiscord<salt> shouldn't should it? just check first letter
08:56:41FromDiscord<Elegantbeef> Yes it could
08:56:44FromDiscord<Elegantbeef> It's all suggest symbols
09:08:16FromDiscord<Phil> In reply to @salt "i'm pretty neutral on": Pythonistas highly appreciate it whenever they touch any of my camelcase libs
09:08:30FromDiscord<Phil> ~~Not that they're actually used by anyone I don't think~~
09:10:33FromDiscord<salt> there are a lot of python libs that are just bindings to c functions and they use the c naming conventions and it looks awful! Style insensitivity would be nice in those cases.
09:11:07FromDiscord<salt> looking at you `cv2`
09:11:58FromDiscord<albassort> In reply to @Slava0135 "~~cool kids use rust": uh not the place to shill rust
09:12:05FromDiscord<albassort> if we liked rust we would use rust
09:13:04FromDiscord<albassort> i really don't like it when languages don't have a consistent structure
09:13:10FromDiscord<albassort> (edit) "i really don't like it when languages don't have a consistent structure ... " added "and naming culture"
09:13:17FromDiscord<albassort> for example: C
09:13:24FromDiscord<albassort> GTK: https://media.discordapp.net/attachments/371759389889003532/1049252137479196713/image.png
09:13:33FromDiscord<albassort> X: https://media.discordapp.net/attachments/371759389889003532/1049252172388372500/image.png
09:13:50FromDiscord<albassort> :notLikeThis:
09:14:24FromDiscord<albassort> don't let this happen to nim
09:14:27FromDiscord<Slava0135> In reply to @albassort "i really don't like": goid thing about golang
09:14:39FromDiscord<Slava0135> (edit) "goid" => "good"
09:14:46FromDiscord<albassort> golang's naming structures are insane and should be shamed
09:15:29FromDiscord<Slava0135> but they are solid
09:16:55PMunchHmm, does anyone know how conversion between WGS84 and EUM89 coordinates work?
09:17:17FromDiscord<albassort> i would love to help, but seeing as i have to google it, im sure, I cannot help you
09:17:27FromDiscord<albassort> as you are a smart fella and not a fart smella
09:19:12PMunchHaha, thanks for that imagery :P And I wouldn't ask if I could easily find it via google, the only thing I find there is online converters and instructions for how to do this in certain programs
09:20:51FromDiscord<albassort> In reply to @PMunch "Haha, thanks for that": why is why i didn't answer haha
09:25:20FromDiscord<planetis> I had a geodesy course in uni, don't remember much except they are all ellipsoids with different parameters. Book is at home so I cant fetch it either.
09:35:49PMunchI am curious how it's done, but I found another export with the coordinate system I needed :)
09:40:40*neceve quit (Ping timeout: 260 seconds)
09:41:06FromDiscord<planetis> I don't think conversion is something you would do often, each has an area where it's most accurate and you're supposed to pick the right one when measuring
09:43:58FromDiscord<planetis> Unless I am totally wrong and the tools do that conversion automatically
09:50:05FromDiscord<albassort> is there anyway to compile everything with --threads:on in vscode
09:50:14FromDiscord<albassort> i added it to the default compiler tags but i still need to make .nims
10:18:09FromDiscord<Yardanico> In reply to @albassort "i added it to": "i added it to the default compiler tags" how?
10:18:26FromDiscord<Yardanico> if you mean in the vscode settings, that only affects the nim command that runs when you press F6
10:18:34FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1049268537610469376/image.png
10:18:38FromDiscord<albassort> hmm
10:18:39FromDiscord<Yardanico> so if you want threads to be recognized by highlighting and stuff, you do need .nims or .nim.cfg
10:18:41FromDiscord<albassort> damn
10:18:44FromDiscord<albassort> i realized this now
10:18:55FromDiscord<albassort> sad
10:19:09FromDiscord<albassort> .nim.cfg where?
10:19:13FromDiscord<albassort> in my root?
10:19:26FromDiscord<Yardanico> depends on what you want it to affect
10:19:33FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1049268780699766784/image.png
10:19:39FromDiscord<Yardanico> no
10:19:46FromDiscord<albassort> .-.
10:20:04FromDiscord<Yardanico> if you want it to affect your project, then you just place it near your main .nim file and name it `myfile.nim.cfg`. But again, you can as well use `.nims` for the same purpose, it's newer and is more extensible
10:20:17FromDiscord<albassort> annoying
10:20:17FromDiscord<Yardanico> so just create `myfile.nims` and add `switch("threads", "on")` to it, done
10:20:21FromDiscord<Yardanico> that's how you should do it properly anyway
10:20:56FromDiscord<albassort> i move my dependency structure so its no longer a problem
10:21:02FromDiscord<albassort> (edit) "move" => "moved"
10:21:04FromDiscord<albassort> :)
11:07:00*ltriant joined #nim
11:11:54*ltriant quit (Ping timeout: 260 seconds)
11:36:11*jmdaemon quit (Ping timeout: 264 seconds)
12:08:47FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4hNs
12:09:36FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hNu
12:10:04FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4hNu" => "https://play.nim-lang.org/#ix=4hNv"
12:10:38*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
12:10:42FromDiscord<albassort> i think you might be able to do something like
12:10:51FromDiscord<Jessa> ah, spaces
12:11:05FromDiscord<Jessa> i keep forgetting about spaces
12:11:08FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hNw
12:11:15FromDiscord<albassort> i never tried that tho
12:11:17FromDiscord<albassort> might be wrong
12:11:24FromDiscord<Jessa> `a:seq[string] = @[]` works
12:11:47FromDiscord<Jessa> thank you
12:11:58FromDiscord<albassort> :
12:12:02FromDiscord<albassort> (edit) ":" => ":D"
12:13:02*ltriant joined #nim
12:17:24*ltriant quit (Ping timeout: 246 seconds)
12:42:19FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#ix=4hNB
12:45:03FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#ix=4hND
12:46:21FromDiscord<Generic> it doesn't work for arrays
12:46:27FromDiscord<Generic> your code only works for array literals
12:46:59FromDiscord<Generic> what you need to do is generate code which indexes the array or seq
12:47:00*ltriant joined #nim
12:47:30FromDiscord<Generic> this should work
12:47:30FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=4hNE
12:47:48FromDiscord<Generic> (edit) "what you need to do is generate code which indexes the array or seq ... " added "instead of directly indexing the AST"
12:51:54FromDiscord<emanresu3> It doesn't compile for me, should I change anything else?
12:52:03*TakinOver quit (Ping timeout: 252 seconds)
12:52:15FromDiscord<emanresu3> Still only works for array literals
12:53:10*ltriant quit (Ping timeout: 260 seconds)
13:21:55*TakinOver joined #nim
13:56:36*Phytolizer joined #nim
13:57:11*junaid_ joined #nim
14:03:56*junaid_ quit (Remote host closed the connection)
14:33:30FromDiscord<ringabout> What does `<=` mean for sets? `{sym1, sym2} <= flags`?
14:37:32FromDiscord<auxym> I know `<` means "strict subset", which doesnt include equal sets
14:38:03FromDiscord<auxym> logically `a <= b` should be be `a < b or a == b`
14:38:59FromDiscord<auxym> `{sym1, sym2} <= flags` should be equivalent to `sym1 in flags and sym2 in flags`
14:41:20FromDiscord<ringabout> Yeah, thanks. It is a bit too stretchy for operator overloading. Found a bug in the compiler.
15:05:52noeontheendI'm sure this has been asked before, but is there any way to pass an int *variable* (from a loop at compile time) to a macro and access its value?
15:06:24FromDiscord<Rika> No, macros are compile time only and values of a variable are run time
15:06:41FromDiscord<Rika> You can access the value but only through the generated code and not the generating code
15:07:59noeontheendThanks, that's what I thought but wanted to make sure
15:11:37*PMunch quit (Quit: Leaving)
15:46:43FromDiscord<planetis> In reply to @ringabout "Yeah, thanks. It is": You mean it does the opposite it's supposed to do? It actually used correctly
15:47:03FromDiscord<planetis> (edit) "It" => "It's" | "correctly" => "correctly."
15:50:14FromDiscord<Jessa> i'm curious-↵↵would one get scolded in the Nim community for just using `return . . .` no matter when :P
15:53:02FromDiscord<auxym> huh? using `result` by default and `return` when really needed is idiomatic, but personally I wouldn't scold you for using return
15:53:26FromDiscord<auxym> `return` when really needed for control flow
15:56:21FromDiscord<Yepoleb> we don't scold people for their coding style in general i think
15:58:15FromDiscord<Jessa> i use `return` basically everywhere cus im used to that
16:00:26FromDiscord<demotomohiro> But there are many cases writing procs without `return` makes code simpler.
16:02:16FromDiscord<demotomohiro> `proc get(x: Foo): Bar = x.bar` is simpler than `proc get(x: Foo): Bar = return x.bar`.
16:02:28FromDiscord<Jessa> true↵↵which is just something ii'll have to try and get used to
16:03:57FromDiscord<Yepoleb> while you're learning the language just write the code the way you feel comfortable with
16:05:33*Phytolizer quit (Ping timeout: 260 seconds)
16:07:24FromDiscord<Gumbercules> In reply to @Jessa "i use `return` basically": Blocks and break and assigning to the implicit result are nice for getting rid of returns
16:07:42FromDiscord<Jessa> In reply to @Yepoleb "while you're learning the": basiically what i'm doing, yeah
16:09:04FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/plugin.nim#L55
16:09:08FromDiscord<Gumbercules> For instance
16:09:50FromDiscord<Jessa> rn just found out that the `result` thing is very nice
16:32:09FromDiscord<Gumbercules> In reply to @Jessa "rn just found out": I literally have zero return statements in my code base. I probably take it to an extreme but I'm used to handling early exits this way now so...
16:41:17FromDiscord<Require Support> how to: string to byteSeq and vice versa
16:45:44FromDiscord<Require Support> https://github.com/nim-lang/Nim/issues/14810 related
16:47:19*dtomato4 joined #nim
16:47:27NimEventerNew thread by kaushalmodi: Is the use of doAssert in config.nims deprecated in the latest Nim devel?, see https://forum.nim-lang.org/t/9695
16:49:46*ltriant joined #nim
16:54:11*ltriant quit (Ping timeout: 246 seconds)
17:07:58*Phytolizer joined #nim
17:55:19FromDiscord<auxym> I presume this is new in 1.6.10? `Warning: setLen can potentially expand the sequence, but the element type 'Instruction' doesn't have a valid default value [UnsafeSetLen]`
17:55:43FromDiscord<auxym> we don't have a way to provide a default value until v2, right?
18:00:44FromDiscord<Gumbercules> Why doesn't it just get zero initialized then?
18:00:58FromDiscord<Gumbercules> Seems annoying...
18:04:59FromDiscord<auxym> because the contained type might have 0 an an illegal value. eg. `A .. Z` or `Positive`. which is why it's unsafe, but its annoying when there's no alternative atm
18:05:16FromDiscord<Gumbercules> But does it?
18:05:28FromDiscord<auxym> ?
18:05:36FromDiscord<Gumbercules> If not then it should just zero initialize
18:06:04FromDiscord<Gumbercules> I'm asking if the type it's warning you about fits that description
18:06:27FromDiscord<Gumbercules> Where 0 is an invalid value
18:07:12FromDiscord<auxym> yes
18:09:04FromDiscord<auxym> the warning seems to be triggered even when initializing an empty seq as in `let x: seq[Positive]`
18:09:15FromDiscord<kaddkaka> How to iterate over a seq in reverse order?
18:10:12FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4hP3
18:10:13FromDiscord<kaddkaka> ~ `for i in countdown(<myseq.len, 0): myseq[i]` doesn't feel nice, couldnt find anything in the manual
18:10:44FromDiscord<kaddkaka> nice, is that iterator available in library?
18:10:46FromDiscord<auxym> yeah I don't think there's anything in the stdlib, I just add the iterator above to my code here and there
18:11:24FromDiscord<kaddkaka> ok thanks 👍
18:12:00FromDiscord<auxym> maybe I should PR it? in sequtils? 🤔
18:13:47FromDiscord<auxym> In reply to @kaddkaka "nice, is that iterator": there is `reverse` and `reversed` in std/algorithm btw, but they aren't iterators. One will reverse your seq in place, the second will create a copy
18:13:50FromDiscord<kaddkaka> it's a great way to force me to learn a simple iterator
18:14:05FromDiscord<kaddkaka> I called it `backwards` ^^
18:18:10FromDiscord<jtv> Is there any good way to get the calling context for a macro? Particularly, I want to generate procs at the module scope to avoid weird errors, so if someone calls my macro within a proc/func context, I would like to error on that, instead of generating a nested proc.
18:39:00FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4hPg
18:39:33*Phytolizer quit (Ping timeout: 260 seconds)
18:41:21FromDiscord<auxym> that looks like it should work, doesn't it? or you'd like to accept `s` as an iterator?
18:42:15FromDiscord<kaddkaka> yeah, but I guess, `io.lines` is not a closure iterator, which might be a problem
18:42:25FromDiscord<auxym> in which case you can't do that with inline (default) iterators, because they aren't "first class" values that can be passed around like procs, they are more similar to templates in that they are expanded (to an inline for loop) at compile time
18:42:32FromDiscord<kaddkaka> https://nim-lang.org/docs/io.html#lines.i%2Cstring
18:42:39FromDiscord<kaddkaka> right
18:43:52FromDiscord<kaddkaka> My original problem is that I want to do some logic for the header of a file, and then some other logic for the rest of the file, so if there is some way to break, but then continute the `lines` inline iterator, that would be nice
18:44:15FromDiscord<kaddkaka> (yes I'm doing AoC day5)
18:44:32FromDiscord<auxym> haha, just got done with that
18:44:50FromDiscord<kaddkaka> I parsed the header, but now I want to consume the rest of the file 😛
18:45:00FromDiscord<Cheeseinator> i think iterators can take other iterators but i might be wrong
18:45:06FromDiscord<vestel> How does iterators work "under the hood"?
18:45:07FromDiscord<auxym> you might be interested in zero-functional, which is sort of iterators-on-steroids
18:45:24FromDiscord<auxym> In reply to @vestel "How does iterators work": they inline a for loop at compile time
18:45:35FromDiscord<auxym> like a template, sort of
18:45:40FromDiscord<kaddkaka> @vestel my guess (seeing them the first time today) is that inline iterators just expand to for loop
18:45:41FromDiscord<vestel> I mean there is no yield statement in backend languages
18:45:57FromDiscord<vestel> Doing code virtualizer and kinda stuck on this
18:47:02FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4hPk
18:47:36FromDiscord<auxym> In reply to @kaddkaka "My original problem is": yeah you can't with inline iterators. maybe with a closure iterator. Or just use splitLines, AOC inputs won't fill up your ram 😉
18:47:39FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4hPk" => "https://play.nim-lang.org/#ix=4hPl"
18:47:52FromDiscord<kaddkaka> @auxym but but
18:48:32FromDiscord<MetuMortis> In Pegs is there any way to say X char or Y char
18:48:36FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4hPl" => "https://play.nim-lang.org/#ix=4hPm"
18:49:11FromDiscord<kaddkaka> In reply to @auxym "yeah you can't with": 😦 I feel dirty reading all of it into. ALL OF IT
18:49:20FromDiscord<kaddkaka> (edit) "into." => "into ram."
18:49:26FromDiscord<MetuMortis> In reply to @vestel "I mean there is": nice name btw where are you fromn
18:49:27FromDiscord<MetuMortis> (edit) "fromn" => "from"
18:49:59FromDiscord<auxym> @kaddkaka maybe with this? https://nim-lang.org/docs/enumerate.html
18:50:30FromDiscord<vestel> In reply to @MetuMortis "nice name btw where": Ukraine
18:51:33FromDiscord<kaddkaka> In reply to @auxym "<@185793553539137537> maybe with this?": whoa!
18:51:45FromDiscord<vestel> sent a code paste, see https://play.nim-lang.org/#ix=4hPo
18:51:46FromDiscord<kaddkaka> I thought that wouldn't work with inline iterator, but I guess macro trumps it!
18:52:25FromDiscord<kaddkaka> In reply to @vestel "Thank you. So I": I have no idea, that was just my wild guess. I have never come across "code virtualizer". 🙈
18:52:48FromDiscord<kaddkaka> @auxym so I should be able to do a macro of my `drop` iterator I guess?
18:54:44FromDiscord<vestel> In reply to @kaddkaka "I have no idea,": Basically it generates interpreter for virtual cpu and convert your code to bytecode for it
18:55:06FromDiscord<vestel> (edit) "convert" => "converts"
18:55:11FromDiscord<MetuMortis> sent a code paste, see https://play.nim-lang.org/#ix=4hPp
18:58:47FromDiscord<auxym> In reply to @kaddkaka "<@882793909246369864> so I should": not a macro expert but have a look at https://nim-lang.org/docs/manual.html#macros-for-loop-macro depply advanced stuff though
18:59:00FromDiscord<kaddkaka> @auxym (Also I was looking for `enumerate`, but I only found https://nim-lang.org/docs/manual.html#macros-for-loop-macro, in the manual) 🙂
18:59:27FromDiscord<kaddkaka> heh, yeah, not for tonight to delve inte macros I think, but thanks
19:00:19FromDiscord<auxym> yeah, don't recommend 😉 I used splitLines and hardcoded the line number to split the top from the bottom
19:01:01FromDiscord<kaddkaka> 🙀 `HRDCDD` 🙀
19:01:12FromDiscord<auxym> hm you could use https://nim-lang.org/docs/io.html#readLine%2CFile to read lazily from the file though
19:01:38FromDiscord<kaddkaka> ✝️ ⛪ 🎌
19:14:27*claudius joined #nim
19:14:38*claudius is now known as Mat42
19:17:06Mat42G'day everyone. Is there any work on a native-code compiler for Nim known?
19:18:12Mat42or does someone work on it?
19:18:45FromDiscord<jtv> Not sure where the advantage would be there. Targeting C and then running it on, say, clang, will generate code that should be as good as if you generated the LLVM directly... which will generally produce better code than naively targeting the underlying platform w/o the intermediary
19:19:07*PMunch joined #nim
19:20:35FromDiscord<auxym> i guess nlvm doesn't count as native?
19:21:01FromDiscord<auxym> but yeah that would be a huge amount of work, if you include the optimization that llvm/gcc do these days
19:21:51FromDiscord<jtv> Yeah, the major thing to note that modern compilers do an outstanding job (especially llvm), and you don't have to worry about the N different architectures at the instruction optimization level. There really is no good reason to do it
19:23:50FromDiscord<jmgomez> Not to mention that you lost one of the main Nim use cases, cpp interop
19:24:31PMunchA bit later than usual, but getting ready to stream advent of code again :)
19:30:30oisotaPMunch where/when are going to be streaming?
19:30:49PMunchTwitch YouTube, in about five minutes :)
19:31:11FromDiscord<Andreas> In reply to @PMunch "Twitch YouTube, in about": with or without T-shirt ?
19:31:23Mat42I'm primary interessted in system programming and as well as Nim can be used in this respect conventional C compiler bare some overhead in code size which is caused from the C model, where straight code-size optimized native-code compilation allows targeting architectures with low address spaces, like many common microprocessors or even small SoC.
19:31:30PMunchHaha, with shirt on :P
19:31:33oisotaNice! I started in python but I've been converting my solutions to Nim to help me learn the language
19:32:04PMunchMat42, check out Ratel and my talks on Nim for microcontrollers if you want some nice benchmarks :)
19:32:42Mat42I will do, thanks.
19:32:52FromDiscord<jtv> I fail to see the overhead in code size? Plenty of environments where not even stdlib is compiled in.
19:33:38PMunchOkay, stream is now live: https://www.twitch.tv/pmunche and https://www.youtube.com/watch?v=EsvLO8WVOg0
19:34:37Mat42jtv: If you have an data address-space of say 64 kB where half is used by a real-time kernel code-size become really important.
19:35:50FromDiscord<jtv> Like I said, I'm not sure where C is responsible for code bloat, if you control the linking environment. It doesn't even add bounds checks for you 🙂
19:38:10FromDiscord<albassort> Schizo dragon question but where does blocks exist memory
19:38:28FromDiscord<albassort> Can I generate pointers to dreads blocks and then remotely break them
19:38:57FromDiscord<albassort> (edit) "dragon" => "threads"
19:39:18Mat42jtv: The code bloat is resulted from the C model in which for example a call-frame can not be omitted. As does there exist some exellent C compilers, you end up with hand-optimized assembly code quite often.
19:39:30FromDiscord<albassort> Or do I have to pass a variable pointer to a while loop
19:39:56Mat42Anyhow, as I see it there is no demand on native-code compilation.
19:41:54FromDiscord<jtv> Well, I've definitely seen C compilers, when compiling a static executable, able to optimize away call frames, since it has enough context to prove if non-tail recursion is present. But okay, I'll take your word for it
19:41:55FromDiscord<albassort> A native Nim Target would be very impressive
19:42:09FromDiscord<albassort> I highly doubt we can get anywhere near as fast as we currently do with our small community compiling to native
19:42:18FromDiscord<albassort> We kind of exist on the shoulders of giants here
19:42:35FromDiscord<albassort> And so do a ton of compiled C languages
19:43:09Mat42jtv: Yes, as written there are enough cases where this is not possible. Another problem is that such kind of optimization is not guaranteed.
19:43:42FromDiscord<albassort> But the big problem would be getting stuff like macros to work
19:45:27FromDiscord<albassort> It would be incredible and a big community effort but it would only result in making executables smaller and more embedded friendly
19:45:37FromDiscord<albassort> Which what you want
19:48:52FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4hPB
19:49:11FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4hPB" => "https://play.nim-lang.org/#ix=4hPC"
19:49:24Mat42albassort: A traditional use case is dynamic cross compilation, which I would prefer. In this case only the most important source fragments get compiled to native code and a minimal interpreter is generated which then execute the rest of code. This combines the possibility of high code compression with good performance.
19:51:12Mat42For such the Nim compiler inclusive is macro possibilities is quite fine. Only the code generator is not available.
19:52:54FromDiscord<Jessa> is there any channel dedicated to showing the things you've made?
19:53:08Mat42That may be an attractive feature for low-level programming, I would say.
19:53:52Mat42← hint
19:54:32FromDiscord<Yardanico> In reply to @Jessa "is there any channel": not really, people mostly seem to use the forum for that
19:56:08FromDiscord<Jessa> i see
19:59:42Mat42albassort: What microporcesors do you use?
20:00:08FromDiscord<auxym> an intel i7 😛 (you probably mean microcontroller)
20:00:50Mat42yes, I mean microcontroller, sorry for the typo
20:00:56FromDiscord<albassort> In reply to @Mat42 "<@217459674700578816>: What microporcesors do": I use an Intel i7. When I said microcontroller I meant the smaller baby ones and microprocessors
20:01:07FromDiscord<albassort> (edit) "i7." => "i5."
20:01:22FromDiscord<albassort> In reply to @albassort "I use an Intel": I currently don't use any microcontrollers but there's a project I'm planning on doing eventually which I will use them
20:01:42FromDiscord<albassort> Currently though I'm working on something else. And unfortunately since I have a job I will not have as much time to work on the other side
20:01:52Mat42I see
20:02:12FromDiscord<auxym> fyi there's a few of us in #embedded running nim on AVR, ESP32, SAMD, rp2040, etc
20:02:40FromDiscord<albassort> I know nothing about embedded and I'm going to bother the hell out of you guys whenever I start out of the project
20:02:54FromDiscord<albassort> Get ready to explain to me how to load a program onto opram
20:04:10FromDiscord<auxym> generally: find some docs on how to do it in C and copy that
20:04:38*krux02 joined #nim
20:06:10FromDiscord<Gumbercules> I'm curious - do folks use Nim's stdlib for embedded stuff or roll their own / use some C library
20:06:56FromDiscord<Gumbercules> I got the Nim compiler compiling on my pinephone and I wrote a program and compiled it on the pinephone as well, but that's about as close as I've gotten to anything embedded - so , not very close 🙂
20:07:43FromDiscord<BlueCore> Hello, new to Nim! I have a hashtable that I would like to create a clone (or copy) of, I found deepCopy(), and was just wondering if there is any better way of achieving this?
20:07:46FromDiscord<albassort> Orc usually works fine on embedded so I hear
20:07:53FromDiscord<auxym> nim's stdlib allocates a lot. if you're not trying to squeeze every bit of ram/speed, it works.
20:08:08*arkurious joined #nim
20:08:13FromDiscord<albassort> In reply to @BlueCore "Hello, new to Nim!": Well first of all why do you want to clone it
20:08:22FromDiscord<auxym> if you want to minimize/avoid allocation at all, better avoid seq, string and therefore most of the stdlib
20:08:44FromDiscord<albassort> I'm not trying to be dismissive but there's not too many times when you want to clone something in them
20:08:50FromDiscord<albassort> (edit) "them" => "Nim"
20:09:07FromDiscord<albassort> Deep copy is more of a memory thing, it shouldn't really be used for this purpose
20:10:41FromDiscord<BlueCore> Yup, I know cloning is not a good thing most of the time, I am just very lazy and want to pass the same hashtable into a function that would otherwise mutate it. There is probably a better way of doing it, so if you have suggestions for that I am pleased too
20:11:05FromDiscord<albassort> For example, when exchanging between threads you might deepcopy to make sure that nothing is pointing to another thread
20:11:25FromDiscord<Gumbercules> just pass it - you have a reference to it anyway
20:11:35FromDiscord<albassort> In reply to @BlueCore "Yup, I know cloning": Can you elaborate a bit more?
20:12:09FromDiscord<albassort> Where are you passing to something that you don't want to mutate it? That's not really a thing in the standard library (I don't think?) so you probably had a condition
20:12:21FromDiscord<albassort> (edit) "Where are you passing to something that you don't want to mutate it? That's not really a thing in the standard library (I don't think?) so you ... probably" added "should"
20:12:27FromDiscord<albassort> But, if you want to
20:12:50FromDiscord<albassort> This is the way I do it (I'm sure others will chip in)
20:13:05FromDiscord<Phil> Inim example
20:13:06FromDiscord<Phil> sent a long message, see http://ix.io/4hPK
20:13:44FromDiscord<Phil> As you can see, x only contains the key "a", but y contains "a" and "potato"↵Thus y is a copy of x
20:14:14FromDiscord<Phil> I mean, you can also explicitly copy if you want, but you don't really need to worry
20:14:24FromDiscord<Yardanico> because Table is a value type, yes
20:14:31FromDiscord<Yardanico> but TableRef is not
20:14:35FromDiscord<Yardanico> although you should generally just use Table anyway
20:14:37FromDiscord<Phil> That is correct and fair
20:14:50FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hPL
20:14:55FromDiscord<albassort> or
20:14:55Mat42thanks for the answers, ciao
20:14:57FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4hPL" => "https://play.nim-lang.org/#ix=4hPM"
20:15:00*Mat42 quit (Quit: Leaving)
20:15:02FromDiscord<albassort> (edit) "or ... " added "something"
20:15:13FromDiscord<Phil> see ya
20:15:20FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4hPM" => "https://play.nim-lang.org/#ix=4hPN"
20:15:30FromDiscord<albassort> no need for a special function, no reference is passed to copy
20:16:37FromDiscord<Shield> hey, i'd like to ask about the status of running nim dlls in a nim executable, did the gc problem get solved?
20:16:47FromDiscord<kaddkaka> Adding to my wishlist, `scanf` should have a symbol to parse Naturals: `scanf("5 - 10", "$n - $n", a, b)`
20:17:08FromDiscord<Gumbercules> @Shield https://github.com/Tail-Wag-Games/frag/blob/master/src/plugin.nim
20:17:19FromDiscord<kaddkaka> Also why doesnt seq.delete take backward indices (`^`)?
20:17:46FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/app.nim
20:18:29FromDiscord<albassort> what is this
20:18:36FromDiscord<albassort> why is there so much asm
20:18:40FromDiscord<Gumbercules> it wasn't really a "problem" per se it was just the architecture
20:18:57FromDiscord<Gumbercules> In reply to @albassort "why is there so": because fibers don't exist on any other OS than windows and I didn't feel like using continuations or closure iterators
20:19:18FromDiscord<albassort> are they talking about nim libraries not getting gc because that would be literally impossible?
20:19:20FromDiscord<Gumbercules> so a boost's context library, without the boost stuff in it, works well as a drop-in
20:19:29FromDiscord<Gumbercules> no - Nim's old memory model relied on a thread-local heap
20:19:43FromDiscord<albassort> it doesn't anymore?
20:19:48FromDiscord<Gumbercules> it includes a shared heap
20:19:58FromDiscord<kaddkaka> In reply to @kaddkaka "Also why doesnt seq.delete": `stacks_CrateMover_9001[src].delete(^n..^1)` complains: `■ type mismatch: got <stack, HSlice[system.BackwardsIndex, system.BackwardsIndex]> ...` 😦
20:20:03FromDiscord<Gumbercules> but thread-local heaps weren't the only problem
20:20:06FromDiscord<Shield> i'm reading through the files but what's the giveway? does it work? there was a somebody here working on a text editor with plugins and dropped dlls altogether
20:20:17FromDiscord<Gumbercules> each DLL needed its own instance of the Nim runtime for that thread-local heap to be GC'd
20:20:25FromDiscord<albassort> that sounds insane
20:20:33FromDiscord<Gumbercules> so the GC's would clobber one another
20:20:52FromDiscord<Shield> i'm still dreaming about making a modable game without scripting
20:20:54FromDiscord<Gumbercules> eh it's' not too crazy - a lot of GC'd languages do this
20:20:55FromDiscord<albassort> and now you just embed them in the shared memory on compile?
20:21:04FromDiscord<Gumbercules> mmm no
20:21:12FromDiscord<Gumbercules> I load the plugin dynamically and load symbols from it and execute those
20:21:26FromDiscord<Gumbercules> but I don't have to worry about every DLL I compile / load having its own GC
20:21:28FromDiscord<albassort> i meant standard code lol
20:21:46FromDiscord<albassort> your code is an extendable plugin system
20:21:51FromDiscord<Gumbercules> yes
20:21:55FromDiscord<albassort> so it has to be dynamic and cant go into shared
20:22:03FromDiscord<Gumbercules> no I can access the shared heap
20:22:10FromDiscord<Gumbercules> my host program loads the DLLs
20:22:24FromDiscord<Gumbercules> I don't access the host program's memory inside my plugin - I pass anything I need to it
20:22:40FromDiscord<albassort> nim + asm
20:22:40FromDiscord<Gumbercules> I pass a plugin object to my init function in my plugin, this has a pointer to my API object
20:22:41FromDiscord<albassort> not even once
20:22:52FromDiscord<Gumbercules> well I use the asm code here -
20:23:01FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/fiber.nim
20:23:09FromDiscord<albassort> and yes, what is a fiber?
20:23:10FromDiscord<Gumbercules> which gets used here - https://github.com/Tail-Wag-Games/frag/blob/master/src/job.nim
20:23:15FromDiscord<Gumbercules> a fiber is a green thread / software thread
20:23:29FromDiscord<albassort> like a coroutine?
20:23:30FromDiscord<Gumbercules> it has its own context / stack very similar to a closure iterator
20:23:40FromDiscord<Gumbercules> similar but not exactly
20:23:58FromDiscord<Gumbercules> fiber's context switches need to be managed by some sort of scheduler
20:24:01FromDiscord<albassort> a coroutine with its own stack?
20:24:02FromDiscord<Gumbercules> and they of course can be resumed
20:24:16FromDiscord<albassort> so its async and not threaded
20:24:19FromDiscord<Gumbercules> well coroutines aren't scheduled really
20:24:22FromDiscord<BlueCore> sent a code paste, see https://play.nim-lang.org/#ix=4hPP
20:24:34FromDiscord<Gumbercules> mmmm it's green threads running on threads
20:24:34FromDiscord<Gumbercules> OS threads
20:24:40FromDiscord<Gumbercules> in my engine's case
20:24:48FromDiscord<albassort> 🤔 ok im gonna read up on this
20:24:56FromDiscord<Gumbercules> it's very similar to the job system laid out in this slide deck:http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine
20:25:02FromDiscord<Gumbercules> (edit) "deck:http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine" => "deck: http://www.gdcvault.com/play/1022186/Parallelizing-the-Naughty-Dog-Engine"
20:25:13FromDiscord<demotomohiro> @kaddkaka There are no `delete` proc for seq that takes `BackwordIndex` or `HSlice`. You would need to implement yourself.
20:25:38FromDiscord<Gumbercules> or video I guess - I thought I linked the presentation slides, my bad
20:25:40FromDiscord<Shield> @Gumbercules so did you get it to work fine? no little headaches?
20:25:52FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> There are no": I thought BackwardIndex was desugared before the function call?
20:25:55FromDiscord<Gumbercules> I mean... headaches are subjective
20:25:56FromDiscord<albassort> this is extremely interesting
20:26:01FromDiscord<Gumbercules> I've been coding in Nim for 7 years
20:26:12FromDiscord<Gumbercules> what gives someone here a headache might not bother me as much
20:26:12FromDiscord<kaddkaka> (but I guess not)
20:26:13FromDiscord<Shield> last time i tried it it was something in the std lib not playing well
20:26:42FromDiscord<Gumbercules> mmmm if you're referring to the hot reloading functionality that Nim has as an experimental feature - I don't know what the status of it is
20:27:05FromDiscord<Gumbercules> there was also the issue with the default allocator not being threadsafe and needing to synchronize allocations
20:27:34FromDiscord<Gumbercules> but you can work around those now - there's some new experimental allocator which is supposed to become default - I tried getting it to work on windows using the MSVC compiler and it wouldn't work
20:27:46FromDiscord<Gumbercules> but this is why I'm using `mimalloc` in my project and may end up rolling my own stdlib + allocators
20:27:47FromDiscord<Shield> i wish there was a possibility where you just pass the allocator back to the dll when you load it
20:27:49FromDiscord<Gumbercules> need to benchmark mimalloc first
20:27:58FromDiscord<Gumbercules> well you can do this - just need to roll your own stdlib
20:28:07FromDiscord<Shield> yeah
20:28:09FromDiscord<Gumbercules> you can also patch Nim's `alloc.nim`
20:28:26FromDiscord<Gumbercules> which is probably a quicker way to do it
20:28:26FromDiscord<demotomohiro> @kaddkaka There are `[]` proc for seq that takes `BackwordsIndex` or `HSlice`.https://nim-lang.org/docs/system.html#%5B%5D%2CopenArray%5BT%5D%2CHSlice%5BU%3A%20Ordinal%2CV%3A%20Ordinal%5D
20:28:29FromDiscord<albassort> @Gumbercules from waht im reading so far, why are conflating green threads with fibers?
20:28:42FromDiscord<albassort> (edit) "waht" => "what"
20:28:52FromDiscord<Gumbercules> but you still have no nice way to say - for this one allocation, use this allocator
20:29:00FromDiscord<Gumbercules> In reply to @albassort "<@204328759715692544> from what im": I'm not? they're essentially the same thing
20:29:15FromDiscord<Shield> what's the next sane way to handle plugins then? assume a game where you want to add and update new entities
20:29:58FromDiscord<albassort> noooo green threads use mulithreading in a user environment rather that a kernel level environment allowing for more universal compatibility at the cost of speed
20:30:04FromDiscord<albassort> fibers are special boy rocoutines
20:30:21FromDiscord<Gumbercules> green threads are software threads
20:30:28FromDiscord<Gumbercules> fibers are software threads
20:30:32FromDiscord<Gumbercules> I fail to see a difference really
20:30:33FromDiscord<albassort> (edit) "rocoutines" => "coroutines"
20:30:45FromDiscord<Gumbercules> neither are scheduled by the OS
20:30:51FromDiscord<albassort> https://en.wikipedia.org/wiki/Fiber_(computer_science)
20:30:56FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> There are `[]`": How does that interact with `delete`?
20:31:02FromDiscord<albassort> green threads can run fibers
20:31:08FromDiscord<Gumbercules> sure
20:31:14FromDiscord<Gumbercules> fibers can run more fibers
20:31:15FromDiscord<albassort> because they are tied to threads in the cpu
20:31:22FromDiscord<albassort> fibers are not
20:31:40FromDiscord<Gumbercules> huh? no...
20:31:43FromDiscord<albassort> green threads cannot run more green threads in the same sense a fiber can do fibers
20:31:47FromDiscord<Gumbercules> green threads are not tied to OS threads
20:32:03FromDiscord<albassort> but they're tied to hardware thread, otherwise they wouldn't function
20:32:07FromDiscord<Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4hPR
20:32:11FromDiscord<Gumbercules> well you need a thread to run a fiber on too
20:32:51*bmp joined #nim
20:33:03FromDiscord<Gumbercules> In reply to @Shield "what's the next sane": the way I'm doing it
20:33:13FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hPS
20:33:18FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hPT
20:33:20FromDiscord<Gumbercules> right
20:33:21FromDiscord<albassort> they exten concurrency
20:33:29FromDiscord<albassort> (edit) "exten" => "extend"
20:33:34FromDiscord<Gumbercules> green threads aren't preemptive either
20:33:37FromDiscord<albassort> green threads are parallelism
20:33:39FromDiscord<demotomohiro> @kaddkaka I dont think they do nothing to `delete`.
20:33:44FromDiscord<albassort> nonconcurrent
20:34:18FromDiscord<Gumbercules> I'm going to leave you to your understanding here @albassort if it's working for you haha
20:34:30FromDiscord<Gumbercules> but I think you're saying basically the same thing I am
20:34:49FromDiscord<Gumbercules> I'm not saying they are 1:1 in terms of implementation but there's no reason you couldn't replace fibers with green threads
20:34:50FromDiscord<albassort> lol
20:34:52FromDiscord<Gumbercules> or vis versa
20:34:54FromDiscord<albassort> im not trying to argue with you
20:34:58FromDiscord<albassort> lov u
20:35:05FromDiscord<Gumbercules> no I didn't take it that way, don't worry 🙂
20:35:07FromDiscord<albassort> probably just different words
20:35:21FromDiscord<Gumbercules> @Shield - I use a C library - https://github.com/fungos/cr
20:35:32FromDiscord<Gumbercules> and I use this to manage the loading and unloading and rollback for my plugins
20:35:43FromDiscord<Gumbercules> you could replace it with something written in Nim
20:35:50FromDiscord<Gumbercules> there are some gotchas though - like preserving state between reloads
20:35:57FromDiscord<Gumbercules> but this can be handled with a simple template that introduces a custom pragma
20:36:06FromDiscord<albassort> as a side note, i really wanna get coroutines working in nim
20:36:10FromDiscord<albassort> current coroutines stuff sucks
20:36:20FromDiscord<Gumbercules> the plugin architecture you're describing is exactly what I have implemented in my game engine
20:36:21FromDiscord<demotomohiro> @kaddkaka If you implement a `delete` proc that works with `BackwordsIndex`, you would create a new `delete` proc that takes `BackwordsIndex`, covert it to just an index and call existing `delete`.
20:36:21FromDiscord<albassort> potentially fibers might be a better alternative
20:36:33FromDiscord<Gumbercules> In reply to @albassort "potentially fibers might be": fibers only have native support on Windows
20:36:36FromDiscord<albassort> boost has fibers on unix
20:36:48FromDiscord<Gumbercules> well not real fibers but yeah - that's what I"m using essentially
20:36:54FromDiscord<Gumbercules> the boost context library without any boost stuff in it
20:36:59FromDiscord<Shield> @Gumbercules what's the gotchas of your way? not preserving states is fine for me, i just want to know if i have to ditch std lib from the start
20:37:07FromDiscord<Gumbercules> no you don't
20:37:20FromDiscord<Gumbercules> there are no real gotchas per se
20:37:26FromDiscord<Shield> i'll bookmark your project, the assembly folder is pretty scary
20:37:28FromDiscord<Gumbercules> if you look at my code - it works
20:37:29FromDiscord<albassort> In reply to @Gumbercules "the boost context library": hmm? I haven't used boost. Is it a viable to wrap it for arbitrary code?
20:37:33FromDiscord<Gumbercules> you dont' need to worry about the assembly library
20:37:39FromDiscord<Gumbercules> I compile the asm files into object files here
20:37:50FromDiscord<c4ulmu> Hi again. I've read in documentation that AsyncHttpClient doesn't support timeout? Is it true? Is there other ways to have timeout for async http requests ?
20:37:54FromDiscord<kaddkaka> In reply to @demotomohiro "<@185793553539137537> If you implement": Sorry I dont follow. Do you mean that one of the `delete`s can be implemented using the other one?
20:37:57FromDiscord<albassort> oh no its c
20:37:59FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/config.nims
20:38:21FromDiscord<Gumbercules> you don't need the assembly for this @Shield
20:38:24FromDiscord<Gumbercules> these are two different conversations xD
20:38:37FromDiscord<Gumbercules> the assembly code is used for context switching in my game engine's job system
20:38:54*krux02 quit (Quit: Leaving)
20:38:55*bmp left #nim (#nim)
20:38:58FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/thirdparty/cr.cpp
20:39:00FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hPV
20:39:07FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4hPW
20:39:10FromDiscord<albassort> asediohndfgioj\
20:39:20FromDiscord<Yardanico> In reply to @c4ulmu "Hi again. I've": there's withTimeout that can be used for any async procedures, but AFAIK there is a bug because asynchttpclient doesn't accept a usual timeout
20:39:21FromDiscord<Gumbercules> I compile that cpp file and then use it here - https://github.com/Tail-Wag-Games/frag/blob/master/src/plugin.nim
20:39:24FromDiscord<albassort> the only other option is withTiemout
20:39:25FromDiscord<Yardanico> so dial etc might hang
20:39:29FromDiscord<Shield> just tell me the default gc play nice on both the executable and the plugins, i think advertising nim to make plugins with native speed would be pretty good
20:39:38FromDiscord<Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/app.nim is the entry point
20:39:40FromDiscord<albassort> In reply to @Yardanico "there's withTimeout that can": +100 never got withTimeout to work
20:39:46FromDiscord<Gumbercules> I use `--gc:arc/orc`
20:39:46FromDiscord<Yardanico> In reply to @albassort "+100 never got withTimeout": not what I mean
20:39:53FromDiscord<Gumbercules> for now - arc since I don't have any cycles in my program
20:39:53FromDiscord<Yardanico> withTimeout works fine for me
20:40:02FromDiscord<albassort> i suppose its the context i use it in
20:40:12FromDiscord<Gumbercules> `orc` will become the default gc in Nim 2.0 which is supposedly near
20:40:27FromDiscord<albassort> In reply to @Gumbercules "`orc` will become the": im excited and afraid
20:40:30FromDiscord<Gumbercules> I have no idea when, I haven't been following Nim that closely later
20:40:35FromDiscord<Gumbercules> eh, it will be fine
20:40:52FromDiscord<c4ulmu> Thank you. I will try withTimeout
20:41:41FromDiscord<Shield> the deal breaker for me are always async/network stuff, gui and the dlls
20:41:51FromDiscord<Shield> i didn't touch nim for a year and i'm out of the loop
20:42:03FromDiscord<Shield> it seems that gui is still not solved
20:42:04FromDiscord<Gumbercules> mmm - I don't use any async I rolled my own coroutines
20:42:10FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hPZ
20:42:14FromDiscord<Gumbercules> gui I use dearimgui
20:42:26FromDiscord<Gumbercules> and plugin architectures work now with the new memory model
20:42:34FromDiscord<Gumbercules> they could work before too - you just couldn't use Nim's stdlib
20:42:51FromDiscord<Yardanico> In reply to @Gumbercules "they could work before": wdym?
20:42:59FromDiscord<Yardanico> with nimrtl you could
20:43:08FromDiscord<Shield> nope
20:43:12FromDiscord<Shield> nimrtl didn't work well
20:43:17FromDiscord<kaddkaka> @demotomohiro right, I guess I was surprised that that proc doesn't come for free
20:43:24FromDiscord<Gumbercules> yeah but you couldn't really avoid the GC's from collecting since they had no clue multiple instances of the runtime existed
20:43:27FromDiscord<Yardanico> I'm talking if your whole program was using Nim, and the host app and plugins were using nimrtl
20:43:30FromDiscord<Shield> "didnt" (i dunno if it still doesn't)
20:43:43FromDiscord<Gumbercules> this is why the whole hot reload experimental feature never panned out
20:43:48FromDiscord<c4ulmu> I just very surprised that async http client doesn't support timeout. Timeouts is the very first thing for production use
20:43:51FromDiscord<kaddkaka> nimrtl?! is that a thing?
20:44:08FromDiscord<Gumbercules> it's a compiler option - it just indicated to the compiler that it should be linked to the program
20:44:11FromDiscord<kaddkaka> oh rtl is maybe not what I think it is ...
20:44:15FromDiscord<Gumbercules> runtime library
20:44:20FromDiscord<kaddkaka> ah...
20:44:27FromDiscord<Yardanico> you can compile nimrtl separately
20:44:34FromDiscord<Yardanico> so then all different nim dlls have a shared GC runtime
20:44:43FromDiscord<Yardanico> since they would load it dynamically
20:44:44FromDiscord<kaddkaka> I was thinking Register Transfer Level 😅
20:45:08FromDiscord<Yardanico> https://nim-lang.org/docs/nimc.html#dll-generation
20:45:32FromDiscord<Gumbercules> if I allocated a sequence in my host program on its thread local heap and then passed it to my plugin, even if it was compiled with `nimrtl` program would eventually segfault / deadlock
20:45:42FromDiscord<Gumbercules> with the default refc gc
20:46:03FromDiscord<albassort> i wonder if puppy with stop dead locking in the middle of ssl requests
20:46:22FromDiscord<Gumbercules> this is no longer the case with `arc/orc` and you also no longer need to worry about linking anything against the nimrtl library
20:46:36FromDiscord<Gumbercules> it "just works"
20:46:50FromDiscord<albassort> gumber, should i ever learn asm?
20:47:04FromDiscord<albassort> I've had a hard time getting nim working with it embedded
20:47:49FromDiscord<Gumbercules> if you're interested in systems programming I'd say learning some assembly is most definitely worth it
20:47:59FromDiscord<Shield> i really wish --gc:regions went somewhere
20:48:03FromDiscord<Gumbercules> 6502 is easy to pick up, although not really used anymore
20:48:06FromDiscord<Shield> it was amazing
20:48:38FromDiscord<jmgomez> In reply to @Yardanico "https://nim-lang.org/docs/nimc.html#dll-generation": is it a pre-orc thing? I never ran into any issues with multiple dlls
20:48:42FromDiscord<Yardanico> yes
20:49:02FromDiscord<Gumbercules> https://repo.zenk-security.com/Magazine%20E-book/Hacking-%20The%20Art%20of%20Exploitation%20(2nd%20ed.%202008)%20-%20Erickson.pdf
20:49:06FromDiscord<Gumbercules> fun book that teaches some assembly
20:49:13FromDiscord<Yepoleb> i think reading assembly is great skill, but you almost never have to write it
20:49:14FromDiscord<jmgomez> where I did run into issues is if I try to use nim from other thread created in cpp. Is that a known problem?
20:49:49FromDiscord<Gumbercules> `setupForeignThreadGc `
20:49:58FromDiscord<albassort> gumb one last thing
20:50:06FromDiscord<albassort> do you think i can do libaco
20:50:13FromDiscord<albassort> (edit) "do you think i can do libaco ... " added "in nim?"
20:50:43FromDiscord<Shield> @jmgomez so both your host and your dll ran nim just fine?
20:50:46FromDiscord<Gumbercules> sure - although it also relies on assembly
20:50:49FromDiscord<Shield> i'd like more input
20:51:00FromDiscord<albassort> In reply to @Gumbercules "sure - although it": will that be a pita
20:51:03FromDiscord<albassort> for wrappingf
20:51:05FromDiscord<albassort> (edit) "wrappingf" => "wrapping"
20:51:16FromDiscord<jmgomez> In reply to @Shield "<@726017160115126333> so both your": yes, and algo a third one, game.dll
20:51:19PMunchI've run a Nim DLL and so in production. Embedded into an existing C program
20:51:23*ltriant joined #nim
20:51:36FromDiscord<Gumbercules> It's no more difficult than wrapping C code
20:51:42PMunchIt might be a bit finicky to get right, but isn't all that hard to figure out
20:52:01FromDiscord<Gumbercules> @PMunch they're talking about hot reloading w/ plugins from a Nim host
20:52:09PMunchJust need to make sure to call NimMain and with ARC/ORC I believe you don't even need NimRTL any longer
20:52:12FromDiscord<Gumbercules> plugins authored in Nim
20:52:12PMunchAah
20:52:24FromDiscord<Gumbercules> shield trust me, this all works
20:52:25FromDiscord<Shield> i think the actual problem was when both the host and the dlls were made with nim, there was no problem if you use other languages
20:52:26PMunchWell the idea should be the same
20:52:31FromDiscord<Gumbercules> yeah
20:52:46FromDiscord<Gumbercules> I wouldn't be writing my game engine with a plugin architecture if I was concerned it wouldn't work
20:52:56FromDiscord<Gumbercules> that or I wouldn't be using Nim
20:52:57PMunchThere where some weird limitations like that with refc, but with ARC/ORC this has become much easier
20:53:57FromDiscord<albassort> aco doesn't seem too hard to wrap
20:54:02FromDiscord<albassort> it looks really nice too
20:54:04FromDiscord<albassort> 👀
20:54:06FromDiscord<Shield> time to try that again i guess
20:54:28FromDiscord<albassort> if i was born 20 years earlier i'd be a c programer
20:54:50FromDiscord<albassort> 25 i'd be a pascal
20:55:00FromDiscord<albassort> 30 c again
20:55:14FromDiscord<Shield> would you? wasn't c++ hot back in 2000
20:55:26FromDiscord<Shield> nvm
20:55:35FromDiscord<Shield> ignore that please
20:55:37PMunchOh no, just realised people commented on my stream without me noticing.. Damn you chat overlay program (which I forgot to actually start)!
20:55:52FromDiscord<Shield> link?
20:56:11FromDiscord<albassort> It was but I think my personality would still hate c++
20:56:12*ltriant quit (Ping timeout: 268 seconds)
20:56:35FromDiscord<albassort> its the same reason i prefer JS over TS
20:56:42FromDiscord<albassort> i like the chaos i methinks
20:57:11FromDiscord<Shield> @exelotl ! my guy how's your game going?
20:57:14FromDiscord<exelotl> C++ was my first language and I've pretty much never enjoyed it... it's just pure friction and jumping through hoops and features that don't fit together and historical baggage
20:57:28FromDiscord<exelotl> it's going good thanks!
20:57:37FromDiscord<albassort> in 2000 it was a young baby lang
20:57:40FromDiscord<albassort> i imagine it wasn't so bad
20:57:58FromDiscord<Shield> i could use more nim videos and stream
20:58:04FromDiscord<exelotl> I started learning it around 2008 or so
20:58:11FromDiscord<albassort> it was very annoying, the only time i ever had to use C++, I had to update an old library because half of it was gutted
20:58:24FromDiscord<albassort> by like a 2012 update
20:58:45*PMunch quit (Quit: leaving)
20:58:45FromDiscord<albassort> so i had to fiercely google the replacement code while not knowing any C++ and barely any systems lang
20:59:56FromDiscord<exelotl> In reply to @Shield "<@90614688374624256> ! my guy": we hit a big milestone with the full game last week - 50% content complete (you can play the game from start to middle)
21:01:39FromDiscord<Gumbercules> I love coding in C/C++
21:01:53FromDiscord<Gumbercules> C especially
21:01:59FromDiscord<Gumbercules> but I'm much more productive in Nim
21:02:10FromDiscord<Shield> cool, it's always nice going through your github and projects
21:02:19FromDiscord<Shield> i'm catching up a bit
21:03:05FromDiscord<Shield> btw, did araq finally document that goto pragma?
21:07:19FromDiscord<etra> huh, I just noticed that when I run my compiled program through valgrind, I get a lot of uninitialized values errors, but when I use `--gc:orc` I don't have any error
21:10:18FromDiscord<Yardanico> In reply to @etra "huh, I just noticed": if you want to actually use valgrind, then only use it with arc/orc + `-d:useMalloc`
21:10:22FromDiscord<Yardanico> because nim uses its own allocator by default
21:10:29FromDiscord<Yardanico> and valgrind doesn't like refc because it does stack scanning
21:11:19FromDiscord<etra> ooh, thanks, TIL!
21:12:52FromDiscord<etra> is there a way to always prefer `orc`?
21:13:37*pech quit (Read error: Connection reset by peer)
21:13:57FromDiscord<Yardanico> wdym?
21:14:04FromDiscord<auxym> `--mm:orc` ?
21:14:15FromDiscord<auxym> or add it to your project nim.cfg
21:14:44*disso_peach joined #nim
21:16:12FromDiscord<etra> yeah the nim.cfg was it!
21:16:37FromDiscord<etra> I still have a bit of trouble understanding when to use `ref`, and when not 😅
21:18:31FromDiscord<auxym> seems to be a common question for newcomers
21:18:43FromDiscord<auxym> TLDR: don't use ref unless you need it
21:19:02FromDiscord<auxym> and you need it when you need multiple "handles" to a single piece of data
21:19:10FromDiscord<Elegantbeef> People still dont seem to get that auxym 😄
21:19:11FromDiscord<Yardanico> or for mutability in async code
21:19:16FromDiscord<Yardanico> that's kind of all
21:19:21FromDiscord<Yardanico> otherwise you can just use `var`
21:19:30FromDiscord<Yardanico> if you e.g. need to mutate something in a proc
21:19:33FromDiscord<etra> so, for example, if I'm writing a _linked_ stack, the Node should not be ref?
21:19:47FromDiscord<Elegantbeef> I just link https://forum.nim-lang.org/t/8426#54529 whenever someone asks
21:20:20FromDiscord<Elegantbeef> Yes if you have a non terminating cyclical type you need a ref
21:20:45FromDiscord<Elegantbeef> Non ref objects are structs so require infinite memory when non terminating cycles appear
21:22:04*xet7 quit (Ping timeout: 260 seconds)
21:22:57FromDiscord<auxym> that too
21:23:06FromDiscord<Yepoleb> i use refs for things with destructors
21:23:19FromDiscord<Yardanico> In reply to @Yepoleb "i use refs for": so you mean shared mutability?
21:23:26FromDiscord<Yardanico> because you don't inherently need refs to use destructors
21:23:38FromDiscord<Yardanico> destructors are written as `var ObjectType` so they work for normal objects too
21:24:43FromDiscord<Yardanico> ah yeah I parsed your sentence incorrectly :P
21:24:43FromDiscord<Elegantbeef> Well destructors only work with value types 😄
21:24:44FromDiscord<Yardanico> time to sleep
21:25:06FromDiscord<Elegantbeef> Yea i often also use refs with destructors as it better fits the semantics i want
21:25:20FromDiscord<Elegantbeef> But disabling copy and only sinking also works
21:26:09FromDiscord<Yepoleb> i think destructors are more specific in nim than in other language
21:26:15FromDiscord<Yepoleb> i mean a clean up function
21:27:39FromDiscord<Yepoleb> so os handles for examples, it's very hard to make them copyable in a meaninful way
21:45:45*anddam quit (Quit: WeeChat 3.6)
21:56:55*anddam joined #nim
21:58:15*anddam quit (Client Quit)
21:58:57*anddam joined #nim
21:59:25*disso_peach quit (Quit: Leaving)
22:00:58*jmdaemon joined #nim
22:15:20*ltriant joined #nim
22:51:50FromDiscord<MetuMortis> What is the best way to create a nim project? Is there any way to install dependencies per project not globally (like node_modules at NodeJS)? Is it possible to create different configs for each project (like package.json at NodeJS)?
22:52:31FromDiscord<Generic> post people use nimble to manage dependencies
22:52:38FromDiscord<Generic> (edit) "post" => "most"
22:52:47FromDiscord<MetuMortis> I have nimble too, is it like npm?
22:52:49FromDiscord<Elegantbeef> `nimble init`. I think with nimble 0.14 but that's not out, so no. Yes make a `config.nims` at the root of your project
22:53:08FromDiscord<Elegantbeef> It's a package manager yes
22:53:31FromDiscord<MetuMortis> thanks
23:13:22*xet7 joined #nim
23:25:27*xet7 quit (Ping timeout: 268 seconds)
23:33:00*xet7 joined #nim
23:34:41*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
23:35:16*dtomato4 joined #nim
23:43:24FromDiscord<jtv> Bumping from earlier today, assuming the answer here is I'm SOL: Is there any good way to get the calling context for a macro? Particularly, I want to generate procs at the module scope to avoid weird errors, so if someone calls my macro within a proc/func context, I would like to error on that, instead of generating a nested proc.
23:47:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hQH
23:47:45FromDiscord<jtv> Thanks 🙂