<< 26-06-2022 >>

00:01:43FromDiscord<kevin> Looks v cool, would be great to see this as an optional ssl backend for `net`
00:03:32FromDiscord<exelotl> is there a way to detect that a file doesn't exist at compile-time and show a friendly error message to the user, without importing `os` ?
00:04:53FromDiscord<kevin> try catch? @exelotl
00:05:10FromDiscord<kevin> try to open a file and then display an error if you can't get to it
00:05:14FromDiscord<Elegantbeef> Wont work if using staticRead
00:06:20FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=40Ut
00:06:29FromDiscord<exelotl> it stops on staticRead
00:08:07FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=40Uu
00:08:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40Uv
00:08:48FromDiscord<Elegantbeef> Might be `((include "foo.nim"))`
00:09:12FromDiscord<exelotl> trouble is, that means the error will be wrong if there's an error in "foo.nim"
00:11:23FromDiscord<exelotl> like, the hypothetical foo generator isn't rock solid, maybe someone could feed a stupid filename to it and it generates invalid Nim code
00:11:46FromDiscord<exelotl> I wouldn't want the show "Please run the foo generator" if that happened, I'd want to show the actual error
00:11:55FromDiscord<exelotl> (edit) "the" => "to" | "generator"" => "generator.""
00:12:35FromDiscord<Elegantbeef> I mean cant you just include foo and document in your read me "If you get 'cannot include foo', run the foo generat" 😄
00:12:53FromDiscord<exelotl> yeah, I guess I'll just do that x)
00:13:39FromDiscord<Elegantbeef> Actually we can do this better
00:13:58FromDiscord<Elegantbeef> Hmmm maybe we can
00:14:01FromDiscord<exelotl> beef I swear if this involves concepts... xD
00:14:24FromDiscord<Elegantbeef> How would it involve concepts you're doing module operations
00:15:30FromDiscord<Elegantbeef> I'm thinking if we can do multiple checks....
00:15:41FromDiscord<exelotl> idk, it's just you're the concepts guy
00:15:54FromDiscord<Elegantbeef> I mean concepts are lovely and everyone should use htem
00:18:32FromDiscord<Elegantbeef> Hmph dont think there is a way
00:20:50FromDiscord<Elegantbeef> Actually.... there might be a hack
00:20:51FromDiscord<Elegantbeef> I'm right to assume you're generating this file right?
00:21:25FromDiscord<Elegantbeef> Ok i've got it
00:23:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40Uz
00:24:21FromDiscord<Elegantbeef> Do i get some style points or something for this fantastical solution? 😛
00:27:21FromDiscord<exelotl> oh wow I didn't know {.define.} was a thing xD
00:27:36FromDiscord<Elegantbeef> Nor did i until a few weeks ago, i just tried it and it worked
00:27:41FromDiscord<exelotl> I saw someone asking if that was possible earlier and I thought to myself "no, that would be insane"
00:28:13FromDiscord<exelotl> and not the good kind of insane xD
00:28:22FromDiscord<Elegantbeef> I mean you can do the same with macros + macro cache
00:28:30FromDiscord<Elegantbeef> A module does not have to compile for you to get code from it
00:29:19FromDiscord<exelotl> hmm yeah, if it's macrocache friendly then that's fine I guess
00:31:36*noeontheend joined #nim
00:32:39FromDiscord<Elegantbeef> https://wandbox.org/permlink/g3cc64gOzUAZg1BR cursed code ahead
00:33:11FromDiscord<Elegantbeef> A check if a module can be included having a side effect on the program
00:33:29FromDiscord<exelotl> very cursed 🤔 https://media.discordapp.net/attachments/371759389889003532/990414465017196615/Screenshot_from_2022-06-26_01-33-38.png
00:33:54FromDiscord<Elegantbeef> Hmm no clue what other site i can throw it on, i can just give a single paste
00:34:30FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=40UA
00:34:36FromDiscord<Elegantbeef> There you go properly cursed
00:38:13FromDiscord<exelotl> god yeah that's awful lol
00:38:32FromDiscord<Elegantbeef> I mean it's "proper" afaict
00:39:03FromDiscord<exelotl> I feel like if a module errors it should roll back all the changes the module made to the macrocache
00:40:05FromDiscord<Elegantbeef> Yea i dont know
00:40:15FromDiscord<Elegantbeef> It didnt add invalid code
01:03:31FromDiscord<Yepoleb> i keep running into gc bugs, but i'm too scared to investigate them 😦
01:04:03FromDiscord<konsumlamm> report them and let someone else investigate them
01:06:27FromDiscord<Yepoleb> some bugs are already reported i don't think a vague "object gets destroyed when it shouldn't" is of any help to anyone
01:06:45FromDiscord<Yepoleb> (edit) "some bugs are already reported ... i" added "and"
01:11:27FromDiscord<konsumlamm> /shrug it's more helpful than silently being unnoticed by everyone except you
01:12:30FromDiscord<!Patitotective> \/shrug lmao
01:13:14FromDiscord<konsumlamm> that works when discord likes me
01:14:12FromDiscord<!Patitotective> how do i reverse a string 🤨
01:14:16FromDiscord<!Patitotective> In reply to @konsumlamm "that works when discord": ¯\_(ツ)_/¯
01:14:32FromDiscord<konsumlamm> ¯\\_(ツ)\_/¯
01:16:49FromDiscord<Yepoleb> In reply to @konsumlamm "/shrug it's more helpful": but nobody will ever be able to reproduce it
01:17:11*ltriant quit (Ping timeout: 255 seconds)
01:17:25FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/sTe
01:18:38FromDiscord<Prestige> There are more efficient solutions, like swapping characters from the front half and 2nd half of the string, if you care for the little performance gain
01:18:46*wallabra joined #nim
01:19:06FromDiscord<!Patitotective> In reply to @Avahe "There are more efficient": that requires `var string`, right?
01:19:35FromDiscord<Prestige> Or just a new string, use `result`
01:21:51FromDiscord<Prestige> Im on my phone or I'd just write it, but.. basically inside the loop you could assign result[i] to s[s.high - 1] in addition to the code you already have
01:22:12FromDiscord<Prestige> Then you don't need to iterate over the entire string, just half of it
01:22:24FromDiscord<!Patitotective> thanks :]
01:22:33*wallabra_ joined #nim
01:23:15FromDiscord<Elegantbeef> Make a min repro
01:24:46FromDiscord<Elegantbeef> `import std/algorithm`
01:25:06*wallabra quit (Ping timeout: 272 seconds)
01:25:07*wallabra_ is now known as wallabra
01:25:31FromDiscord<Elegantbeef> there is `reversed` in unicode if you need it to be unicode aware
01:25:39FromDiscord<Elegantbeef> I guess algorithm returns a `seq[char]`
01:25:51FromDiscord<Elegantbeef> Unicode shudders↵(@Prestige)
01:26:06FromDiscord<Elegantbeef> `reversed` exists
01:26:11FromDiscord<Elegantbeef> also `sugar.dup` exists
01:27:44FromDiscord<Prestige> In reply to @Elegantbeef "Unicode shudders (<@778498877464117248>)": Then wouldn't you just iterate over runes?
01:27:53*ltriant joined #nim
01:27:54FromDiscord<Prestige> Unicode be crazy
01:28:10FromDiscord<Elegantbeef> Iterating over runes is an O(N) operation
01:28:34FromDiscord<Elegantbeef> In utf8 strings that is
01:28:44FromDiscord<Elegantbeef> since they're variable sized you need to go to each one to know what it's
01:32:02*noeontheend quit (Ping timeout: 255 seconds)
01:54:47FromDiscord<Prestige> Sounds horrible
01:56:39FromDiscord<Rika> Would you have rathered every letter be four bytes
01:57:07FromDiscord<Rika> UTF-16 does that instead, for fixed character size
01:57:45FromDiscord<Rika> Wait was it that
01:58:02FromDiscord<Rika> I don’t recall, but I know there’s some encoding that does 4 byte fixed character
01:58:18FromDiscord<Elegantbeef> utf-32?
01:58:44FromDiscord<Rika> I guess
02:00:57*Jjp137 quit (Ping timeout: 248 seconds)
02:01:15*Jjp137 joined #nim
02:22:13*rockcavera quit (Remote host closed the connection)
02:35:44FromDiscord<Yepoleb> i tried to get reliable GC crashes and this is what i came up with <https://gist.github.com/Yepoleb/cab387724ec972b71faf614585856beb>↵with `--mm:orc` it crashes with SIGSEGV at `/usr/lib/nim/system/orc.nim(145) unregisterCycle` and with `--mm:arc` it crashes with SIGSEGV at `/usr/lib/nim/system/arc.nim(63) nimIncRef`. Am i doing something stupid here or should this work?
02:38:29FromDiscord<demotomohiro> utf-16 is not fixed sized. Surrogate pairs: https://datacadamia.com/data/type/text/surrogate
02:40:27FromDiscord<Rika> In reply to @demotomohiro "utf-16 is not fixed": Yeah I know, I said I didn’t know
02:40:42FromDiscord<Rika> I thought so, I didn’t know
02:41:52FromDiscord<Yepoleb> utf-16 should be deleted from existance
02:44:24FromDiscord<demotomohiro> Yes, but then, windows would lose backward compatibility
02:47:02FromDiscord<Yepoleb> windows should be deleted from existence
02:47:15FromDiscord<Yepoleb> problem solved
02:52:04FromDiscord<demotomohiro> @Yepoleb Your code copying `ref` type from mutiple thread:↵` let data = cont.data`↵This increase ref counter of cont.data and decrease when exiting the proc.↵If I remember correctly, Nim's arc/orc doesn't use atomic counter and doesn't support sharing from mutiple threads.
02:52:22*kayabaNerve left #nim (Leaving)
02:55:20FromDiscord<Elegantbeef> I mean it errors even without that
02:56:35FromDiscord<Elegantbeef> Someone didnt make a good min repro
02:56:56*arkurious quit (Quit: Leaving)
03:00:54FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=40UO a proper min repro
03:02:21FromDiscord<Yepoleb> In reply to @demotomohiro "<@144300201857777664> Your code copying": can you elaborate to what extent sharing is possible?
03:03:14FromDiscord<frankcryptic> I'll help 10 individuals how to earn $20,000 in just 72 hours from the crypto market. But you will pay me 10% commission when you receive your profit. if interested send me a direct message via Whatapp by asking me HOW for more details on how to get started↵+1 (570) 801-0862
03:03:23FromDiscord<frankcryptic> I'll help 10 individuals how to earn $20,000 in just 72 hours from the crypto market. But you will pay me 10% commission when you receive your profit. if interested send me a direct message via Whatapp by asking me HOW for more details on how to get started↵+1 (570) 801-0862
03:03:32FromDiscord<Yepoleb> <@&371760044473319454> crypto spam
03:03:32FromDiscord<Tuatarian> wow
03:03:38FromDiscord<Tuatarian> I'm going to message right now
03:03:43FromDiscord<Tuatarian> such a convincing message
03:04:32FromDiscord<Tuatarian> I wonder why these canned message authors can't bother to run it through the most basic of grammar checkers
03:04:38FromDiscord<Yepoleb> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=40UO a proper min": i've had this running for over a minute and it still has not crashed
03:04:50FromDiscord<Elegantbeef> I mean it crashes instantly here
03:05:10FromDiscord<Yepoleb> the nested ref seemed necessary to reliably crash for me
03:05:48FromDiscord<Yepoleb> In reply to @Elegantbeef "I mean it crashes": are you reproducing the orc crash or the arc one?
03:05:57FromDiscord<Elegantbeef> Orc
03:06:29FromDiscord<Elegantbeef> The orc one is reproducible with like 5 loc afaict
03:07:02FromDiscord<Yepoleb> i am more concerned about arc, orc crashes as soon as it senses a thread
03:09:13FromDiscord<Elegantbeef> Well then demo is right making `let data {.cursor.} = cont.data` is sufficient to make it work
03:10:15FromDiscord<Yepoleb> thanks
03:11:19FromDiscord<Yepoleb> but is this intended or not?
03:11:25FromDiscord<Rika> What does cursor indicate in such case
03:13:13FromDiscord<Elegantbeef> I think it might just be abuse of cursor
03:13:23FromDiscord<Elegantbeef> I dont know if it's quite proper but it's generally just "alias the expression"
03:14:22FromDiscord<Elegantbeef> > Automatic reference counting also has the disadvantage that it introduces overhead when iterating over linked structures. The .cursor annotation can also be used to avoid this overhead
03:14:31FromDiscord<Elegantbeef> So i think it might be valid... but idk
03:14:39FromDiscord<guzba> In reply to @demotomohiro "https://github.com/treeform/pixie/blob/461d713fc140": there used to be but we removed that a long time ago, looks like we forgot to delete the when
03:14:47FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation docks are here
03:15:10FromDiscord<Elegantbeef> docs even
03:16:41FromDiscord<Yepoleb> i was under the impression that arc/orc gives me a shared heap, but this is no different than using pointers with refc, isn't it?
03:17:08FromDiscord<Elegantbeef> It does have a shared heap the cursor inference is the issue methinks
03:20:43FromDiscord<Yepoleb> i am still confused about what's wrong here
03:20:46FromDiscord<Elegantbeef> Atleast it doesnt crash with the cursor, it also doesnt seem to be functioning
03:21:56FromDiscord<Yepoleb> am i misusing the GC or is it broken?
03:22:09FromDiscord<Elegantbeef> No clue
03:23:14FromDiscord<demotomohiro> arc/orc increment ref counter when ref is copied but `{.cursor.}` doesnt.
03:25:17FromDiscord<demotomohiro> Increment/decrement int value from mutiple threads at same time is undefined behaiver.↵You need to use atomic int or locks.
03:25:46FromDiscord<Yepoleb> What do i need to lock?
03:29:51FromDiscord<demotomohiro> Using `SharedPtr` instead of ref might fix the bug: https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim↵It has Atomic[int] counter.
03:30:16*toluene quit (Quit: Ping timeout (120 seconds))
03:31:24FromDiscord<Yepoleb> Thanks for the workaround
03:32:14*toluene joined #nim
03:32:28FromDiscord<Yepoleb> I see no way to lock the ref counting part that happens implicitly after the proc is done
03:33:59FromDiscord<Elegantbeef> You cant you use an atomic ref counter 😄
03:33:59FromDiscord<Elegantbeef> You really dont want a locking ref counter either
03:36:10FromDiscord<Yepoleb> In reply to @Elegantbeef "You cant you use": That's the smart pointer then, right?
03:36:46FromDiscord<Elegantbeef> You as a user yes, i was more saying that Nim could use an atomic counter
03:38:22FromDiscord<demotomohiro> If use `SharedPtr`, you don't need to lock when you copy it.
03:39:32FromDiscord<demotomohiro> I heard arc/orc doesn't use atomic counter because it is slow.
03:39:56FromDiscord<Elegantbeef> would be cool if we could get a `sharedRef` that did 😄
03:43:46FromDiscord<demotomohiro> I also heard Araq doesn't want to make many reference types like C++.
03:48:00FromDiscord<Yepoleb> I think I don't even need the sharedptr really, because i only read
03:48:50FromDiscord<Yepoleb> But getting a raw pointer from a ref is impossible without temporarily modifying the ref counter, right?
03:49:37FromDiscord<Elegantbeef> Not safely
03:51:52FromDiscord<Elegantbeef> You can just cast a referenct into `ptr T` if you dont care about safety
03:52:57FromDiscord<Yepoleb> Wait that works 😮
03:53:26FromDiscord<Elegantbeef> Yes references are explicitly implemented in such a way you can cast them to `ptr T` if you need to
03:53:42FromDiscord<Elegantbeef> That doesnt extend the lifetime of them so it's unsafe
03:56:11FromDiscord<demotomohiro> sent a code paste, see https://paste.rs/J5y
03:57:07FromDiscord<Yepoleb> Thanks for the help, but this is all very sad
03:57:50FromDiscord<Prestige> In reply to @Yepoleb "windows should be deleted": lol, yeah
04:03:08FromDiscord<Yepoleb> Maybe safety obsessed hype language is the better tool for this kind of task
05:06:13FromDiscord<arnetheduck> In reply to @kevin "Looks v cool, would": might be interested in https://github.com/status-im/nim-chronos/ then which comes with http(s) support using that library
05:36:02*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
05:36:15*wallabra joined #nim
05:37:56*vicecea quit (Remote host closed the connection)
05:38:24*vicecea joined #nim
05:42:51*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
05:44:20*wallabra joined #nim
06:12:37*toluene quit (Quit: Ping timeout (120 seconds))
06:14:38*toluene joined #nim
06:29:30FromDiscord<Torbatti> any gui library that works ?
06:29:52FromDiscord<Torbatti> (edit) "any gui library that ... works" added "just"
06:30:03FromDiscord<Prestige> I think https://github.com/trustable-code/NiGui is used often but I haven't tried it myself
06:32:09FromDiscord<Elegantbeef> owlkettle, nigui, gintro, wx-nim, fidget, nimx
06:32:23FromDiscord<Elegantbeef> Think there's also a qt wrapping
06:34:08FromDiscord<amadan> Theres nimqml which wraps QT's qml thing
06:50:13FromDiscord<j-james> i'm having luck with windy+boxy+pixie 😃
06:50:21FromDiscord<j-james> technically gui
06:50:34FromDiscord<Elegantbeef> I mean you're making a GUI library at that point
07:02:23FromDiscord<qb> nimraylib -> raygui, nimgl -> imgui
07:02:50FromDiscord<Elegantbeef> Eh using those UIs are lack luster for proper desktop programs
07:04:23FromDiscord<qb> huh why
07:04:51FromDiscord<Elegantbeef> lacks the features of something like gtk or qt
07:05:05FromDiscord<Elegantbeef> Accessibility is a big one
07:05:29FromDiscord<Elegantbeef> Making properly usable UI libraries isnt that easy and that's why there arent many 😄
07:09:53madpropsdon't sleep on Godot
07:10:07madpropsit's a game engine but actually useful for UI interfaces
07:10:30FromDiscord<Elegantbeef> The exception there is the entire game engine is made using the UI library
07:11:11madpropswhich UI library?
07:11:21FromDiscord<Elegantbeef> It's own UI
07:12:30madpropslike check this stuff https://old.reddit.com/r/godot/comments/r74kow/whiteboard_software_v108_made_with_godot/
07:13:06FromDiscord<Elegantbeef> Yea it's a mostly usable toolkit as it's been dogfooded as such
07:16:28FromDiscord<qb> Imo great stuff is made with imgui
07:16:39FromDiscord<qb> https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png
07:16:40FromDiscord<Elegantbeef> I mean i hate imgui so sure
07:17:47FromDiscord<qb> And raygui looks sexy aswell
07:17:53FromDiscord<qb> doesn't has that windows 95 feeling 😛
07:19:36madpropsi think the classic look of windows topped at 2000
07:19:49madpropsthough i never used that one
07:20:02madpropsbut on xp it changed a lot
07:20:17madpropsthen it climaxed at 7
07:23:12madpropsdoesn't make sense for me to use windows now
07:23:23madpropsi don't think the engineeers there actually understand the code now
07:23:33madpropswhich is not a state you want to be in
07:23:45madpropsprobably living on borrowed time
07:24:31madpropsor they do and win11 is great idk
07:37:21FromDiscord<offbeat-stuff (offbeat-stuff)> Hi, successfully compile nim into wasm
07:37:22FromDiscord<offbeat-stuff (offbeat-stuff)> https://github.com/offbeat-stuff/wasm-in-nim
07:37:27FromDiscord<offbeat-stuff (offbeat-stuff)> although one problem
07:38:02FromDiscord<offbeat-stuff (offbeat-stuff)> even though i specified --noMain it still is giving a NimMain function
07:38:34FromDiscord<offbeat-stuff (offbeat-stuff)> https://offbeat-stuff.github.io/wasm-in-nim/
07:38:48FromDiscord<offbeat-stuff (offbeat-stuff)> Here is the github pages for it
08:02:40FromDiscord<Elegantbeef> I dont know offbeat i know with emcc it works properly but i'm also doing `--noMain:on` though i'm fairly certain that's what `--noMain` should do
08:13:45NimEventerNew thread by Jmgomez: Changing the order of nimbase.h in generated files, see https://forum.nim-lang.org/t/9265
09:56:35*matt_13377 quit (Quit: The Lounge - https://thelounge.chat)
10:01:59*matt_13377 joined #nim
10:06:01FromDiscord<Tuatarian> is there a way to write a template that takes one input and returns two things as output?
10:06:23*matt_13377 quit (Client Quit)
10:06:39FromDiscord<Tuatarian> I have a vec2 type, and I want to pass vec2 to functions needing int values but am kinda sick of typing `v.x.int, v.y.int` every single time and am wondering if there is a way I can automate this and pass it to a function as 2 params
10:06:50*matt_13377 joined #nim
10:08:32FromDiscord<Rika> No that’s not possible, at least the case you described
10:08:43FromDiscord<Tuatarian> that's unfortunate
10:08:45FromDiscord<Tuatarian> thanks anyway
10:22:52FromDiscord<vindaar> the problem btw isn't really that it's not possible to return two things, but rather that you cannot "expand" the single argument to two arguments of a function call correctly↵(@Tuatarian)
10:24:13FromDiscord<vindaar> the function call is a node kind `nnkCall`. The arguments are just children of that call. And with a template / macro you cannot "add" children like that.↵However, if you write a macro that also wraps the function call, it's possible of course
10:26:16FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=40VH
10:26:32FromDiscord<vindaar> note how in the second one the function call itself is part of the template
10:26:52FromDiscord<vindaar> (the `v` argument could be `typed` in the first macro too btw)
12:21:14FromDiscord<vestel> If I import some lib in `static` section, will be this module imported in binary?
12:21:46FromDiscord<vestel> or still `static` is not a top-level?
12:52:27FromDiscord<Rika> Is it possible to import in a static, even?
12:52:33FromDiscord<Rika> Never tried it before
12:52:45FromDiscord<Rika> !eval static: import strutils
12:52:47NimBotCompile failed: /usercode/in.nim(1, 9) Error: 'import' is only allowed at top level
12:54:54FromDiscord<Yardanico> In reply to @vestel "If I import some": You don't need to worry about that as Nim always has dead code elimination enabled
12:55:44FromDiscord<vestel> In reply to @Yardanico "You don't need to": including ffi code?
12:55:58FromDiscord<vestel> cause i may by accident include disasm in mine dll
12:56:20FromDiscord<vestel> (edit) "disasm" => "disasember"
12:58:59*ltriant quit (Ping timeout: 246 seconds)
13:00:36FromDiscord<Yardanico> In reply to @vestel "including ffi code?": If you mean code from the C side, it depends
13:00:46FromDiscord<Yardanico> But really you should also use flto if you're worried
13:01:00FromDiscord<Yardanico> lto will throw away all unused stuff on the C compiler level as well
13:43:05*ltriant joined #nim
13:46:01FromDiscord<eyecon> sent a code paste, see https://play.nim-lang.org/#ix=40Wi
13:48:06*ltriant quit (Ping timeout: 268 seconds)
13:49:58*def- quit (Quit: -)
13:50:10*def- joined #nim
13:51:05FromDiscord<vindaar> what do you consider "dangerous territory"?
13:52:23FromDiscord<vindaar> (I'd consider calling `strip` on the binary, possibly even `upx` to be fine. Maybe some of the `upx` options is what you'd call dangerous I guess)
14:04:12FromDiscord<eyecon> I do call upx in fact, also occasionally strip
14:04:27FromDiscord<eyecon> Dangerous like removing boundary checks
14:07:08FromDiscord<vindaar> oh, that kind of dangerous!
14:07:32FromDiscord<vindaar> not sure how much impact `-d:danger` vs. `-d:release` even makes on the binary size
14:08:55*arkurious joined #nim
14:10:16FromDiscord<vindaar> sent a long message, see http://ix.io/40Wn
14:17:18FromDiscord<eyecon> Thanks, I'll check that out
14:22:46FromDiscord<choltreppe> Why does overloading `is` work inside the file where its defined, but not in another file where it gets imported?
14:27:54FromDiscord<Phil> Is your `is` overload annotated with
14:27:56FromDiscord<Phil> (edit) "Is your `is` overload annotated with ... " added "?"
14:30:19FromDiscord<choltreppe> Yes
14:31:33FromDiscord<choltreppe> I also changed it to another operator and worked fine. So it seems to be something about the is operator
14:54:44*Guest97 joined #nim
14:54:58*Guest97 quit (Client Quit)
14:59:16*ltriant joined #nim
15:04:25*ltriant quit (Ping timeout: 248 seconds)
15:21:14FromDiscord<PyryTheBurger> Hello i am very new to nim… I tried to read documentation about json but how do i actually write a json object to a json file and not just a string?
15:27:32FromDiscord<Prestige> What are you trying to do?
15:42:41FromDiscord<PyryTheBurger> I a, trying to save a json object to a json file
15:43:10FromDiscord<dizzyliam> @mratsim Got a quick weave question if you're around :)
15:43:49FromDiscord<PyryTheBurger> In reply to @Avahe "What are you trying": I am trying to save a json object to a json file
15:43:51FromDiscord<PyryTheBurger> Write
15:49:34FromDiscord<aph> In reply to @PyryTheBurger "Hello i am very": so you meant to put that string in a file?
15:50:32FromDiscord<aph> maybe https://nim-by-example.github.io/files/ help? idk what you mean unfortunately
15:52:03FromDiscord<Phil> In reply to @PyryTheBurger "I am trying to": A json file is just a txt file with the `.json` file ending that contains a json object turned into a string that you can copy paste into a browser and get an object out of
15:52:23FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=40WP
15:52:40FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=40WP" => "https://paste.rs/0UE"
15:53:16FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=40WQ" => "https://play.nim-lang.org/#ix=40WR"
15:53:28FromDiscord<Phil> Patito's answer does pretty much a normal file-write, with the exception taht thanks to the pretty proc that he calls there you're likely getting the json string in a really nice format as if you had run a normal formatter over it
15:55:08FromDiscord<Phil> In reply to @choltreppe "I also changed it": Ah, forgot to answer here. I never played around with the `is` operator so I sadly can't help there
15:57:41*ltriant joined #nim
16:02:47*ltriant quit (Ping timeout: 255 seconds)
16:08:56*xet7 joined #nim
16:11:59FromDiscord<deadmeme77> I've been trying to learn pointers and references, is there any Nim tutorials about it? Maybe about GC too? My background is from Python so... Can I translate C concepts/syntax to Nim? I understand that we can call C functions from modules easily.
16:31:49*ltriant joined #nim
16:37:06*ltriant quit (Ping timeout: 272 seconds)
16:46:49FromDiscord<untoreh> In reply to @untoreh "what is this error?": any suggestions on how to debug this?
16:46:55FromDiscord<Phil> sent a long message, see http://ix.io/40X3
16:47:10FromDiscord<Phil> https://nim-lang.org/docs/tut1.html Here is the first part, which has a section about references/pointers
16:48:05FromDiscord<Phil> In reply to @untoreh "any suggestions on how": I think a code sample would help here so that we know what code is throwing the error
16:50:41FromDiscord<Phil> In reply to @deadmeme77 "I've been trying to": Other than that, there's wiki pages detailing comparisons between nim and python/c:↵https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers↵https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers
18:21:19*xet7 quit (Remote host closed the connection)
18:33:23*ltriant joined #nim
18:38:29*ltriant quit (Ping timeout: 255 seconds)
19:08:42*rockcavera joined #nim
19:08:42*rockcavera quit (Changing host)
19:08:42*rockcavera joined #nim
19:10:23FromDiscord<deadmeme77> Ah, this is an important concept that I need to get, I guess
19:10:25FromDiscord<deadmeme77> "In C, there's nothing that stops you from keeping a pointer to a stack-allocated array after the function that declared it has returned (and the stack is invalidated). In Nim, this is true as well, but you are strongly discouraged from using pointers in Nim, and you can accomplish almost everything you'd otherwise use pointers for with normal arguments, "var" arguments, variables, and "ref"."
19:11:05FromDiscord<deadmeme77> so in C codes that use pointers, I should check whether to replace them with normal arguments, or references
20:28:30FromDiscord<Elegantbeef> Given the purpose of `is` overriding it is suspect at best↵(@choltreppe)
20:34:57*ltriant joined #nim
20:35:42FromDiscord<Elegantbeef> `is` is meant to be used for compile time type checking for generics and similar, overriding it does not make any sense to me
20:36:05FromDiscord<Elegantbeef> Yep the best Nim code uses `ptr`s only where they're absolutely needed(typically with C interop) otherwise you use safer tools↵(@deadmeme77)
20:39:35*ltriant quit (Ping timeout: 246 seconds)
21:19:22*adium quit (Quit: Stable ZNC by #bnc4you)
21:27:14*adium joined #nim
21:38:03*ltriant joined #nim
21:42:10*ltriant quit (Ping timeout: 240 seconds)
21:50:37*void09 joined #nim
21:50:51void09whoami
21:52:36FromDiscord<voidwalker09> sorry
22:33:03FromDiscord<demotomohiro> If you are using pointer or `addr` but not using C library/API, you are very likely doing something wrong.
23:00:48*ltriant joined #nim
23:18:07FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=410q
23:20:46FromDiscord<Elegantbeef> You can annotate the enum with `{.pure.}` or use `overloadableEnum`s
23:21:19FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=410r
23:22:10FromDiscord<Elegantbeef> Having a type named the same as an enum field is bad practice anyway
23:23:24FromDiscord<Elegantbeef> Overloadable enums doesnt solve the problem though
23:23:35FromDiscord<Elegantbeef> Thought it would, but it doesnt
23:23:48FromDiscord<!Patitotective> im translating some cpp code to nim (~~3k lines 😭 ~~) so i guess i'll reconsider all names when i get it working ;]
23:24:07FromDiscord<Elegantbeef> What're you translating?
23:24:51FromDiscord<!Patitotective> https://github.com/BalazsJako/ImGuiColorTextEdit 😶
23:27:04FromDiscord<Elegantbeef> You do realize the `.h` file is only 300 loc right?
23:27:44FromDiscord<!Patitotective> yeaaa but i dont want to wrap it
23:27:56FromDiscord<Elegantbeef> Then have fun
23:28:04FromDiscord<!Patitotective> ~~and i dont know how to compile it either~~
23:28:08FromDiscord<!Patitotective> In reply to @Elegantbeef "Then have fun": :/