00:00:40 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Laq |
00:01:52 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Laq" => "https://play.nim-lang.org/#ix=3Las" |
00:02:04 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Las" => "https://paste.rs/wE4" |
00:06:09 | FromDiscord | <Elegantbeef> The pointer is typeless |
00:06:13 | FromDiscord | <Elegantbeef> What type is it supposed to be |
00:07:44 | NimEventer | New Nimble package! base45 - Base45 encoder and decoder, see https://git.sr.ht/~ehmry/base45 |
00:08:32 | FromDiscord | <Elegantbeef> You should do `cast[ptr YourType](data)[]` |
00:08:33 | FromDiscord | <Patitotective> In reply to @Elegantbeef "What type is it": I'm passing to it an object |
00:08:58 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You should do `cast[ptr": where |
00:09:03 | FromDiscord | <Elegantbeef> Then you need to cast it to a ptr of that object |
00:09:33 | FromDiscord | <Elegantbeef> when you go to use the data you were given |
00:12:22 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lax |
00:13:08 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lay |
00:13:12 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Lax" => "https://play.nim-lang.org/#ix=3Laz" |
00:15:58 | FromDiscord | <impbox [ftsf]> argh, i can never figure out how to generate a lookup table at compile time |
00:16:30 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3LaA |
00:17:18 | FromDiscord | <Elegantbeef> const |
00:18:15 | FromDiscord | <impbox [ftsf]> doesn't const have to be initialised? |
00:18:26 | FromDiscord | <impbox [ftsf]> i can't fill in a const |
00:22:03 | FromDiscord | <Elegantbeef> I mean why does it matter |
00:22:15 | FromDiscord | <impbox [ftsf]> uh... i'm just trying to figure out how to do this |
00:22:23 | FromDiscord | <impbox [ftsf]> how would you do it with const? |
00:23:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LaB |
00:23:30 | FromDiscord | <impbox [ftsf]> "compileTime variables are available at runtime too. This simplifies certain idioms where variables are filled at compile-time (for example, lookup tables) but accessed at runtime" trying to figure out the simple idiom for filling a lookup table at compile time |
00:24:47 | FromDiscord | <impbox [ftsf]> thanks beef <3 |
00:25:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LaC |
00:25:19 | FromDiscord | <Elegantbeef> But it's best just make the procedure like i did since there isnt any reason to annotate it a compiletime proc/variable imo |
00:26:23 | FromDiscord | <impbox [ftsf]> yeah makes sense, was just going by what the manual said with regards to filling in variables at compile time, which after your example seems like the manual is misleading |
00:27:45 | FromDiscord | <Elegantbeef> I think it's not misleading just doesnt work always |
00:28:38 | FromDiscord | <Elegantbeef> That works for instance |
00:28:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LaD |
00:29:18 | FromDiscord | <impbox [ftsf]> misleading in that, you shouldn't do this because that's not the simple idiomatic way |
00:31:46 | NimEventer | New Nimble package! nimdenter - A tool for people who don't like Nim's indentation-based syntax, see https://github.com/xigoi/nimdenter |
00:32:11 | FromDiscord | <impbox [ftsf]> downloads another language? |
00:32:33 | FromDiscord | <Elegantbeef> No it's just commented out `{}`s |
00:32:40 | FromDiscord | <Elegantbeef> Uses them to reason indention |
00:33:01 | FromDiscord | <impbox [ftsf]> so i see... |
00:37:18 | FromDiscord | <congusbongus> looks like BCPL in a way |
00:40:07 | FromDiscord | <huantian> Can I run a bunch of async functions concurrently, with a max number running at once?↵I was thinking of trying to do it by chaining callbacks, but not sure if that's the proper way |
00:40:49 | FromDiscord | <Elegantbeef> I swear i heard this question before |
00:41:06 | FromDiscord | <huantian> I asked it somewhere in the past I think |
00:41:23 | FromDiscord | <Elegantbeef> I dont use async so can only nod |
00:41:49 | FromDiscord | <huantian> I'd assume async is the right thing to use for this and not threading too right |
00:41:56 | FromDiscord | <congusbongus> async is single-threaded isn't it? So it's not actually running at once |
00:42:00 | FromDiscord | <Elegantbeef> Depends on what you're limited by |
00:42:07 | FromDiscord | <Elegantbeef> If you're limited by IO then async is right |
00:42:15 | FromDiscord | <Elegantbeef> If you're limited by cpu then threading is right |
00:42:26 | FromDiscord | <huantian> ok that makes sense |
00:43:10 | FromDiscord | <congusbongus> Raymond Hettinger did a good talk on async vs threading vs multiprocessing |
00:56:18 | FromDiscord | <huantian> hm it seems as if httpclient is not having a good time with multiple downloadFiles at the same time |
00:56:47 | FromDiscord | <Elegantbeef> async or sync? |
00:56:51 | FromDiscord | <huantian> async |
00:57:05 | FromDiscord | <impbox [ftsf]> are you using a different client for each download? |
00:57:08 | FromDiscord | <Elegantbeef> Different clients? |
00:57:14 | FromDiscord | <huantian> should I be? |
00:57:16 | FromDiscord | <Elegantbeef> God dammit imp |
00:57:25 | FromDiscord | <huantian> sniped |
00:57:28 | FromDiscord | <Elegantbeef> Yes you should two concurrent connections waiting for data sounds horrid |
00:57:54 | FromDiscord | <Elegantbeef> Atleast i think you should |
01:01:48 | NimEventer | New Nimble package! jalali_nim - Jalili <=> Gregorian date converter, originally a copy of http://jdf.scr.ir/, see https://github.com/hamidb80/jalili-nim |
01:11:24 | NimEventer | New thread by Oyster: Real type of openArray?, see https://forum.nim-lang.org/t/8779 |
01:28:29 | * | NimBot joined #nim |
01:29:01 | * | Guest6782 quit (Ping timeout: 240 seconds) |
01:44:46 | * | noeontheend joined #nim |
02:32:23 | * | neurocyte091 joined #nim |
02:34:51 | * | neurocyte09 quit (Ping timeout: 256 seconds) |
02:34:52 | * | neurocyte091 is now known as neurocyte09 |
02:41:16 | * | arkurious quit (Quit: Leaving) |
02:57:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
04:10:08 | * | noeontheend joined #nim |
05:04:57 | * | noeontheend quit (Ping timeout: 240 seconds) |
05:09:56 | * | yitr joined #nim |
05:17:59 | * | rockcavera quit (Remote host closed the connection) |
05:26:28 | * | mahlon_ is now known as mahlon |
05:46:56 | * | yitr quit (Quit: Client closed) |
07:01:37 | * | nac quit (Quit: The Lounge - https://thelounge.chat) |
07:02:03 | * | nac joined #nim |
07:27:51 | * | dithpri joined #nim |
07:49:09 | * | PMunch joined #nim |
07:53:15 | * | dithpri quit (Ping timeout: 276 seconds) |
08:59:55 | * | Gustavo6046 quit (Quit: Leaving) |
09:51:38 | * | pro joined #nim |
09:51:41 | * | pro left #nim (#nim) |
09:52:26 | * | pro joined #nim |
10:48:08 | FromDiscord | <SirOlaf> Varargs really are quite scuffed https://play.nim-lang.org/#ix=3Ld0 |
10:48:56 | FromDiscord | <Elegantbeef> Eh that's kinda tobe expected |
10:49:28 | FromDiscord | <SirOlaf> Would be one confusing error to encounter |
10:49:45 | FromDiscord | <Elegantbeef> Sure but `varargs[typedesc]` is a nonsensical collection of ints |
10:49:52 | FromDiscord | <Elegantbeef> In this case |
10:50:09 | FromDiscord | <Elegantbeef> typedesc is a typeclass so it binds to the first one |
10:50:35 | FromDiscord | <SirOlaf> What does that mean? |
10:50:55 | FromDiscord | <Elegantbeef> `varargs[typedesc]` is just a stupid complicated version of `typedesc` |
10:51:19 | FromDiscord | <Elegantbeef> You cannot have a varargs of anything but the first typedesc passed |
10:51:23 | FromDiscord | <Elegantbeef> since it |
10:51:33 | FromDiscord | <Elegantbeef> it's a homogeneous collection\ |
10:51:45 | FromDiscord | <SirOlaf> Huh, that's interesting |
10:51:53 | FromDiscord | <SirOlaf> Would have expected typedesc to be more concrete for some reason |
10:53:07 | FromDiscord | <SirOlaf> So why does it fail with a single int type passed? |
10:53:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/NCe |
10:53:31 | FromDiscord | <Elegantbeef> It fails on Cgen afaict |
10:54:47 | FromDiscord | <Elegantbeef> The failure is probably just the type not being assigned but eitherway an error should be emitted for `varargs[typedesc]` |
10:55:22 | FromDiscord | <Elegantbeef> It's a pointless collection that can only ever be used at CT |
10:56:13 | FromDiscord | <SirOlaf> Doesn't typeof make it "usable" at runtime |
10:59:11 | FromDiscord | <Elegantbeef> No cause that's a compile time statement |
10:59:17 | FromDiscord | <Elegantbeef> It's a pointless construct |
10:59:40 | FromDiscord | <Elegantbeef> What's the benefit of `[int, int, int]` verses `static int` |
10:59:53 | FromDiscord | <Elegantbeef> If you want `varargs[typedesc]` just do `typedesc[tuple]` |
11:00:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/oP4 |
11:01:07 | FromDiscord | <Elegantbeef> `typeof` evaluates the expression and returns the type at compile time |
11:01:57 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3Ld9 |
11:02:20 | FromDiscord | <Elegantbeef> Come again? |
11:02:29 | FromDiscord | <SirOlaf> Using tuple does not compile for me |
11:02:38 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Ldb |
11:02:40 | FromDiscord | <Elegantbeef> Runs fine |
11:02:47 | FromDiscord | <SirOlaf> That's weird |
11:03:24 | FromDiscord | <SirOlaf> Oh, it's because I didn't have a trailing comma |
11:03:34 | FromDiscord | <Elegantbeef> Anyway i'm going to sleep, so this has been "4am rants with beef" |
11:03:59 | FromDiscord | <SirOlaf> gn. I'll keep having fun with weird features |
11:36:38 | * | jjido joined #nim |
11:41:15 | * | jjido quit (Client Quit) |
11:53:07 | * | fvs joined #nim |
12:45:18 | FromDiscord | <Smarc> https://github.com/Smarcy/connect_the_dotfiles/blob/master/src/connect_the_dotfiles.nim↵After adding and then removing a file, listing all saved files (reading StorageFile at the whole) does return nothing although there should be something there. I think I am missing some File-handling stuff I don't know about, could anyone give me a hint? |
12:47:26 | * | rockcavera joined #nim |
12:47:27 | * | rockcavera quit (Changing host) |
12:47:27 | * | rockcavera joined #nim |
12:49:52 | * | jjido joined #nim |
12:58:58 | FromDiscord | <Rika> what do you mean? |
12:59:36 | FromDiscord | <Rika> your code probably is wrong |
13:00:19 | FromDiscord | <Rika> im gonna check it again wait |
13:02:44 | FromDiscord | <Rika> https://github.com/Smarcy/connect_the_dotfiles/blob/master/src/connect_the_dotfiles.nim#L90 probably that you do not close this file before you move it |
13:02:59 | FromDiscord | <Rika> @Smarc |
13:07:44 | FromDiscord | <Smarc> Ah, because the `defer: f.close()` happens only after the proc? |
13:10:55 | FromDiscord | <Smarc> nevermind, i forgot `defer tmpF.close()` .. you were right, thank you! |
13:17:28 | FromDiscord | <SecureThisShit> sent a long message, see http://ix.io/3Lee |
13:31:03 | FromDiscord | <kaddkaka> In reply to @SecureThisShit "One question: I'm using": If you only have the address of the string and it contains sentinel values, you need to hace some other information on where the the string ends. for example a length? |
13:32:01 | FromDiscord | <Michal Maršálek> I'm want to create a template that would take a type and return a value of that type and I'm struggling a bit. Can someone help, please? https://play.nim-lang.org/#ix=3Lej |
13:32:52 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:33:59 | FromDiscord | <eyecon> What would it return when it would be called by, I dunno, a tuple? |
13:34:08 | FromDiscord | <eyecon> (edit) "by," => "with," |
13:34:12 | FromDiscord | <Michal Maršálek> Basically something similar to static constants in OOP languages |
13:34:38 | FromDiscord | <Michal Maršálek> In reply to @eyecon "What would it return": I only want it for some types. |
13:38:08 | FromDiscord | <kaddkaka> I took a guess: https://play.nim-lang.org/#ix=3Lej |
13:38:20 | FromDiscord | <kaddkaka> `@[one(typeof S)]` |
13:38:42 | FromDiscord | <kaddkaka> Seems to work, I'm not sure if it's correct. |
13:39:22 | FromDiscord | <kaddkaka> @Michal Maršálek (Thats in response to your code) |
13:39:54 | FromDiscord | <kaddkaka> (edit) "https://play.nim-lang.org/#ix=3Lej" => "https://play.nim-lang.org/#ix=3Leo" |
13:56:14 | FromDiscord | <eyecon> Related question: Is there a way to get `int` from `seq[int]` in generics? I.e. to have a generic function of type S, which is a container of T, and return T? |
13:59:23 | FromDiscord | <eyecon> `proc contained_type[S: openarray](): typedesc = # to return the type of S's elements, e.g. int for seq[int]` |
14:00:50 | * | katsuragi joined #nim |
14:00:55 | * | katsuragi left #nim (WeeChat 2.9) |
14:03:26 | FromDiscord | <SecureThisShit> In reply to @kaddkaka "If you only have": I also have the length. I could do for example memory allocation and copyMem() but I think there should be a simpler solution or not? |
14:10:29 | FromDiscord | <Solitude> In reply to @eyecon "Related question: Is there": https://nim-lang.org/docs/typetraits.html#genericParams.t%2Ctypedesc |
14:13:08 | * | arkurious joined #nim |
14:25:58 | * | rockcavera quit (Remote host closed the connection) |
14:27:01 | FromDiscord | <Michal Maršálek> In reply to @kaddkaka "Seems to work, I'm": Seems to work, but feels like a workaround.... is there a way to fix the signature of that template so that `S:typedesc`? |
14:29:53 | FromDiscord | <Solitude> In reply to @Michal58 "I'm want to create": i think someone reported that issue... |
14:30:21 | * | pro quit (Quit: WeeChat 3.4) |
14:30:34 | FromDiscord | <Michal Maršálek> In reply to @Solitude "i think someone reported": what is the issue? I don't really understand what is happening there |
14:31:21 | FromDiscord | <Solitude> In reply to @Michal58 "what is the issue?": https://github.com/nim-lang/Nim/issues/13527 |
14:31:36 | FromDiscord | <Solitude> generics parameters in templates get treated as values |
14:32:26 | FromDiscord | <Solitude> you can change definitions to proc and it works correctly |
14:33:27 | FromDiscord | <Solitude> In reply to @Michal58 "what is the issue?": oh, i reported it https://github.com/nim-lang/Nim/issues/17240 |
14:34:09 | FromDiscord | <Michal Maršálek> hmm |
14:38:06 | FromDiscord | <Solitude> In reply to @Michal58 "hmm": you can also use typetraits module to operate directly on typedesc parameter instead of generic parameter https://play.nim-lang.org/#ix=3LeQ |
14:38:57 | FromDiscord | <Michal Maršálek> Thank you will look into that |
14:39:13 | FromDiscord | <Michal Maršálek> Is there a more canonical way to define these "static" constants? |
14:41:03 | FromDiscord | <Solitude> look aight to me. but you are stepping into a minefield combining templates and generics. |
14:42:27 | FromDiscord | <Michal Maršálek> I was using converters initially but they were executed where t was nonsensical so I abondonded them |
14:43:41 | FromDiscord | <Michal Maršálek> Also why debugging my macros, I noticed a minor bug in `toStrLit` output: https://play.nim-lang.org/#ix=3LeT |
14:44:01 | FromDiscord | <Michal Maršálek> the `` needs backticks around it |
14:44:17 | FromDiscord | <Michal Maršálek> but `toStrLit` doesn't produce them |
14:51:16 | FromDiscord | <eyecon> In reply to @Solitude "https://nim-lang.org/docs/typetraits.html#genericPa": Thanks! |
14:56:56 | FromDiscord | <exelotl> https://play.nim-lang.org/#ix=3Lf4 lol |
14:57:08 | FromDiscord | <exelotl> linked lists are buggy |
14:57:20 | FromDiscord | <Michal Maršálek> In reply to @Solitude "look aight to me.": Thanks |
14:59:37 | FromDiscord | <eyecon> In reply to @Solitude "https://nim-lang.org/docs/typetraits.html#genericPa": I got an internal error while testing this: https://play.nim-lang.org/#ix=t%20wr |
15:00:01 | FromDiscord | <Solitude> In reply to @eyecon "I got an internal": wrong link |
15:00:09 | FromDiscord | <eyecon> Sorry, wrong one |
15:00:10 | FromDiscord | <Solitude> you got played by playground |
15:03:06 | FromDiscord | <eyecon> I meant: https://play.nim-lang.org/#ix=3Lfl |
15:06:22 | FromDiscord | <Solitude> In reply to @eyecon "I meant: https://play.nim-lang.org/#ix=3Lfl": nim moment |
15:06:31 | FromDiscord | <Solitude> feel free to create the issue |
15:11:07 | FromDiscord | <Solitude> In reply to @eyecon "I meant: https://play.nim-lang.org/#ix=3Lfl": if you only need to extract generic parameter from sequences, you can use this https://play.nim-lang.org/#ix=3Lfu |
15:12:51 | FromDiscord | <Michal Maršálek> What does "Error: Invalid node kind nnkCall for macros.`$`" mean? |
15:13:35 | FromDiscord | <eyecon> In reply to @Solitude "feel free to create": https://github.com/nim-lang/Nim/issues/19334 |
15:13:55 | FromDiscord | <Solitude> you cant $/echo NimNodes directly, you need repr/treeRerp them |
15:13:56 | * | dithpri joined #nim |
15:14:03 | FromDiscord | <Solitude> In reply to @Michal58 "What does "Error: Invalid": ^ |
15:14:08 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3Lfv |
15:14:19 | FromDiscord | <Michal Maršálek> I see |
15:14:26 | FromDiscord | <eyecon> In reply to @Solitude "if you only need": Interesting approach, thanks, but mine is still supposed to work, right? |
15:14:27 | FromDiscord | <Michal Maršálek> I need to use toStrLit or something |
15:14:54 | FromDiscord | <Solitude> In reply to @eyecon "Interesting approach, thanks, but": whatever you're doing compiler shouldn;t crash |
15:15:31 | FromDiscord | <kaddkaka> `Error: unhandled exception: index 127 not in 0 .. 6 [IndexDefect]` is related to my `characters` string only having indices `0..6`, but if I make that string long enough, everything outputs "correctly". |
15:15:45 | FromDiscord | <kaddkaka> @Solitude oh, is that a compiler crash |
15:16:02 | FromDiscord | <eyecon> In reply to @Solitude "whatever you're doing compiler": Yes, but more than not crashing, it should give the same output as a direct call, right? At least I don't see why not |
15:16:29 | FromDiscord | <Solitude> yas |
15:17:01 | FromDiscord | <kaddkaka> (sorry got confused) |
15:19:11 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3Lfy |
15:21:11 | FromDiscord | <Solitude> you're trolling |
15:21:12 | FromDiscord | <Solitude> second |
15:21:13 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3Lfz |
15:21:14 | FromDiscord | <Solitude> what the hell |
15:22:14 | FromDiscord | <kaddkaka> @Solitude I'm playing in the playground: https://play.nim-lang.org/#ix=3LfA |
15:23:06 | FromDiscord | <kaddkaka> The crash looks strange. I encountered it because I was stupid and created a function called `char`. |
15:25:10 | FromDiscord | <Michal Maršálek> In reply to @demotomohiro "It seems you cannot": Ha! Sometimes you can?!!: https://play.nim-lang.org/#ix=3LfB |
15:25:42 | FromDiscord | <Solitude> In reply to @kaddkaka "The crash looks strange.": its because function calls have high priority than type conversions i guess↵` if c <= 127.char:` this is the line in system that invokes your `char` |
15:25:48 | FromDiscord | <Solitude> (higher |
15:29:43 | FromDiscord | <kaddkaka> @Solitude In what file is that? I'm looking at `/home/david/.choosenim/toolchains/nim-1.6.0/lib/system.nim` right now |
15:30:28 | FromDiscord | <kaddkaka> found it line 2913, thanks |
15:30:28 | FromDiscord | <Solitude> right there, addQuoted |
15:31:12 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3LfG |
15:31:39 | FromDiscord | <Solitude> because only strings in collections/objects need addQuoted |
15:31:44 | FromDiscord | <Solitude> and the second one is empty |
15:34:59 | FromDiscord | <kaddkaka> Right |
15:38:47 | NimEventer | New Nimble package! xlsxio - This is a xlsxio wrapper done Nim in mind., see https://github.com/jiiihpeeh/xlsxio-nim |
15:38:53 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=3LfJ |
15:39:04 | FromDiscord | <Solitude> they dont need to be escaped? |
15:39:10 | FromDiscord | <Solitude> why would you want your string to be quoted |
15:47:31 | FromDiscord | <SirOlaf> In reply to @exelotl "linked lists are buggy": Someone forgot to fix the tail |
15:49:57 | FromDiscord | <Michal Maršálek> How can I define what happens on explicit type conversion like `MyType 1`? I can somewhat control that by defining a converter from `int` to `MyType`, however that leads to implicit conversions happening which I don't want. Is there a way to allow only explicit conversions? |
15:55:34 | * | jjido joined #nim |
15:56:35 | FromDiscord | <Rika> You can’t explicitly convert object types afaik |
15:59:46 | FromDiscord | <Michal Maršálek> I'm sad |
16:00:19 | * | jjido quit (Client Quit) |
16:00:59 | FromDiscord | <kaddkaka> In reply to @Solitude "its because function calls": Is it possible to explicit call the type conversion and not the function? |
16:01:06 | FromDiscord | <Rika> Use a procedure, toX or a to(your type, typedesc) |
16:01:16 | FromDiscord | <Rika> In reply to @kaddkaka "Is it possible to": Rename the function please |
16:01:36 | FromDiscord | <kaddkaka> i@Rika that's not what I'm asking, but ofc I will not have a function named lke that |
16:01:43 | FromDiscord | <Rika> No |
16:01:51 | FromDiscord | <Rika> There is no way from what I know |
16:01:54 | FromDiscord | <kaddkaka> ok |
16:08:48 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LfY |
16:09:02 | FromDiscord | <SirOlaf> The type itself gets allowed |
16:10:26 | FromDiscord | <Rika> Have you tried? what error? |
16:10:45 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/WBC |
16:10:53 | FromDiscord | <Rika> .isNil |
16:11:14 | FromDiscord | <SirOlaf> https://play.nim-lang.org/#ix=3Lg2 "cannot create null element for: tyVoid" |
16:11:15 | FromDiscord | <Patitotective> Oh ok :upś |
16:11:20 | FromDiscord | <Patitotective> (edit) ":upś" => "🙃" |
16:12:03 | FromDiscord | <SirOlaf> In reply to @SirOlaf "https://play.nim-lang.org/#ix=3Lg2 "cannot create n": Casting 0 to the type works though |
16:12:08 | FromDiscord | <Rika> Huh |
16:12:13 | FromDiscord | <Rika> Funky |
16:13:21 | FromDiscord | <SirOlaf> Nice, I got the compiler to crash with it |
16:13:38 | FromDiscord | <SirOlaf> https://play.nim-lang.org/#ix=3Lg6 |
16:14:06 | FromDiscord | <SirOlaf> So void should probably not be allowed in that context |
16:15:38 | FromDiscord | <eyecon> Two compiler crashes in a day, lucky us |
16:15:56 | FromDiscord | <SirOlaf> To be fair, I'm actively looking for issues |
16:16:07 | FromDiscord | <eyecon> Well, I'm not 😄 |
16:30:03 | FromDiscord | <SirOlaf> Also found a weird varargs bug yesterday where the parameters share a memory location |
16:45:29 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lgg |
16:45:55 | FromDiscord | <Solitude> what the hell is stopwatch |
16:45:59 | FromDiscord | <Solitude> does it have state field |
16:46:01 | FromDiscord | <Solitude> is it exported |
16:46:11 | FromDiscord | <Patitotective> sorry i forgot that part lol |
16:46:14 | FromDiscord | <Patitotective> one sec |
16:46:40 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Lgg" => "https://play.nim-lang.org/#ix=3Lgh" |
16:46:44 | FromDiscord | <Solitude> export the field |
16:47:03 | FromDiscord | <Patitotective> Do you mean ``? |
16:47:06 | FromDiscord | <Solitude> yes |
16:47:16 | FromDiscord | <Patitotective> Do I need to do that for all the fields? |
16:47:31 | FromDiscord | <Rika> All the fields you care about |
16:47:32 | FromDiscord | <Rika> Yes |
16:47:48 | FromDiscord | <Solitude> In reply to @Patitotective "Do I need to": https://nim-lang.org/docs/tut1.html#advanced-types-objects |
16:48:55 | FromDiscord | <Patitotective> Is there a way to export all fields? |
16:50:39 | * | dithpri left #nim ('); DROP TABLE Users;--) |
16:51:01 | FromDiscord | <Rika> Automatically no |
16:51:02 | FromDiscord | <Solitude> you could write a macro for that, otherwise no |
16:51:15 | FromDiscord | <Rika> Well yeah but that’s probably not what he wants… |
16:51:44 | FromDiscord | <Rika> Well if you want someone to do it for you wait for beef to wake up or something I don’t know |
16:52:11 | FromDiscord | <Solitude> or use an editor where placing bunch of stars isnt a problem |
16:52:14 | FromDiscord | <Patitotective> It's okay 🙃 |
16:53:26 | FromDiscord | <Patitotective> Also Nim seems to be super awesome, oop and pointers specifically (im a python programmer) |
16:56:58 | FromDiscord | <Patitotective> btw is it possible to have an emtpy procedure? so if I call it it happens nothing? |
16:56:59 | FromDiscord | <Patitotective> (edit) "nothing?" => "nothing" |
16:57:06 | * | Figworm quit (Quit: Figworm) |
16:57:50 | FromDiscord | <Solitude> `discard` |
17:00:51 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lgr |
17:01:14 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3Lgr" => "https://play.nim-lang.org/#ix=3Lgs" |
17:04:32 | FromDiscord | <Patitotective> Or should I use m a c r o s ? |
17:04:56 | FromDiscord | <Solitude> you should, but what do you want this code to do? |
17:05:50 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lgt |
17:06:42 | FromDiscord | <Solitude> why does it have to be `let myProc` instead of normal procedure definition? |
17:07:16 | * | rockcavera joined #nim |
17:07:16 | * | rockcavera quit (Changing host) |
17:07:16 | * | rockcavera joined #nim |
17:07:16 | FromDiscord | <Solitude> and yes, you can do that. |
17:07:50 | FromDiscord | <Patitotective> In reply to @Solitude "why does it have": cause `myProc` is really a field of an object |
17:09:09 | FromDiscord | <Patitotective> In reply to @Solitude "and yes, you can": I'm getting `Error: expression expected, but found 'keyword discard'` |
17:09:41 | FromDiscord | <Solitude> can you slap some parens around it? |
17:10:37 | FromDiscord | <Patitotective> In reply to @Solitude "can you slap some": huh? where? |
17:10:43 | FromDiscord | <Solitude> around proc definition |
17:10:51 | * | Figworm joined #nim |
17:11:44 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Lgx |
17:13:11 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3Lgy |
17:14:42 | * | pro joined #nim |
17:17:28 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LgA |
17:18:09 | * | rockcavera quit (Ping timeout: 256 seconds) |
17:18:26 | FromDiscord | <Solitude> remove `: StopwatchProc` |
17:20:06 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LgD |
17:20:25 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3LgD" => "https://play.nim-lang.org/#ix=3LgE" |
17:22:13 | FromDiscord | <eyecon> @Patitotective check this out too, maybe it works for you: https://github.com/mratsim/Synthesis |
17:22:15 | FromDiscord | <Solitude> you didnt change my snippet to fit your code... |
17:22:35 | FromDiscord | <Solitude> your procs should have the signature of StopwatchProc |
17:24:16 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/sGp |
17:24:38 | FromDiscord | <Solitude> thats literally what i told you to do... |
17:24:50 | FromDiscord | <Patitotective> hmmmm lol |
17:28:17 | FromDiscord | <Rosen> bruh moment |
17:45:51 | * | rockcavera joined #nim |
17:45:51 | * | rockcavera quit (Changing host) |
17:45:51 | * | rockcavera joined #nim |
17:48:37 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LgO |
17:49:29 | FromDiscord | <Rosen> why would you like that |
17:49:30 | FromDiscord | <Rosen> that's awful |
18:21:28 | * | Gustavo6046 joined #nim |
18:23:44 | * | neurocyte09 quit (Read error: Connection reset by peer) |
18:24:33 | * | neurocyte091 joined #nim |
18:41:58 | * | krux02 joined #nim |
19:12:05 | FromDiscord | <Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3Lhg |
19:12:43 | FromDiscord | <enthus1ast> also with --gc\:arc ? |
19:12:51 | FromDiscord | <Hamid_Bluri> with every gc |
19:13:37 | FromDiscord | <Hamid_Bluri> i think i dont know something about GC |
19:13:57 | FromDiscord | <Hamid_Bluri> nim's GC actually |
19:18:40 | FromDiscord | <Solitude> seq doesnt release its capacity |
19:19:55 | FromDiscord | <Solitude> nvm |
19:20:08 | FromDiscord | <Hamid_Bluri> seq just stores `ref` of string |
19:20:44 | FromDiscord | <Solitude> nim doesnt release the memory allocated |
19:20:48 | FromDiscord | <Hamid_Bluri> http://zevv.nl/nim-memory/ |
19:20:55 | FromDiscord | <Solitude> you have to use -d:useMalloc for that |
19:22:05 | FromDiscord | <Solitude> yep, releases fine with malloc |
19:22:17 | FromDiscord | <Hamid_Bluri> no difference |
19:22:25 | FromDiscord | <Solitude> useMalloc only works with arc/orc |
19:22:36 | FromDiscord | <Solitude> its expected behaviour |
19:23:16 | FromDiscord | <Hamid_Bluri> why's refc doesn't release allocated memory? |
19:23:31 | FromDiscord | <Hamid_Bluri> (edit) "why's" => "why" |
19:23:32 | FromDiscord | <Solitude> its not refc, its nims allocator |
19:24:19 | FromDiscord | <Solitude> it doesnt release memory back to os, so it can be reused faster, probably |
19:24:45 | FromDiscord | <Hamid_Bluri> thanks |
19:25:02 | FromDiscord | <Solitude> status have pr to nim that ports useMalloc to refc |
19:34:22 | * | jjido joined #nim |
19:39:36 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:56:54 | FromDiscord | <michaelb> when adding pragma/s to a proc is it possible to have some conditions, e.g. if there's variation re: the version of Nim? |
19:57:31 | FromDiscord | <michaelb> or is it a matter of using `when/else` in combination with push/pop above below the definition of the proc? |
19:59:22 | FromDiscord | <Solitude> In reply to @brainproxy "when adding pragma/s to": huh? maybe this can help https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma |
20:00:17 | FromDiscord | <michaelb> ah very nice, will try that |
20:00:20 | FromDiscord | <michaelb> thank you |
20:01:19 | FromDiscord | <enthus1ast> can i forward declare a proc in another file? |
20:01:31 | FromDiscord | <enthus1ast> like c in c headers? |
20:03:18 | FromDiscord | <Solitude> if you mean module, then no. why do you need that |
20:03:43 | FromDiscord | <enthus1ast> i have a recursive dependecy that i do not know to break up yet |
20:03:51 | FromDiscord | <enthus1ast> how to |
20:04:04 | FromDiscord | <Solitude> actually, there is a hack with using importc and exportc |
20:04:18 | FromDiscord | <Solitude> but its a hack and you should feel bad for using it |
20:04:28 | FromDiscord | <enthus1ast> ah before i go this route i will try to refactor |
20:06:50 | FromDiscord | <enthus1ast> ok i think i have a solution, i must strictly break up types and procs and put the types in their own module |
20:09:02 | Zevv | what's with nim releasing memory |
20:11:40 | FromDiscord | <michaelb> In reply to @enthus1ast "ok i think i": happens that way quite frequently |
20:11:42 | FromDiscord | <michaelb> ime |
20:15:16 | * | jjido joined #nim |
20:16:09 | FromDiscord | <Patitotective> Is it possible to create a _windows_ executable from linux? |
20:16:28 | FromDiscord | <Solitude> yes, install mingw |
20:24:14 | pro | what you want is wine |
20:24:56 | nrds | <Prestige99> nah pro |
20:25:06 | pro | yeah I missread nrds |
20:25:49 | FromDiscord | <Patitotective> In reply to @Solitude "yes, install mingw": what do i do now? |
20:27:01 | FromDiscord | <michaelb> sent a long message, see http://ix.io/3LhD |
20:27:12 | FromDiscord | <Sabena Sema> sigh working in C and Rust lately and wow, it drives home home much “thrust to weight” nim has |
20:27:16 | FromDiscord | <Solitude> In reply to @Patitotective "what do i do": compile with -d:mingw |
20:27:39 | FromDiscord | <Sabena Sema> you can also run msvc under wine |
20:27:48 | FromDiscord | <michaelb> (edit) "http://ix.io/3LhD" => "http://ix.io/3LhE" |
20:28:20 | FromDiscord | <Sabena Sema> theres a set of scripts to download and extract msvc and the sdks independent from the vs installer |
20:28:51 | FromDiscord | <Sabena Sema> this can be handy if you need to do SEH or c++ things |
20:29:47 | FromDiscord | <Sabena Sema> In reply to @brainproxy "if you have windows": msys2 is almost the same as cygwin tbh, they regularly take patches from eachother/sync their code |
20:30:03 | FromDiscord | <michaelb> it's really not |
20:30:15 | FromDiscord | <michaelb> or that's to say, it's missing a lot of the point of MSYS@ |
20:30:18 | FromDiscord | <michaelb> (edit) "MSYS@" => "MSYS2" |
20:30:31 | FromDiscord | <Sabena Sema> it is, mingw-w64 is the “different” part |
20:30:54 | FromDiscord | <Patitotective> @Sabena Sema It seems a little bit complex, I will try what @Solitude said and if it doesn't work I know who to ask 😉 |
20:31:04 | FromDiscord | <michaelb> do you understand the concept of MSYS2's environments? UCRT64 vs MINGW64 vs. CLANG32? |
20:31:15 | FromDiscord | <Sabena Sema> I think you can even install mingw-w64 and use it from cygwin |
20:31:16 | FromDiscord | <michaelb> what they bring to the table? |
20:31:28 | FromDiscord | <Sabena Sema> yeah, they are basically shell profiles |
20:31:40 | FromDiscord | <michaelb> with different /usr/lib |
20:31:43 | FromDiscord | <Sabena Sema> yes |
20:32:02 | FromDiscord | <Sabena Sema> also: use ucrt64 if at all possible |
20:32:12 | FromDiscord | <michaelb> anyway, point is you can generate standalone native exe |
20:32:16 | FromDiscord | <michaelb> I |
20:32:20 | FromDiscord | <Sabena Sema> the old msvcrt is bug ridden and basically unmaintained |
20:32:28 | FromDiscord | <Sabena Sema> yeah |
20:32:31 | * | stkrdknmibalz joined #nim |
20:33:20 | FromDiscord | <michaelb> I've had luck compiling on Win 10 + MSYS2 with `-static` and then copying the executable to a bare bones Windows 7 machine (nothing of msys2 or cygwin installed) and it worked fine |
20:33:29 | FromDiscord | <michaelb> context being Nim programming |
20:33:39 | FromDiscord | <Sabena Sema> static doesnt do the same thing on windows as linux |
20:33:51 | FromDiscord | <Sabena Sema> windows does not have “static executables” |
20:34:06 | FromDiscord | <Sabena Sema> it just modifies the linkers preference for static vs dynamic libs |
20:34:21 | FromDiscord | <Sabena Sema> for pe hosts |
20:35:34 | FromDiscord | <michaelb> fair enough, you're more knowledgeable than me in this area apparently; what I meant is that with help of `-static` passed to gcc in msys2 mingw64 environment on win 10, I was able to produce a program that I could copy to an old Win 7 box and it ran fine though that box didn't have anything ever installed having to do with msys2, cygwin, etc. |
20:35:44 | FromDiscord | <Sabena Sema> you shouldn’t use it on linux either tbh, it can opt you out of some security features, and you dont get the vdso |
20:36:01 | FromDiscord | <Sabena Sema> yeah |
20:36:34 | FromDiscord | <Sabena Sema> Thats possible with the ucrt as well if I’m not mistaken, there is a static version of the ucrt |
20:36:44 | FromDiscord | <michaelb> yes, I believe so |
20:36:49 | FromDiscord | <Sabena Sema> idk if `-static` alone picks it up |
20:37:34 | FromDiscord | <michaelb> ucrt is definitely preferable, and has proper support for utf-8 |
20:37:44 | FromDiscord | <michaelb> msvcrt lacks that |
20:39:54 | FromDiscord | <Sabena Sema> tbh it should also be possible to link with msvcversion.dll to, in theory, but because that would mean you need to redistribute a nonfree file the mingw folks were never interested in supporting it, which is why the horrid and crufty msvcrt.dll was the default for so long |
20:40:20 | FromDiscord | <Sabena Sema> it also is non-broken under multithreading |
20:40:23 | FromDiscord | <Sabena Sema> and is faster |
20:41:33 | FromDiscord | <Sabena Sema> seriously msvcrt hasnt been updated except for extremely critical security issues since 1998 |
20:41:55 | FromDiscord | <michaelb> win 98 ftw |
21:15:32 | FromDiscord | <Isofruit> sent a code paste, see https://play.nim-lang.org/#ix=3LhU |
21:16:04 | FromDiscord | <Isofruit> I know I can iterate over the fields using the `fieldPair`iterator, but that gives me the field name as a string and the fieldvalue as a... wait I can just call fieldvalue.type() |
21:16:25 | FromDiscord | <Isofruit> (edit) "I know I can iterate over the fields using the `fieldPair`iterator, but that gives me the field name as a string and the fieldvalue as a... wait I can just call fieldvalue.type() ... " added "and compare that with my type" |
21:16:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LhV |
21:16:39 | FromDiscord | <Isofruit> That looks a lot simpler than what I had in mind |
21:17:05 | FromDiscord | <Isofruit> fields is defined for types? When I skimmed over the page for it, I only glimpsed one for strings |
21:17:24 | FromDiscord | <Isofruit> Wait no , that was the pairs iterator |
21:17:33 | FromDiscord | <Isofruit> Fuck my brain today, curse this log4j hell |
21:17:35 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/iterators.html#fields.i%2CT |
21:18:03 | FromDiscord | <Isofruit> Thanks Beef! |
21:18:33 | FromDiscord | <SirOlaf> Hey Beef, what do you think of my newest creation? https://github.com/nim-lang/Nim/issues/19335 |
21:19:38 | FromDiscord | <Elegantbeef> I mean not helpful compiler errors suck, but stuff like this is like "No stop it, dont hit yourself, oh no what will i do" |
21:20:05 | FromDiscord | <SirOlaf> Oh yeah, I agree, this is some very obscure stuff. But was funny to see what it did |
21:20:26 | FromDiscord | <Elegantbeef> I mean it's not exactly obscure as completely pointless 😀 |
21:20:43 | FromDiscord | <SirOlaf> The pointless part is allowing void in type declarations |
21:20:57 | FromDiscord | <Elegantbeef> Exactly |
21:21:25 | FromDiscord | <Elegantbeef> My point is more "Ok so void is 'allowed', but if you use it you're a purposely writing code that will not work" |
21:21:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LhY |
21:22:17 | FromDiscord | <Solitude> In reply to @SirOlaf "The pointless part is": its not entirely pointless, it only breaks if void is only field |
21:23:10 | FromDiscord | <SirOlaf> No, void never works |
21:23:12 | FromDiscord | <Elegantbeef> Attempting to instantiate void is the issue |
21:23:17 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3LhZ |
21:23:25 | FromDiscord | <SirOlaf> You cannot instantiate the void |
21:23:31 | FromDiscord | <Elegantbeef> I've used `distinct void` multiple times as a named flag |
21:23:44 | FromDiscord | <Elegantbeef> Void does work in typedefs |
21:24:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:24:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Li0 |
21:24:34 | FromDiscord | <Elegantbeef> Here's a valid use of void in a type def |
21:24:46 | FromDiscord | <Elegantbeef> We make a type that's usable as a flag to a parameter |
21:25:06 | FromDiscord | <Elegantbeef> You can also use void in a typeclass of course |
21:25:19 | FromDiscord | <Elegantbeef> Unless you meant object definitions |
21:25:41 | FromDiscord | <SirOlaf> When using void as a concrete type in a object definition it seems kinda pointless |
21:25:50 | FromDiscord | <Isofruit> Is there an iterator you can use directly on a type as opposed to an instance of a type? |
21:25:51 | FromDiscord | <Elegantbeef> It's 100% pointless |
21:26:15 | FromDiscord | <SirOlaf> Good, so I'm not just missing the intricacies of invalid types here |
21:26:41 | FromDiscord | <Elegantbeef> You just said typedef so i was pointing out there are valid usages |
21:26:44 | FromDiscord | <Elegantbeef> iso i dont think so |
21:26:59 | FromDiscord | <Elegantbeef> Why are you after that? |
21:27:41 | FromDiscord | <Solitude> `echo default (void,)` compiler really likes that |
21:28:08 | FromDiscord | <Isofruit> I'm just trying to see whether I can make the proc's signature look something like this:↵`a.getRelatedFieldName(B)` with a being an instance of A and B being the type B |
21:28:18 | FromDiscord | <SirOlaf> In reply to @Solitude "`echo default (void,)` compiler": Nice, another crash |
21:28:42 | FromDiscord | <Isofruit> Because that intuitively makes sense to me, as in, give me the field on B that is related to my instance of a |
21:29:19 | FromDiscord | <Isofruit> But I think I can still make that work by iterating over an empty instance, so just doing B() beforehand in the proc |
21:29:29 | FromDiscord | <Solitude> In reply to @Isofruit "Because that intuitively makes": you can do whatever you want |
21:29:44 | FromDiscord | <Solitude> just dont instantiate void |
21:29:57 | FromDiscord | <Isofruit> Too late, instructions unclear, deleted the internet |
21:39:12 | * | PMunch quit (Quit: leaving) |
21:42:38 | FromDiscord | <SirOlaf> Does typeRel seem right for this issue? https://github.com/nim-lang/Nim/issues/18845 |
21:42:44 | FromDiscord | <SirOlaf> Wanna try fixing some of them instead of creating more |
21:52:44 | * | zgasma[m] joined #nim |
21:54:04 | FromDiscord | <Elegantbeef> It could be |
21:54:10 | FromDiscord | <Elegantbeef> My dud of a PR might help though doubtful |
21:54:28 | FromDiscord | <SirOlaf> I saw it, but was in a completely different area from what I think is the issue |
21:55:05 | FromDiscord | <Elegantbeef> From what i could tell the dispatch just doesnt know about non ref inheritance so `tyObject -> tyObject` |
21:56:02 | FromDiscord | <Elegantbeef> I could be wrong about the issue |
21:56:21 | FromDiscord | <SirOlaf> typeRel returns isSubtype for it I think |
21:57:02 | FromDiscord | <Elegantbeef> Well good luck |
21:57:15 | FromDiscord | <Elegantbeef> If you need any back and forth you know where to find me 🙂 |
21:57:35 | FromDiscord | <SirOlaf> 👍 |
22:00:30 | FromDiscord | <Elegantbeef> Ah correction skipping `tyObject` brings you to the `tyGenericInst` which is why my solution works |
22:01:24 | FromDiscord | <Elegantbeef> In any other object case it doesnt skip or gets nil, in inheritance it's an `object -> genericInst -> (params, inheriting type)` |
22:02:33 | FromDiscord | <SirOlaf> That does sound correct |
22:04:38 | FromDiscord | <SirOlaf> So that's kinda fixed if you just reopen your pr. Gonna look at a different issue |
22:06:52 | FromDiscord | <Elegantbeef> I do have my doubts on if that's the best solution though |
22:08:59 | FromDiscord | <Elegantbeef> If you want a fun issue look at generic distincts borrowing |
22:09:08 | FromDiscord | <Elegantbeef> I looked at it a while and could not reason a good method |
22:09:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Lin |
22:10:33 | FromDiscord | <Elegantbeef> The issue here is that there first isnt a mechanism to know `MySeq[T]` is a generic distinct iirc, then also getting the symbol of the proc is complicated due to that |
22:11:15 | FromDiscord | <SirOlaf> That one does look pretty interesting |
22:11:40 | FromDiscord | <SirOlaf> Is it this one? https://github.com/nim-lang/Nim/issues/19097 |
22:11:51 | FromDiscord | <Elegantbeef> Yeppers |
22:14:22 | FromDiscord | <Elegantbeef> Further comments https://forum.nim-lang.org/t/8568#55770 |
22:16:59 | FromDiscord | <Elegantbeef> `./build_all.sh` on \nix |
22:16:59 | FromDiscord | <Elegantbeef> then you can do `./koch temp c ./someSourceFile.nim` |
22:16:59 | FromDiscord | <ynfle (ynfle)> How do I build koch to test my changes to nim locally? |
22:17:01 | FromDiscord | <ynfle (ynfle)> Where someSourceFile.nim is part of the standard lib? |
22:17:01 | FromDiscord | <ynfle (ynfle)> Thanks |
22:17:02 | FromDiscord | <Elegantbeef> I guess depends what you're testing |
22:17:02 | FromDiscord | <Elegantbeef> If you're testing the stdlib then yea, if you have a scenario you're testing then no |
22:17:15 | FromDiscord | <Elegantbeef> I generally fix semantic stuff so i have a file i just compile to see if anything changes |
22:17:59 | FromDiscord | <ynfle (ynfle)> I want to add to `json` |
22:18:01 | FromDiscord | <Elegantbeef> If you're just changing the stdlib, then you can just do `./koch test cat stdlib` iirc |
22:18:13 | FromDiscord | <ynfle (ynfle)> What's cat in this context? |
22:18:44 | FromDiscord | <Elegantbeef> It's short for category and is just to tell koch "i want to run all tests in X folder" |
22:18:52 | FromDiscord | <Elegantbeef> I dont recall/know if it's possible to run single tests |
22:19:10 | FromDiscord | <ynfle (ynfle)> Ok |
22:23:09 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "The issue here is": Just seems like it's impossible to borrow generic functions in general |
22:24:14 | FromDiscord | <SirOlaf> (edit) "In reply to @Elegantbeef "The issue here is": Just seems like it's impossible to borrow generic functions ... in" added "to generic types" |
22:26:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Liu |
22:26:18 | FromDiscord | <SirOlaf> That's because B is concrete |
22:26:54 | FromDiscord | <Elegantbeef> Then yes it's presently impossible for generic distincts to borrow operations |
22:27:10 | FromDiscord | <Elegantbeef> That's what that issue comes to |
22:29:22 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3Liv |
22:29:39 | FromDiscord | <SirOlaf> Although I'm not sure if it should |
22:30:07 | FromDiscord | <SirOlaf> (edit) "https://play.nim-lang.org/#ix=3Liv" => "https://play.nim-lang.org/#ix=3Liw" |
22:30:26 | FromDiscord | <SirOlaf> (edit) "https://play.nim-lang.org/#ix=3Liw" => "https://play.nim-lang.org/#ix=3Lix" |
22:32:23 | FromDiscord | <Elegantbeef> It should |
22:32:52 | FromDiscord | <Elegantbeef> Adding type information does not change the base |
22:38:17 | FromDiscord | <SirOlaf> What does `$.T`mean |
22:38:22 | FromDiscord | <SirOlaf> (edit) "`$.T`mean" => "`$.T` mean" |
22:38:46 | FromDiscord | <SirOlaf> Is that just for internal substitution or something? |
22:38:53 | FromDiscord | <Elegantbeef> `$T`? |
22:39:14 | FromDiscord | <SirOlaf> Printed fn.typ in searchForBorrowProc which gave `proc (a: B[$.T]): string` |
22:39:26 | FromDiscord | <Elegantbeef> `$` is the stringification operator in Nim |
22:39:39 | FromDiscord | <SirOlaf> That I do know |
22:39:48 | FromDiscord | <Elegantbeef> Seems `$` is leaking into the generic parameter |
22:40:08 | FromDiscord | <SirOlaf> So no special meaning in this context? |
22:40:25 | FromDiscord | <Elegantbeef> Well `$.T` == `$(T)` |
22:41:05 | FromDiscord | <SirOlaf> sent a code paste, see https://paste.rs/HIH |
22:41:33 | FromDiscord | <Elegantbeef> You're welcome 😀 |
22:42:03 | FromDiscord | <SirOlaf> Is this even an issue then |
22:42:41 | FromDiscord | <SirOlaf> Seems more like bad documentation at best |
22:42:48 | FromDiscord | <SirOlaf> (edit) "best" => "worst" |
22:43:43 | FromDiscord | <Elegantbeef> well we cannot do `$(b: B[int]): string {.borrow.}` `$(b: B[float]): string = "Hello"` |
22:44:33 | FromDiscord | <Elegantbeef> So i guess this is a possible non issue just needs a better error message to use a composite type class |
22:45:06 | FromDiscord | <SirOlaf> This works too though |
22:45:06 | FromDiscord | <Elegantbeef> Actually the two procs in the example are atrocious to write |
22:45:08 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3LiA |
22:45:57 | FromDiscord | <SirOlaf> No wonder you didn't find a solution if it isn't broken in the first place |
22:46:07 | FromDiscord | <Elegantbeef> I mean look at the example code again |
22:46:17 | FromDiscord | <Elegantbeef> We have a generic distinct we want to borrow operation for |
22:46:23 | FromDiscord | <SirOlaf> Oh |
22:46:33 | FromDiscord | <SirOlaf> Yeah, that works too |
22:47:14 | FromDiscord | <Elegantbeef> How? |
22:47:21 | FromDiscord | <Elegantbeef> Or do we just do `auto` everywhere |
22:47:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3LiC |
22:48:04 | FromDiscord | <SirOlaf> Don't know if I'm still misunderstanding https://play.nim-lang.org/#ix=3LiD |
22:49:56 | FromDiscord | <Elegantbeef> It doesnt work for uninstantiated generics |
22:50:26 | FromDiscord | <Elegantbeef> You might say "makes sense" but that means it requires manually making operations for any instantiated type |
22:55:22 | FromDiscord | <Elegantbeef> Basically from my recollection we need to know that `DefaultTable[A, B]` is a distinct, get the symbol add it to the generic proc, then not instantiate the body on the generic procs instantiation |
22:55:35 | FromDiscord | <Elegantbeef> The hard part was the knowing it was a distinct and getting the original symbol |
22:57:48 | * | pro quit (Quit: WeeChat 3.4) |
22:57:49 | FromDiscord | <SirOlaf> I see now |
22:58:31 | FromDiscord | <SirOlaf> Ah yes `proc [missing parameters](t: var DefaultTable, key: A, val: B): var B` |
22:58:44 | FromDiscord | <Elegantbeef> Lol |
23:03:40 | FromDiscord | <Elegantbeef> I think the issue was along the lines of "we now know this is a distinct, but `semOverloadedCall` get's a type instead of an instantiated type, so doesnt get the symbol" |
23:05:39 | FromDiscord | <SirOlaf> Seems correct, it can't resolve it |
23:16:29 | FromDiscord | <SirOlaf> It is tyGenericInvocation instead of tyDistinct |
23:21:49 | FromDiscord | <SirOlaf> Can you just call like newType on it |
23:22:21 | FromDiscord | <SirOlaf> Probably not, but there must be something to resolve generics, right? |
23:23:32 | FromDiscord | <Elegantbeef> My idea was going to be look up the procedure name check if the generic constrains match and all the types match, if so use that |
23:23:36 | FromDiscord | <Elegantbeef> But i couldnt reason that |
23:24:33 | FromDiscord | <SirOlaf> Feels like it would be easier to just fix the distinct check |
23:27:25 | * | yitr joined #nim |
23:29:41 | FromDiscord | <SirOlaf> May have a solution |
23:37:42 | FromDiscord | <SirOlaf> Yeah, so I do have a solution |
23:37:49 | FromDiscord | <SirOlaf> But it probably works only for this scenario |
23:39:10 | FromDiscord | <SirOlaf> The info about these generic types is buried a lot deeper than normal |
23:40:40 | FromDiscord | <SirOlaf> It also only seems to "fix" the first part of the issue |
23:43:07 | * | yitr quit (Quit: Client closed) |
23:43:48 | FromDiscord | <Elegantbeef> Yea you will have to not instantiated the proc body if the body is a symbol |
23:43:55 | FromDiscord | <Elegantbeef> So do you have it getting the proper sym? |
23:44:29 | FromDiscord | <SirOlaf> I have something, but not quite sure what exactly I have |
23:45:09 | FromDiscord | <SirOlaf> Can figure out if it's distinct for this specific case by going to t[0].lastSon (obviously check type and length before) |
23:52:05 | * | vicfred joined #nim |
23:53:47 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3Lj2 |
23:54:30 | FromDiscord | <Elegantbeef> Ah yes you're at the part i had issue now 😀 |
23:54:35 | FromDiscord | <SirOlaf> Nice |
23:54:45 | FromDiscord | <SirOlaf> So what is the issue starting here? |
23:54:48 | FromDiscord | <Elegantbeef> SemOverloaded call is now attempting to call with the type |
23:55:09 | FromDiscord | <Elegantbeef> The uninstantiated generic does not allow you to get a resolved symbol |
23:55:31 | FromDiscord | <Elegantbeef> In this case was where my reasoning was to "check all symbols of name and find the one that matches" manually |
23:55:57 | FromDiscord | <Elegantbeef> Since this is a borrow of a generic we do not want to call, but we want to find a symbol of a specific kind |
23:57:13 | FromDiscord | <SirOlaf> Are you sure about that |
23:57:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Lj4 |
23:57:19 | FromDiscord | <Elegantbeef> I now wonder if that'd be the solution |
23:57:35 | FromDiscord | <Elegantbeef> to make the body be `(proc(args)) symName` |
23:58:16 | FromDiscord | <Elegantbeef> I dont know if you know how borrows work |
23:58:41 | FromDiscord | <SirOlaf> Not in detail |
23:58:48 | FromDiscord | <SirOlaf> Just going off of what I see |
23:58:57 | FromDiscord | <Elegantbeef> They do not copy code, what they do is store the symbol inside the proc body, and then on `transf` the turn into a call to the base proc, reducing binary size and reducing indirection |
23:59:17 | FromDiscord | <Elegantbeef> So any proc annotated with borrow does not exist past `transf` iirc |