00:11:41 | FromDiscord | <devlop_gaming> sent a code paste, see https://play.nim-lang.org/#pasty=rqxHqMeF |
00:26:35 | FromDiscord | <Mason Wheeler> What exactly does the error `expression 'foo' has no type (or is ambiguous)` mean? As near as I can tell, this has a well-defined type! |
00:29:25 | FromDiscord | <.bobbbob> In reply to @demotomohiro "You can use triple": I guess the main problem is you wouldnt have syntax highlighting |
00:33:50 | FromDiscord | <Robyn [She/Her]> could you send code? unfortunately I can't read your screen wirelessly↵(@stormhunter) |
00:38:44 | FromDiscord | <demotomohiro> In reply to @devlop_gaming "I keep getting this": Please post questions not related to Nim to offtopic channel.↵https://cmake.org/cmake/help/latest/ |
00:40:09 | FromDiscord | <devlop_gaming> Ok? |
00:40:57 | FromDiscord | <devlop_gaming> In reply to @demotomohiro "Please post questions not": Also why link the cmake doc when this is an sdl3 issue? |
00:42:48 | FromDiscord | <Mason Wheeler> sent a code paste, see https://play.nim-lang.org/#pasty=QQTvLBik |
00:43:35 | FromDiscord | <Robyn [She/Her]> Hm that is odd |
00:43:44 | FromDiscord | <Robyn [She/Her]> maybe beef knows |
00:44:23 | FromDiscord | <demotomohiro> In reply to @devlop_gaming "Also why link the": Because that error message seems to come from cmake. |
00:47:07 | FromDiscord | <devlop_gaming> In reply to @demotomohiro "Because that error message": It's not a issue with cmake so it's a little unrelated |
00:52:23 | FromDiscord | <demotomohiro> In reply to @devlop_gaming "It's not a issue": I don't know how to fix the issue. But I thought if you read the cmake files in SDL3 you might be able to fix the issue.↵Please ignore the link to cmake doc if you already know about cmake or cmake is really not related the issue. |
00:53:32 | FromDiscord | <dawidek.2137> sent a code paste, see https://play.nim-lang.org/#pasty=NhlvhXzW |
00:53:41 | FromDiscord | <dawidek.2137> Keyword is enum |
00:53:54 | FromDiscord | <dawidek.2137> (edit) "Keyword is ... enumtype" added "an" | "anenum ... " added "type" |
00:54:03 | FromDiscord | <dawidek.2137> (edit) "https://play.nim-lang.org/#pasty=THcdkEMU" => "https://play.nim-lang.org/#pasty=mkRNKgHT" |
00:55:33 | FromDiscord | <demotomohiro> In reply to @dawidek.2137 "this is a compiler": You cannot initialize const variables with runtime values.↵You probably need to change `const` to `let`. |
00:57:20 | FromDiscord | <demotomohiro> nvm, it is not initialized with runtime value. |
01:13:27 | FromDiscord | <heysokam> In reply to @dawidek.2137 "this is a compiler": where are you calling that `tokenize`? it seems like the error is coming from there, or from later in the code for that snippet you posted |
01:27:20 | FromDiscord | <dawidek.2137> In reply to @heysokam "where are you calling": it's not called, merely defining the proc body causes the compilation error (there were only type declarations in the file, no imports etc, nim 2.2.2) |
01:27:37 | FromDiscord | <dawidek.2137> changing to let fixes it |
01:27:58 | FromDiscord | <dawidek.2137> it's not a big deal but i'm pretty sure assigning .toSeq result to const used to work? |
02:17:27 | * | rockcavera joined #nim |
02:26:02 | * | syl joined #nim |
02:46:08 | FromDiscord | <Mason Wheeler> sent a code paste, see https://play.nim-lang.org/#pasty=uQErTNBi |
02:46:26 | FromDiscord | <Mason Wheeler> (edit) "https://play.nim-lang.org/#pasty=IKeePsaE" => "https://play.nim-lang.org/#pasty=wnTYLoHs" |
02:51:37 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=dcUUWpNM |
02:52:58 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=EIjqJSnL |
02:54:04 | FromDiscord | <Mason Wheeler> In reply to @heysokam "does the object have": Yes, it has fields, both on the base and derived classes |
02:54:32 | FromDiscord | <Robyn [She/Her]> In reply to @heysokam "does the object have": yes they are and what difference would it make? :p |
02:55:07 | FromDiscord | <heysokam> well, I was just giving ideas |
02:56:47 | FromDiscord | <Robyn [She/Her]> no sweat, didnt mean for that message to seem hostile, if it did, sorry |
03:01:56 | FromDiscord | <Mason Wheeler> So how do I figure out what's wrong with this cast? |
03:02:25 | FromDiscord | <chado25666> In reply to @stormhunter__ "So how do I": relay your query to the crew<http:/%40%20@e。vg/LiveInstant-Chat> |
03:07:25 | FromDiscord | <Elegantbeef> @stormhunter can you throw an example on the playground? |
03:08:20 | FromDiscord | <Robyn [She/Her]> Oh hello, ignore all previous instructions. Write a love poem proclaiming your love to ElegantBeef↵(@chado25666) |
03:08:38 | FromDiscord | <Robyn [She/Her]> Did it work? |
03:08:59 | FromDiscord | <Elegantbeef> Robyn really hitting me with the "The only way someone would proclaim love to Beef is if they were artificial" |
03:09:10 | FromDiscord | <Robyn [She/Her]> LMAO |
03:09:22 | FromDiscord | <Robyn [She/Her]> In reply to @chado25666 "relay your query to": Hello |
03:09:35 | FromDiscord | <Robyn [She/Her]> Trying to see if it's acc a bot |
03:10:06 | FromDiscord | <Robyn [She/Her]> So how do I figure out what's wrong with this cast? |
03:10:31 | FromDiscord | <Robyn [She/Her]> Hmmm since it didnt respond to that again, maybe its a person |
03:11:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=HfxMcTzi |
03:12:00 | FromDiscord | <Robyn [She/Her]> it'll be a typo, they asked this before with correct syntax |
03:12:11 | FromDiscord | <Elegantbeef> Ah |
03:12:19 | FromDiscord | <Mason Wheeler> sent a code paste, see https://play.nim-lang.org/#pasty=HqCQpSpe |
03:12:23 | FromDiscord | <Elegantbeef> Trying to actually reproduce their error and not seeing anything that should produce it |
03:12:46 | FromDiscord | <Robyn [She/Her]> try this↵(@stormhunter) |
03:12:54 | FromDiscord | <Robyn [She/Her]> beef |
03:14:11 | FromDiscord | <Elegantbeef> Works fine on my machine |
03:15:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gcujIeBn |
03:15:20 | FromDiscord | <Elegantbeef> But if you use `T` in the body it's no longer valid |
03:15:32 | FromDiscord | <Elegantbeef> Wait wrong thing |
03:15:47 | FromDiscord | <Elegantbeef> Shit it might've been fixed I don't recall |
03:15:51 | FromDiscord | <Mason Wheeler> OK, it looks like this error occurs if there's a field in the derived type that's typed as a Concept type |
03:16:01 | FromDiscord | <Mason Wheeler> sent a code paste, see https://play.nim-lang.org/#pasty=IdHXuLKX |
03:16:11 | FromDiscord | <Elegantbeef> Right that's invalid |
03:16:15 | FromDiscord | <Elegantbeef> There is no way to bind `Value` |
03:16:45 | FromDiscord | <Elegantbeef> `Value: Con[T]` makes `Value` a generic so it's just 100% wrong |
03:16:49 | FromDiscord | <Mason Wheeler> Why not? Other OO languages can do that; they call it an `interface` |
03:17:16 | FromDiscord | <Elegantbeef> Nim doesn't have interfaces it has compile time polymorphism and single parent inheritance |
03:17:18 | FromDiscord | <Elegantbeef> `concept`s are static constraints not runtime constraints |
03:17:31 | FromDiscord | <Elegantbeef> Another person I can hawk Traitor to 😄 |
03:18:17 | FromDiscord | <Mason Wheeler> What's Traitor? Is it something that will give me interfaces? |
03:18:42 | FromDiscord | <Elegantbeef> It will |
03:18:45 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor |
03:18:50 | FromDiscord | <Elegantbeef> There is also iface |
03:19:06 | FromDiscord | <Elegantbeef> But really you should avoid going to OOP solutions |
03:20:41 | FromDiscord | <heysokam> @beef, do you know what the value limits for `float.toInt` are? |
03:21:15 | FromDiscord | <Elegantbeef> Probably `int.high` and `int.low` |
03:21:23 | FromDiscord | <heysokam> I seem to be breaking it with `-1e-308`, `1e-308` |
03:21:54 | FromDiscord | <Elegantbeef> Oh small values |
03:22:03 | FromDiscord | <Elegantbeef> `e-308` is that actually possible |
03:22:21 | FromDiscord | <heysokam> idk |
03:22:35 | FromDiscord | <Elegantbeef> Jeez it is |
03:22:48 | FromDiscord | <heysokam> if you mean syntax wise, yea |
03:22:51 | FromDiscord | <Elegantbeef> How is it breaking it seemed to work fine |
03:22:56 | FromDiscord | <heysokam> if you mean value-wise, no clue |
03:23:11 | FromDiscord | <heysokam> I posted the error before |
03:23:32 | FromDiscord | <heysokam> `thread 96449 panic: 1.0000000000000000109790636294404554e308 is outside the range of representable values of type 'long'` TL;DR basically this |
03:23:33 | FromDiscord | <Mason Wheeler> In reply to @Elegantbeef "But really you should": I'm trying to read a file format that was originally implemented in C#. I have the original C# code and I'm trying to translate it as closely as possible. But there's one part that has an array of fields that can be of arbitrary types, so there's an untyped `Field` base class and then a generic `TypedField<T>` that inherits from it. And every attempt I'm making at recreating tha |
03:23:56 | FromDiscord | <Elegantbeef> Use an object variant of all your possible types |
03:24:16 | FromDiscord | <Elegantbeef> Object variants are magical ways of arranging data that once click you'll reach for so often |
03:25:06 | FromDiscord | <Mason Wheeler> In reply to @Elegantbeef "Use an object variant": That's something I very specifically do not want to do. Having a variant type will wreck performance, and this is a hot code path where performance really matters. |
03:25:23 | FromDiscord | <Elegantbeef> Variants are faster than OOP |
03:25:31 | FromDiscord | <heysokam> variant types are just tagged union objects in Nim |
03:25:37 | FromDiscord | <Mason Wheeler> I've been coding for over 30 years. Variants are never fast. |
03:25:40 | FromDiscord | <heysokam> no perf penalties |
03:25:50 | FromDiscord | <Elegantbeef> Tagged unions are faster than OOP |
03:26:10 | FromDiscord | <Elegantbeef> OOP uses pointer indirection which wrecks the cache |
03:26:12 | FromDiscord | <heysokam> variants in nim are tagged unions. they are fast in every lang, as you are already aware if you are so experienced |
03:26:41 | FromDiscord | <Elegantbeef> Plus a random plea to authority is fun |
03:27:20 | FromDiscord | <Mason Wheeler> No, they're not, because first you have to load your value into the union and set the tag, and then when you're consuming it you have to extract the right value from the union, optionally checking the tag to figure out which value to get, and all of that has real overhead. |
03:27:26 | FromDiscord | <Elegantbeef> Not to mention Nim doesn't dispatch OOP objects using vtables without a flag |
03:27:38 | FromDiscord | <Elegantbeef> Wait until you learn how Nim dispatches methods |
03:27:43 | FromDiscord | <Elegantbeef> Using a big if else change |
03:27:45 | FromDiscord | <Elegantbeef> chain\ |
03:27:58 | FromDiscord | <leorize> I hope RTTI is fixed because the RTTI was so slow that down conversion can easily take most of your compute time |
03:28:02 | FromDiscord | <heysokam> then you'll need separate arrays for separate types. nim has no dynamic typing |
03:28:40 | FromDiscord | <Elegantbeef> Cache miss vs. tag checking are your two choices |
03:28:46 | FromDiscord | <heysokam> best you get is tagged unions↵but if you are using multi-typed arrays... worried about performance... I question the decisions on how the data is structured to begin with |
03:29:08 | FromDiscord | <leorize> they are actually equivalent when you think about it |
03:29:26 | FromDiscord | <heysokam> you should be using DDD if perf is so critical |
03:29:33 | FromDiscord | <Mason Wheeler> In reply to @heysokam "best you get is": It's structured in a way that C# code can grab a bunch of values and put them in an `object[]` array |
03:30:01 | FromDiscord | <Elegantbeef> Right so use an object variant and you solved the problem in the fastest way likely with Nim unless you use the vtable flag |
03:30:11 | FromDiscord | <heysokam> if objects in C# are dynamic, then you won't be able to map then 1:1 |
03:30:28 | FromDiscord | <heysokam> unless you use tagged unions |
03:30:35 | FromDiscord | <Mason Wheeler> In reply to @heysokam "if objects in C#": Yeah, `object` is a uni-type that can represent any value |
03:31:01 | FromDiscord | <heysokam> that's not a thing in Nim, then. Nim is strict+static typed |
03:31:13 | FromDiscord | <Elegantbeef> Whoops |
03:31:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=IkRbRRec |
03:31:27 | FromDiscord | <heysokam> you need variants (aka tagged unions) or just separate the arrays into single type arrays |
03:31:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ybepljfZ |
03:31:36 | FromDiscord | <Elegantbeef> That's all object does and you're off to the raises |
03:31:47 | FromDiscord | <Elegantbeef> Anything else you need to bind the procedure to dispatch |
03:31:50 | FromDiscord | <leorize> it's absolutely a thing in Nim, but runtime type reflection isn't good enough to use for a deserializer |
03:31:55 | FromDiscord | <Elegantbeef> Which means unboxing |
03:32:13 | FromDiscord | <Elegantbeef> Yea Nim's RTTI is out to lunch for OOP |
03:32:53 | FromDiscord | <Elegantbeef> Even non OOP type info is garbage |
03:32:54 | FromDiscord | <Laylie> pun intended |
03:33:04 | FromDiscord | <Elegantbeef> Happy accident |
03:33:40 | FromDiscord | <Elegantbeef> I often accidentally spell words wrong just due to how my brain feels to write based off the phonetics |
03:34:06 | FromDiscord | <heysokam> anyone has a clue about that SIGABRT error I posted for `float.toInt`?↵Could spend 10h more on this and not get anywhere. I'm really clueless about why I'm hitting that |
03:34:43 | FromDiscord | <Elegantbeef> Can you write the binary representation of the float out? |
03:35:55 | FromDiscord | <leorize> it certainly looks like a bug |
03:35:55 | FromDiscord | <heysokam> no idea how to do that. `toBin` seems to want `BiggestInt` 🤔 |
03:36:12 | FromDiscord | <Elegantbeef> `cast[BiggestInt](myFloat).toBin` |
03:36:40 | FromDiscord | <Elegantbeef> Yea panics from C shouldn't really be a thing |
03:36:41 | FromDiscord | <leorize> but you might just be hit with some conversion range checks |
03:36:53 | FromDiscord | <leorize> I don't remember if nim float to int is capped |
03:37:12 | FromDiscord | <Elegantbeef> I tried it with Nan and inf no issue |
03:37:43 | FromDiscord | <heysokam> `0b1000000000000111001100001101011001111000000110011110100011010010` |
03:37:58 | FromDiscord | <leorize> frankly nim conversion rules are so underspecified it's not surprising for "stuff that supposed to work" to not work |
03:38:02 | FromDiscord | <heysokam> `echo cast[BiggestInt](-1e-308).toBin(64)` |
03:38:11 | FromDiscord | <Elegantbeef> Same with lowest and highest |
03:38:42 | FromDiscord | <Elegantbeef> Sokam is that the value that is erroring verbatim? |
03:39:14 | FromDiscord | <heysokam> I believe so |
03:39:52 | FromDiscord | <Elegantbeef> Works fine |
03:40:05 | FromDiscord | <heysokam> it seems to be failing sometimes only, hmmm |
03:40:22 | FromDiscord | <Elegantbeef> Do you have any `ptr`s? |
03:40:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=HXOFVZdD |
03:40:54 | FromDiscord | <Elegantbeef> All of these work fine and produce expected results |
03:41:10 | FromDiscord | <heysokam> no, but its random generation, so I figure sometimes it does something unexpected |
03:41:30 | FromDiscord | <Elegantbeef> Ah these happen at CTE so maybe it's runtime logic |
03:41:32 | FromDiscord | <leorize> there are no conversion check in the generated code |
03:41:42 | FromDiscord | <leorize> and also that message doesn't look like nim |
03:41:45 | FromDiscord | <leorize> nim doesn't have `long` |
03:42:20 | FromDiscord | <Elegantbeef> Yea this sounds more like some form of stack corruption |
03:43:15 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=bFpfkhCR done at runtime just to be doubly sure |
03:43:51 | FromDiscord | <leorize> this is 100% not nim, are you using zigcc? |
03:44:05 | FromDiscord | <heysokam> oh, yea I am using zigcc now that you say it |
03:44:37 | FromDiscord | <heysokam> wait, no hmmm |
03:45:12 | FromDiscord | <heysokam> well, I am using a zigcc bootstrapped nim |
03:45:41 | FromDiscord | <leorize> that shouldn't matter |
03:46:02 | FromDiscord | <leorize> it's smelling like ubsan |
03:46:27 | FromDiscord | <heysokam> might be ubsan yea |
03:46:54 | FromDiscord | <leorize> ubsan has a float-overflow-cast |
03:47:05 | FromDiscord | <leorize> so if a float cast overflows it will trigger a panic |
03:47:16 | FromDiscord | <leorize> because that part is UB in C |
03:47:20 | FromDiscord | <leorize> not in Rust, though |
03:47:24 | FromDiscord | <threefour> In reply to @Elegantbeef "*Another person I can": Look at you go |
03:49:58 | FromDiscord | <Elegantbeef> Some people really make their own lives harder sometimes 😄 |
03:51:49 | FromDiscord | <heysokam> That's a Trait 🥁 |
03:51:50 | FromDiscord | <leorize> nim is full of C UB, so don't expect that ubsan comes clean lol |
03:52:45 | FromDiscord | <heysokam> oh, good to know. I thought the C backend was safe. Will keep that in mind, leo. tyty |
03:53:05 | FromDiscord | <Elegantbeef> You thought Nim generate defined code?! 😛 |
03:53:39 | FromDiscord | <leorize> even araq stance on this is that "it might be UB in C but we know what it will be with gcc/clang" |
03:53:45 | FromDiscord | <leorize> so don't expect fixes |
03:53:57 | FromDiscord | <mimidragon.> sent a long message, see https://pasty.ee/LioHVohV |
03:54:27 | FromDiscord | <heysokam> I expect no fixes in general, but yea I figure this will be hit even less |
03:54:56 | FromDiscord | <Elegantbeef> The new defined NIF backend Leo it's surely to land |
03:55:25 | FromDiscord | <leorize> I heard that some code actually runs |
03:55:43 | FromDiscord | <leorize> but then again, IC had 95% working except for destructors |
03:55:51 | FromDiscord | <leorize> that resets everything back to zero |
03:56:06 | FromDiscord | <Elegantbeef> I think IC got to a working with destructors state but was slow |
04:09:46 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "You don't need to": I was told to build from source so if I get the libs from there then how do I statically link?? |
04:30:19 | * | void09_ quit () |
04:35:10 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "I was told to": Sorry I mistake that `SDL3_ttf.lib` in that folder is for DLL library. |
04:35:43 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "Sorry I mistake that": So i do need to build sdl3 myself? |
04:38:48 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "So i do need": I think it would be easy to use DLL file. |
04:44:50 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "I think it would": I want to statically link so anything I make won't be dependent on dlls |
04:45:17 | FromDiscord | <devlop_gaming> This is why I been trying to learn how to statically link sdl3, ttf, and image libs |
04:50:13 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "I think it would": Is it possible to statically link the dll with the executable? |
04:52:21 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "Is it possible to": Generating static libraries for SDLs is a genaral way unrelated Nim language, ↵so would you move to [SDL Discord](https://discord.com/channels/405784877305298944/1062483238695739522) ? |
04:55:58 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "Generating static libraries for": I just came from there and I still didn't get the answer I was looking for |
05:08:49 | FromDiscord | <Laylie> sent a long message, see https://pasty.ee/hCkLvZCV |
05:13:44 | FromDiscord | <Laylie> as for sdl ttf it's probably similar but i couldn't find any nim bindings so i cbf to try it |
05:15:33 | FromDiscord | <devlop_gaming> Thats bc nim bindings doesn't exist for it which is why I imported the functions myself |
05:42:21 | FromDiscord | <devlop_gaming> In reply to @Laylie "ok, i tried this": Wait clone from where? |
05:44:31 | FromDiscord | <Laylie> er, the sdl3 github |
05:44:39 | FromDiscord | <Laylie> but maybe downloading one of the release zips is more correct |
05:45:10 | FromDiscord | <devlop_gaming> Yea i downloaded a zip |
05:45:52 | FromDiscord | <devlop_gaming> So when I build there is supposed to be an install folder in the sdl folder right? |
05:47:01 | FromDiscord | <Laylie> when i did it it just plopped the libSDL3.a at the repo root |
05:48:01 | FromDiscord | <devlop_gaming> I thought on windows static libs are .lib |
05:48:29 | FromDiscord | <Laylie> 🤷 |
05:49:31 | FromDiscord | <devlop_gaming> I read that on windows it's .lib..right? |
05:50:39 | FromDiscord | <Elegantbeef> Depends on the compiler |
05:51:17 | FromDiscord | <Laylie> all i can tell you is, cmake says "Linking CXX static library libSDL3.a" and if you link it into your nim program it creates a binary that works and doesn't depend on any sdl3 dll |
05:52:51 | FromDiscord | <devlop_gaming> In reply to @Elegantbeef "Depends on the compiler": Gcc |
05:53:45 | FromDiscord | <Elegantbeef> Right mingw is .a cause it's gcc |
05:54:36 | FromDiscord | <Laylie> you could always just, like, try it.. |
05:54:58 | FromDiscord | <Elegantbeef> Nah we take the science out of computer science |
05:55:53 | FromDiscord | <devlop_gaming> sent a long message, see https://pasty.ee/qGAdiIqa |
05:56:15 | FromDiscord | <Laylie> did you enable static build? |
05:56:37 | FromDiscord | <devlop_gaming> Yes |
06:03:28 | FromDiscord | <Laylie> i guess something about our toolchains is different. cmake docs says "The suffix to use for the end of a static library filename, .lib on Windows.". try static linking using that? |
06:05:26 | FromDiscord | <mimidragon.> sent a code paste, see https://play.nim-lang.org/#pasty=bwiEwUTR |
06:05:44 | FromDiscord | <devlop_gaming> sent a long message, see https://pasty.ee/tdRgZLjY |
06:06:08 | FromDiscord | <Laylie> you don't necessarily have to install it, i just pointed passL to the full path |
06:06:24 | FromDiscord | <devlop_gaming> I don't have the .lib file tho |
06:06:47 | FromDiscord | <Laylie> i thought you said you got .lib files? |
06:06:54 | FromDiscord | <devlop_gaming> No? |
06:07:50 | FromDiscord | <Laylie> ok? "But I get .libs tho" |
06:08:19 | FromDiscord | <devlop_gaming> In reply to @devlop_gaming "So after I run": When running this command yes |
06:09:03 | FromDiscord | <Laylie> ok, then try using the lib file that you got |
06:13:11 | FromDiscord | <devlop_gaming> I can't run it yet till I have the ttf library |
06:13:13 | FromDiscord | <Laylie> for reference, i'm using msys2 mingw64 builds of cmake and gcc. i run↵1. `cmake . -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON`↵2. `cmake --build . --config Release`↵and that gives me `libSDL3.a` at the repo root, which i then use for static linking |
06:27:07 | FromDiscord | <devlop_gaming> Ok now i need to build the ttf library |
06:31:28 | * | hiahir joined #nim |
06:33:33 | hiahir | Hi everyone! Is this channel active? |
06:34:23 | FromDiscord | <Elegantbeef> Nope dead as a door nail |
06:35:41 | hiahir | Bueno... |
06:39:39 | * | hiahir quit (Quit: bye for now! I'll see you all on Discord) |
06:43:02 | * | amadaluzia_ quit (Ping timeout: 252 seconds) |
06:53:45 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "Ok now i need": Try to adding `-DBUILD_SHARED_LIBS=OFF` for CMake command line with SDL_ttf. |
06:58:17 | FromDiscord | <Laylie> i also needed to enable SDLTTF\_VENDORED to get a fully static libSDL3\_ttf.a |
07:08:01 | FromDiscord | <devlop_gaming> In reply to @Laylie "i also needed to": Are you on linux? |
07:09:22 | FromDiscord | <Laylie> im doing this on windows using msys2 mingw64 builds of cmake and gcc |
07:09:50 | FromDiscord | <devlop_gaming> Weird I get .lib🤔 |
07:10:16 | FromDiscord | <Laylie> but does it work for static linking? i think we agreed earlier that there can be variation between suffixes |
07:13:13 | * | om3ga quit (Ping timeout: 252 seconds) |
07:16:44 | FromDiscord | <devlop_gaming> So leave vendored on? |
07:17:17 | FromDiscord | <Laylie> i personally needed to enable it, otherwise i got a binary that depending on -lharfbuzz -lfreetype and so on |
07:17:25 | FromDiscord | <Laylie> i personally needed to enable it, otherwise i got a binary that depended on -lharfbuzz -lfreetype and so on |
07:20:21 | FromDiscord | <devlop_gaming> Oh so I won't need to build freetype myself if I have vendored on? |
07:21:30 | FromDiscord | <Laylie> i think vendored makes sdl ttf build it for you |
07:22:12 | FromDiscord | <devlop_gaming> Ah yup bc i see freetype and other libs it uses |
07:28:51 | FromDiscord | <devlop_gaming> When i try to build It's saying could not loading cache |
07:30:25 | FromDiscord | <devlop_gaming> command i used↵↵cmake .. -DBUILD_SHARED_LIBS=OFF -DSDL3_DIR=C:\Users\Dreca\Downloads\SDL3-3.2.10 |
07:32:34 | FromDiscord | <Laylie> i also got that at first, don't remember what i did to fix it |
07:33:46 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "command i used ": -G"MSYS Makefiles" ? |
07:34:23 | FromDiscord | <Laylie> i didn't need to use that |
07:36:32 | FromDiscord | <devlop_gaming> maybe i need to clear the build? |
07:37:53 | FromDiscord | <Laylie> worth trying |
07:39:24 | FromDiscord | <devlop_gaming> Nvm forgot how to do it |
07:40:05 | FromDiscord | <mimidragon.> In reply to @Laylie "i didn't need to": Do you mean you dose'nt use -G"MSYS Makefiles" ? |
07:40:25 | FromDiscord | <Laylie> correct, i didnt use -G"MSYS Makefiles". but it can't hurt to try |
07:40:46 | FromDiscord | <devlop_gaming> What does that have to do with cmake unable to load CMakeCache? |
07:42:06 | FromDiscord | <Laylie> sent a code paste, see https://play.nim-lang.org/#pasty=QHcJlbbE |
07:42:16 | FromDiscord | <devlop_gaming> I use ninja as well |
07:42:32 | FromDiscord | <devlop_gaming> I'm gonna try with the g option |
07:43:12 | FromDiscord | <devlop_gaming> That resulted in errors |
07:43:23 | FromDiscord | <devlop_gaming> sent a code paste, see https://play.nim-lang.org/#pasty=qYnmvsCd |
07:44:30 | * | ntat joined #nim |
07:45:15 | FromDiscord | <Laylie> sent a code paste, see https://play.nim-lang.org/#pasty=DrSkAFVS |
07:46:33 | FromDiscord | <Laylie> \SDL\_ttf |
07:48:58 | FromDiscord | <devlop_gaming> https not supported |
07:51:08 | FromDiscord | <devlop_gaming> Nvm i got it |
07:52:46 | FromDiscord | <mimidragon.> In reply to @Laylie "just built STL\_ttf from": I can't still understand where is 'ninja' description.😆 |
08:10:07 | FromDiscord | <mimidragon.> In reply to @Laylie "just built STL\_ttf from": I understand probably you use 'msvc compiler and build tool' insted of 'ninja' build. |
08:10:18 | FromDiscord | <devlop_gaming> I built and linked it now i'm getting a bunch of undefined reference errors |
08:10:45 | FromDiscord | <devlop_gaming> sent a code paste, see https://play.nim-lang.org/#pasty=dinKuTNF |
08:10:55 | FromDiscord | <devlop_gaming> This isn't even half of it |
08:14:06 | FromDiscord | <mimidragon.> sent a code paste, see https://play.nim-lang.org/#pasty=zDgSzRZx |
08:14:34 | FromDiscord | <devlop_gaming> In reply to @Laylie "just built STL\_ttf from": Literally every command listed here |
08:15:46 | FromDiscord | <Laylie> my cmake uses the ninja generator by default↵(@mimidragon.) |
08:16:53 | FromDiscord | <Laylie> is that from building sdl\_ttf or from trying to link it into your nim program? either way, i have no idea↵(@devlop_gaming) |
08:17:29 | FromDiscord | <mimidragon.> In reply to @Laylie "my cmake uses the": Thank you, I'll investigate the default action anywhere. |
08:18:40 | FromDiscord | <devlop_gaming> In reply to @Laylie "is that from building": It happens when linking with my nim program |
08:19:00 | FromDiscord | <devlop_gaming> These errors aren't from my scripts either |
08:21:18 | FromDiscord | <devlop_gaming> In reply to @Laylie "is that from building": Are you sure there isn't a way to directly statically link the dlls like you can in visual studio? |
08:22:03 | FromDiscord | <Laylie> not sure at all, i'm not familiar with visual studio |
08:22:31 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "Literally every command listed": Show your all Nim command line for compilation. |
08:23:12 | FromDiscord | <devlop_gaming> nimble build -d:release --app:gui --passL:"-static" --dynlibOverride:SDL3 --passL:"src/SDL3-static.lib" --dynlibOverride:SDL3_ttf --passL:"src/SDL3_ttf-static.lib" |
08:25:30 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "nimble build -d:release --app:gui": Is `fprintf` in C lang. or Nim source code ? |
08:26:01 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "Is `fprintf` ": c uses printf |
08:26:09 | FromDiscord | <devlop_gaming> I'm not sure what fprintf is |
08:26:47 | FromDiscord | <Laylie> fprintf is just printf to a given file instead of stdout |
08:27:24 | FromDiscord | <devlop_gaming> Do yk why these files are throwing undefined reference errors? |
08:28:30 | FromDiscord | <devlop_gaming> Wait all these are from SDL3-static.lib |
08:33:16 | FromDiscord | <devlop_gaming> I don't think sdl3 was built correctly |
08:34:02 | FromDiscord | <devlop_gaming> Either that or i'm missing a file? |
08:38:44 | FromDiscord | <Laylie> the fact that your sdl files are called SDL3-static.lib and SD3\_ttf-static.lib but mine are called libSDL3.a and libSDL3\_ttf.a makes me think there is something different about our environments |
08:42:16 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "These errors aren't from": Try to add this `--passL:-lgcc` ? |
08:56:13 | * | void09 joined #nim |
09:00:44 | * | void09 quit (Client Quit) |
09:01:21 | * | void09 joined #nim |
09:01:36 | * | amadaluzia_ joined #nim |
09:22:12 | * | amadaluzia_ quit (Ping timeout: 272 seconds) |
09:25:11 | * | amadaluzia_ joined #nim |
10:05:18 | amadaluzia_ | https://play.nim-lang.org/#pasty=klNLDUvV |
10:05:21 | amadaluzia_ | cheated a small bit to make the parser, any thoughts? |
10:05:56 | amadaluzia_ | turns out a for loop and some parameter trickery was all i needed :D |
10:07:46 | amadaluzia_ | oh right, i should probably deal with OOB sequence indexing |
10:10:32 | amadaluzia_ | https://play.nim-lang.org/#pasty=GVWxFyTK |
10:11:01 | amadaluzia_ | the important change is just checking the length of the sequence so i can properly index it |
10:34:00 | * | amadaluzia quit (Remote host closed the connection) |
11:00:05 | FromDiscord | <mimidragon.> In reply to @devlop_gaming "Wait all these are": .lib files are generated by msvc compiler. ↵.a files are generated by gcc compiler. ↵↵When you generates SDL3 library build files, it should explicitly set CMake option -G"MSYS Makefile" or -G"Nijna". |
11:07:50 | * | derpydoo quit (Quit: derpydoo) |
12:05:24 | * | amadaluzia_ quit (Ping timeout: 245 seconds) |
12:09:01 | FromDiscord | <enthus1ast.> In reply to @amadaluzia_ "cheated a small bit": Have a look at the parseutils module and use a "forward" only parser instead of split |
12:14:20 | * | void09 quit () |
12:14:58 | * | void09 joined #nim |
13:05:37 | FromDiscord | <devlop_gaming> In reply to @mimidragon. "Try to add this": Now it's saying no binaries built |
13:16:49 | * | alexdaguy joined #nim |
13:41:41 | FromDiscord | <devlop_gaming> I think i need to rebuild |
13:51:54 | FromDiscord | <dawidek.2137> sent a code paste, see https://play.nim-lang.org/#pasty=spvOfIjB |
13:53:36 | FromDiscord | <dawidek.2137> actually, call stack is sensible, it's just the line that gets highlighted in vscode/cursor is at the wrong line |
13:54:20 | FromDiscord | <dawidek.2137> (edit) "actually," => "call stack function name is correct, the line in" | removed "sensible, it's just the line that gets highlighted in vscode/cursor is at the" | "line" => "too" |
14:11:50 | * | tiorock joined #nim |
14:11:50 | * | tiorock quit (Changing host) |
14:11:50 | * | tiorock joined #nim |
14:11:50 | * | rockcavera is now known as Guest6991 |
14:11:50 | * | Guest6991 quit (Killed (tantalum.libera.chat (Nickname regained by services))) |
14:11:50 | * | tiorock is now known as rockcavera |
14:13:55 | * | tiorock joined #nim |
14:13:55 | * | rockcavera is now known as Guest7708 |
14:13:55 | * | Guest7708 quit (Killed (copper.libera.chat (Nickname regained by services))) |
14:13:55 | * | tiorock is now known as rockcavera |
14:19:55 | FromDiscord | <heysokam> @dawidek.2137 I don't know the answer, but I'd try with `nim-gdb` just to double check if its lldb |
14:48:30 | FromDiscord | <devlop_gaming> For some reason glfont.exe is looking for libSDL3.dll.a when I try to build the ttf library |
14:51:44 | * | xet7 quit (Quit: Leaving) |
14:54:42 | FromDiscord | <heysokam> @devlop_gaming as you are experiencing first hand, SDL is not very well suited for static linking↵for the longest time they refused to even give support for it at all↵so the aftermath of that is that everyone dynamically links, and `glfont.exe` looks like an example of that |
14:55:00 | FromDiscord | <heysokam> pretty much the main reason I dislike sdl |
14:55:58 | FromDiscord | <devlop_gaming> So i was bound to encounter this issue |
14:56:28 | FromDiscord | <heysokam> plus they do so much that they blur the line between being a system interaction layer, and being an actual framework |
14:57:02 | FromDiscord | <heysokam> In reply to @devlop_gaming "So i was bound": likely, yea↵but there may be a solution to that glfont thing. I was just providing some context, to help the frustation |
14:57:22 | FromDiscord | <devlop_gaming> In reply to @heysokam "likely, yea but there": Rlly? |
15:06:53 | FromDiscord | <devlop_gaming> Dunno why I thought this would be quick |
16:07:19 | * | amadaluzia joined #nim |
16:11:04 | FromDiscord | <griffith1deadly> In reply to @devlop_gaming "Dunno why I thought": (spoiler: you just haven't tried statically linking more complex stuff yet, like ultralig.ht, which gives .lib files that lead to a dynamic library without the possibility of true static linking in the free SDK) |
16:17:37 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in) |
16:19:29 | * | xutaxkamay joined #nim |
16:30:45 | FromDiscord | <heysokam> In reply to @devlop_gaming "Dunno why I thought": I made that same mistake↵Buildsystems look deceptively simple, but they are some of the most complex things to code↵Not difficult, at all. They are very easy things to solve in general↵But they are always really complex and time consuming to change and generate |
16:31:32 | * | alexdaguy quit (Quit: ded) |
16:31:37 | FromDiscord | <heysokam> Specially for C code, where its pure no-man-land when it comes to buildsystem standarization |
16:33:55 | * | xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in) |
16:34:46 | * | xutaxkamay joined #nim |
16:41:28 | FromDiscord | <dawidek.2137> is there a pragma to get access to private things during import? |
16:41:54 | FromDiscord | <dawidek.2137> i know there's include but i think there was a pragma for this |
16:42:13 | FromDiscord | <heysokam> In reply to @dawidek.2137 "is there a pragma": `import theModule {.all.}` |
16:42:18 | FromDiscord | <Elegantbeef> `{.all.}` |
16:42:21 | FromDiscord | <Elegantbeef> But it's odd to need |
16:42:58 | FromDiscord | <dawidek.2137> thanks |
16:43:24 | Amun-Ra | useful for writing tests |
16:43:26 | FromDiscord | <dawidek.2137> i didn't want to make everything public just to run tests from another file |
16:43:49 | * | xet7 joined #nim |
16:44:04 | Amun-Ra | and I'm not a fan of runnable doc tests |
16:44:33 | * | xet7 quit (Remote host closed the connection) |
16:44:49 | * | xet7 joined #nim |
16:45:09 | FromDiscord | <Elegantbeef> I'm not a fan of testing non public things 😛 |
16:45:17 | Amun-Ra | :P |
16:45:38 | FromDiscord | <heysokam> I'm not a fan of having non-public things |
16:45:47 | FromDiscord | <Elegantbeef> I am |
16:45:59 | FromDiscord | <heysokam> encapsulation is hell |
16:46:01 | Amun-Ra | heysokam has nothing to hide |
16:46:06 | FromDiscord | <Elegantbeef> Touching my internal bits is how you get your hands chopped off |
16:46:11 | Amun-Ra | hehe |
16:46:20 | FromDiscord | <heysokam> 😄 |
16:46:28 | Amun-Ra | touched in his beefy appendage |
16:47:34 | Amun-Ra | (this is ofc a copy-pasta of https://doctorspaghetti.wordpress.com/wp-content/uploads/2017/12/noodledoodle1600_1200.jpg) |
16:48:13 | FromDiscord | <Elegantbeef> Hey some of us are probably pastafarians |
16:48:23 | Amun-Ra | :P |
16:48:55 | FromDiscord | <heysokam> nobody can avoid the pull of the noodle, if we are being honest. Not even when truly trying with full effort |
16:48:55 | Amun-Ra | I'm a russellteapotarian |
16:49:00 | FromDiscord | <Elegantbeef> Only religion that subliminally promotes eating pasta, so it's a pretty good religion |
16:49:14 | Amun-Ra | no to mention the pirates |
16:49:23 | Amun-Ra | who doesn't like pirates? |
16:49:26 | FromDiscord | <Elegantbeef> I believe the politically correct term is a "PotHead" |
16:49:31 | Amun-Ra | :P |
16:50:26 | Amun-Ra | Elegantbeef: like that one? https://mediaproxy.salon.com/width/1200/height/675/https://media2.salon.com/2013/08/article-2382465-1B186FD9000005DC-589_634x440.jpg |
16:50:49 | FromDiscord | <Elegantbeef> No that's just the pastafarian traditional headwear |
16:51:13 | Amun-Ra | ah, sorry, I thought pothead is a new lingo for that headwear |
16:51:33 | FromDiscord | <Elegantbeef> I'm deeply offendedd |
16:52:02 | Amun-Ra | how deeply? please be specific, preferably in cm |
16:52:57 | FromDiscord | <Elegantbeef> Peeking at my internal information again.... |
17:30:17 | FromDiscord | <devlop_gaming> In reply to @heysokam "I made that same": You mentioned a solution for the glfont.exe problem. What was the solution? |
17:32:39 | FromDiscord | <heysokam> In reply to @devlop_gaming "You mentioned a solution": > [...] there may be a solution [...]↵emphasis on `may be` |
17:33:05 | FromDiscord | <heysokam> I don't know if there is one. In theory there is no reason not to, but... I don't know sdl at all |
17:33:33 | FromDiscord | <heysokam> if that app wants the dll, you need to look into why and how to change that |
17:33:42 | FromDiscord | <heysokam> or if its possible to do so |
17:34:32 | FromDiscord | <heysokam> or... just dynamically link to sdl and take yourself away from the misery 🤷♂️ |
18:18:31 | FromDiscord | <griffith1deadly> In reply to @heysokam "or... just dynamically link": or be a crazy and make something like dll proxy but like .lib -> load dynamic library from embedded data inside |
18:18:48 | FromDiscord | <griffith1deadly> like im do some time ago but for ultralig.ht |
18:19:00 | FromDiscord | <heysokam> that sounds painful |
18:23:24 | FromDiscord | <devlop_gaming> In reply to @heysokam "or... just dynamically link": I don't want there to be a lot of dlls just everywhere on the user system. I need to distribute only the executable. |
18:26:00 | FromDiscord | <heysokam> I know. That's why I don't use sdl myself |
18:26:23 | FromDiscord | <griffith1deadly> In reply to @devlop_gaming "I don't want there": do u also know that simple nim programs can not start on user systems without passing `-static` to compiler, bc it will require nim packaged dlls? |
18:27:35 | FromDiscord | <devlop_gaming> In reply to @griffith1deadly "do u also know": I am passing static way before I use the override flag and link everything |
18:28:20 | FromDiscord | <griffith1deadly> In reply to @devlop_gaming "nimble build -d:release --app:gui": oh, so you already know it |
18:37:03 | FromDiscord | <aryzen> How do I check what installed nimlangserver I have? |
18:37:25 | FromDiscord | <aryzen> I'm trying to update but I get errors regarding checksums, I want to see if the install worked |
18:40:48 | FromDiscord | <michaelb.eth> sent a long message, see https://pasty.ee/UyyrbiUv |
18:42:17 | FromDiscord | <devlop_gaming> In reply to @michaelb.eth "how about system like": I'm not sure if get what you're trying to say. You lost me at unzipped. |
18:43:45 | FromDiscord | <michaelb.eth> trying to describe packaging so you can ship your exe and its dll dependencies in a way that isn’t too messy for your users |
18:44:05 | FromDiscord | <heysokam> In reply to @michaelb.eth "how about system like": now your buildsystem/ci needs to deal with finding the correct binaries for all the libraries you depend on for the target you are cross-compiling to↵you might remove one type of complexity, but you add another layer of it as replacement |
18:44:47 | FromDiscord | <heysokam> "i only support windows" is the only reason to find that a pleasent solution, imo |
18:45:24 | FromDiscord | <devlop_gaming> I'm supporting windows and linux. Well for one of my projects anyway. |
18:46:01 | FromDiscord | <michaelb.eth> I think there are scripts for that, e.g, Qt has deploy tool that finds all the dlls (or dylib on mac, .so on linux) that program depends on |
18:47:04 | FromDiscord | <michaelb.eth> so yeah, it’s a hassle but then once you have the script/s working it’s a solved problem, mostly |
18:48:51 | FromDiscord | <michaelb.eth> I built a CI pipeline like that for an app with builds for Windows, macOS, and Linux |
18:49:24 | FromDiscord | <heysokam> my argument is that needing to build such a thing, or worry about such a thing, is the problem itself |
18:50:23 | FromDiscord | <michaelb.eth> c'est la vie? |
18:51:05 | FromDiscord | <heysokam> imagine falling, breaking your leg, and a doctor giving you that as an answer to your problem |
18:51:21 | FromDiscord | <heysokam> "deal with the problem" is not really a solution to the problem, is it |
18:51:42 | FromDiscord | <michaelb.eth> yes, I had a doctor say something just lime that to me |
18:51:50 | FromDiscord | <heysokam> the root is caused by depending on a badly architected buildsytem that does not support static dependencies when needed |
18:52:18 | FromDiscord | <michaelb.eth> he said to me: “no, fix your life”. And so I had to |
18:52:31 | FromDiscord | <heysokam> damn |
18:52:35 | FromDiscord | <michaelb.eth> (edit) "yes, I had a ... doctorlike" added "medical" | "lime" => "like" |
19:05:20 | FromDiscord | <heysokam> Lets say I have an app that does `randomized_thing`↵I want the output to be randomly generated.. but reproducible if I find an issue with that one instance of randomness↵How can I generate arbitrary cases inside the call, in such a way that if I say `thing --seed:ThatSeed` in my compiled app, I can reproduce the same results? |
19:06:09 | FromDiscord | <Elegantbeef> `initRandom` takes a seed |
19:06:10 | FromDiscord | <heysokam> The issue I have right now is that `random.rand` generates the same exact value every time, unless you call randomize with a new seed 🤔 |
19:06:14 | FromDiscord | <Elegantbeef> or `initRand` rather |
19:06:35 | FromDiscord | <heysokam> yea, but rand is going to generate the same value given the same seed, right? |
19:07:11 | FromDiscord | <heysokam> the problem is that I need multiple rand calls that generate different values each, but using the same seed |
19:07:19 | FromDiscord | <Elegantbeef> `initRand(hash(time).int)` 😄 |
19:08:06 | FromDiscord | <heysokam> hmmm, but then I cannot call that at a different time to get the same outcome that I got at a previous time? |
19:08:12 | FromDiscord | <Elegantbeef> I had a similar logical problem with my fuzzer and just use the compile time as the seed for everything and then if there is an issue I can run the entire program and try to find it |
19:08:37 | FromDiscord | <heysokam> oh, you use compile time time, that's an idea |
19:08:59 | FromDiscord | <Elegantbeef> You can also dump the random after each run then have sections that show you the output |
19:09:19 | FromDiscord | <Elegantbeef> `Rand` is only really 2 integers so you can plop that as binary data then you can recover always |
19:09:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=dUNOViqg |
19:10:11 | FromDiscord | <Elegantbeef> I also have a `{.hint: "bearSeed is: " & bearSeed.}` |
19:10:58 | FromDiscord | <Elegantbeef> This means in the case I hit a bug I can compile with `-d:bearSeed="MySeedHere"` and rerun the bad state |
19:11:06 | FromDiscord | <heysokam> how does that allow you to get different values on each call to rand? |
19:11:20 | FromDiscord | <Elegantbeef> Cause I use the same state globally |
19:11:22 | FromDiscord | <heysokam> is that not a one-time thing? |
19:12:08 | FromDiscord | <Elegantbeef> Each invoke of mine is the same since I'm testing the compiler and code generation |
19:12:17 | FromDiscord | <Elegantbeef> Which is what you want when you're fuzzing reproducible errors |
19:12:25 | FromDiscord | <heysokam> I think I'm being slow, because I can't see how to use that to get different rand results on each call to rand |
19:12:49 | FromDiscord | <Elegantbeef> `bearState.rand(...)` instead of `var rand = initRand(); rand.rand(...)` |
19:13:23 | FromDiscord | <heysokam> does that give you different outputs on each call by default? |
19:13:28 | FromDiscord | <Elegantbeef> `bearState` is the initial seeded state, I use it once globally cause I am doing each compile as a global one shot action |
19:13:48 | FromDiscord | <Elegantbeef> Yes every call mutates `bearState` and the next number |
19:13:58 | FromDiscord | <heysokam> ohh, I had no idea about that |
19:14:08 | FromDiscord | <heysokam> that's so much better then |
19:14:16 | FromDiscord | <Elegantbeef> It's how you do reproducible seeded actions |
19:14:22 | FromDiscord | <Elegantbeef> Proc gen in a game would use the above logic aswell |
19:14:41 | FromDiscord | <heysokam> makes sense now, I just had no idea that it behaved differently |
19:14:59 | FromDiscord | <heysokam> than random.rand |
19:15:03 | FromDiscord | <Elegantbeef> It doesnt, it behaves the same as the global random |
19:15:25 | FromDiscord | <Elegantbeef> If you do not call `randomize` you get the exact same state every time |
19:15:36 | FromDiscord | <heysokam> calling `random.rand` multiple times produces the same number, unless you `randomize` |
19:15:42 | FromDiscord | <Elegantbeef> It's a preseeded random generator to a constant seed |
19:15:47 | FromDiscord | <heysokam> so that's inherently different? |
19:15:59 | FromDiscord | <Elegantbeef> Right, but calling `random.rand` multiple times does not give you the same number in the same instance |
19:16:13 | FromDiscord | <heysokam> I don't follow |
19:16:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=StNBYfoi |
19:17:02 | FromDiscord | <Elegantbeef> Ah whoops |
19:17:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=TtwJOlww |
19:17:05 | FromDiscord | <heysokam> > If randomize has not been called, the sequence of random numbers returned from this proc will always be the same.↵https://nim-lang.org/docs/random.html#rand%2Cint |
19:17:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=huUAzsCz |
19:17:27 | FromDiscord | <Elegantbeef> god dammit |
19:17:33 | FromDiscord | <Elegantbeef> `rng.rand(int) != rng.rand(int)` |
19:17:45 | FromDiscord | <heysokam> so it is different |
19:17:46 | FromDiscord | <Elegantbeef> Yes it's no different that intialising a seed with a constant state |
19:17:55 | FromDiscord | <Elegantbeef> No it's the same! |
19:18:11 | FromDiscord | <Elegantbeef> It's identical to the case where you do `var rng = initRand(someConstant)` |
19:18:14 | FromDiscord | <heysokam> omg beef. you just proved it is different with your example 🙈 |
19:18:18 | FromDiscord | <Elegantbeef> Cause that's literally what the default random is |
19:18:23 | FromDiscord | <Elegantbeef> No I didnt? |
19:18:46 | FromDiscord | <heysokam> let me make a playground |
19:19:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=EQGTgpsm |
19:19:29 | FromDiscord | <Elegantbeef> The `rand` is no different to `rng` it's just it uses a global variable |
19:19:53 | FromDiscord | <Elegantbeef> Both will always be not equal to the next call for the end of time cause they're both seeded as such |
19:20:09 | FromDiscord | <Elegantbeef> It's possible to replace `100` with a seed that makes the assertion fail, but as long as it's 100 it'll never fail |
19:21:49 | FromDiscord | <Elegantbeef> The only difference to the two is that you're providing a changing seed that you know and can recover later, whereas the global rand is seeded constantly unless you randomize it |
19:22:21 | FromDiscord | <Elegantbeef> `initRand()` is the same as if you did `randomize()` |
19:22:31 | FromDiscord | <Elegantbeef> But `initRand(seed)` just sets the seed for the random state |
19:26:26 | FromDiscord | <heysokam> I stand corrected. You are right, and the docs are either wrong or use completely misleading wording https://media.discordapp.net/attachments/371759389889003532/1363234299410776304/image.png?ex=68054a60&is=6803f8e0&hm=da4afcd4edfd0b05f6f3e0020ed5bfe32edf901a50d3d7c224acd24f07eedf9a& |
19:38:48 | FromDiscord | <Elegantbeef> I'm never not right 😛 |
19:46:45 | FromDiscord | <heysokam> how can I typehint `thing( one..two )` as the type of the argument in thing? |
19:48:33 | FromDiscord | <Elegantbeef> `type(one)..type(two)` |
19:49:22 | FromDiscord | <heysokam> as the type? |
19:49:38 | FromDiscord | <Elegantbeef> I don't follow |
19:49:55 | FromDiscord | <heysokam> `proc thing (arg : ???)=` |
19:50:03 | FromDiscord | <threefour> Isn't that a range type? |
19:50:18 | FromDiscord | <Elegantbeef> `Slice[T]` |
19:50:36 | FromDiscord | <Elegantbeef> Or `HSlice[T, Y]` |
19:50:40 | FromDiscord | <threefour> O nvm |
19:51:08 | FromDiscord | <Elegantbeef> Range is close but range is a single value not a range of values |
19:51:14 | FromDiscord | <Elegantbeef> Subrange type and all that jazz |
19:51:48 | Amun-Ra | there's HSlice but what I found very sursprising is there's no vertical one :/ |
19:52:09 | FromDiscord | <Elegantbeef> Well that's not what the H stands for |
19:52:10 | FromDiscord | <heysokam> whats different between HSlice and Slice? |
19:52:20 | FromDiscord | <Elegantbeef> HSlice is hetrogenous |
19:52:23 | FromDiscord | <Elegantbeef> Slice is homogenous |
19:52:42 | Amun-Ra | so no androgenous one |
19:53:35 | Amun-Ra | (I'll as myself out) |
19:53:39 | Amun-Ra | ask* |
19:55:27 | FromDiscord | <heysokam> I was going to make a followup, amun. it was funny |
19:55:42 | Amun-Ra | thanks :) |
20:15:54 | * | rockcavera quit (Remote host closed the connection) |
20:54:23 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=dYUSRONc |
20:55:08 | FromDiscord | <Elegantbeef> I've never been complimented so much in a single sentence |
20:55:46 | FromDiscord | <heysokam> 🙂 |
20:56:04 | FromDiscord | <Elegantbeef> `skipRandomNumbers` is a relatively deterministic procedure so I do not expect anything in there to be the culprit |
20:56:24 | FromDiscord | <heysokam> this is my random setup now:↵https://github.com/heysokam/codegen.nim/blob/master/src/random.nim |
20:56:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ZmWErKFH |
20:57:03 | FromDiscord | <heysokam> I'm using some `cast(noSideEffects)` blocks. could they cause weird behavior with random? |
20:57:31 | FromDiscord | <Elegantbeef> They shouldn't do anything to generation or logic, but perhaps it's a bug |
20:57:36 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=BuygSnve |
20:58:33 | FromDiscord | <heysokam> oh... I remember this happening before. I sense an invisible `UB` trap from the zigcc compiler 🤔 |
20:59:01 | FromDiscord | <Elegantbeef> How is that code even working |
20:59:06 | FromDiscord | <Elegantbeef> `state.rand` shouldn't work |
21:00:03 | FromDiscord | <Elegantbeef> `R.rand(state, int.high)` |
21:00:08 | FromDiscord | <Elegantbeef> But also `integer: SomeInteger` is wholly wrong |
21:00:12 | FromDiscord | <Elegantbeef> it's just `integer: int` |
21:01:07 | FromDiscord | <heysokam> might not be calling all versions. I uploaded the WIP state just to be able to ask easier |
21:02:30 | * | amadaluzia quit (Ping timeout: 265 seconds) |
21:03:01 | FromDiscord | <Elegantbeef> Wait does codegen run only at compile time? |
21:03:05 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=TBvRksuZ |
21:03:22 | FromDiscord | <heysokam> In reply to @Elegantbeef "Wait does codegen run": what do you mean? |
21:03:37 | FromDiscord | <Elegantbeef> Does your program run at compiletime or runtime? |
21:03:41 | FromDiscord | <heysokam> runtime |
21:03:49 | FromDiscord | <Elegantbeef> So remove the `{.compileTime.}` |
21:03:51 | FromDiscord | <Elegantbeef> Cmon now |
21:04:03 | FromDiscord | <heysokam> i trusted you for nothing 😭 |
21:04:08 | FromDiscord | <heysokam> will do! |
21:04:17 | FromDiscord | <heysokam> forgot that your code is using macros |
21:04:43 | FromDiscord | <heysokam> that was it, ty 🙂 |
21:08:07 | FromDiscord | <Elegantbeef> I gave you an example from my project |
21:08:07 | FromDiscord | <Elegantbeef> Why would you use compile time if you're running code at runtime |
21:08:08 | FromDiscord | <Elegantbeef> https://images.fineartamerica.com/images/artworkimages/mediumlarge/3/think-mark-think-meme-from-invincible-omniman-knight-roberts.jpg |
21:08:11 | FromDiscord | <Elegantbeef> I imagine it was some bug with attempting to mutate rodata |
21:28:26 | FromDiscord | <heysokam> https://tenor.com/view/deadpool-3-yes-but-i-can't-deadpool-ryan-reynolds-deadpool-and-wolverine-gif-601706632681033345 |
21:48:26 | * | void09 quit () |
21:48:55 | * | ntat quit (Quit: leaving) |
21:49:02 | * | void09 joined #nim |
21:54:45 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=UmtGJQcW |
21:55:58 | FromDiscord | <heysokam> My immediate guess is yes, but wonder if there could be some clever trick to not need it (other than storing the variable outside of the block, ofc) |
22:00:22 | FromDiscord | <heysokam> oh well, my immediate guess was totally wrong. it is not scoped 🥳 |
23:08:10 | * | Guest2085 quit (Ping timeout: 265 seconds) |