00:01:43 | FromDiscord | <kevin> Looks v cool, would be great to see this as an optional ssl backend for `net` |
00:03:32 | FromDiscord | <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:53 | FromDiscord | <kevin> try catch? @exelotl |
00:05:10 | FromDiscord | <kevin> try to open a file and then display an error if you can't get to it |
00:05:14 | FromDiscord | <Elegantbeef> Wont work if using staticRead |
00:06:20 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=40Ut |
00:06:29 | FromDiscord | <exelotl> it stops on staticRead |
00:08:07 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=40Uu |
00:08:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40Uv |
00:08:48 | FromDiscord | <Elegantbeef> Might be `((include "foo.nim"))` |
00:09:12 | FromDiscord | <exelotl> trouble is, that means the error will be wrong if there's an error in "foo.nim" |
00:11:23 | FromDiscord | <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:46 | FromDiscord | <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:55 | FromDiscord | <exelotl> (edit) "the" => "to" | "generator"" => "generator."" |
00:12:35 | FromDiscord | <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:53 | FromDiscord | <exelotl> yeah, I guess I'll just do that x) |
00:13:39 | FromDiscord | <Elegantbeef> Actually we can do this better |
00:13:58 | FromDiscord | <Elegantbeef> Hmmm maybe we can |
00:14:01 | FromDiscord | <exelotl> beef I swear if this involves concepts... xD |
00:14:24 | FromDiscord | <Elegantbeef> How would it involve concepts you're doing module operations |
00:15:30 | FromDiscord | <Elegantbeef> I'm thinking if we can do multiple checks.... |
00:15:41 | FromDiscord | <exelotl> idk, it's just you're the concepts guy |
00:15:54 | FromDiscord | <Elegantbeef> I mean concepts are lovely and everyone should use htem |
00:18:32 | FromDiscord | <Elegantbeef> Hmph dont think there is a way |
00:20:50 | FromDiscord | <Elegantbeef> Actually.... there might be a hack |
00:20:51 | FromDiscord | <Elegantbeef> I'm right to assume you're generating this file right? |
00:21:25 | FromDiscord | <Elegantbeef> Ok i've got it |
00:23:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=40Uz |
00:24:21 | FromDiscord | <Elegantbeef> Do i get some style points or something for this fantastical solution? 😛 |
00:27:21 | FromDiscord | <exelotl> oh wow I didn't know {.define.} was a thing xD |
00:27:36 | FromDiscord | <Elegantbeef> Nor did i until a few weeks ago, i just tried it and it worked |
00:27:41 | FromDiscord | <exelotl> I saw someone asking if that was possible earlier and I thought to myself "no, that would be insane" |
00:28:13 | FromDiscord | <exelotl> and not the good kind of insane xD |
00:28:22 | FromDiscord | <Elegantbeef> I mean you can do the same with macros + macro cache |
00:28:30 | FromDiscord | <Elegantbeef> A module does not have to compile for you to get code from it |
00:29:19 | FromDiscord | <exelotl> hmm yeah, if it's macrocache friendly then that's fine I guess |
00:31:36 | * | noeontheend joined #nim |
00:32:39 | FromDiscord | <Elegantbeef> https://wandbox.org/permlink/g3cc64gOzUAZg1BR cursed code ahead |
00:33:11 | FromDiscord | <Elegantbeef> A check if a module can be included having a side effect on the program |
00:33:29 | FromDiscord | <exelotl> very cursed 🤔 https://media.discordapp.net/attachments/371759389889003532/990414465017196615/Screenshot_from_2022-06-26_01-33-38.png |
00:33:54 | FromDiscord | <Elegantbeef> Hmm no clue what other site i can throw it on, i can just give a single paste |
00:34:30 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=40UA |
00:34:36 | FromDiscord | <Elegantbeef> There you go properly cursed |
00:38:13 | FromDiscord | <exelotl> god yeah that's awful lol |
00:38:32 | FromDiscord | <Elegantbeef> I mean it's "proper" afaict |
00:39:03 | FromDiscord | <exelotl> I feel like if a module errors it should roll back all the changes the module made to the macrocache |
00:40:05 | FromDiscord | <Elegantbeef> Yea i dont know |
00:40:15 | FromDiscord | <Elegantbeef> It didnt add invalid code |
01:03:31 | FromDiscord | <Yepoleb> i keep running into gc bugs, but i'm too scared to investigate them 😦 |
01:04:03 | FromDiscord | <konsumlamm> report them and let someone else investigate them |
01:06:27 | FromDiscord | <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:45 | FromDiscord | <Yepoleb> (edit) "some bugs are already reported ... i" added "and" |
01:11:27 | FromDiscord | <konsumlamm> /shrug it's more helpful than silently being unnoticed by everyone except you |
01:12:30 | FromDiscord | <!Patitotective> \/shrug lmao |
01:13:14 | FromDiscord | <konsumlamm> that works when discord likes me |
01:14:12 | FromDiscord | <!Patitotective> how do i reverse a string 🤨 |
01:14:16 | FromDiscord | <!Patitotective> In reply to @konsumlamm "that works when discord": ¯\_(ツ)_/¯ |
01:14:32 | FromDiscord | <konsumlamm> ¯\\_(ツ)\_/¯ |
01:16:49 | FromDiscord | <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:25 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/sTe |
01:18:38 | FromDiscord | <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:06 | FromDiscord | <!Patitotective> In reply to @Avahe "There are more efficient": that requires `var string`, right? |
01:19:35 | FromDiscord | <Prestige> Or just a new string, use `result` |
01:21:51 | FromDiscord | <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:12 | FromDiscord | <Prestige> Then you don't need to iterate over the entire string, just half of it |
01:22:24 | FromDiscord | <!Patitotective> thanks :] |
01:22:33 | * | wallabra_ joined #nim |
01:23:15 | FromDiscord | <Elegantbeef> Make a min repro |
01:24:46 | FromDiscord | <Elegantbeef> `import std/algorithm` |
01:25:06 | * | wallabra quit (Ping timeout: 272 seconds) |
01:25:07 | * | wallabra_ is now known as wallabra |
01:25:31 | FromDiscord | <Elegantbeef> there is `reversed` in unicode if you need it to be unicode aware |
01:25:39 | FromDiscord | <Elegantbeef> I guess algorithm returns a `seq[char]` |
01:25:51 | FromDiscord | <Elegantbeef> Unicode shudders↵(@Prestige) |
01:26:06 | FromDiscord | <Elegantbeef> `reversed` exists |
01:26:11 | FromDiscord | <Elegantbeef> also `sugar.dup` exists |
01:27:44 | FromDiscord | <Prestige> In reply to @Elegantbeef "Unicode shudders (<@778498877464117248>)": Then wouldn't you just iterate over runes? |
01:27:53 | * | ltriant joined #nim |
01:27:54 | FromDiscord | <Prestige> Unicode be crazy |
01:28:10 | FromDiscord | <Elegantbeef> Iterating over runes is an O(N) operation |
01:28:34 | FromDiscord | <Elegantbeef> In utf8 strings that is |
01:28:44 | FromDiscord | <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:47 | FromDiscord | <Prestige> Sounds horrible |
01:56:39 | FromDiscord | <Rika> Would you have rathered every letter be four bytes |
01:57:07 | FromDiscord | <Rika> UTF-16 does that instead, for fixed character size |
01:57:45 | FromDiscord | <Rika> Wait was it that |
01:58:02 | FromDiscord | <Rika> I don’t recall, but I know there’s some encoding that does 4 byte fixed character |
01:58:18 | FromDiscord | <Elegantbeef> utf-32? |
01:58:44 | FromDiscord | <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:44 | FromDiscord | <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:29 | FromDiscord | <demotomohiro> utf-16 is not fixed sized. Surrogate pairs: https://datacadamia.com/data/type/text/surrogate |
02:40:27 | FromDiscord | <Rika> In reply to @demotomohiro "utf-16 is not fixed": Yeah I know, I said I didn’t know |
02:40:42 | FromDiscord | <Rika> I thought so, I didn’t know |
02:41:52 | FromDiscord | <Yepoleb> utf-16 should be deleted from existance |
02:44:24 | FromDiscord | <demotomohiro> Yes, but then, windows would lose backward compatibility |
02:47:02 | FromDiscord | <Yepoleb> windows should be deleted from existence |
02:47:15 | FromDiscord | <Yepoleb> problem solved |
02:52:04 | FromDiscord | <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:20 | FromDiscord | <Elegantbeef> I mean it errors even without that |
02:56:35 | FromDiscord | <Elegantbeef> Someone didnt make a good min repro |
02:56:56 | * | arkurious quit (Quit: Leaving) |
03:00:54 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=40UO a proper min repro |
03:02:21 | FromDiscord | <Yepoleb> In reply to @demotomohiro "<@144300201857777664> Your code copying": can you elaborate to what extent sharing is possible? |
03:03:14 | FromDiscord | <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:23 | FromDiscord | <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:32 | FromDiscord | <Yepoleb> <@&371760044473319454> crypto spam |
03:03:32 | FromDiscord | <Tuatarian> wow |
03:03:38 | FromDiscord | <Tuatarian> I'm going to message right now |
03:03:43 | FromDiscord | <Tuatarian> such a convincing message |
03:04:32 | FromDiscord | <Tuatarian> I wonder why these canned message authors can't bother to run it through the most basic of grammar checkers |
03:04:38 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> I mean it crashes instantly here |
03:05:10 | FromDiscord | <Yepoleb> the nested ref seemed necessary to reliably crash for me |
03:05:48 | FromDiscord | <Yepoleb> In reply to @Elegantbeef "I mean it crashes": are you reproducing the orc crash or the arc one? |
03:05:57 | FromDiscord | <Elegantbeef> Orc |
03:06:29 | FromDiscord | <Elegantbeef> The orc one is reproducible with like 5 loc afaict |
03:07:02 | FromDiscord | <Yepoleb> i am more concerned about arc, orc crashes as soon as it senses a thread |
03:09:13 | FromDiscord | <Elegantbeef> Well then demo is right making `let data {.cursor.} = cont.data` is sufficient to make it work |
03:10:15 | FromDiscord | <Yepoleb> thanks |
03:11:19 | FromDiscord | <Yepoleb> but is this intended or not? |
03:11:25 | FromDiscord | <Rika> What does cursor indicate in such case |
03:13:13 | FromDiscord | <Elegantbeef> I think it might just be abuse of cursor |
03:13:23 | FromDiscord | <Elegantbeef> I dont know if it's quite proper but it's generally just "alias the expression" |
03:14:22 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> So i think it might be valid... but idk |
03:14:39 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation docks are here |
03:15:10 | FromDiscord | <Elegantbeef> docs even |
03:16:41 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> It does have a shared heap the cursor inference is the issue methinks |
03:20:43 | FromDiscord | <Yepoleb> i am still confused about what's wrong here |
03:20:46 | FromDiscord | <Elegantbeef> Atleast it doesnt crash with the cursor, it also doesnt seem to be functioning |
03:21:56 | FromDiscord | <Yepoleb> am i misusing the GC or is it broken? |
03:22:09 | FromDiscord | <Elegantbeef> No clue |
03:23:14 | FromDiscord | <demotomohiro> arc/orc increment ref counter when ref is copied but `{.cursor.}` doesnt. |
03:25:17 | FromDiscord | <demotomohiro> Increment/decrement int value from mutiple threads at same time is undefined behaiver.↵You need to use atomic int or locks. |
03:25:46 | FromDiscord | <Yepoleb> What do i need to lock? |
03:29:51 | FromDiscord | <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:24 | FromDiscord | <Yepoleb> Thanks for the workaround |
03:32:14 | * | toluene joined #nim |
03:32:28 | FromDiscord | <Yepoleb> I see no way to lock the ref counting part that happens implicitly after the proc is done |
03:33:59 | FromDiscord | <Elegantbeef> You cant you use an atomic ref counter 😄 |
03:33:59 | FromDiscord | <Elegantbeef> You really dont want a locking ref counter either |
03:36:10 | FromDiscord | <Yepoleb> In reply to @Elegantbeef "You cant you use": That's the smart pointer then, right? |
03:36:46 | FromDiscord | <Elegantbeef> You as a user yes, i was more saying that Nim could use an atomic counter |
03:38:22 | FromDiscord | <demotomohiro> If use `SharedPtr`, you don't need to lock when you copy it. |
03:39:32 | FromDiscord | <demotomohiro> I heard arc/orc doesn't use atomic counter because it is slow. |
03:39:56 | FromDiscord | <Elegantbeef> would be cool if we could get a `sharedRef` that did 😄 |
03:43:46 | FromDiscord | <demotomohiro> I also heard Araq doesn't want to make many reference types like C++. |
03:48:00 | FromDiscord | <Yepoleb> I think I don't even need the sharedptr really, because i only read |
03:48:50 | FromDiscord | <Yepoleb> But getting a raw pointer from a ref is impossible without temporarily modifying the ref counter, right? |
03:49:37 | FromDiscord | <Elegantbeef> Not safely |
03:51:52 | FromDiscord | <Elegantbeef> You can just cast a referenct into `ptr T` if you dont care about safety |
03:52:57 | FromDiscord | <Yepoleb> Wait that works 😮 |
03:53:26 | FromDiscord | <Elegantbeef> Yes references are explicitly implemented in such a way you can cast them to `ptr T` if you need to |
03:53:42 | FromDiscord | <Elegantbeef> That doesnt extend the lifetime of them so it's unsafe |
03:56:11 | FromDiscord | <demotomohiro> sent a code paste, see https://paste.rs/J5y |
03:57:07 | FromDiscord | <Yepoleb> Thanks for the help, but this is all very sad |
03:57:50 | FromDiscord | <Prestige> In reply to @Yepoleb "windows should be deleted": lol, yeah |
04:03:08 | FromDiscord | <Yepoleb> Maybe safety obsessed hype language is the better tool for this kind of task |
05:06:13 | FromDiscord | <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:30 | FromDiscord | <Torbatti> any gui library that works ? |
06:29:52 | FromDiscord | <Torbatti> (edit) "any gui library that ... works" added "just" |
06:30:03 | FromDiscord | <Prestige> I think https://github.com/trustable-code/NiGui is used often but I haven't tried it myself |
06:32:09 | FromDiscord | <Elegantbeef> owlkettle, nigui, gintro, wx-nim, fidget, nimx |
06:32:23 | FromDiscord | <Elegantbeef> Think there's also a qt wrapping |
06:34:08 | FromDiscord | <amadan> Theres nimqml which wraps QT's qml thing |
06:50:13 | FromDiscord | <j-james> i'm having luck with windy+boxy+pixie 😃 |
06:50:21 | FromDiscord | <j-james> technically gui |
06:50:34 | FromDiscord | <Elegantbeef> I mean you're making a GUI library at that point |
07:02:23 | FromDiscord | <qb> nimraylib -> raygui, nimgl -> imgui |
07:02:50 | FromDiscord | <Elegantbeef> Eh using those UIs are lack luster for proper desktop programs |
07:04:23 | FromDiscord | <qb> huh why |
07:04:51 | FromDiscord | <Elegantbeef> lacks the features of something like gtk or qt |
07:05:05 | FromDiscord | <Elegantbeef> Accessibility is a big one |
07:05:29 | FromDiscord | <Elegantbeef> Making properly usable UI libraries isnt that easy and that's why there arent many 😄 |
07:09:53 | madprops | don't sleep on Godot |
07:10:07 | madprops | it's a game engine but actually useful for UI interfaces |
07:10:30 | FromDiscord | <Elegantbeef> The exception there is the entire game engine is made using the UI library |
07:11:11 | madprops | which UI library? |
07:11:21 | FromDiscord | <Elegantbeef> It's own UI |
07:12:30 | madprops | like check this stuff https://old.reddit.com/r/godot/comments/r74kow/whiteboard_software_v108_made_with_godot/ |
07:13:06 | FromDiscord | <Elegantbeef> Yea it's a mostly usable toolkit as it's been dogfooded as such |
07:16:28 | FromDiscord | <qb> Imo great stuff is made with imgui |
07:16:39 | FromDiscord | <qb> https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v176/tracy_profiler.png |
07:16:40 | FromDiscord | <Elegantbeef> I mean i hate imgui so sure |
07:17:47 | FromDiscord | <qb> And raygui looks sexy aswell |
07:17:53 | FromDiscord | <qb> doesn't has that windows 95 feeling 😛 |
07:19:36 | madprops | i think the classic look of windows topped at 2000 |
07:19:49 | madprops | though i never used that one |
07:20:02 | madprops | but on xp it changed a lot |
07:20:17 | madprops | then it climaxed at 7 |
07:23:12 | madprops | doesn't make sense for me to use windows now |
07:23:23 | madprops | i don't think the engineeers there actually understand the code now |
07:23:33 | madprops | which is not a state you want to be in |
07:23:45 | madprops | probably living on borrowed time |
07:24:31 | madprops | or they do and win11 is great idk |
07:37:21 | FromDiscord | <offbeat-stuff (offbeat-stuff)> Hi, successfully compile nim into wasm |
07:37:22 | FromDiscord | <offbeat-stuff (offbeat-stuff)> https://github.com/offbeat-stuff/wasm-in-nim |
07:37:27 | FromDiscord | <offbeat-stuff (offbeat-stuff)> although one problem |
07:38:02 | FromDiscord | <offbeat-stuff (offbeat-stuff)> even though i specified --noMain it still is giving a NimMain function |
07:38:34 | FromDiscord | <offbeat-stuff (offbeat-stuff)> https://offbeat-stuff.github.io/wasm-in-nim/ |
07:38:48 | FromDiscord | <offbeat-stuff (offbeat-stuff)> Here is the github pages for it |
08:02:40 | FromDiscord | <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:45 | NimEventer | New 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:01 | FromDiscord | <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:39 | FromDiscord | <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:32 | FromDiscord | <Rika> No that’s not possible, at least the case you described |
10:08:43 | FromDiscord | <Tuatarian> that's unfortunate |
10:08:45 | FromDiscord | <Tuatarian> thanks anyway |
10:22:52 | FromDiscord | <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:13 | FromDiscord | <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:16 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=40VH |
10:26:32 | FromDiscord | <vindaar> note how in the second one the function call itself is part of the template |
10:26:52 | FromDiscord | <vindaar> (the `v` argument could be `typed` in the first macro too btw) |
12:21:14 | FromDiscord | <vestel> If I import some lib in `static` section, will be this module imported in binary? |
12:21:46 | FromDiscord | <vestel> or still `static` is not a top-level? |
12:52:27 | FromDiscord | <Rika> Is it possible to import in a static, even? |
12:52:33 | FromDiscord | <Rika> Never tried it before |
12:52:45 | FromDiscord | <Rika> !eval static: import strutils |
12:52:47 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: 'import' is only allowed at top level |
12:54:54 | FromDiscord | <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:44 | FromDiscord | <vestel> In reply to @Yardanico "You don't need to": including ffi code? |
12:55:58 | FromDiscord | <vestel> cause i may by accident include disasm in mine dll |
12:56:20 | FromDiscord | <vestel> (edit) "disasm" => "disasember" |
12:58:59 | * | ltriant quit (Ping timeout: 246 seconds) |
13:00:36 | FromDiscord | <Yardanico> In reply to @vestel "including ffi code?": If you mean code from the C side, it depends |
13:00:46 | FromDiscord | <Yardanico> But really you should also use flto if you're worried |
13:01:00 | FromDiscord | <Yardanico> lto will throw away all unused stuff on the C compiler level as well |
13:43:05 | * | ltriant joined #nim |
13:46:01 | FromDiscord | <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:05 | FromDiscord | <vindaar> what do you consider "dangerous territory"? |
13:52:23 | FromDiscord | <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:12 | FromDiscord | <eyecon> I do call upx in fact, also occasionally strip |
14:04:27 | FromDiscord | <eyecon> Dangerous like removing boundary checks |
14:07:08 | FromDiscord | <vindaar> oh, that kind of dangerous! |
14:07:32 | FromDiscord | <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:16 | FromDiscord | <vindaar> sent a long message, see http://ix.io/40Wn |
14:17:18 | FromDiscord | <eyecon> Thanks, I'll check that out |
14:22:46 | FromDiscord | <choltreppe> Why does overloading `is` work inside the file where its defined, but not in another file where it gets imported? |
14:27:54 | FromDiscord | <Phil> Is your `is` overload annotated with |
14:27:56 | FromDiscord | <Phil> (edit) "Is your `is` overload annotated with ... " added "?" |
14:30:19 | FromDiscord | <choltreppe> Yes |
14:31:33 | FromDiscord | <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:14 | FromDiscord | <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:32 | FromDiscord | <Prestige> What are you trying to do? |
15:42:41 | FromDiscord | <PyryTheBurger> I a, trying to save a json object to a json file |
15:43:10 | FromDiscord | <dizzyliam> @mratsim Got a quick weave question if you're around :) |
15:43:49 | FromDiscord | <PyryTheBurger> In reply to @Avahe "What are you trying": I am trying to save a json object to a json file |
15:43:51 | FromDiscord | <PyryTheBurger> Write |
15:49:34 | FromDiscord | <aph> In reply to @PyryTheBurger "Hello i am very": so you meant to put that string in a file? |
15:50:32 | FromDiscord | <aph> maybe https://nim-by-example.github.io/files/ help? idk what you mean unfortunately |
15:52:03 | FromDiscord | <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:23 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=40WP |
15:52:40 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=40WP" => "https://paste.rs/0UE" |
15:53:16 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=40WQ" => "https://play.nim-lang.org/#ix=40WR" |
15:53:28 | FromDiscord | <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:08 | FromDiscord | <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:59 | FromDiscord | <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:49 | FromDiscord | <untoreh> In reply to @untoreh "what is this error?": any suggestions on how to debug this? |
16:46:55 | FromDiscord | <Phil> sent a long message, see http://ix.io/40X3 |
16:47:10 | FromDiscord | <Phil> https://nim-lang.org/docs/tut1.html Here is the first part, which has a section about references/pointers |
16:48:05 | FromDiscord | <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:41 | FromDiscord | <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:23 | FromDiscord | <deadmeme77> Ah, this is an important concept that I need to get, I guess |
19:10:25 | FromDiscord | <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:05 | FromDiscord | <deadmeme77> so in C codes that use pointers, I should check whether to replace them with normal arguments, or references |
20:28:30 | FromDiscord | <Elegantbeef> Given the purpose of `is` overriding it is suspect at best↵(@choltreppe) |
20:34:57 | * | ltriant joined #nim |
20:35:42 | FromDiscord | <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:05 | FromDiscord | <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:51 | void09 | whoami |
21:52:36 | FromDiscord | <voidwalker09> sorry |
22:33:03 | FromDiscord | <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:07 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=410q |
23:20:46 | FromDiscord | <Elegantbeef> You can annotate the enum with `{.pure.}` or use `overloadableEnum`s |
23:21:19 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=410r |
23:22:10 | FromDiscord | <Elegantbeef> Having a type named the same as an enum field is bad practice anyway |
23:23:24 | FromDiscord | <Elegantbeef> Overloadable enums doesnt solve the problem though |
23:23:35 | FromDiscord | <Elegantbeef> Thought it would, but it doesnt |
23:23:48 | FromDiscord | <!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:07 | FromDiscord | <Elegantbeef> What're you translating? |
23:24:51 | FromDiscord | <!Patitotective> https://github.com/BalazsJako/ImGuiColorTextEdit 😶 |
23:27:04 | FromDiscord | <Elegantbeef> You do realize the `.h` file is only 300 loc right? |
23:27:44 | FromDiscord | <!Patitotective> yeaaa but i dont want to wrap it |
23:27:56 | FromDiscord | <Elegantbeef> Then have fun |
23:28:04 | FromDiscord | <!Patitotective> ~~and i dont know how to compile it either~~ |
23:28:08 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Then have fun": :/ |