00:10:10 | FromDiscord | <huantian> Mine was much simpler lol, just checked that the owner of the symbol was an iterator of the correct return type |
00:10:48 | FromDiscord | <Elegantbeef> That doesnt work inside blocks or similar |
00:11:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/WGq |
00:12:30 | FromDiscord | <huantian> Ah true, so you have to travel up the owners to find a proc or iterator |
00:12:38 | FromDiscord | <Elegantbeef> Yep |
00:20:05 | FromDiscord | <huantian> too bad compiles doesn't work with yield |
00:20:22 | FromDiscord | <Elegantbeef> I mean it doesnt help anyway |
00:20:36 | FromDiscord | <Elegantbeef> `"Invalid usuage of await"` or w/e you'd give isnt helpful |
00:21:28 | FromDiscord | <huantian> I mean all the error messages boil down to "can only use await in async proc" |
00:21:41 | FromDiscord | <Elegantbeef> Sure but you can be more helpful |
00:22:12 | FromDiscord | <Elegantbeef> I dont know, my view is that when you can provide a more accurate error you should |
00:22:48 | FromDiscord | <Elegantbeef> Like yes technically "You can only use await in an async proc" is accurate, but we can always just point to the exact issue |
00:22:51 | FromDiscord | <Elegantbeef> I dont know i might be an idiot |
00:26:04 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3SNS though it's not too hard to change it |
00:32:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
00:36:44 | FromDiscord | <huantian> Maybe combine both messages? idk |
00:36:52 | * | ltriant joined #nim |
00:37:21 | FromDiscord | <Elegantbeef> What? |
00:37:40 | FromDiscord | <huantian> like uh "Await can only be used in async, not macro/top-level" |
00:38:06 | * | ltriant_ quit (Ping timeout: 252 seconds) |
00:40:02 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SNW |
00:40:13 | FromDiscord | <Elegantbeef> `if r.code == HttpCode200` |
00:40:22 | FromDiscord | <TennisBowling> oh |
00:40:24 | FromDiscord | <TennisBowling> thank you! |
00:40:32 | FromDiscord | <Elegantbeef> `if r.code in HttpCode200..HttpCode299` |
00:41:01 | FromDiscord | <huantian> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3SNS though it's not": shouldn't it loop until it sees a nskMacro or nskIterator as well? |
00:41:19 | FromDiscord | <Elegantbeef> Cant async inside a macro |
00:41:40 | FromDiscord | <huantian> yeah so if it gets to a macro before an iterator, then it should error right |
00:42:09 | FromDiscord | <Elegantbeef> \TIL macros can be declared not at toplevel |
00:42:21 | FromDiscord | <TennisBowling> wait but then |
00:42:42 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SNY |
00:43:00 | FromDiscord | <huantian> is self a `var` type? |
00:43:09 | FromDiscord | <TennisBowling> no it's an object |
00:43:14 | FromDiscord | <Elegantbeef> `let r` |
00:43:14 | FromDiscord | <Elegantbeef> Also why would you change the status |
00:43:24 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SNZ |
00:43:31 | FromDiscord | <Elegantbeef> Should be `var r` |
00:43:32 | FromDiscord | <TennisBowling> In reply to @Elegantbeef "Also why would you": it to store if the node is alive or not |
00:43:49 | FromDiscord | <huantian> In reply to @Elegantbeef "Should be `var r`": nono self is a separate object from r |
00:43:54 | FromDiscord | <TennisBowling> yeah |
00:44:14 | FromDiscord | <Elegantbeef> Either way it's a mutabillity issue |
00:44:14 | FromDiscord | <Elegantbeef> pass in `self` as `var NodeInstance` |
00:44:34 | FromDiscord | <Elegantbeef> I'm probably in the minority, but i destest `self` |
00:44:47 | FromDiscord | <TennisBowling> cool that worked |
00:44:52 | FromDiscord | <TennisBowling> then what do you use? |
00:44:53 | FromDiscord | <TennisBowling> this? |
00:45:01 | FromDiscord | <Elegantbeef> `nodeInstance` |
00:45:04 | FromDiscord | <Elegantbeef> `node` |
00:45:12 | FromDiscord | <Elegantbeef> Anything that's not pretending Nim is OOP 😛 |
00:45:56 | FromDiscord | <TennisBowling> I come from oop languages so just a habit |
00:47:57 | FromDiscord | <Elegantbeef> Yea you can use whatever you want, i'm just an odd person |
00:56:20 | pch | https://media.discordapp.net/attachments/362945838366064651/954543462483623946/fuckoffcompiler.png nim 1.6 packaged in debian (haha stable btw) |
00:57:16 | FromDiscord | <Elegantbeef> What's the code? |
00:57:37 | pch | scattered across 4 files thanks |
00:58:24 | pch | it's hitting error trying to match MultiElementBuffer[0] (an array type) to MultiElementBuffer (the same array type but without its size specified) |
00:59:19 | pch | https://media.discordapp.net/attachments/362945838366064651/954544539367006228/fuckoffcompiler2.png |
00:59:46 | FromDiscord | <TennisBowling> how do I do a return type of something that could be two things |
00:59:52 | FromDiscord | <TennisBowling> thing1 | thing2 |
00:59:54 | FromDiscord | <TennisBowling> ? |
01:00:07 | FromDiscord | <Elegantbeef> Is it two seperate things at runtime or compile time? |
01:00:16 | FromDiscord | <Elegantbeef> If it's at runtime you need to use an object variant |
01:01:17 | FromDiscord | <Elegantbeef> is `intris` the same type as the `attemlems` specialized type? |
01:02:53 | pch | yes, they're element types for storing reference to array positions |
01:03:25 | pch | it's not two separate things, the code does detect the length of the given MultiElementBuffer though |
01:03:37 | FromDiscord | <Elegantbeef> That might be the issue |
01:04:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SO5 |
01:04:35 | FromDiscord | <Elegantbeef> put `distinct MultiElementBuffer` |
01:04:46 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=3SO6↵does something like this work? just shuffled it around a bit |
01:06:18 | pch | there's no derivative type based on the multielementbuffer |
01:06:25 | FromDiscord | <Elegantbeef> Do not know, dont really like the solution since though |
01:06:33 | FromDiscord | <Elegantbeef> What do you mean PCH? |
01:06:49 | pch | im just using multielementbuffer directly |
01:06:55 | pch | lemme screenshot the erroring code next |
01:06:58 | FromDiscord | <Elegantbeef> You said the specialized type of the attemlems is not the same as the first |
01:07:07 | pch | no they're the exact same type |
01:08:15 | pch | ive defined "testNorms" with the line `var testNorms: MultiElementBuffer[0]` specifically so that the code skips the normal interpolation |
01:08:39 | pch | I put it into the function I've taken a screenshot of, and receive the error I entered with |
01:08:55 | pch | in the postion of "normelem" |
01:09:31 | FromDiscord | <Elegantbeef> If all of the `MultiElementBuffer`s are the same type the issue i thought it was wasnt it |
01:10:42 | FromDiscord | <Elegantbeef> you may need to do `[T: static int]` ... `MultiElementBuffer[T]` |
01:11:00 | pch | MultiElementBuffer is defined as |
01:11:26 | pch | `MultiElementBuffer*[size: static int] = array[size, TrianglePointer] |
01:11:29 | pch | er |
01:11:32 | pch | `MultiElementBuffer*[size: static int] = array[size, TrianglePointer]` |
01:11:43 | FromDiscord | <Elegantbeef> Yes i dont care about that |
01:11:47 | FromDiscord | <Elegantbeef> The issue is the call site |
01:11:54 | FromDiscord | <Elegantbeef> What's the call site look liike |
01:13:23 | pch | `drawReadyElements(testTriElem, testTriTrans, depthbuf, defaultPSveccol, interiorcolbuf, os, testNorms, trestTriBuf, @[testTriElem], testTriCol)` |
01:13:42 | pch | lots of reuse because of mandatory fields I haven't worked on making non-mandatory yet |
01:13:59 | pch | just have detections to see if the field is representing an empty variable |
01:14:10 | FromDiscord | <Elegantbeef> what's `testTriElem` declared as? |
01:14:18 | pch | MultiElementBuffer |
01:14:36 | FromDiscord | <Elegantbeef> The entire type |
01:15:12 | pch | `var testTriElem: MultiElementBuffer[1] = [vec3(0.uint32,1,2)]` |
01:15:24 | FromDiscord | <Elegantbeef> There is your fucking issue! |
01:15:25 | FromDiscord | <Elegantbeef> Like i said |
01:15:43 | FromDiscord | <Elegantbeef> Put distinct before anything that isnt supposed to match the first `MultiElementBuffer` |
01:15:45 | FromDiscord | <huantian> In reply to @huantian "https://play.nim-lang.org/#ix=3SO6 does something l": wups it has to be "Future" not "FutureBase" |
01:15:51 | FromDiscord | <huantian> (edit) "In reply to @huantian "https://play.nim-lang.org/#ix=3SO6 does something l": wups it has to be ... "Future"" added ""FutureBase" not" | removed "not "FutureBase"" |
01:16:01 | FromDiscord | <Elegantbeef> Nim's composite type classes bind to the first type they're provided |
01:16:08 | FromDiscord | <Elegantbeef> You need to put distinct before it to resolve that mismatch |
01:16:15 | pch | well that's an issue |
01:16:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SO9 |
01:17:17 | FromDiscord | <huantian> huh I didn't even know you could have plain `seq` as a param type |
01:17:24 | FromDiscord | <Elegantbeef> Composite typeclass |
01:17:27 | FromDiscord | <Elegantbeef> It applies to all generics |
01:19:27 | pch | https://cdn.discordapp.com/attachments/362945838366064651/954549605318672515/AAAA.png |
01:20:04 | FromDiscord | <Elegantbeef> Past the procedure definition please |
01:20:11 | FromDiscord | <Elegantbeef> So i can edit it to what it needs to be |
01:20:57 | NimEventer | New question by Big Man: Nim stack overflow in recursive loop, see https://stackoverflow.com/questions/71534666/nim-stack-overflow-in-recursive-loop |
01:21:19 | pch | `proc drawReadyElements* (intris: MultiElementBuffer, tribuf: V3Buffer, dbuf: var ScalarBuffer2D, shad: PShadingCallback, outbound: var ColourInnerBufferINTE, outsize: BufRESprefloat, normelem: distinct MultiElementBuffer, normatt: distinct V3Buffer, attelems: seq[MultiElementBuffer], attachments: varargs[array])` |
01:24:25 | FromDiscord | <Elegantbeef> So many typeclasses this is a fun bug |
01:25:12 | FromDiscord | <Elegantbeef> `proc drawReadyElements[T,Y: static int](intris: MultiElementBuffer[T], tribuf: V3Buffer, dbuf: var ScalarBuffer2D, shad: PShadingCallback, outbound: var ColourInnerBufferINTE, outsize: BufRESprefloat, normelem: MultiElementBuffer[Y], normatt: distinct V3Buffer, attelems: seq[MultiElementBuffer[T]], attachments: varargs[array])`↵might work |
01:25:53 | pch | they both house the same type though? |
01:26:01 | FromDiscord | <Elegantbeef> Yes it's a workaround, but it's a very very large generic param list so hard to reason though |
01:26:05 | FromDiscord | <Elegantbeef> What do you mean? |
01:26:43 | pch | intris, normelem, and attelems' members all house the exact same type |
01:26:55 | FromDiscord | <Elegantbeef> Not at your call site |
01:27:12 | FromDiscord | <Elegantbeef> `var testTriElem: MultiElementBuffer[1] = [vec3(0.uint32,1,2)]` is the first arg |
01:27:41 | pch | yes, the type held within a MultiElementBuffer never changes |
01:27:54 | pch | it's always a TrianglePointer, which is always a Vec3[uint32] |
01:28:11 | FromDiscord | <Elegantbeef> Your passing a `MutliElementBuffer[0]` to `normelem` |
01:28:19 | FromDiscord | <Elegantbeef> If they're supposed to be the same type, pass the same type |
01:28:30 | FromDiscord | <Elegantbeef> Is there anyway i can see the entire code? |
01:28:36 | pch | they're the same type though but of different sizes? |
01:28:45 | FromDiscord | <Elegantbeef> Yes |
01:28:48 | pch | I haven't put it up on VCS yet |
01:28:58 | pch | trying to make sure it renders out first before I do |
01:29:15 | FromDiscord | <Elegantbeef> Nim's static types are distinct |
01:29:19 | FromDiscord | <Elegantbeef> `array[0, uint32] is not array[1, uint32]` |
01:29:24 | pch | ah |
01:29:31 | pch | immediately see the issue then |
01:29:32 | FromDiscord | <Elegantbeef> rather `array[0, uint32] isnot array[1, uint32]` |
01:29:48 | FromDiscord | <Elegantbeef> This is where the `distinct` goes |
01:30:26 | pch | alright, I'll use a slight variation of your fix then |
01:30:28 | pch | thanks |
01:30:48 | FromDiscord | <huantian> do macros have default return values? |
01:31:05 | FromDiscord | <Elegantbeef> `nnkNilLit` or `nnkEmpty` dont recall |
01:31:43 | FromDiscord | <huantian> kk |
01:32:18 | FromDiscord | <Elegantbeef> Are you still working on the async stuff? |
01:32:42 | FromDiscord | <huantian> yeah |
01:33:07 | FromDiscord | <huantian> was going to see if there could be a better error message for improper multisync |
01:33:57 | FromDiscord | <huantian> and perhaps more testing would be good |
01:34:22 | FromDiscord | <huantian> /adding test case |
01:47:57 | FromDiscord | <huantian> this is what I have rn <https://play.nim-lang.org/#ix=3SOd> |
01:48:59 | * | Gustavo6046 quit (Remote host closed the connection) |
01:49:02 | FromDiscord | <Elegantbeef> Seems good |
02:14:21 | * | lumo_e quit (Ping timeout: 252 seconds) |
02:19:24 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/SHj |
02:20:26 | FromDiscord | <Elegantbeef> I'd add tests anywhere there might be an issue |
02:20:40 | FromDiscord | <Elegantbeef> It's better to test for behaviour that might fail than assume you have coverage |
02:22:20 | FromDiscord | <huantian> is there a way to get testament check for multiple errors in the same file? |
02:23:49 | FromDiscord | <huantian> or should I just split it into multiple files |
02:23:50 | FromDiscord | <Elegantbeef> `nim check` |
02:25:15 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/tests/generics/tstatic_constrained.nim an example |
02:26:05 | FromDiscord | <huantian> hm ok |
02:44:07 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SOs |
02:44:58 | FromDiscord | <huantian> you probably want std/option |
02:45:06 | FromDiscord | <TennisBowling> what do you mean? |
02:45:11 | FromDiscord | <huantian> void is special and can't be used like that |
02:45:23 | FromDiscord | <Elegantbeef> Nim's typeclasses are for generics instantiation not runtime unions |
02:46:25 | FromDiscord | <Elegantbeef> `void | NodeInstance` means "This procedure can be instantiated in such a way it can return `void`, but also can be instantitated so it can return `NodeInstance`" |
02:46:43 | FromDiscord | <Elegantbeef> It does not mean "It can return `void` or `NodeInstance` dynamically at runtime |
02:47:51 | FromDiscord | <Elegantbeef> For instance |
02:47:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SOt |
02:48:57 | FromDiscord | <Elegantbeef> Though Araq generally says "Typeclasses are only for parameters, not for return values, use `auto`" |
02:49:54 | FromDiscord | <Elegantbeef> Hopefully that makes sense |
02:52:51 | FromDiscord | <Elegantbeef> The way to do dynamic values is https://nim-lang.org/docs/manual.html#types-object-variants or with libraries like https://github.com/alaviss/union |
03:00:22 | pch | hmm, can't seem to access sdl Surface.pixels property |
03:00:42 | pch | trying to cast it to an uncheckedarray (which is what it is) results in a compile-time error about non-concrete types |
03:01:12 | pch | trying to use it directly doesn't work since it's just defined as a `pointer` type |
03:01:17 | FromDiscord | <Bubblie> I got the nim plugin for Clion |
03:01:18 | FromDiscord | <Bubblie> however |
03:01:25 | FromDiscord | <Bubblie> its having issues with the nim.exe? |
03:01:48 | FromDiscord | <Bubblie> its asking for the nim.exe |
03:01:57 | FromDiscord | <Bubblie> but thats already in bin |
03:03:22 | FromDiscord | <Elegantbeef> pch `cast[ptr UncheckedArray[YourType]](surface.pixels)` |
03:03:34 | pch | i |
03:03:35 | pch | thanks |
03:04:16 | FromDiscord | <Elegantbeef> Dont know what to say bubblie, jetbrains addon isnt the greatest since they're writing from the ground up, but then again Nim tooling isnt that great 😛 |
03:04:26 | FromDiscord | <Bubblie> oh |
03:04:47 | FromDiscord | <Bubblie> what do you use for nim development? |
03:04:50 | FromDiscord | <Bubblie> vscode? |
03:04:58 | FromDiscord | <Elegantbeef> I've been using Kate recently, but I generally use vscode |
03:05:06 | FromDiscord | <Bubblie> 👀 never heard of kate |
03:06:20 | FromDiscord | <Elegantbeef> Eh it's just an OSS text editor that now has LSP support |
03:06:40 | FromDiscord | <Elegantbeef> Slight issue presently in that it doesnt show errors, which i need to investigate |
03:07:13 | FromDiscord | <Bubblie> now it is saying there is no nim binary? |
03:07:14 | FromDiscord | <Bubblie> weird |
03:07:35 | FromDiscord | <Elegantbeef> Is your path getting throttled by something? |
03:07:46 | FromDiscord | <Bubblie> not sure |
03:07:57 | FromDiscord | <Bubblie> the nim path should be in the path of User Variables right |
03:08:01 | FromDiscord | <Bubblie> or should it be in environmental as well |
03:08:18 | nrds | <Prestige99> Elegantbeef have you had issues with false errors being reported? I've brought it up before but, haven't heard anyone else talking about it |
03:08:23 | FromDiscord | <Elegantbeef> Not a windows user it should be in your `PATH` variable |
03:08:25 | FromDiscord | <Elegantbeef> Whatever the equivlent is for windows |
03:08:38 | FromDiscord | <Elegantbeef> I've seen it a few times, but havent had it in a while |
03:08:40 | termer | path is in win |
03:08:53 | FromDiscord | <Bubblie> there is path in user and in environmental |
03:08:59 | FromDiscord | <Elegantbeef> Generally it seems like it's the project causing the bug |
03:08:59 | termer | there's a local path and global path if I remember correctly but it's the same concept as in linux |
03:09:01 | FromDiscord | <Bubblie> nim auto added it to user |
03:09:02 | FromDiscord | <Elegantbeef> Oh hey termer |
03:09:04 | termer | hey dude |
03:09:06 | * | om3ga quit (Ping timeout: 250 seconds) |
03:09:17 | FromDiscord | <Elegantbeef> Time to destroy your project 😛 |
03:09:20 | termer | uh oph |
03:09:25 | termer | what did you find |
03:09:31 | * | ozzz joined #nim |
03:09:39 | FromDiscord | <Elegantbeef> A few things to clean it up |
03:10:21 | nrds | <Prestige99> Elegantbeef https://github.com/nim-lang/Nim/issues/19371 zero replies so uh, maybe I put the error in the wrong repo |
03:10:35 | nrds | <Prestige99> It's quite annoying maybe I should make a forum post |
03:10:40 | FromDiscord | <Elegantbeef> I'll look at it a minute |
03:11:53 | FromDiscord | <Bubblie> ok yeah |
03:12:00 | FromDiscord | <Elegantbeef> https://github.com/termermc/argon2-highlevel/blob/master/argon2_highlevel/async.nim#L99-L100 `except Exception as e: job.fail(e, e.msg)` |
03:12:08 | FromDiscord | <Bubblie> nim is being added to the user variable |
03:12:13 | FromDiscord | <Bubblie> but why isn't vscode recognizing it |
03:12:24 | FromDiscord | <Bubblie> thats so weird |
03:13:07 | FromDiscord | <Elegantbeef> Have you restarted since installing? |
03:13:14 | FromDiscord | <Elegantbeef> Window's environmental variables suck |
03:13:17 | FromDiscord | <Bubblie> that may be it |
03:13:21 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Window's environmental variables suck": oh yeah |
03:13:29 | termer | Elegantbeef what's this issue on this line |
03:13:31 | FromDiscord | <Bubblie> 100% I hate windows, I want to move to fedora linux but uh |
03:13:39 | FromDiscord | <Bubblie> I cant dual boot atm |
03:13:48 | FromDiscord | <Bubblie> so I might just run fedora in QEMU or something |
03:14:01 | FromDiscord | <Elegantbeef> you're using `getCurrentException` and `getCurrentExceptionMsg` it's code smell |
03:14:04 | termer | virtualizing is more pain than it is useful |
03:14:08 | FromDiscord | <Elegantbeef> Just use what i suggested |
03:14:12 | FromDiscord | <Elegantbeef> It's cleaner |
03:14:20 | FromDiscord | <Bubblie> In reply to @termer "virtualizing is more pain": Probably |
03:14:24 | termer | Elegantbeef I didn't see your suggestion |
03:14:26 | FromDiscord | <Bubblie> I might have enough on my d drive for fedora |
03:14:27 | FromDiscord | <Bubblie> Or |
03:14:35 | FromDiscord | <Bubblie> i might use an external hard drive |
03:14:38 | FromDiscord | <Bubblie> Just to use fedora |
03:14:39 | termer | was it to just except CatchableError as err or something? |
03:14:39 | FromDiscord | <Elegantbeef> It's after the link |
03:14:49 | FromDiscord | <Elegantbeef> https://irclogs.nim-lang.org/19-03-2022.html#03:12:00 |
03:14:56 | termer | oh sorry |
03:14:56 | FromDiscord | <Elegantbeef> Yes it was |
03:15:02 | termer | I'm a bit tired |
03:15:08 | termer | I'll update it right now |
03:15:12 | termer | is there anything else you noticed |
03:15:32 | FromDiscord | <Elegantbeef> line 156 you're using a for loop iterating indicies instead of just `for thread in hasher.threads.mitems` |
03:16:15 | termer | more beautiful 2am code |
03:16:18 | FromDiscord | <Elegantbeef> There was another issue that was bigger i swear |
03:16:20 | termer | thanks lol |
03:16:29 | * | arkurious quit (Quit: Leaving) |
03:18:02 | FromDiscord | <huantian> In reply to @Elegantbeef "Well get at it": I have the get at it-ed |
03:18:05 | FromDiscord | <Elegantbeef> Oh yes `https://github.com/termermc/argon2-highlevel/blob/master/argon2_highlevel/private/utils.nim#L19-L24` this! |
03:18:45 | termer | wuh oh |
03:18:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SOA |
03:19:21 | termer | that's my first time seeing the {.global.} pragma |
03:19:34 | termer | does that create a var in global scope the first time it's run? |
03:19:34 | FromDiscord | <Elegantbeef> I say bigger issue, but i'm just weird |
03:19:39 | pch | as it turns out the canoncial way to write to a pixel array in sdl is with memset |
03:19:45 | pch | and i cant get any other way to work |
03:19:49 | FromDiscord | <Elegantbeef> It does what you did, just Nim scopes it to `genId` |
03:20:05 | FromDiscord | <Elegantbeef> What's the type of the `pixels`? |
03:20:10 | termer | in a way this seems weirder other than being inside of the proc |
03:20:29 | termer | by the way I noticed you removed the inline pragma, I'm guessing I didn't really need it, right |
03:20:33 | pch | Elegantbeef internally-formatted byte array |
03:21:25 | FromDiscord | <Elegantbeef> I mean you can inline it if you want, if calling a procedure that increments is a slowdown to your programi think you're in a great state |
03:21:32 | FromDiscord | <Elegantbeef> Plus the compiler may already attempt to inline it |
03:21:42 | FromDiscord | <Elegantbeef> Ok so you have a pointer and you know the data it holds? |
03:22:02 | pch | the "proper" way to write to a surface in SDL is to import it as an image then blit it to the new surface with an SDL command |
03:22:16 | termer | I have one more question, you removed the "return" keyword and just referenced the variable at the end. Is this an implicit return then |
03:22:25 | termer | it looks very weird to me coming from basically everything besides nim |
03:22:25 | FromDiscord | <Elegantbeef> Yes |
03:22:31 | termer | is that standard |
03:22:36 | FromDiscord | <Elegantbeef> All statements can be expressions so `return` is almost never needed |
03:22:49 | FromDiscord | <Elegantbeef> It's pretty idiomatic to disregard `return` |
03:22:55 | termer | ok noted |
03:23:06 | termer | although it seems a bit ambiguous compared to typing return |
03:23:22 | FromDiscord | <Elegantbeef> Perhaps if you're new, i heavily use expressions |
03:23:32 | termer | just in genera; |
03:23:34 | termer | *general |
03:24:01 | FromDiscord | <Elegantbeef> It's an expression it's not ambigous to me |
03:24:14 | FromDiscord | <Elegantbeef> The procedure has a return type and the last statement is a variable |
03:24:23 | termer | hmm fair enough I suppose |
03:25:02 | termer | wait a minute |
03:25:12 | termer | you mentioned doing for thread in hasher.threads.mitems |
03:25:16 | termer | I've never used mitems |
03:25:27 | FromDiscord | <Elegantbeef> It's 'mutable items' |
03:25:28 | pch | return can be useful for quick exit |
03:25:30 | termer | the reason I was using an index was because I wanted to assign to the thread arr at that idx |
03:25:37 | termer | pch well of course |
03:25:51 | pch | so you're passing return instead of break, which should behave more predictably |
03:26:17 | termer | yeah I do use return to exit out of a proc early often |
03:26:22 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3SOC this might help you pch |
03:26:32 | FromDiscord | <Elegantbeef> I generally never use return unless I need to |
03:26:40 | FromDiscord | <Elegantbeef> For performance or logic reasons |
03:26:55 | termer | is there actually a performance hit with using return |
03:26:59 | termer | I've never heard of that |
03:27:09 | FromDiscord | <Elegantbeef> termer `mitems` iterates over the collection yielding a pointer to the element since you dont use `i` there is no difference |
03:27:20 | FromDiscord | <Elegantbeef> No i meant performance in the other way |
03:27:28 | termer | oh |
03:27:41 | FromDiscord | <Elegantbeef> iterating over a collection to find an element for instance you can either do `result = true;break` or `return true` |
03:28:07 | FromDiscord | <Elegantbeef> It yields a `var T` which is a mutable reference or a 'pointer' 😀 |
03:28:13 | termer | could you show me how you'd write that bit with the threads array |
03:28:56 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3SOD |
03:29:18 | termer | oh I'm retarded |
03:29:23 | termer | that makes perfect sense LOL |
03:29:52 | termer | I'd like to blame all my bad code on lack of sleep but seeing as I only have time to write nim when it's late I really can't keep using that excuse |
03:32:22 | FromDiscord | <Elegantbeef> You also can use `https://nim-lang.org/docs/system.html#createShared%2Ctypedesc` instead of `allocShared0` |
03:32:52 | termer | what's the benefit of that over allocShared0 |
03:33:03 | FromDiscord | <Elegantbeef> no needing to type `sizeof` 😛 |
03:34:46 | FromDiscord | <Elegantbeef> I'd also do `type ThreadMessage = (ref AsyncArgon2, ptr Channel[Job], ptr Channel[JobRes])` or declare an object to save on typing |
03:36:24 | FromDiscord | <Elegantbeef> For createshared you dont need to cast it to a ptr on top of it |
03:36:33 | termer | that figures |
03:36:59 | termer | ok I'll do that stuff tomorrow |
03:37:03 | termer | I appreciate your advice |
03:37:04 | FromDiscord | <Elegantbeef> so you get a much more readable `hasher.jobChan = createShared(Channel[Job])` |
03:38:34 | * | ltriant quit (Ping timeout: 250 seconds) |
03:39:29 | * | ozzz quit (Ping timeout: 256 seconds) |
03:42:58 | FromDiscord | <TennisBowling> In reply to @Elegantbeef "Though Araq generally says": but with auto I have problems for when I set a variable to that function |
03:43:10 | termer | pushed changes |
03:43:16 | FromDiscord | <Elegantbeef> What? |
03:43:27 | FromDiscord | <Elegantbeef> Auto means the compiler will resolve the type |
03:43:52 | * | ozzz joined #nim |
03:44:22 | FromDiscord | <Elegantbeef> Tennis what's the code |
03:45:44 | FromDiscord | <TennisBowling> if I set the return instance to auto, then functions that call it like↵let x = theFunc()↵say that the type is ambiguous↵which makes sense but what do I do |
03:46:00 | FromDiscord | <Elegantbeef> what's `theFunc`? |
03:46:10 | FromDiscord | <Elegantbeef> the return type being `auto` doesnt mean it's ambiguousu |
03:46:29 | FromDiscord | <TennisBowling> sent a code paste, see https://paste.rs/yQL |
03:46:34 | FromDiscord | <Elegantbeef> Nim's statically typed, there is no way you can write `theFunc` to be ambigous |
03:46:47 | FromDiscord | <Elegantbeef> There is no ambiguity |
03:46:48 | FromDiscord | <TennisBowling> (edit) "https://paste.rs/ROC" => "https://paste.rs/ZAE" |
03:47:00 | FromDiscord | <Elegantbeef> `outOfAlivenodes` is a `Node` as is `node` |
03:47:14 | FromDiscord | <TennisBowling> `Error: type mismatch: got 'NodeInstance' for 'node' but expected 'typedesc[outOfAliveNodes]'` |
03:47:31 | FromDiscord | <Elegantbeef> what is `outOfAliveNodes`? |
03:47:46 | FromDiscord | <TennisBowling> `type outOfAliveNodes = void↵` |
03:47:49 | FromDiscord | <Elegantbeef> Like i said Nim doesnt have dynamic typing |
03:48:05 | FromDiscord | <Elegantbeef> the procedure should return `void` then |
03:48:23 | FromDiscord | <TennisBowling> right but it can return NodeInstance |
03:48:38 | FromDiscord | <Elegantbeef> node is not `void` |
03:48:43 | FromDiscord | <Elegantbeef> Like was said you want to use options |
03:49:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SOO |
03:49:35 | FromDiscord | <Elegantbeef> You cannot return two types from a single instance of a procedure |
03:49:40 | FromDiscord | <TennisBowling> ah I see |
03:49:40 | FromDiscord | <huantian> I think you have an extra `result = ` beef |
03:49:41 | FromDiscord | <Elegantbeef> It either returns one or the other |
03:49:51 | FromDiscord | <Elegantbeef> yes |
03:50:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/1cO |
03:51:36 | FromDiscord | <huantian> 😈 |
03:53:02 | FromDiscord | <TennisBowling> hmm |
03:53:21 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/options.html#basic-usage |
03:53:29 | FromDiscord | <TennisBowling> with that I get ↵`Error: expression 'none(NodeInstance)' is of type 'Option[consensusbackup.NodeInstance]' and has to be used (or discarded)` |
03:53:36 | FromDiscord | <TennisBowling> on the if thing |
03:53:39 | FromDiscord | <TennisBowling> (first if) |
03:54:11 | FromDiscord | <Elegantbeef> Both expressions have an implicit result so make sure you indented properly |
03:54:22 | * | slowButPresent quit (Quit: leaving) |
03:54:33 | FromDiscord | <Elegantbeef> also `typeof(node) is NodeInstance`? |
03:54:40 | FromDiscord | <TennisBowling> yes |
03:54:58 | FromDiscord | <Elegantbeef> What's your entire code now? |
03:55:03 | FromDiscord | <TennisBowling> sent a code paste, see https://paste.rs/Bq8 |
03:55:19 | FromDiscord | <TennisBowling> sent a code paste, see https://paste.rs/BHA |
03:55:53 | FromDiscord | <Elegantbeef> i guess do `result = none(NodeInstance)` and same for the `result = some(node)` |
03:56:10 | FromDiscord | <Elegantbeef> I dont see where the exprression is falling through |
03:56:13 | FromDiscord | <huantian> you could also use the default result value too and be more implicit |
03:57:11 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SOQ |
03:57:30 | FromDiscord | <Elegantbeef> You're doing `getAlive == outOfAlive` |
03:57:36 | FromDiscord | <Elegantbeef> it's `getAliveNode.isSome` |
03:57:44 | FromDiscord | <Elegantbeef> or `getAlive Node.isNone` |
03:57:49 | FromDiscord | <TennisBowling> ahhhh |
03:58:18 | FromDiscord | <Bubblie> can I add breakpoints in nim |
03:58:26 | FromDiscord | <Bubblie> when debugging |
03:58:33 | FromDiscord | <Elegantbeef> Yes with GDB setup properly |
03:58:41 | FromDiscord | <Bubblie> how do I set up gdb? |
03:58:44 | FromDiscord | <TennisBowling> cool that worked |
03:58:46 | FromDiscord | <TennisBowling> thanks! |
03:58:47 | FromDiscord | <Elegantbeef> Fuck if i know |
03:58:49 | FromDiscord | <Bubblie> LMAO |
03:58:52 | FromDiscord | <Elegantbeef> I dont debug using debuggers |
03:59:02 | FromDiscord | <Bubblie> oh I see |
03:59:04 | FromDiscord | <huantian> cool kids use treeform print |
03:59:12 | FromDiscord | <Bubblie> or just, systout |
03:59:17 | FromDiscord | <Bubblie> (edit) "systout" => "sysout" |
03:59:22 | FromDiscord | <Elegantbeef> You can follow https://github.com/saem/vscode-nim#debugging |
03:59:39 | FromDiscord | <Elegantbeef> I know the author of GDB frontend got ok results using that |
03:59:50 | FromDiscord | <Elegantbeef> Gdb frontend that is |
03:59:56 | FromDiscord | <Elegantbeef> https://github.com/rohanrhu/gdb-frontend this thingy |
04:00:28 | FromDiscord | <Bubblie> 👀 |
04:00:31 | FromDiscord | <Bubblie> cool ill look into it |
04:00:59 | FromDiscord | <Bubblie> oh wait |
04:01:02 | FromDiscord | <Elegantbeef> This old doc exists but i wouldnt suggest nimprof https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html |
04:01:03 | FromDiscord | <Bubblie> CLion works now LETS GOOOOO |
04:01:11 | FromDiscord | <Bubblie> I can debug with CLion right off the bat |
04:01:21 | FromDiscord | <Bubblie> god this is awesome |
04:01:40 | FromDiscord | <huantian> is the variable viewer thingy good? on clion? |
04:01:46 | FromDiscord | <Bubblie> not sure |
04:01:52 | FromDiscord | <huantian> I don't know what that's called tbh |
04:01:52 | FromDiscord | <Bubblie> what do you mean by variable viewer thingy |
04:01:55 | FromDiscord | <Bubblie> like |
04:01:58 | FromDiscord | <Bubblie> the breakpoint information? |
04:02:01 | FromDiscord | <huantian> uh |
04:02:01 | FromDiscord | <huantian> ig |
04:02:10 | FromDiscord | <Elegantbeef> Doubt any will be good they lack all the information of types, so a `set[char]` will be like debugging an array of ints↵(@huantian) |
04:02:40 | FromDiscord | <Bubblie> I mean im testing it right now hold on |
04:02:44 | FromDiscord | <Elegantbeef> Same with a `set[enum]` |
04:02:56 | FromDiscord | <Bubblie> does nim have Algebraic data types? |
04:03:05 | FromDiscord | <Bubblie> like sum types and stuff |
04:03:06 | FromDiscord | <Elegantbeef> I answered this yesterday |
04:03:13 | FromDiscord | <Elegantbeef> It has object variants |
04:03:18 | FromDiscord | <Elegantbeef> Which are just tagged unions |
04:03:29 | FromDiscord | <Elegantbeef> Though https://github.com/alaviss/union exists |
04:03:34 | FromDiscord | <Bubblie> oh I didn't see that |
04:03:37 | FromDiscord | <Elegantbeef> Considerr reading https://nim-lang.org/docs/manual.html |
04:03:54 | FromDiscord | <Bubblie> also the debugging is actually pretty good |
04:03:56 | FromDiscord | <Bubblie> in CLion |
04:04:09 | FromDiscord | <Bubblie> its telling me info, not sure about types though |
04:04:25 | FromDiscord | <Bubblie> alright |
04:04:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SOV |
04:04:30 | FromDiscord | <Bubblie> where do you want the breakpoints |
04:04:35 | FromDiscord | <Bubblie> on the type Color right? |
04:04:39 | FromDiscord | <Elegantbeef> 3 and 4 the only running code |
04:05:09 | FromDiscord | <Elegantbeef> i'm 99% certain it'll show `a` as `3` and then `7` |
04:05:52 | FromDiscord | <Elegantbeef> I dont imagine it'll show `{red, green}` then `{red, green, blue}` |
04:07:03 | FromDiscord | <Bubblie> you may be right |
04:07:38 | FromDiscord | <Bubblie> might set up vim in vscode then |
04:07:51 | FromDiscord | <Elegantbeef> Well no debugger shows the actual enum values |
04:08:02 | FromDiscord | <Elegantbeef> Either it's not possible or someone needs to fix the nim-gdb script |
04:08:16 | FromDiscord | <Bubblie> maybe |
04:08:30 | FromDiscord | <Bubblie> I might just, debug without breakpoints maybe |
04:08:35 | FromDiscord | <Bubblie> but im so use to breakpoint debugging |
04:08:36 | FromDiscord | <Bubblie> LMAO |
04:08:42 | FromDiscord | <Elegantbeef> `echo a` does print `{red, green, blue` |
04:08:55 | FromDiscord | <Bubblie> yes |
04:08:58 | FromDiscord | <Bubblie> echo will print it |
04:09:06 | FromDiscord | <Bubblie> but with a normal break point it doesn't show red,green,blue |
04:09:11 | FromDiscord | <Elegantbeef> Echo prints 'all' 😛 |
04:09:14 | FromDiscord | <Bubblie> which as you said is to be expected |
04:09:23 | FromDiscord | <huantian> this is what vscode shows https://media.discordapp.net/attachments/371759389889003532/954592394819539014/unknown.png |
04:09:32 | FromDiscord | <Bubblie> thats what I go too |
04:09:33 | FromDiscord | <Elegantbeef> Well if you want to make debugging better go hammer your head into `nim-gdb.py` |
04:09:36 | FromDiscord | <Bubblie> (edit) "go" => "got" |
04:09:50 | FromDiscord | <Bubblie> also, clion was able to show me the disassembly file |
04:09:52 | FromDiscord | <Bubblie> which was like |
04:09:55 | FromDiscord | <Bubblie> LMAO |
04:09:57 | FromDiscord | <Bubblie> not sure why |
04:10:10 | FromDiscord | <huantian> nah it's the same elsewhere |
04:10:12 | FromDiscord | <Elegantbeef> did you compile with `--debugger:native` huan? |
04:10:24 | FromDiscord | <huantian> yep |
04:10:38 | FromDiscord | <Bubblie> does clion support assembly? |
04:10:39 | FromDiscord | <Bubblie> I wonder |
04:10:50 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/tools/nim-gdb.py is where that python file exists if anyone wants to take a shot 😛 |
04:11:05 | FromDiscord | <Bubblie> oh holy fuck |
04:11:08 | FromDiscord | <Bubblie> clion supports NASM? |
04:11:10 | FromDiscord | <Bubblie> YOOOO |
04:11:18 | FromDiscord | <Bubblie> how good is it though |
04:11:30 | FromDiscord | <huantian> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/blob/devel/tools/ni": why does my python not have type hints |
04:11:45 | FromDiscord | <huantian> also I think I was using lldb on vscode because lazy |
04:11:54 | FromDiscord | <Elegantbeef> Python fucking sucks that's why |
04:12:03 | FromDiscord | <Bubblie> never heard a truer statement |
04:12:13 | FromDiscord | <Bubblie> I use to use python a lot |
04:12:18 | FromDiscord | <Bubblie> I still use it sometimes |
04:12:19 | FromDiscord | <Bubblie> but jesus |
04:12:22 | FromDiscord | <huantian> well python can't enforce type hints |
04:12:33 | FromDiscord | <Elegantbeef> Not with that attitude |
04:12:37 | FromDiscord | <huantian> true! |
04:12:41 | FromDiscord | <Bubblie> LOL |
04:13:01 | FromDiscord | <Bubblie> im glad CLion supports NASM |
04:13:07 | FromDiscord | <Elegantbeef> python 4 start enforcing static typing in code not written inside a `fuckingIdioticBlock` |
04:13:19 | FromDiscord | <Elegantbeef> Then eventually you're golden and all your code will be static typed |
04:13:26 | FromDiscord | <Elegantbeef> 10/10 trust me i'm a genius |
04:14:12 | FromDiscord | <huantian> also maybe they should add less leaky scoping |
04:14:24 | FromDiscord | <Elegantbeef> Maybe we shouldnt use it |
04:14:43 | FromDiscord | <Elegantbeef> "And other things a perpetually unemployed programmer can say" |
04:15:12 | * | ltriant joined #nim |
04:15:21 | FromDiscord | <Bubblie> maybe python shouldn't be shit |
04:16:46 | FromDiscord | <huantian> ok but can your language do `a, b = a[:] = [[]], []` |
04:16:57 | FromDiscord | <Bubblie> LMAO |
04:17:14 | FromDiscord | <Bubblie> nim actually made me like indentation langs |
04:17:26 | FromDiscord | <Bubblie> nim is like the first language ive seen that does indentation right |
04:17:27 | FromDiscord | <Elegantbeef> Well it's whitespace isnt silly |
04:17:34 | FromDiscord | <Bubblie> fr |
04:17:39 | FromDiscord | <Bubblie> holy shit its like a breathe of fresh air |
04:17:47 | FromDiscord | <Bubblie> ruby and python are just |
04:17:48 | FromDiscord | <Bubblie> oh my god |
04:17:51 | FromDiscord | <Elegantbeef> You can do that you need `\` |
04:17:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SP1 |
04:18:15 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3SP2 |
04:18:17 | FromDiscord | <Elegantbeef> Lol |
04:18:22 | FromDiscord | <Elegantbeef> That's ambiguous though |
04:18:29 | FromDiscord | <Elegantbeef> Is it unary is it binary who knows! |
04:18:44 | FromDiscord | <Bubblie> can you make nim compile to things other than an exe |
04:18:46 | FromDiscord | <Elegantbeef> Also that's horizontally aligned code, so it's fucking tedious |
04:18:52 | FromDiscord | <Elegantbeef> You can write libraries yes |
04:18:57 | FromDiscord | <Elegantbeef> `--app:lib` goes brr |
04:19:07 | FromDiscord | <Bubblie> so like, how would I make an executeable for mac |
04:19:17 | FromDiscord | <Elegantbeef> You'd cross compile for mac |
04:19:26 | FromDiscord | <Elegantbeef> Which is tedious and damn near impossible if you arent on mac |
04:19:30 | FromDiscord | <Elegantbeef> Atleast afaik |
04:19:31 | FromDiscord | <Bubblie> I have a mac |
04:19:32 | FromDiscord | <Bubblie> so |
04:19:35 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3SP4 |
04:19:38 | FromDiscord | <Bubblie> it shouldn't be that bad |
04:19:40 | FromDiscord | <Bubblie> but |
04:19:44 | FromDiscord | <Bubblie> I say that but mac development is hell |
04:19:44 | FromDiscord | <huantian> In reply to @Elegantbeef "Which is tedious and": because apple is dum dum |
04:19:47 | FromDiscord | <Elegantbeef> Just compile locally on the mac then |
04:19:49 | FromDiscord | <Bubblie> does nim work on m1? |
04:19:53 | FromDiscord | <Elegantbeef> Yes |
04:19:56 | FromDiscord | <Bubblie> perfect |
04:19:59 | FromDiscord | <Bubblie> my mac is an m1 |
04:20:02 | FromDiscord | <Elegantbeef> I think Araq uses a M1 |
04:20:14 | FromDiscord | <Bubblie> as soon as I get fedora linux I will be the master of all elements |
04:20:21 | FromDiscord | <huantian> araq uses macos? time to stop using nim |
04:20:34 | FromDiscord | <Elegantbeef> Agreed |
04:20:49 | FromDiscord | <Bubblie> I keep putting semi colons in nim like its java 💀 |
04:20:53 | FromDiscord | <Elegantbeef> I'm going to fork it and just make it so it doesnt compile for mac |
04:20:57 | FromDiscord | <Bubblie> this is what java does to a person |
04:21:10 | FromDiscord | <Elegantbeef> When i write shaders i do the same |
04:21:17 | FromDiscord | <Elegantbeef> Start religiously putting semicolons and crying |
04:21:23 | FromDiscord | <Elegantbeef> "They're redundant" i scream |
04:21:25 | FromDiscord | <huantian> whenever I write semicolon langs I always write the code and then when it doesn't compile I put all my semicolons in |
04:21:47 | FromDiscord | <Elegantbeef> I've got so many "expected ;" errors working inbetween shader and game codee |
04:22:02 | FromDiscord | <Elegantbeef> Shady needs UBO/SSBO support before i can use it |
04:22:19 | FromDiscord | <huantian> ~~also why does unity not have init only properties grumble grumble~~ |
04:22:34 | FromDiscord | <Elegantbeef> The fuck is a Unity 😛 |
04:22:40 | FromDiscord | <huantian> it's that uh |
04:22:43 | FromDiscord | <huantian> one desktop environment |
04:22:47 | FromDiscord | <huantian> and that one song by the fat rat |
04:22:57 | FromDiscord | <Elegantbeef> And that game engine |
04:23:24 | FromDiscord | <Bubblie> also I love how nim uses var and not val |
04:23:25 | FromDiscord | <Elegantbeef> Let's see if i can get any game dev done or if my brain will run off into "oh look a squirrel mode" |
04:23:31 | FromDiscord | <Bubblie> idk I like var better |
04:23:35 | FromDiscord | <Bubblie> also I dislike let |
04:23:46 | FromDiscord | <Elegantbeef> But nim uses `let` |
04:23:55 | FromDiscord | <Bubblie> but nim uses var? |
04:24:05 | FromDiscord | <Elegantbeef> Nim uses `var` `let` and `const` |
04:24:06 | FromDiscord | <Bubblie> does it have both? |
04:24:07 | FromDiscord | <Bubblie> OH SHIT |
04:24:12 | FromDiscord | <Elegantbeef> `let` is immutable |
04:24:12 | FromDiscord | <Bubblie> okay thats fine |
04:24:22 | FromDiscord | <Bubblie> ah okay |
04:24:25 | FromDiscord | <Bubblie> makes sense |
04:24:25 | FromDiscord | <Elegantbeef> `var` is mutable and i'll let you guess what `const` is |
04:24:30 | FromDiscord | <huantian> I was writing some c# and I was like "dang I wish c# had macros" |
04:24:33 | FromDiscord | <Bubblie> const is self explanatory |
04:24:46 | FromDiscord | <Elegantbeef> Rosyln source code generators is the best they can do |
04:25:45 | FromDiscord | <huantian> why can't I just put my entire game in `static:` and have it run at build time unity smh |
04:26:07 | FromDiscord | <Elegantbeef> Huan you're also a gamedev? |
04:26:30 | FromDiscord | <Bubblie> so just to refresh my memory, let can be assigned once just like const, except const cannot be assigned to something like input |
04:26:31 | FromDiscord | <Bubblie> let can |
04:26:41 | FromDiscord | <Elegantbeef> `const` is compiletime constant |
04:26:46 | FromDiscord | <Bubblie> its still assigned once but it isn't enforced in compile time |
04:26:49 | FromDiscord | <Elegantbeef> `let` is runtime 'constant' |
04:26:50 | FromDiscord | <Bubblie> In reply to @Elegantbeef "`const` is compiletime constant": yeah |
04:26:54 | FromDiscord | <Elegantbeef> Var is 100% mutable |
04:27:13 | FromDiscord | <huantian> In reply to @Elegantbeef "Huan you're also a": I do some coding for Rhythm Doctor ye |
04:27:18 | FromDiscord | <Bubblie> 👀 |
04:27:24 | FromDiscord | <Bubblie> wait |
04:27:25 | FromDiscord | <Bubblie> like |
04:27:28 | FromDiscord | <Bubblie> rhythm doctor mods |
04:27:30 | FromDiscord | <Elegantbeef> Nim has compile time evaluation so you can do something like `const myShader = staticRead"myDir/shader"` |
04:27:30 | FromDiscord | <Bubblie> or the actual game |
04:27:38 | FromDiscord | <huantian> actual game |
04:27:41 | FromDiscord | <Bubblie> 👀 |
04:27:44 | FromDiscord | <Bubblie> holy shit |
04:27:53 | FromDiscord | <huantian> ~~yall should play it it's a good game unbiased opinion~~ |
04:27:56 | FromDiscord | <Bubblie> I love rhythm doctor |
04:28:09 | FromDiscord | <Bubblie> I didn't think I would meet an actual rhythm doctor dev |
04:28:12 | FromDiscord | <Elegantbeef> literally unplayable |
04:28:13 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/954597133619699752/image.png |
04:28:34 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Nim has compile time": ah okay |
04:28:46 | FromDiscord | <Bubblie> so a good time to use const is when I never assign anything at run time |
04:28:49 | FromDiscord | <Bubblie> only at compile time |
04:29:05 | FromDiscord | <huantian> nim's `var` `let` `const` is so much better than js's lmao |
04:29:08 | FromDiscord | <Elegantbeef> Const is as the name implies for constants |
04:29:35 | FromDiscord | <Elegantbeef> If something is constant and unchanging use `const` if something loads from runtime values but is otherwise constant use `let`, finally use \`var |
04:29:42 | FromDiscord | <Bubblie> yes |
04:29:44 | FromDiscord | <Bubblie> alright good |
04:29:45 | FromDiscord | <Elegantbeef> That's the order i take when making variables |
04:29:47 | FromDiscord | <Bubblie> my brain is functional |
04:29:59 | FromDiscord | <Bubblie> In reply to @huantian "nim's `var` `let` `const`": they are |
04:30:00 | FromDiscord | <Elegantbeef> The most immutable program is the best program imo |
04:30:14 | FromDiscord | <Bubblie> I mean, I would assume it depends on the program right |
04:30:18 | FromDiscord | <Bubblie> depending on what tools would be used |
04:30:21 | FromDiscord | <huantian> In reply to @Bubblie "I didn't think I": I only joined end of last year lol, suprised you're not in the Rhythm docto discord server |
04:30:27 | FromDiscord | <huantian> (edit) "Rhythm docto" => "rhythm doctor" |
04:30:29 | FromDiscord | <Elegantbeef> No the smallest mutable state is the best |
04:30:46 | FromDiscord | <Bubblie> In reply to @huantian "I only joined end": I never joined, I should |
04:30:47 | FromDiscord | <Elegantbeef> i'm not going to sound off like a FP programmer saying everything has to be pure, but when it can be it should be |
04:30:54 | FromDiscord | <Bubblie> Its just im at the max discord server limit |
04:31:02 | FromDiscord | <Bubblie> don't ask why im in 100 programming servers |
04:31:09 | FromDiscord | <Bubblie> and inactive in 90 of them |
04:31:14 | FromDiscord | <Elegantbeef> Well you have nim now so leave 99 of them |
04:31:21 | FromDiscord | <Bubblie> LMAO |
04:31:36 | FromDiscord | <huantian> yeah I have to leave a server each time I join a new one |
04:31:47 | FromDiscord | <Bubblie> im in a bunch of minecraft mod dev servers |
04:31:51 | FromDiscord | <Bubblie> so I think that adds to it |
04:32:07 | FromDiscord | <huantian> In reply to @Elegantbeef "i'm not going to": yeah I think recently I've been too functional and immutable... |
04:32:14 | FromDiscord | <huantian> maybe I should go code some js or something |
04:32:53 | FromDiscord | <Bubblie> code js...? |
04:32:58 | FromDiscord | <Bubblie> why would you do that to yourself |
04:33:41 | FromDiscord | <Bubblie> I envy people who can actually enjoy JS |
04:33:43 | FromDiscord | <Bubblie> I cant |
04:34:16 | FromDiscord | <huantian> In reply to @Elegantbeef "image.png": soon™️ |
04:34:34 | FromDiscord | <huantian> I do wish c# had object variants tho |
04:35:08 | FromDiscord | <Elegantbeef> Dont lie you wish it was Nim |
04:35:24 | FromDiscord | <Bubblie> C# feels like java, so for me it is easy to use |
04:36:00 | FromDiscord | <Bubblie> I wonder how good I can make an entity component system in nim |
04:36:12 | FromDiscord | <huantian> and this doesn't work |
04:36:13 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3SP9 |
04:36:15 | nrds | <Prestige99> There are a few out there |
04:36:20 | FromDiscord | <huantian> and I'm just like fuming |
04:36:50 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3SP9" => "https://paste.rs/88r" |
04:36:50 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3SPa" => "https://paste.rs/8rw" |
04:37:01 | FromDiscord | <Elegantbeef> Oh right i was going to look at that errror |
04:37:24 | FromDiscord | <Elegantbeef> Prestige can you repost the link? |
04:37:48 | nrds | <Prestige99> Elegantbeef https://github.com/nim-lang/Nim/issues/19371 this? |
04:37:55 | FromDiscord | <Elegantbeef> danke |
04:38:10 | nrds | <Prestige99> Thanks for looking into it |
04:40:08 | nrds | <Prestige99> Hmm can you write a case statement for a union type? |
04:40:36 | FromDiscord | <Elegantbeef> What? |
04:40:40 | FromDiscord | <huantian> union type? |
04:41:03 | FromDiscord | <Elegantbeef> No error reported here with nvim |
04:41:31 | FromDiscord | <Elegantbeef> You're using the LSP right? |
04:45:16 | FromDiscord | <Elegantbeef> Yea it's related to nimlsp afaict |
04:49:07 | FromDiscord | <Elegantbeef> Yep saem's extension using nimsuggest doesnt error but bung's extension using lsp does |
04:49:16 | FromDiscord | <Elegantbeef> So it's something the lsp is doing to get that error |
04:49:46 | FromDiscord | <Elegantbeef> prestige that was all for you so you best respond |
04:54:08 | pch | aha i got it working |
04:54:27 | FromDiscord | <Elegantbeef> Congrats |
04:54:27 | pch | next up for the api: attempt to implement frame pacing |
04:57:47 | nrds | <Prestige99> Elegantbeef hmm let me check something |
04:58:45 | nrds | <Prestige99> Yeah Elegantbeef if you just put that code into a file and directly run nimsuggest on it, it will show that error I reported |
04:59:29 | nrds | <Prestige99> nimsuggest foo.nim then chk 1 |
05:00:42 | FromDiscord | <Elegantbeef> Ah you're right |
05:00:55 | FromDiscord | <Elegantbeef> nvim/vscode worked fine |
05:01:04 | nrds | <Prestige99> I wonder why |
05:02:22 | FromDiscord | <Elegantbeef> Only way to learn is to debug it 😛 |
05:08:21 | nrds | <Prestige99> I'm getting those errors from within nvim actually so yeah |
05:14:07 | FromDiscord | <Elegantbeef> Well we're using different error services so yea |
05:14:13 | FromDiscord | <Elegantbeef> I was just saying with my setup of nvim it didnt error |
05:20:56 | nrds | <Prestige99> Yours doesn't use nimsuggest then I take it |
05:21:43 | FromDiscord | <Elegantbeef> Yes it does |
05:21:45 | nrds | <Prestige99> It seems like nobody really cares that nimsuggest is essentially broken |
05:22:28 | FromDiscord | <Elegantbeef> Actually you're right it might use nimcheck |
05:22:56 | FromDiscord | <Elegantbeef> Well i mean you seem to care, but arent trying to fix it so checkmate |
05:23:41 | nrds | <Prestige99> I mean if I wanted to write and work on a new language I'd be doing that instead lol |
05:24:55 | FromDiscord | <Elegantbeef> I'll take a look at it, knowing the compiler it's just missing a flag 😛 |
05:28:45 | FromDiscord | <Elegantbeef> Also how dare you not actually make a min repro |
05:29:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SPo |
05:30:43 | nrds | <Prestige99> Lol |
05:30:45 | nrds | <Prestige99> Thanks for looking |
05:33:23 | FromDiscord | <Elegantbeef> `semIdeForTemplateOrGenericCheck` hmm this stuff might be related |
05:33:52 | * | rawrrr quit (Quit: Connection closed for inactivity) |
05:36:47 | FromDiscord | <Elegantbeef> Holy shit the issue is that the type and proc are exported |
05:37:45 | FromDiscord | <Elegantbeef> Remove the export from the proc and it works |
05:38:15 | FromDiscord | <Elegantbeef> It's just that the proc is exported, so that limits the scope down a bit |
05:42:04 | nrds | <Prestige99> hmm |
05:42:29 | nrds | <Prestige99> well if I _want_ it exported, that shouldn't cause this issue I'd think |
05:42:45 | FromDiscord | <Elegantbeef> What? |
05:42:57 | nrds | <Prestige99> like, this error being reported is still false |
05:43:09 | FromDiscord | <Elegantbeef> The issue is a exported generic causes this bug, it limits the scope of the issue down quite a bit |
05:43:34 | FromDiscord | <Elegantbeef> We went from "Why the fuck does this happen" to "Ok it's just an exported generic procedure" |
05:43:41 | FromDiscord | <Elegantbeef> Which makes me wonder if a constrained generic also does |
05:45:06 | FromDiscord | <Elegantbeef> It's even more percise now |
05:45:31 | FromDiscord | <Elegantbeef> an exported inferred generic procedure is the culprit |
05:46:09 | FromDiscord | <Elegantbeef> if you instead do `doThing[string](BinaryTree[string]())` it goes away |
05:46:41 | nrds | <Prestige99> Interesting... |
05:47:02 | nrds | <Prestige99> So it's unable to intepret the correct function based on the param type? |
05:47:19 | FromDiscord | <Elegantbeef> There is a nimsuggest generic optimization which is causing this i believe |
05:47:56 | FromDiscord | <Elegantbeef> I dont know where it is yet, but i'm thinking either in `qualifiedLookup`,`seminst`, `semtypeinst` though those dont have special casing for nimsuggest |
05:48:32 | nrds | <Prestige99> It started after 1.4.8 if that helps at all |
05:51:23 | FromDiscord | <Elegantbeef> Going to add my findings to that issue anyway |
05:57:22 | nrds | <Prestige99> ty |
06:01:09 | FromDiscord | <Elegantbeef> Now if i can reason why and how to fix it is another thing |
07:07:31 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3SPJ |
07:08:02 | FromDiscord | <Elegantbeef> `--cc:tcc` |
07:08:21 | FromDiscord | <creikey> I think it's mostly because of nimble |
07:08:36 | FromDiscord | <Elegantbeef> Until `IC` we're stuck with compile times |
07:08:42 | FromDiscord | <Rika> Then maybe don’t use nimble since aside from improving the code… |
07:08:52 | FromDiscord | <creikey> In reply to @Rika "Then maybe don’t use": yeah just `nim r` seems a lot faster |
07:08:58 | FromDiscord | <creikey> don't know why I didn't try that in the first place |
07:09:14 | FromDiscord | <Elegantbeef> Then yea just use `nimble` for ensuring it's a reproducible build |
07:09:15 | FromDiscord | <Rika> Nimble probably does some sort of checks from the network |
07:09:23 | FromDiscord | <Rika> Cuz packages |
07:09:39 | FromDiscord | <Elegantbeef> Doesnt `nimble run` make a release build? |
07:09:51 | FromDiscord | <Elegantbeef> `nimble run -d:debug` might be fasteer |
07:10:05 | FromDiscord | <Rika> Run does not pass switches |
07:10:25 | FromDiscord | <Rika> which is a bug |
07:10:51 | FromDiscord | <creikey> just had to explain to my rooommate what irc was |
07:11:55 | FromDiscord | <creikey> In reply to @Elegantbeef "`nimble run -d:debug` might": same amount of time proving it's just scanning the deps |
07:12:02 | FromDiscord | <Elegantbeef> Odd |
07:12:11 | FromDiscord | <Elegantbeef> Make a new task then i guess |
07:12:15 | FromDiscord | <creikey> yeah |
07:12:17 | FromDiscord | <creikey> oh wait |
07:12:18 | FromDiscord | <creikey> nimble task |
07:12:38 | FromDiscord | <creikey> In reply to @Elegantbeef "Odd": I'm using windy which depends on everything treeform so it's all his code but spread across like 20 dependencies |
07:12:59 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/954638601176641556/unknown.png |
07:13:25 | FromDiscord | <Elegantbeef> Ah |
07:13:43 | pch | https://github.com/kinkinkijkin/nimsgp on public VCS now |
07:15:08 | FromDiscord | <Elegantbeef> Oh yet another canuck |
07:15:18 | FromDiscord | <Rika> When will people stop naming Nim projects with “Nim” in it |
07:15:39 | FromDiscord | <Elegantbeef> Never |
07:15:55 | pch | I put nim in it because I need to describe that it's specifically for usage with the nim language |
07:16:10 | pch | you know, like 90% of libraries that aren't just C do |
07:16:30 | nrds | <Prestige99> I've definitely never done that 😅 |
07:17:00 | FromDiscord | <Rika> Well at least give it a catchier name than “SGP” |
07:17:37 | FromDiscord | <huantian> How about tenderchart |
07:18:08 | pch | names mean very little and I'm currently dealing with extremely much more important things in my life than whether my free software is marketable |
07:18:13 | FromDiscord | <Rika> Okay |
07:18:27 | FromDiscord | <Elegantbeef> Your comments rant make me laugh a bit |
07:19:12 | pch | I even removed arbitrary attachements at some point after I wrote that |
07:19:20 | pch | like, they're not there any more at all |
07:19:22 | pch | I gave up |
07:21:23 | FromDiscord | <Elegantbeef> 10/10 on the proper spelling of colour |
07:29:25 | FromDiscord | <Elegantbeef> Well prestige no luck in fixing it so far |
07:29:44 | FromDiscord | <Elegantbeef> An hour of scrolling code and testing is enough for the night 😀 |
07:30:01 | nrds | <Prestige99> thanks for the effort, I appreciate ya |
07:32:43 | FromDiscord | <Elegantbeef> It's pretty clear it's in the semoverloadedCall branch, just dont know exactly where |
07:55:27 | * | jjido joined #nim |
08:00:30 | pch | maintainer of sdl2 bindings for nim: the bindings hard-search for libSDL2.so |
08:00:50 | pch | on haiku the so is named "libSDL2-2.0.so.0" |
08:01:33 | nrds | <Prestige99> I see both on my system (linux) so that's interesting |
08:01:55 | FromDiscord | <Rika> Probably best to raise an issue |
08:04:04 | pch | issue raised |
08:08:20 | * | Gustavo6046 joined #nim |
08:09:50 | * | acidsys quit (Excess Flood) |
08:10:04 | * | Gustavo6046 quit (Remote host closed the connection) |
08:10:24 | * | acidsys joined #nim |
08:10:26 | * | acidsys quit (Excess Flood) |
08:11:05 | * | acidsys joined #nim |
08:12:12 | * | Gustavo6046 joined #nim |
08:13:08 | * | Gustavo6046 quit (Remote host closed the connection) |
08:13:28 | * | Gustavo6046 joined #nim |
08:22:18 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:35:37 | pch | tested renderer with a fix to the sdl2 bindings for haiku, confirmed working |
09:12:47 | FromDiscord | <Goel> How to create an array starting with Index 1 instead of 0? |
09:13:37 | FromDiscord | <Elegantbeef> `array[1..EndIndex, YourType]` |
09:33:04 | FromDiscord | <Shinyzenith> Hi what's the difference between `<ptr mytype>` and `ptr mytype`? https://media.discordapp.net/attachments/371759389889003532/954673852082946048/unknown.png |
09:44:43 | * | lumo_e joined #nim |
09:44:51 | FromDiscord | <Rika> Nothing, full error is needed |
09:46:06 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954677136030052352/unknown.png |
09:46:35 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3SQa |
09:48:07 | FromDiscord | <Shinyzenith> futhark is being really wonky |
09:55:34 | FromDiscord | <Shinyzenith> In reply to @Shinyzenith "": very odd error code |
09:55:36 | FromDiscord | <Shinyzenith> :/ |
10:07:17 | * | ozzz is now known as om3ga |
10:36:08 | FromDiscord | <nariod> Hello !↵Is it possible to call native Win32 API using winim ? I already use this lib for high level API such VirtualAllocEx, but API such as NtCreateSection does not seem to be implemented. |
10:48:53 | FromDiscord | <demotomohiro> @nariod I think you can manually import Win32 APIs with header pragma: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma |
10:49:49 | FromDiscord | <demotomohiro> Or dynlib pragma: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-import |
10:51:22 | FromDiscord | <demotomohiro> winlean module is a good example to use these pragmas: https://github.com/nim-lang/Nim/blob/devel/lib/windows/winlean.nim |
10:52:39 | FromDiscord | <nariod> In reply to @demotomohiro "<@410127425956085770> I think you": Nice, thanks! |
11:09:35 | FromDiscord | <hmmm> broski is there in existance somewhere a counter that start from 0 and builds up using all alphanumeric? Something like uuid4 but not 36 char from the start, it should build up from zero |
11:14:09 | FromDiscord | <Rika> a counter |
11:14:20 | FromDiscord | <Rika> thats called "a counter" |
11:14:42 | FromDiscord | <Rika> theres a veeeeeery good reason UUID is not sequential |
11:17:35 | FromDiscord | <hmmm> yea but a counter that works like 8,9,a .. , z, 10, 11 ... zz, 100 |
11:18:50 | FromDiscord | <hmmm> I need to store a bunch of them and want the counter as compact as possible |
11:19:20 | FromDiscord | <Rika> just use a number then convert it into "base36" |
11:19:31 | FromDiscord | <hmmm> hmmm |
11:19:55 | FromDiscord | <hmmm> semms like an reasonable way to go around it |
11:20:40 | FromDiscord | <Rika> a reasonable |
11:21:36 | FromDiscord | <demotomohiro> Storing counters as binary or msgpack form would be more compact. |
11:21:53 | FromDiscord | <hmmm> oh yes? |
11:21:59 | FromDiscord | <hmmm> what libraries do we have for that |
11:22:21 | FromDiscord | <hmmm> no wait I need the counter to work for id too |
11:22:32 | FromDiscord | <Rika> please do not use a sequential counter for IDs |
11:22:52 | FromDiscord | <hmmm> but I was using uuid4 and I get monstrous sizes |
11:22:57 | FromDiscord | <hmmm> I need something more compact |
11:24:07 | FromDiscord | <hmmm> I'll try the base36 rika method(TM) |
11:24:22 | FromDiscord | <demotomohiro> https://github.com/jangko/msgpack4nim |
11:24:32 | FromDiscord | <Rika> https://github.com/ai/nanoid |
11:24:42 | FromDiscord | <Rika> https://github.com/icyphox/nanoid.nim |
11:25:43 | FromDiscord | <hmmm> hmm 21 vs 36 is already much better |
11:26:29 | FromDiscord | <Rika> https://github.com/ai/nanoid#custom-alphabet-or-size |
11:26:57 | FromDiscord | <Rika> you can configure size to whatever you want, given that the collision chance is acceptable for you |
11:27:27 | FromDiscord | <hmmm> hmm why do I need to have a collision chance when I can just use a progessive counter that ensures that? |
11:28:22 | FromDiscord | <Rika> progressive counter means it is easy to guess what the next counter is |
11:28:38 | FromDiscord | <hmmm> oh that's entirely not a problem lol |
11:28:50 | FromDiscord | <Rika> if it is not then go ahead with the counter, whats this for anyway |
11:29:13 | FromDiscord | <hmmm> storing some kind of weird tree I made |
11:29:29 | FromDiscord | <Rika> why does the string representation matter here |
11:30:00 | FromDiscord | <hmmm> hmm elements of the trees have an id lol |
11:30:28 | FromDiscord | <Rika> yes, and theyre just numbers |
11:30:34 | FromDiscord | <Rika> why does the string representation matter |
11:30:41 | FromDiscord | <Rika> are you saving it to a file? |
11:30:44 | FromDiscord | <hmmm> yes |
11:30:47 | FromDiscord | <Rika> just binary pack the whole type then |
11:30:54 | FromDiscord | <hmmm> wot |
11:30:56 | FromDiscord | <hmmm> I'm using json |
11:30:59 | FromDiscord | <Rika> why |
11:31:09 | FromDiscord | <hmmm> idk it seemed the easiest thing |
11:31:20 | FromDiscord | <Rika> and the most inefficient choice? |
11:31:23 | FromDiscord | <hmmm> hmm |
11:31:29 | FromDiscord | <hmmm> msgpack? |
11:32:49 | FromDiscord | <demotomohiro> https://en.m.wikipedia.org/wiki/MessagePack |
11:33:17 | FromDiscord | <Rika> https://github.com/disruptek/frosty could work too if you dont care about language interoperability |
11:34:02 | FromDiscord | <hmmm> what about https://github.com/treeform/flatty |
11:36:49 | FromDiscord | <Rika> whichever |
11:37:11 | FromDiscord | <Valdar> I use this one, https://github.com/jangko/msgpack4nim, but flatty should be good. I haven't gotten around to trying it. |
11:41:39 | FromDiscord | <enthus1ast> We need a wrapper for this https://github.com/magiblot/tvision |
11:43:58 | FromDiscord | <hmmm> thats so cool |
11:58:20 | FromDiscord | <Phil> Out of curiosity, anyone have an idea what exactly nimibook does that is so insanely expensive in terms of calculations? |
12:02:02 | FromDiscord | <Forest> Anyone know how i could define an API that could be used in plain C? |
12:02:56 | FromDiscord | <Forest> So i wanna define some functions in Nim, then have someone just include the library if they wanna use it with `#include "library.h` |
12:03:00 | FromDiscord | <Forest> (edit) ""library.h`" => ""library.h"`" |
12:03:05 | FromDiscord | <Rika> exportc maytbe? |
12:03:38 | FromDiscord | <Forest> Oki, but how would i get the header file then? |
12:03:48 | FromDiscord | <Forest> Since didn't Nim drop support for that? |
12:16:54 | FromDiscord | <hmmm> what's our version of isinstance(thingy, int) |
12:18:17 | FromDiscord | <Rika> `thing is int`? `typeof thing == int`? |
12:18:20 | FromDiscord | <Rika> idk which is right |
12:18:50 | FromDiscord | <hmmm> yea I think it's that |
12:19:05 | FromDiscord | <hmmm> can I restrict it to naturals and it will work too? |
12:23:32 | FromDiscord | <Phil> typeof will be the death of me |
12:23:42 | FromDiscord | <Phil> I can never keep straight which language has that and which doesn't |
12:25:00 | FromDiscord | <hmmm> what is this daemon speak I hear about, there is only a language and it's nim 🧐 |
12:25:49 | FromDiscord | <Phil> Please, if there was only nim people could neither flame about rust, nor stare at me horrified when I once more reveal the well known fact I code in java at work |
12:27:14 | FromDiscord | <hmmm> hehe |
12:28:12 | FromDiscord | <hmmm> java must be a comfy boomer lang if you can stomach the boilerplate |
12:28:32 | FromDiscord | <hmmm> and whatever brings the dinner on the table I guess 😊 |
12:28:48 | FromDiscord | <Phil> Ehhh it's... I'd give it a C. What is most painful about it is that for the most trivial thing I immediately throws 50 layers of abstractions on it |
12:28:57 | FromDiscord | <Phil> (edit) "I" => "it" |
12:29:25 | FromDiscord | <hmmm> as someone writing java a lot you must feel plenty good writing nim |
12:29:44 | FromDiscord | <Phil> For the boilerplate there's code generators in the IDE and otherwise java has a lot of nice finished packages |
12:31:19 | FromDiscord | <Phil> depends. The language is clearly superior. I'm really liking the concepts I have access to in nim.↵What's obviously missing is the sheer variety of packages. Java has its own package for integrating elasticsearch for pete's sake, and another for fetching docker containers for absolutely trivial integration-testing when you have an elasticsearch backend, making "implementing" it and integration testing trivial |
12:32:09 | FromDiscord | <Phil> That's all stuff I'd have to wire up myself in nim. There's a reason I'm contributing left and right the tooling that I insist on having for my application. |
12:32:56 | FromDiscord | <hmmm> yea we just need 10% of rust community and we are set |
12:33:10 | FromDiscord | <hmmm> more eyeballs more libraries better libraries |
12:35:50 | FromDiscord | <coal <3> In reply to @hmmm "more eyeballs more libraries": better libraries more eyeballs, etc etc |
12:36:49 | FromDiscord | <coal <3> (edit) "In reply to @hmmm "more eyeballs more libraries": better libraries ... more" added "->" |
12:37:01 | FromDiscord | <hmmm> it's a snake eating it's tail, we must cut the snake in half with the flaming sword of Araq, it is placed on a dungeon 50 floors into the ground, only 1 hero can do it |
12:55:52 | * | acidsys quit (Excess Flood) |
12:56:26 | * | acidsys joined #nim |
12:56:29 | * | acidsys quit (Excess Flood) |
12:57:07 | * | acidsys joined #nim |
12:59:13 | FromDiscord | <Forest> What's the simplest websocket library in Nim? I wanna just have like, two procs |
12:59:35 | FromDiscord | <Forest> One that recieves and processes data, and the other that sends data |
13:08:10 | FromDiscord | <auxym> In reply to @Forest "Oki, but how would": https://github.com/treeform/genny |
13:16:31 | * | slowButPresent joined #nim |
13:32:14 | * | lumo_e quit (Ping timeout: 250 seconds) |
13:45:14 | FromDiscord | <Forest> Neat, thanks! |
13:55:03 | FromDiscord | <Jakraes> Hey guys, quick question, how do I use a character as a proc name? I've seen it somewhere but I forgot where and I have no idea how to implement it |
13:55:29 | FromDiscord | <Jakraes> Like this |
13:56:32 | FromDiscord | <Jakraes> proc ^(number1, number2) = number1 number2 |
13:56:39 | FromDiscord | <Jakraes> And then it'd be used as something like this |
13:56:44 | FromDiscord | <Jakraes> number1^number2 |
14:00:14 | FromDiscord | <Phil> Backticks when you define the char |
14:00:25 | FromDiscord | <Phil> https://play.nim-lang.org/#ix=3SR7 |
14:00:34 | FromDiscord | <Phil> @Jakraes |
14:00:55 | FromDiscord | <Jakraes> Great, thank you so much! |
14:01:04 | FromDiscord | <Jakraes> It works, nice |
14:01:31 | FromDiscord | <Phil> Sidenote to myself: I really need to keep in mind to import std/sugar more often when I want JS style anonymous procs |
14:02:09 | FromDiscord | <Phil> Just had to troubleshoot for 3 minute only to figure out that my "=>" proc didn't work because sugar wasn't imported |
14:13:50 | * | arkurious joined #nim |
14:18:40 | * | lumo_e joined #nim |
14:23:50 | FromDiscord | <Shinyzenith> can someone tell me what this cryptic error code means ? https://media.discordapp.net/attachments/371759389889003532/954747027240140830/unknown.png |
14:29:34 | * | lumo_e quit (Quit: Quit) |
14:38:16 | FromDiscord | <auxym> well it's a type mismatch... the cryptic type names are probably auto generated, by futhark perhaps? In any case I'd assume it's a bug in the "herb" package |
14:38:45 | FromDiscord | <Daniel> https://gankra.github.io/blah/c-isnt-a-language/ |
14:39:32 | FromDiscord | <Shinyzenith> In reply to @auxym "well it's a type": it is futhark |
14:39:37 | FromDiscord | <Shinyzenith> herb is the package I'm writing |
14:39:42 | FromDiscord | <Shinyzenith> (edit) "package" => "binary" |
14:39:52 | FromDiscord | <auxym> oh |
14:39:54 | FromDiscord | <Shinyzenith> this just doesn't make sense |
14:39:55 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3SRg |
14:39:58 | FromDiscord | <Shinyzenith> the type names are the same |
14:40:05 | FromDiscord | <Shinyzenith> one is wrapped in `<>` and one is not |
14:40:07 | FromDiscord | <Shinyzenith> like wtf |
14:40:16 | FromDiscord | <auxym> yeah didn't notice that tbh :/ |
14:40:20 | FromDiscord | <auxym> weird |
14:40:24 | FromDiscord | <Shinyzenith> very very weird |
14:40:26 | FromDiscord | <Shinyzenith> 😔 |
14:40:44 | FromDiscord | <auxym> maybe @pmunch could help if he's around |
14:40:58 | FromDiscord | <Shinyzenith> Oh I didn't know they had a discord acc |
14:41:13 | FromDiscord | <Shinyzenith> I opened a gh issue regarding some other stuff, no reply yet so I assume they're busy |
14:42:01 | FromDiscord | <Shinyzenith> but when i echo .type on my variable, none of the <> bs shows up https://media.discordapp.net/attachments/371759389889003532/954751603288711229/unknown.png |
14:42:02 | FromDiscord | <Shinyzenith> 🥲 |
14:42:47 | FromDiscord | <Shinyzenith> so I have no idea why it's conflicting |
14:51:23 | FromDiscord | <Rika> show the code you used with futhark |
14:51:28 | FromDiscord | <Rika> overrides and whatnot |
14:52:40 | FromDiscord | <Shinyzenith> sent a code paste, see https://paste.rs/vQV |
14:53:03 | FromDiscord | <Rika> you dont need to do ` Re-defining a few type names because the ones from futhark are terrible.`1 |
14:53:14 | FromDiscord | <Shinyzenith> sent a code paste, see https://paste.rs/1X5 |
14:54:36 | FromDiscord | <Shinyzenith> In reply to @Rika "you dont need to": so I should use the odd numbered ones? |
14:55:06 | FromDiscord | <Shinyzenith> (edit) "https://play.nim-lang.org/#ix=3SRl" => "https://paste.rs/7Kw" |
14:55:50 | FromDiscord | <Rika> no, you dont need to use the numbered ones... |
14:55:56 | FromDiscord | <Rika> why did you think you needed to? |
14:56:26 | FromDiscord | <Shinyzenith> cuz when I searched up the type names, they showed up 🥲 |
14:57:40 | FromDiscord | <Rika> well if you read the relatively messy generated code you'd see that further down theres another define |
14:58:02 | FromDiscord | <Shinyzenith> Oh |
14:58:07 | FromDiscord | <Shinyzenith> I'll read it |
14:58:21 | FromDiscord | <Shinyzenith> so i can just remove the funky numbers? |
14:58:47 | FromDiscord | <Shinyzenith> yep removing them fixed it |
14:58:54 | FromDiscord | <Shinyzenith> ' https://media.discordapp.net/attachments/371759389889003532/954755849920872448/unknown.png |
14:58:59 | FromDiscord | <Shinyzenith> thank you so much rika! |
15:15:29 | termer | I know this was pretty far back in message history, but I recommend MessagePack |
15:15:38 | termer | it works well |
15:16:35 | termer | you can also use ProtocolBuffers. There's an interesting protobuf library in nim but I couldn't use it because the writer generator didn't support async sockets. Could've modified it but was too lazy |
15:41:13 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a fixed point type? |
15:45:45 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SRU |
15:55:08 | FromDiscord | <Rika> `node.get.httpClient`... |
15:55:18 | FromDiscord | <Rika> nim does not have flow typing |
16:03:16 | FromDiscord | <TennisBowling> ah I see |
16:14:06 | FromDiscord | <TennisBowling> sent a code paste, see https://paste.rs/zWU |
16:14:29 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SS3 |
16:15:48 | FromDiscord | <Rika> how do you use doRequest |
16:17:02 | FromDiscord | <TennisBowling> ohhhh |
16:17:06 | FromDiscord | <TennisBowling> there it's set as a table |
16:17:14 | FromDiscord | <TennisBowling> in the function that calls it |
16:17:30 | * | toulene joined #nim |
16:18:20 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SS9 |
16:18:25 | FromDiscord | <TennisBowling> however it still throws that error |
16:29:52 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3SSd |
16:30:54 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3SSd" => "https://play.nim-lang.org/#ix=3SSe" |
16:31:02 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3SSe" => "https://play.nim-lang.org/#ix=3SSf" |
16:37:17 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SSi |
16:37:47 | FromDiscord | <Rika> In reply to @Isofruit "Do callback-procs in a": single line if =>, multiline is possible otherwise |
16:38:08 | FromDiscord | <Phil> In reply to @Rika "single line if =>,": So I just need to use `proc` instead? |
16:38:14 | FromDiscord | <Phil> Let me try that |
16:38:22 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/0lW |
16:38:41 | FromDiscord | <Rika> In reply to @Isofruit "So I just need": im honestly not sure if => is single line only even |
16:38:45 | FromDiscord | <Rika> i know proc() works thoug |
16:38:50 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "use `result` variable in": what does it do? |
16:38:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3SSm |
16:39:04 | FromDiscord | <Phil> Whatever is in result will be returned as the output |
16:39:08 | FromDiscord | <Phil> return X is actually a hidden result = x |
16:39:17 | FromDiscord | <Rika> In reply to @System64 "what does it do?": you dont need `var operator: operator` anymore |
16:39:22 | FromDiscord | <Rika> also capitalise your type names |
16:39:31 | FromDiscord | <System64 ~ Flandre Scarlet> like OPERATOR? |
16:39:35 | FromDiscord | <Rika> `Operator` |
16:39:40 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright like Java |
16:39:54 | FromDiscord | <Rika> like pretty much all modern programming languages |
16:39:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3SSo |
16:40:00 | FromDiscord | <System64 ~ Flandre Scarlet> yeah, sorry |
16:40:13 | FromDiscord | <System64 ~ Flandre Scarlet> and any exemple for result? |
16:40:26 | FromDiscord | <Phil> The proc above for example uses result |
16:40:43 | FromDiscord | <Phil> The only reason the inner proc uses return is because I dunno about result in anonymous functions |
16:41:13 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright↵↵and it returns an empty object? |
16:41:44 | FromDiscord | <Phil> Remember how, when you define a variable, there's strangely something in that variable that you can access? |
16:41:59 | FromDiscord | <Phil> like, when you do var x: int, you can do echo x and it'll show a value |
16:42:23 | FromDiscord | <System64 ~ Flandre Scarlet> Operator is going wrong https://media.discordapp.net/attachments/371759389889003532/954781893327454278/unknown.png |
16:42:34 | FromDiscord | <Rika> you messed up the indentation |
16:42:41 | FromDiscord | <Phil> nim initializes types to a certain degree for you (I say to a certain degree because the DateTime type for example will straight up error out if you try to access a DateTime field without the object being properly instantiated) |
16:42:42 | FromDiscord | <Rika> `adsr: Adsr` |
16:42:47 | FromDiscord | <Rika> `interpolation: Interpolation` |
16:42:55 | FromDiscord | <Phil> (edit) "nim initializes types to a certain degree for you ... (I" added "just when you set up the variable" |
16:43:23 | FromDiscord | <System64 ~ Flandre Scarlet> Still exploding https://media.discordapp.net/attachments/371759389889003532/954782142473338910/unknown.png |
16:43:23 | FromDiscord | <Phil> So basically you can treat result as if it were a variable that had already been declared with the type that is the return type of your proc |
16:43:31 | FromDiscord | <Rika> indentation |
16:43:33 | FromDiscord | <Rika> i said it above |
16:43:37 | FromDiscord | <Rika> you fucked the indentation |
16:43:44 | pch | question for nimble maintainers |
16:44:00 | FromDiscord | <System64 ~ Flandre Scarlet> ah now it's better |
16:44:00 | FromDiscord | <Phil> @System64 ~ Flandre Scarlet See how Interpolation is indented compared to "Operator" |
16:44:10 | pch | can you please not error-enforce a very specific folder structure and just have a "source folder" variable |
16:44:12 | FromDiscord | <Phil> And see on which indentation level your "type" keyword is |
16:44:14 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "you messed up the": ah didn't saw this message, sorry |
16:45:20 | pch | ex I want to make a git repo with a macrolibrary split into multiple sublibraries and this is just the first step to being able to do so with nimble |
16:45:48 | pch | and nimble is complaining that I don't have a perfectly flat folder structure and saying it will error out in the future |
16:54:57 | FromDiscord | <Shinyzenith> sent a long message, see http://ix.io/3SSr |
16:55:41 | FromDiscord | <Shinyzenith> (edit) "http://ix.io/3SSr" => "http://ix.io/3SSs" |
16:56:48 | FromDiscord | <Rika> what does "parent object" refer to |
16:57:11 | FromDiscord | <Phil> I am now sad, turns out I can't properly use strformat to insert stuff into a json string |
16:57:31 | FromDiscord | <Shinyzenith> In reply to @Rika "what does "parent object"": https://media.discordapp.net/attachments/371759389889003532/954785703433236530/unknown.png |
16:57:37 | FromDiscord | <Shinyzenith> that's the zig one |
16:57:41 | FromDiscord | <Shinyzenith> do you want the nim definition? |
16:57:58 | FromDiscord | <System64 ~ Flandre Scarlet> Why does it do that? https://media.discordapp.net/attachments/371759389889003532/954785817493143602/unknown.png |
16:59:02 | FromDiscord | <Rika> i is not an index |
16:59:07 | FromDiscord | <Phil> Generally showing the exact compilation error does help. That loop also seems wrong |
16:59:09 | FromDiscord | <Rika> its an object |
16:59:22 | FromDiscord | <Rika> In reply to @Shinyzenith "": i dont know what im looking at |
16:59:26 | FromDiscord | <Phil> Are you familiar with "for in" loops as opposed to regular forloops @System64 ~ Flandre Scarlet ? |
16:59:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Isofruit "Are you familiar with": a bit, used ths in JS, but yeah I'm dumb lol |
17:01:05 | FromDiscord | <Phil> In reply to @System64 "a bit, used ths": basically for <some var name> in <some seq> gives you, in order, the entries in the seq into the var name, no indexing required. ↵If you want to go the full java functional way, sequtils have `map`, `filter` etc. procs to work with |
17:01:43 | FromDiscord | <Shinyzenith> In reply to @Rika "i dont know what": Uhh Ok I'll rewrite it in nim and try to explain properly, i'll brb |
17:02:00 | FromDiscord | <Phil> and with std/sugar that can look almost exactly like JS, for example↵`let myNewOperators = operators.map(operator => newOperator())` |
17:02:08 | FromDiscord | <Rika> im still unsure what a "parent object" is |
17:02:32 | FromDiscord | <Rika> OH |
17:02:36 | FromDiscord | <Rika> YOU WANT TO DEREFERENCE THE POINTER |
17:02:39 | FromDiscord | <Rika> is that what? |
17:02:39 | FromDiscord | <Phil> (edit) "myNewOperators" => "myNewOperators: seq[Operator]" |
17:03:11 | FromDiscord | <Rika> `var wlr_output: wlr output = cast[ptr wlr_output](data)[]` |
17:03:13 | FromDiscord | <Rika> i think? |
17:03:19 | FromDiscord | <Rika> whoops i used space by mistak |
17:03:29 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Isofruit "and with std/sugar that": Oh beautiful |
17:04:26 | FromDiscord | <Phil> In reply to @System64 "Oh beautiful": The key difference that the above has to your code is that the "map" operator creates a new array, while you were using an existing array and putting an operator in it... I think |
17:04:35 | FromDiscord | <Phil> (edit) "array," => "seq," |
17:04:39 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/Fao |
17:04:45 | FromDiscord | <Rika> @Shinyzenith come baaaaaack i think i get what you mean |
17:05:16 | FromDiscord | <Phil> (edit) "think" => "think↵Also for that to work you'll need to import `std/[sequtils, sugar]`" |
17:05:34 | FromDiscord | <Shinyzenith> In reply to @Rika "if you really want": uhhh this might be what I'm looking for |
17:05:39 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SSA |
17:05:44 | FromDiscord | <Shinyzenith> I'll test and let you know |
17:05:51 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#ix=3SSA" => "https://paste.rs/LCc" |
17:05:53 | FromDiscord | <Shinyzenith> it's not exactly dereferencing the pointer |
17:05:54 | FromDiscord | <Rika> yeah i think i understood what you wanted |
17:05:54 | FromDiscord | <Shinyzenith> but its' close |
17:06:15 | FromDiscord | <Rika> idk then |
17:06:21 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3SSD |
17:06:23 | FromDiscord | <Rika> im not sure what a "parent objcet" is still |
17:07:27 | FromDiscord | <Shinyzenith> In reply to @Rika "im not sure what": https://ziglang.org/documentation/master/#fieldParentPtr maybe this can help |
17:08:00 | FromDiscord | <Rika> i will read one moment |
17:08:06 | FromDiscord | <Shinyzenith> thank you |
17:08:07 | FromDiscord | <Shinyzenith> ! |
17:08:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3SSK |
17:09:01 | FromDiscord | <Phil> 1..4 is a range from 1 to 4, including 1 and 4, so 1,2,3,4 |
17:09:05 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/jH7 |
17:09:05 | FromDiscord | <System64 ~ Flandre Scarlet> not 0..4? |
17:09:11 | FromDiscord | <System64 ~ Flandre Scarlet> arrays starts at 0 |
17:09:16 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "0..4?" => "0..3?" |
17:09:16 | FromDiscord | <huantian> I should not try to write code on mobile agh |
17:09:50 | FromDiscord | <Phil> In reply to @System64 "not 0..3?": Oh right, you use an array not a seq, if you want to use the number as an index then yeah, you can go 0..3 |
17:10:02 | FromDiscord | <System64 ~ Flandre Scarlet> wait, seq starts at 1? |
17:10:02 | FromDiscord | <Rika> i honestly still have no idea |
17:10:14 | FromDiscord | <Phil> In reply to @System64 "wait, seq starts at": No, in a seq I'd just have done x.add("bla") |
17:10:15 | FromDiscord | <Rika> no |
17:10:20 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
17:10:20 | FromDiscord | <Rika> seqs start at 0 always |
17:10:23 | FromDiscord | <Phil> Which means the index wuoldn't have mattered |
17:10:35 | FromDiscord | <Phil> (edit) "wuoldn't" => "wouldn't" |
17:10:54 | FromDiscord | <huantian> With a seq you would just do newSeqWith |
17:10:54 | FromDiscord | <Phil> I very, very rarely ever use arrays tbh |
17:11:31 | FromDiscord | <Shinyzenith> In reply to @Rika "i honestly still have": :PepeKek: Ok i'll try again |
17:12:19 | * | pch quit (Remote host closed the connection) |
17:12:31 | FromDiscord | <Shinyzenith> such as field 3 |
17:12:32 | FromDiscord | <Shinyzenith> sent a long message, see http://ix.io/3SSO |
17:13:01 | FromDiscord | <Rika> oh man okay that sounds cursed |
17:13:19 | FromDiscord | <Shinyzenith> |
17:13:26 | FromDiscord | <Rika> i can think of something upo |
17:13:27 | FromDiscord | <Shinyzenith> it's really useful in wayland callback design |
17:13:39 | FromDiscord | <Shinyzenith> In reply to @Rika "i can think of": So no stdlib implementations? QwQ |
17:13:43 | FromDiscord | <Rika> no |
17:13:46 | FromDiscord | <Shinyzenith> 😔 |
17:13:51 | FromDiscord | <Shinyzenith> that's a really useful macro tho!! |
17:14:01 | FromDiscord | <Shinyzenith> I'll make a github issue with feature request I guess |
17:14:02 | FromDiscord | <Shinyzenith> 👁️ |
17:14:03 | FromDiscord | <Rika> i dont know anyone who has used it |
17:14:17 | FromDiscord | <Shinyzenith> 🥲 |
17:15:11 | FromDiscord | <Rika> i get what it does now though |
17:15:25 | FromDiscord | <Shinyzenith> 🙏 Glad I could explain it |
17:17:36 | FromDiscord | <demotomohiro> @Shinyzenith Why dont you pass a pointer to `MyObject` instead of the field? Then you can easily access any fields of `MyObject` without using `fieldParentPtr`. |
17:18:03 | FromDiscord | <Shinyzenith> thing is, any sane person would do that |
17:18:26 | FromDiscord | <Shinyzenith> but the wl_listener notify field only accepts a wlr_listener(t) type |
17:18:29 | FromDiscord | <Shinyzenith> (edit) "wlr_listener(t)" => "wlr_listener(T)" |
17:18:44 | FromDiscord | <Shinyzenith> (edit) "wlr_listener(T)" => "wl_signal(T)" |
17:19:12 | FromDiscord | <Shinyzenith> libwayland created wl_container_of to counter this but it's a function style macro which futhark doesn't support yet |
17:19:55 | * | pch joined #nim |
17:20:53 | FromDiscord | <Rika> @Shinyzenith WAIT |
17:20:56 | FromDiscord | <Rika> I FOUND SOMETHING |
17:21:07 | FromDiscord | <Rika> its prolly not that long of a function |
17:22:58 | FromDiscord | <Rika> probably???? |
17:23:01 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3SSR |
17:25:21 | FromDiscord | <Rika> ah |
17:25:22 | FromDiscord | <Rika> cast |
17:25:24 | FromDiscord | <Rika> not convert |
17:25:44 | FromDiscord | <Rika> `cast[ptr T](cast[int](data) - offsetOf(T, field))[]` |
17:25:47 | FromDiscord | <Rika> its 2 am |
17:25:50 | FromDiscord | <Shinyzenith> Hmmm I don't understand it too well since I'm still not that good at nim↵but I guess the only way to find out is to stick it in the file lol↵i'll try when on pc <a:aPES_Fedora:493676570255294464> |
17:25:51 | FromDiscord | <Rika> im dead in the brain |
17:26:02 | FromDiscord | <Rika> you too tomohiro you should sleep XD |
17:26:28 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3SSS |
17:26:33 | FromDiscord | <Rika> yeah i think that should work...? |
17:26:59 | FromDiscord | <Rika> `fieldParentPtr[SomeType](fieldnameNoQuotes, data)` |
17:27:02 | FromDiscord | <Rika> smth like that for usage |
17:27:30 | FromDiscord | <Shinyzenith> Ok i'll test it |
17:27:34 | FromDiscord | <demotomohiro> I think `cast[ptr T](cast[uint](data) - offsetOf(T, field).uint)[]`. |
17:27:58 | FromDiscord | <Rika> i guess that works "safer" |
17:28:17 | FromDiscord | <Shinyzenith> In reply to @Rika "`fieldParentPtr[SomeType](fieldnameNoQuotes, data)`": so the name of the field i'm passing as the data? |
17:28:26 | FromDiscord | <Rika> yes |
17:28:47 | FromDiscord | <Shinyzenith> Ok I'm gonna edit the server struct rq and get back to you |
17:34:20 | FromDiscord | <TennisBowling> has anyone used nim-presto? |
17:35:31 | FromDiscord | <Jakraes> Is there some sort of terminal event listener in nim? |
17:35:44 | FromDiscord | <Jakraes> Like, listening to key presses in terminal |
17:37:45 | FromDiscord | <Rika> set terminal to raw mode and you will get key presses as they are done |
17:37:59 | FromDiscord | <Rika> dont ask me how to do that, i did it a long time ago and it was legitimately painful |
17:45:04 | FromDiscord | <Phil> And here I thought I could save myself the "serialization" step in the data-line db-data --> nim object --> serialization --> json↵Turns out even if I have jsony, I still want to have special logic here and there and fields in a different name than the object fields are, so I still need a "serialization" step, I just create objects that jsony then serializes >_> |
17:45:55 | FromDiscord | <huantian> I do wish there was a way to create custom field hooks for specific object fields |
17:46:37 | FromDiscord | <Phil> Nim to define a whole lot of types for final serialization and conversion procs of my model-types into those serialization types |
17:46:41 | FromDiscord | <Phil> (edit) "Nim" => "Time" |
17:52:17 | FromDiscord | <Phil> Oh lord I have several levels of nested types |
17:52:22 | FromDiscord | <Phil> Gods this will be painful |
18:07:28 | FromDiscord | <Shinyzenith> @Rika https://media.discordapp.net/attachments/371759389889003532/954803307178774658/unknown.png |
18:07:51 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954803402947321876/unknown.png |
18:14:10 | * | krux02 joined #nim |
18:15:01 | FromDiscord | <Rika> usage? |
18:15:13 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954805259904110782/unknown.png |
18:15:31 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3ST1 |
18:16:03 | FromDiscord | <Shinyzenith> (edit) "https://play.nim-lang.org/#ix=3ST1" => "https://play.nim-lang.org/#ix=3ST2" |
18:16:38 | FromDiscord | <demotomohiro> You need to pass type for `[T]` like `fieldParentPtr[FooType](...)` |
18:17:16 | FromDiscord | <Shinyzenith> passing the type returns this] https://media.discordapp.net/attachments/371759389889003532/954805775249862677/unknown.png |
18:17:38 | FromDiscord | <Rika> AH im dumb 🙂 |
18:17:40 | FromDiscord | <Elegantbeef> Nice a compiler error |
18:17:53 | FromDiscord | <Rika> no no im dumb, i passed an untyped to something expecting a sym |
18:18:07 | FromDiscord | <Rika> beef fix it its too late for me rn |
18:18:33 | FromDiscord | <Rika> prolly needs a macro at this point because i dont know how to get the symbol from a field name |
18:18:53 | FromDiscord | <Rika> the casts are unavoidable in this case as well btw |
18:18:55 | FromDiscord | <Elegantbeef> The hell are we doing? |
18:19:06 | FromDiscord | <Shinyzenith> Oh get some sleep! I'm sorry for the ping! |
18:19:21 | FromDiscord | <Rika> getting the address of a main object given a pointer to one of its fields |
18:19:27 | FromDiscord | <Rika> and the type of the main object |
18:20:08 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3ST3 |
18:20:13 | FromDiscord | <Rika> field shouldnt be untyped |
18:20:18 | FromDiscord | <Rika> offsetOf takes a sym |
18:20:22 | FromDiscord | <Elegantbeef> That wont change anything |
18:20:25 | FromDiscord | <Rika> ah wait no |
18:20:42 | FromDiscord | <Rika> it takes an untyped i think i mistook offsetof for the one in macros |
18:20:45 | FromDiscord | <Elegantbeef> the issue is you're passing `a.field` into `offsetOf` |
18:20:47 | FromDiscord | <Rika> yeah this should work |
18:20:57 | FromDiscord | <Elegantbeef> Doesnt matter if it takes or untyped |
18:21:03 | FromDiscord | <Rika> this offsetOf is the system one not macros |
18:21:23 | FromDiscord | <Elegantbeef> Nim sems code after the template expands so doesnt matter what the code takes |
18:21:29 | FromDiscord | <Rika> `var herb_server = fieldParentPtr(new_output, listener);` is his usage, aside from the missing [] its right isnt it? |
18:21:41 | FromDiscord | <Elegantbeef> The issue here is that you need to supply just the field name to `offsetOf` |
18:21:49 | FromDiscord | <Elegantbeef> Since it uses the `offsetOf` magic |
18:22:00 | FromDiscord | <Rika> he does... |
18:22:04 | FromDiscord | <Shinyzenith> O_O I'll read up about all this, cuz rn it's going all over my head |
18:22:09 | FromDiscord | <Rika> what are you on about |
18:22:17 | FromDiscord | <Elegantbeef> I misread the usage |
18:22:18 | FromDiscord | <Rika> this is exactly whats happening |
18:22:19 | FromDiscord | <Rika> xd |
18:22:43 | FromDiscord | <Solitude> matrix bridge scrambles parameters in codeblocks |
18:22:47 | FromDiscord | <Rika> okay |
18:22:51 | FromDiscord | <Rika> unfortunate |
18:23:12 | FromDiscord | <Elegantbeef> It doesnt of course it's just what we're going with |
18:23:23 | FromDiscord | <Shinyzenith> sent a long message, see http://ix.io/3ST7 |
18:23:28 | FromDiscord | <Shinyzenith> that's what I was trying to achieve |
18:27:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3STb |
18:27:08 | FromDiscord | <Elegantbeef> Issue is that generic parameters are fucky in templates |
18:28:05 | FromDiscord | <Elegantbeef> `echo fieldParentPtr(b, obj.b.addr, MyObject)` |
18:28:10 | FromDiscord | <Rika> unfortunate |
18:28:15 | FromDiscord | <Elegantbeef> No redundant call |
18:28:41 | FromDiscord | <Rika> if you want to make it like the one in zig the order of params would be `T: typedesc, field: untyped, data: pointer` |
18:36:12 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3STj |
18:36:25 | FromDiscord | <Shinyzenith> In reply to @Rika "if you want to": well if it works, it works 😆 |
18:38:08 | FromDiscord | <Shinyzenith> Thank you beef and Rika !! It works flawlessly! |
18:38:11 | FromDiscord | <Shinyzenith> just like the one in zig |
18:38:20 | FromDiscord | <Shinyzenith> I'll read up about templates to understand this :D |
19:41:37 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3STF |
19:45:23 | FromDiscord | <Phil> I'm actually not sure jsony can do JSON --> Table, |
19:45:31 | FromDiscord | <Phil> Or even JSON --> JsonNode |
19:45:44 | FromDiscord | <ajusa> JSON --> JsonNode should work, it has that in its readme I think |
19:46:02 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3STH |
19:46:07 | FromDiscord | <Phil> In the jsony examples it has Table --> JSON, the other way around I haven't seen |
19:46:47 | FromDiscord | <ajusa> Hm, maybe. Also @Phil, did you try doing something like `import chronicles except toJson` for https://github.com/treeform/jsony/issues/47? |
19:46:55 | FromDiscord | <ajusa> (edit) "https://github.com/treeform/jsony/issues/47?" => "https://github.com/treeform/jsony/issues/47 ?" |
19:47:43 | FromDiscord | <ajusa> also the readme seems to have a table parsing example, not sure how I'm screwing this up in my code |
19:53:32 | FromDiscord | <Phil> In reply to @ajusa "Hm, maybe. Also <@!180601887916163073>,": That works as well, doesn't fix the underlying issue though that it shouldn't be the case that code within jsony explodes in such a scenario |
19:54:50 | FromDiscord | <Phil> In this scenario I don't need the "toJson" proc from another package, in other scenarios I might and then I'll still have to adjust jsony's code because the template within can't ensure it calls primarily the procs from the same module as the template |
19:55:46 | FromDiscord | <ajusa> fair point. You are probably right in that jsony should prefix internal calls with jsony.whatever, but it's also just a strange issue |
19:56:19 | FromDiscord | <Phil> I mean, for the most part it's because nim doesn't have a lot of large-ish application which would want to do a ton of logging |
19:57:36 | FromDiscord | <Phil> Given how funkily logging behaves for me (I e.g. get no longer the error outputs of prologue/norm when an error occurs for some utterly obscure reason) I'm not a terribly large fan of what we have for logging currently either way |
19:58:26 | FromDiscord | <ajusa> yeah, logging could be better in Nim land, I agree. too many solutions as well imo |
20:02:23 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3STI |
20:13:27 | * | kayabaNerve quit (Ping timeout: 252 seconds) |
20:19:21 | * | jjido joined #nim |
20:26:52 | * | kayabaNerve joined #nim |
20:36:33 | * | kayabaNerve quit (Ping timeout: 252 seconds) |
20:42:10 | FromDiscord | <hmmm> hoy what's our nim way of python int(string,base) |
20:43:21 | FromDiscord | <Elegantbeef> What does that do? |
20:43:36 | FromDiscord | <hmmm> takes a string and makes it int but in the preferred base |
20:44:11 | FromDiscord | <Elegantbeef> preferred base meaning? |
20:44:33 | FromDiscord | <Phil> as in base 2, base 4 |
20:44:40 | FromDiscord | <hmmm> like hmm binary base ten |
20:45:23 | FromDiscord | <Elegantbeef> Nim has just normal parse methods |
20:45:41 | FromDiscord | <Phil> if nim has a log proc and the inverse of a log proc you can do that calculation |
20:46:02 | FromDiscord | <hmmm> hmm |
20:46:03 | FromDiscord | <Phil> I'd need to check up on the formula again for converting into a base of your choosing |
20:46:09 | FromDiscord | <Elegantbeef> `parseHexInt`, `parseBinInt`, `parseInt` |
20:46:26 | FromDiscord | <hmmm> the base should be 36 lol |
20:46:36 | FromDiscord | <Elegantbeef> If you need base 36 you're in hell |
20:46:40 | FromDiscord | <Phil> but if you can get the logarithm of a number in any way you can calculate stuff to base 36 |
20:46:55 | FromDiscord | <hmmm> 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ |
20:47:01 | FromDiscord | <hmmm> lol |
20:47:37 | FromDiscord | <Elegantbeef> You also could always write your own silly base parser |
20:47:49 | FromDiscord | <hmmm> I'll probably need to |
20:47:56 | FromDiscord | <Elegantbeef> Why do you have base 36? |
20:48:00 | FromDiscord | <hmmm> need to brush my pity maths |
20:48:17 | FromDiscord | <hmmm> It's for a stupid attempt I'm doing it won't probably amount to much |
20:49:26 | FromDiscord | <hmmm> part1 of the plan is encoding and decoding base 36 |
20:50:04 | FromDiscord | <Elegantbeef> Well 0 to Z is a terrible format for base |
20:50:26 | FromDiscord | <hmmm> encode part was just translating the python thing on nim, but the decoding part python has the battery included thingy |
20:57:10 | FromDiscord | <Elegantbeef> The downsized of `0-9`, 'A-Z' is that there is no easy to reason bit op 😀 |
20:57:24 | FromDiscord | <tandy> hmm, my library isnt importing↵it has \_ in the name could that be why? |
20:57:34 | FromDiscord | <Elegantbeef> what's the module name? |
20:57:36 | FromDiscord | <tandy> https://github.com/tandy-1000/simple-matrix-client |
20:57:40 | FromDiscord | <Elegantbeef> how are you importing |
20:57:41 | FromDiscord | <tandy> simple\_matrix\_client |
20:57:52 | FromDiscord | <tandy> import pkg/simple\_matrix\_client |
20:57:53 | FromDiscord | <Elegantbeef> That's not a file in the module |
20:58:21 | FromDiscord | <Elegantbeef> `simple_matrix_client/client`? |
20:58:23 | FromDiscord | <tandy> tru, but i tried `import pkg/simple_matrix_client/client` |
20:58:35 | FromDiscord | <Elegantbeef> How are you compiling? |
20:58:43 | FromDiscord | <tandy> no luck |
20:58:44 | FromDiscord | <Elegantbeef> How have you installed the package |
20:58:50 | FromDiscord | <Elegantbeef> How are you compiling, not are you |
20:58:58 | FromDiscord | <tandy> `nim js` |
20:59:03 | FromDiscord | <tandy> nimble install in directory |
20:59:52 | FromDiscord | <Elegantbeef> Ok so you have `.nimble/pkgs/[email protected]/simple_matrix_client` or w/e? |
21:00:51 | FromDiscord | <tandy> hmm no i have bin/client.js |
21:01:35 | FromDiscord | <Elegantbeef> This isnt a hybrid directory |
21:01:42 | FromDiscord | <Elegantbeef> hybrid package\ |
21:01:46 | FromDiscord | <tandy> ok i removed bin from nimble |
21:01:57 | FromDiscord | <tandy> i have this yes |
21:02:07 | FromDiscord | <Elegantbeef> So you've fixed it? |
21:02:16 | FromDiscord | <tandy> still cant open file |
21:02:37 | FromDiscord | <Elegantbeef> fine i'll get it working here |
21:02:46 | FromDiscord | <tandy> thanks beef |
21:04:23 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/nimble#hybrids |
21:07:26 | FromDiscord | <tandy> i read this |
21:08:35 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3STU |
21:10:23 | FromDiscord | <tandy> i pushed some changes to make it hybrid package |
21:11:21 | FromDiscord | <Elegantbeef> the `src` might be the issue |
21:12:45 | FromDiscord | <tandy> i mean im confused \:o |
21:12:49 | FromDiscord | <Elegantbeef> Well use more words |
21:13:02 | FromDiscord | <Elegantbeef> Yea |
21:13:21 | FromDiscord | <Elegantbeef> If you look at the install it's installing the src at root |
21:14:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3STW |
21:14:38 | FromDiscord | <Elegantbeef> As such all files at the root of `src` are added first class |
21:14:46 | FromDiscord | <tandy> ahh yeah |
21:15:15 | FromDiscord | <Elegantbeef> so either add a new folder or make Nimble like your structure |
21:15:28 | FromDiscord | <Elegantbeef> It's up to you if you want to bitch about being forced into a file structure, that one's a freebie |
21:15:31 | FromDiscord | <tandy> i just need to rename client.nim to simple\_matrix\_client.nim |
21:16:01 | FromDiscord | <Elegantbeef> Well you also should move the sub modules into a sub folder if you want to import using `import simple_matrix_client/server` |
21:17:54 | FromDiscord | <tandy> nah i just want to import client.nim |
21:18:10 | FromDiscord | <Elegantbeef> You can currently 😛 |
21:18:25 | FromDiscord | <Elegantbeef> Though that pollutes all other packages |
21:18:42 | FromDiscord | <tandy> yea i want to do `import simple_matrix_client/client` |
21:19:28 | FromDiscord | <Elegantbeef> Well look at balls' nimble https://github.com/disruptek/balls/blob/master/balls.nimble |
21:22:03 | FromDiscord | <hmmm> can we haz disruptek back? |
21:22:10 | FromDiscord | <hmmm> I miss the old geezer |
21:23:15 | FromDiscord | <Elegantbeef> Prestige it's bug search part deux 😛 |
21:25:00 | * | ltriant quit (Ping timeout: 250 seconds) |
21:27:42 | FromDiscord | <tandy> tysm beef |
21:27:45 | FromDiscord | <tandy> that took a whie |
21:27:53 | FromDiscord | <Elegantbeef> No problem |
21:30:26 | FromDiscord | <Elegantbeef> Oh boy is kate + nimlsp is lovely for compiler developing, fast symbol look up and searching |
21:31:17 | FromDiscord | <Elegantbeef> Compared to vscode atleast |
21:33:26 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:42:30 | FromDiscord | <Mysterysib> Do ya'll prefer coding on a white background or a black one? |
21:42:32 | FromDiscord | <Mysterysib> I can't decide |
21:42:35 | * | wyrd quit (Ping timeout: 240 seconds) |
21:43:06 | FromDiscord | <Elegantbeef> ayu mirage |
21:46:19 | FromDiscord | <iencec> is there way to run just a specific proc as sudo? |
21:46:21 | * | kayabaNerve joined #nim |
21:47:06 | FromDiscord | <Elegantbeef> I dont imagine you can raise a small part of a program to elevated privilege, though i could be wrong, what're you trying to do? |
21:47:36 | FromDiscord | <Generic> Elegantbeef, I think this could be related: https://github.com/saem/vscode-nim/issues/82 |
21:48:17 | FromDiscord | <Elegantbeef> Yea it probably is it |
21:48:23 | FromDiscord | <Elegantbeef> Though the searching is just vscode |
21:48:55 | FromDiscord | <iencec> [Elegantbeef](https://matrix.to/#/%40elegantbeef%3Amatrix.org) it is live linux startup script most config is done as user, but a few things need sudo |
21:49:22 | FromDiscord | <iencec> so far I had two separate cli binaries |
21:49:26 | FromDiscord | <Elegantbeef> Run everything that doesnt need sudo then prompt for sudo password when you need it is what i'd do |
21:49:36 | FromDiscord | <iencec> called the second with sudo. |
21:49:44 | * | wyrd joined #nim |
21:50:16 | FromDiscord | <Elegantbeef> I dont know the proper way to do this so i should shush |
21:50:45 | FromDiscord | <iencec> [Elegantbeef](https://matrix.to/#/%40elegantbeef%3Amatrix.org) but in two separate binaries? or within one? |
21:51:16 | FromDiscord | <Elegantbeef> I'd do it in one binaries, but like i said I know nothing |
21:51:17 | FromDiscord | <iencec> with two it works already, but feels clunky. |
21:51:44 | FromDiscord | <iencec> yeah, one single binary would be great. |
21:53:00 | FromDiscord | <Elegantbeef> There is `osproc.startProcess` and https://nim-lang.org/docs/terminal.html#readPasswordFromStdin%2Cstring%2Cstring |
21:53:31 | FromDiscord | <Elegantbeef> So you can exec the process then if the program requires `password` you can enter it, though no clue how this is properly done |
21:53:44 | FromDiscord | <Elegantbeef> Probably smarter to elevate the process if possiblee |
21:53:54 | FromDiscord | <iencec> thx! will have a look. |
21:59:20 | FromDiscord | <Elegantbeef> Well I seemed to have found the bug with nimsuggest, `==` is not the same as `sameType` 😛 |
22:08:20 | FromDiscord | <Shinyzenith> @beef @Rika I think I'm getting the wrong pointer or something↵not entirely sure |
22:08:58 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954864082194931752/unknown.png |
22:09:11 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954864136276295710/unknown.png |
22:09:30 | FromDiscord | <Shinyzenith> Since I'm not getting the same struct data, wlr_output_init_render call isn't working |
22:11:18 | FromDiscord | <Shinyzenith> (edit) "working" => "working↵↵and the socket data is different too" |
22:13:41 | FromDiscord | <Elegantbeef> Uhhh i'm uncertain here |
22:14:32 | FromDiscord | <Elegantbeef> What's the typedef of the HerbServer? |
22:14:38 | FromDiscord | <Shinyzenith> That's the struct |
22:15:14 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954865658292736000/unknown.png |
22:17:41 | FromDiscord | <Elegantbeef> That's not what i asked |
22:19:45 | FromDiscord | <Shinyzenith> Oh sorry Didn't read it completely |
22:19:51 | FromDiscord | <Shinyzenith> 4am brain does that to me |
22:19:52 | FromDiscord | <Shinyzenith> 🥴 |
22:20:03 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "What's the typedef of": https://media.discordapp.net/attachments/371759389889003532/954866870400479312/unknown.png |
22:20:31 | FromDiscord | <Elegantbeef> No problem, just wanted to make sure nothing was unsafe |
22:20:36 | FromDiscord | <Elegantbeef> Well "unsafe" |
22:20:43 | FromDiscord | <Shinyzenith> :PepeKek: got it |
22:23:38 | FromDiscord | <Elegantbeef> Hmm is there any chance you're not getting the object's address passed? |
22:24:27 | FromDiscord | <Elegantbeef> on the side that calls this proc do `echo cast[int](myHerbServer.newOutput.addr)` and inside the callback do `echo cast[int](data)` |
22:26:41 | FromDiscord | <Shinyzenith> Ok will do |
22:26:51 | FromDiscord | <Shinyzenith> shouldn't it be new_output? |
22:27:05 | FromDiscord | <Elegantbeef> Nim is style insensitive |
22:27:11 | FromDiscord | <Elegantbeef> I dont write snakecase |
22:27:18 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Nim is style insensitive": Did not know that |
22:27:27 | FromDiscord | <Shinyzenith> interesting |
22:27:33 | FromDiscord | <Shinyzenith> 93914817010384 |
22:27:34 | FromDiscord | <Shinyzenith> i got that |
22:27:37 | FromDiscord | <Shinyzenith> on the side that calls the proc |
22:27:38 | FromDiscord | <Elegantbeef> Much like the first book of the bible, the snake leads you to sin 😛 |
22:27:45 | FromDiscord | <Shinyzenith> :PepeKek: |
22:27:48 | FromDiscord | <Elegantbeef> And other silly jokes you can tell yourself |
22:28:19 | FromDiscord | <Elegantbeef> And inside thee callback? |
22:28:34 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954869012251172864/unknown.png |
22:28:42 | FromDiscord | <Shinyzenith> looks like the values of the pointers are different |
22:28:54 | FromDiscord | <Shinyzenith> (edit) "values" => "addrs" |
22:29:02 | FromDiscord | <Elegantbeef> Which means you're not getting a pointer to `newOutput` |
22:29:06 | FromDiscord | <Elegantbeef> So either the API doesnt work as you expect or you're doing somethiing wrong |
22:29:31 | FromDiscord | <Shinyzenith> 😓 |
22:29:55 | FromDiscord | <Elegantbeef> Do you have the place where you pass the `newOutput` to the callback? |
22:30:08 | FromDiscord | <Shinyzenith> Yes |
22:30:20 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954869459175239690/unknown.png |
22:30:58 | FromDiscord | <Shinyzenith> oh |
22:31:05 | FromDiscord | <Shinyzenith> they are supposed to be different |
22:31:08 | FromDiscord | <Shinyzenith> we're checking 2 different entities |
22:31:15 | FromDiscord | <Shinyzenith> new_output is a callback↵data is a just a void pointer |
22:31:23 | FromDiscord | <Shinyzenith> ofc they have different pointers |
22:31:38 | FromDiscord | <Shinyzenith> on logging the pointer to the server struct from both outside and inside the callback I get the same address |
22:31:44 | FromDiscord | <Elegantbeef> Well give me the code that passes `newOutput` |
22:31:49 | FromDiscord | <Shinyzenith> oh nvm I still don't |
22:32:01 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Well give me the": I'll push to a branch and send the link |
22:32:06 | FromDiscord | <Elegantbeef> Thanks |
22:32:33 | FromDiscord | <Elegantbeef> Less pulling of teeth is always better |
22:32:51 | FromDiscord | <Shinyzenith> yep |
22:32:55 | FromDiscord | <Shinyzenith> https://github.com/waycrate/nim-wl/tree/devel |
22:33:09 | FromDiscord | <Shinyzenith> you're gonna need clang and futhark installed |
22:33:16 | FromDiscord | <Shinyzenith> edit the path of clang according to your version number |
22:33:19 | * | Gustavo6046 quit (Remote host closed the connection) |
22:33:22 | FromDiscord | <Shinyzenith> if on arch, the one I have set right now should work fine |
22:33:44 | FromDiscord | <Elegantbeef> Eh i'm not running it |
22:33:51 | FromDiscord | <Shinyzenith> Oh all cool |
22:33:57 | FromDiscord | <Shinyzenith> thank you for helping tho 🙏 |
22:34:02 | FromDiscord | <Shinyzenith> I appreciate you taking the time ;w; |
22:34:10 | FromDiscord | <Elegantbeef> `wl_signal_add` takes a pointer to the signal and a pointer to the listener |
22:34:39 | FromDiscord | <Shinyzenith> you mean in libwayland or in the wrapper I wrote? |
22:34:41 | * | Gustavo6046 joined #nim |
22:34:43 | FromDiscord | <Elegantbeef> `herb_server.new_output.addr` on line 13 |
22:35:03 | FromDiscord | <Elegantbeef> Yea your wrapper assumes something |
22:35:20 | FromDiscord | <Elegantbeef> It assumes `wl_listener` is passed by ref |
22:35:37 | FromDiscord | <Elegantbeef> `proc wl_signal_add(wl_signal: wl_signal, wl_listener: wl_listener)` turn this into `proc wl_signal_add(wl_signal: wl_signal, wl_listener: var wl_listener)` |
22:36:03 | FromDiscord | <Elegantbeef> If it's passed by copy you've got something unsafe |
22:36:12 | FromDiscord | <Shinyzenith> Ok will do |
22:36:15 | FromDiscord | <Elegantbeef> Which is probably the issue |
22:36:15 | * | jjido joined #nim |
22:36:39 | FromDiscord | <Shinyzenith> well it reports the correct pointers now |
22:36:46 | FromDiscord | <Elegantbeef> Good |
22:36:49 | FromDiscord | <Elegantbeef> Solved the issue |
22:37:19 | FromDiscord | <Shinyzenith> but it still doesn't work....hmm which means output.allocator or allocator is still remaining null which shouldn't happen↵↵I will try and debug this on my own |
22:37:19 | FromDiscord | <Shinyzenith> thanks |
22:37:52 | FromDiscord | <Elegantbeef> ` cast[ptr T](cast[int](data) - offsetOf(T, field))[]` is also wrong then i think |
22:38:20 | FromDiscord | <Elegantbeef> Actually nvm i'm dumb |
22:38:24 | FromDiscord | <Shinyzenith> I don't think so because this time on calling herbServer.socket ↵it returns the same value both inside and inside of the callback |
22:38:25 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954871493282631730/unknown.png |
22:38:33 | FromDiscord | <Elegantbeef> Yea i was being dumb |
22:38:40 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954871557824581652/unknown.png |
22:38:49 | FromDiscord | <Shinyzenith> hmmm interesting error |
22:38:57 | FromDiscord | <Shinyzenith> never encountered this in zig/c ↵i'm probably doing someting wrong |
22:39:56 | FromDiscord | <Elegantbeef> Is it line 64 in server causing the issue? |
22:41:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SUi |
22:41:27 | FromDiscord | <Elegantbeef> Dont need the return at the end and the code is cleaner imo |
22:42:14 | FromDiscord | <Elegantbeef> The issue is on line 64 |
22:42:27 | FromDiscord | <Elegantbeef> `var herb_server = fieldParentPtr(HerbServer,new_output, listener);` makes a copy |
22:42:53 | FromDiscord | <Elegantbeef> Or atleast possibly the issue |
22:42:57 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "also do yourself a": Oh didn't know about this notation |
22:42:57 | FromDiscord | <Shinyzenith> will do |
22:43:05 | FromDiscord | <Elegantbeef> I say about 100 dumb things before a smart thing comes out so we're going to be here a while 😛 |
22:43:13 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Is it line 64": if (not wlr_output_init_render(wlr_output.addr, herb_server.allocator, herb_server.renderer)): ↵↵this line |
22:43:14 | FromDiscord | <Elegantbeef> Nim has a implicit result variable |
22:43:40 | FromDiscord | <Shinyzenith> In reply to @Shinyzenith "if (not wlr_output_init_render(wlr_output.addr, her": and this line throws the error because of: |
22:43:59 | FromDiscord | <Shinyzenith> 1 sec, searching for the line |
22:44:15 | FromDiscord | <Shinyzenith> this line https://media.discordapp.net/attachments/371759389889003532/954872960353726504/unknown.png |
22:45:12 | FromDiscord | <Elegantbeef> So we know the right hand isnt null, but the left hand is |
22:45:34 | FromDiscord | <Elegantbeef> So for some reason `wlrOutput`'s allocator/renderer is not nil |
22:45:59 | FromDiscord | <Elegantbeef> `var wlr_output = cast[wlr_output](data);` this is wrong |
22:46:05 | FromDiscord | <Elegantbeef> data is a `ptr` |
22:46:26 | FromDiscord | <Elegantbeef> that should be `var wlrOutput = cast[ptr wlrOutput](data)` |
22:46:34 | FromDiscord | <Shinyzenith> hm I'll try |
22:47:31 | FromDiscord | <Shinyzenith> better now? https://media.discordapp.net/attachments/371759389889003532/954873781678145616/unknown.png |
22:47:39 | FromDiscord | <Elegantbeef> I mean i know for a certainty there is a very low chance that you get lucky enough to get multiple 0'd bytes from a pointer 😛 |
22:47:39 | FromDiscord | <Elegantbeef> So this will work |
22:47:58 | FromDiscord | <Elegantbeef> Less redundant yes |
22:48:09 | FromDiscord | <Shinyzenith> aaaa https://media.discordapp.net/attachments/371759389889003532/954873943817355304/unknown.png |
22:48:12 | FromDiscord | <Shinyzenith> :dead: |
22:48:18 | FromDiscord | <Shinyzenith> 1 sec i'll clean itup |
22:48:23 | FromDiscord | <Elegantbeef> got a useless comma |
22:48:30 | FromDiscord | <Shinyzenith> oh yes. |
22:50:08 | FromDiscord | <Shinyzenith> Final iteration |
22:50:10 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3SUl |
22:50:10 | FromDiscord | <Shinyzenith> time to compile |
22:50:26 | FromDiscord | <Shinyzenith> oof got an extra pointer somewhere https://media.discordapp.net/attachments/371759389889003532/954874519082897458/unknown.png |
22:50:34 | FromDiscord | <Shinyzenith> found it |
22:50:48 | FromDiscord | <Elegantbeef> Yea the compiler told you where |
22:51:07 | FromDiscord | <Shinyzenith> WOO IT WORKS |
22:51:13 | FromDiscord | <Elegantbeef> If you couldnt find it i'd make a PR to disallow anyone with the user name `aakash` from using NIm |
22:51:17 | FromDiscord | <Shinyzenith> WTF I'VE BEEN TRYING TO FIX THIS FOR HOURS 😭 |
22:51:23 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "If you couldnt find": :PepeKek: |
22:51:38 | FromDiscord | <Shinyzenith> In reply to @Shinyzenith "WTF I'VE BEEN TRYING": How did you know the pointer was the issue? |
22:51:43 | FromDiscord | <Shinyzenith> I mean I'm calling addr again |
22:51:49 | FromDiscord | <Shinyzenith> so technically I should get the same pointer |
22:51:50 | FromDiscord | <Shinyzenith> right? |
22:51:52 | FromDiscord | <Elegantbeef> \`Error\: Someone noticed you cant read compiler issues" |
22:51:54 | FromDiscord | <Elegantbeef> No |
22:52:00 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "\`Error\: Someone noticed you": 🤣 |
22:52:01 | FromDiscord | <Elegantbeef> Addr of a pointer is double indirection |
22:52:12 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Addr of a pointer": Oh |
22:52:18 | FromDiscord | <Shinyzenith> Right |
22:52:21 | FromDiscord | <Shinyzenith> I'll remember this |
22:52:52 | FromDiscord | <Elegantbeef> Pointers are fun |
22:52:57 | FromDiscord | <Shinyzenith> and painful |
22:53:18 | FromDiscord | <Shinyzenith> rust pointers feel the most comfy |
22:53:47 | FromDiscord | <Elegantbeef> Nim pointers are nice if you ask me |
22:54:26 | FromDiscord | <Shinyzenith> I guess I'm still too inexperienced, we'll see in a few months after I finish herb...hopefully by then I'll know a bit more. |
22:54:32 | FromDiscord | <Elegantbeef> Throwing cast haphazardly around to get the type system happy isnt how you use pointers |
22:54:52 | FromDiscord | <Shinyzenith> well yes but if I don't libwayland gets angry 🥲 |
22:54:58 | FromDiscord | <Elegantbeef> Is herb a herbsluftwm inspired WM for wayland |
22:55:11 | FromDiscord | <Elegantbeef> Sure but you dont want to make it happy you want to make sure it makes sense |
22:56:02 | FromDiscord | <Shinyzenith> sent a long message, see http://ix.io/3SUn |
22:56:12 | FromDiscord | <Shinyzenith> bspwm because I already cloned sxhkd for wayland 😜 |
22:56:25 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Sure but you dont": Yep, understood :salute: |
22:56:43 | FromDiscord | <Elegantbeef> It's 4am for you so i'll excuse the illogical casting |
22:56:55 | FromDiscord | <Shinyzenith> 🤣 🤣 thank you |
22:57:04 | FromDiscord | <Shinyzenith> 4:30 now 🤣 |
22:57:11 | FromDiscord | <Shinyzenith> I appreciate the help 🥰 |
22:57:18 | FromDiscord | <Elegantbeef> Imagine living in a half timezone |
22:57:19 | FromDiscord | <Shinyzenith> Do you have a github I can follow? |
22:57:31 | FromDiscord | <Alea> does nim have a pass statement like in python? |
22:57:42 | FromDiscord | <Elegantbeef> `discard` |
22:57:56 | FromDiscord | <Alea> ah didn't know that can work for this |
22:57:57 | FromDiscord | <Elegantbeef> https://github.com/beef331 is my github |
22:58:07 | FromDiscord | <Elegantbeef> I mean you dont need a pass statement in nim |
22:58:10 | FromDiscord | <Elegantbeef> You just need some ast |
22:58:27 | FromDiscord | <Elegantbeef> so `discard` `##` both work |
22:58:33 | FromDiscord | <Shinyzenith> Followed 😉 |
22:58:55 | FromDiscord | <Elegantbeef> Oh boy i'm famous |
22:59:40 | FromDiscord | <Shinyzenith> 🤣 |
23:01:09 | FromDiscord | <Elegantbeef> I dont get github following for the most part |
23:01:34 | FromDiscord | <Elegantbeef> It's such a weird thing, some people do the whole follow to get a follow stuff and it's just fucking weird |
23:01:37 | FromDiscord | <Shinyzenith> basically tells me what other people are writing / what's the hot new tech people are starring↵basically keeps me upto date |
23:01:40 | FromDiscord | <Elegantbeef> Why do you want to follow 300000 developers |
23:02:08 | FromDiscord | <Elegantbeef> I only follow people i know in real life or people writing stuff I like |
23:02:22 | FromDiscord | <Elegantbeef> I dont play it like a social media platform, then again I dont use social media platforms |
23:02:38 | FromDiscord | <Shinyzenith> Same |
23:02:46 | FromDiscord | <Shinyzenith> I just use element for work stuff |
23:02:51 | FromDiscord | <Elegantbeef> Continues to rant about people that have like 2000 follows that randomly follow me |
23:03:00 | FromDiscord | <Shinyzenith> 🤣 🤣 |
23:03:07 | FromDiscord | <Elegantbeef> Yet you're not using matrix to talk here? |
23:03:11 | FromDiscord | <Elegantbeef> 0/10 matrix user |
23:03:19 | FromDiscord | <Shinyzenith> I don't know the matrix chat room link QwQ |
23:03:39 | FromDiscord | <Elegantbeef> https://matrix.to/#/#nim:envs.net |
23:03:41 | FromDiscord | <Shinyzenith> and most of my wayland developer friends are here so it's just easier for me to copy paste this |
23:03:44 | FromDiscord | <Shinyzenith> (edit) "this" => "stuff" |
23:03:45 | FromDiscord | <Shinyzenith> and discuss |
23:03:51 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "https://matrix.to/#/#nim:envs.net": omw |
23:04:12 | FromDiscord | <Bubblie> I like rust a lot but I have a problem using it because of its syntax, my brain is very weird and its hard for me to comprehend languages who have syntax that relies on symbol usage that heavily, its not haskell of course but its still hard for me ig |
23:04:15 | FromDiscord | <Elegantbeef> Ah i've been trying to use matrix more, sadly doesnt have channelled voip yet so not great |
23:04:21 | FromDiscord | <Bubblie> its more of a me problem |
23:04:24 | FromDiscord | <Elegantbeef> Ever since teamspeak i love my chalnelled voip! |
23:04:26 | FromDiscord | <Bubblie> rather than rust being the problem |
23:04:38 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "Ever since teamspeak i": O |
23:04:38 | FromDiscord | <Bubblie> becuase rust isn't the problem its just me not being able to read it properly |
23:04:48 | FromDiscord | <Elegantbeef> I think rust is a good language for everything but ergonomics and readabillity |
23:04:48 | FromDiscord | <Shinyzenith> In reply to @Bubblie "becuase rust isn't the": I struggled with that too |
23:04:56 | FromDiscord | <Bubblie> In reply to @Elegantbeef "I think rust is": same |
23:05:17 | FromDiscord | <Elegantbeef> Prestige got a PR to fix your bug, hopefully it's acceepted |
23:05:21 | FromDiscord | <Shinyzenith> In reply to @Shinyzenith "I struggled with that": I just tried writing more and more programs till it stuck with me↵but I still get intimidated by huge repos such as smithay |
23:05:28 | FromDiscord | <Bubblie> its an amazing language but so hard to read and utilize at times, its why I was looking for ways I could do low level programming without heavy usage of the three titans C/C++/Rust |
23:05:30 | FromDiscord | <Bubblie> and then I found nim |
23:05:42 | FromDiscord | <Bubblie> which allowed me to use C and C++ libraries a lot more easier |
23:05:43 | FromDiscord | <Elegantbeef> I mean i've never written Rust properly, i just cant get into it |
23:05:50 | FromDiscord | <Elegantbeef> It's just such a mess to read for me |
23:05:52 | FromDiscord | <Bubblie> Same |
23:06:25 | FromDiscord | <Bubblie> In reply to @Shinyzenith "I just tried writing": huge repos in rust are the bane of my existence |
23:06:25 | FromDiscord | <Shinyzenith> In reply to @Elegantbeef "I mean i've never": I got into it with my first rust program actually lol https://github.com/waycrate/swhkd↵it hit all the points for the language I needed so I stuck with it for a few days and it felt amazing for a small project like this |
23:06:32 | FromDiscord | <Shinyzenith> In reply to @Bubblie "huge repos in rust": absolutely |
23:06:41 | FromDiscord | <Bubblie> like, in other languages its somewhat comprehensive right |
23:06:47 | FromDiscord | <Bubblie> but when I look at complicated rust repos |
23:06:48 | FromDiscord | <Bubblie> I just |
23:06:48 | FromDiscord | <Bubblie> die |
23:06:50 | FromDiscord | <Bubblie> and disspiate |
23:06:54 | FromDiscord | <Bubblie> (edit) "disspiate" => "dissipate" |
23:06:59 | FromDiscord | <Elegantbeef> Plus I'm already capable of bug fixes with Nim, cant wast that effort 😛 |
23:07:04 | FromDiscord | <Shinyzenith> I think repos such as smithay are comprehensive, just too comprehensive sometimes |
23:07:10 | FromDiscord | <Shinyzenith> traits, implementations, turbofish |
23:07:12 | FromDiscord | <Shinyzenith> what not |
23:07:20 | FromDiscord | <Shinyzenith> too much shit to remember!! :PepeKek: |
23:07:26 | FromDiscord | <Bubblie> so like, its too comprehensive that it becomes too hard to read |
23:07:28 | FromDiscord | <Bubblie> is what you mean |
23:07:32 | FromDiscord | <Shinyzenith> yes |
23:07:37 | FromDiscord | <Bubblie> very very relateable |
23:07:45 | FromDiscord | <Bubblie> Im glad I found nim truly |
23:07:49 | FromDiscord | <Elegantbeef> I still should finish my X WM eventually |
23:07:51 | FromDiscord | <Bubblie> I am experimenting with nim pointers |
23:07:54 | FromDiscord | <Bubblie> they are pretty good ngl |
23:07:57 | FromDiscord | <Elegantbeef> I got it relatively far but gave up |
23:08:14 | FromDiscord | <Elegantbeef> The biggest thing is they're distinct from collections |
23:08:17 | FromDiscord | <Shinyzenith> try wlroots! |
23:08:20 | FromDiscord | <Elegantbeef> Fuck no |
23:08:22 | FromDiscord | <Shinyzenith> Xorg is legacy!! |
23:08:24 | FromDiscord | <Bubblie> LMAO |
23:08:34 | FromDiscord | <Shinyzenith> I say fuck yes 😎 |
23:08:43 | FromDiscord | <Elegantbeef> I've heard too many issues with wayland and gaming |
23:08:47 | FromDiscord | <Elegantbeef> So i'll hold off for now |
23:08:49 | FromDiscord | <Shinyzenith> casually hopping platforms |
23:09:07 | FromDiscord | <Elegantbeef> Plus i dont really feel like doing it |
23:09:15 | FromDiscord | <Shinyzenith> If i'm not mistaken the steam deck uses wayland for the gaming mode and xorg for desktop mode |
23:09:16 | FromDiscord | <Shinyzenith> so |
23:09:42 | FromDiscord | <Elegantbeef> Doesnt change what i've seen/heard |
23:09:44 | FromDiscord | <Elegantbeef> I thought it only used pipewire and still uses X |
23:09:44 | FromDiscord | <Shinyzenith> Understandable |
23:09:50 | FromDiscord | <Shinyzenith> what's the name of your wm? |
23:10:03 | FromDiscord | <Elegantbeef> "GoodWm" since it's not awesome 😛 |
23:10:06 | FromDiscord | <Shinyzenith> I know a dude who wrote a Xwm in nim , maybe you'd like to take a look? |
23:10:14 | FromDiscord | <Shinyzenith> O |
23:10:16 | FromDiscord | <Elegantbeef> Are you talking about nimdow |
23:10:20 | FromDiscord | <Shinyzenith> Nope |
23:10:23 | FromDiscord | <Elegantbeef> Ah |
23:10:26 | FromDiscord | <Shinyzenith> it's a dynamic tag based window manager |
23:10:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/goodwm is my shitty WM |
23:10:48 | FromDiscord | <Shinyzenith> https://github.com/codic12/worm |
23:10:52 | FromDiscord | <Elegantbeef> Undoccumented and terribly layed out |
23:10:53 | FromDiscord | <Elegantbeef> Ah i've helped codic |
23:10:55 | FromDiscord | <Bubblie> I am going to make a boid simulation in nim and vulkan |
23:11:01 | FromDiscord | <Bubblie> boids are flock simulations |
23:11:03 | FromDiscord | <Shinyzenith> well we all start somewhere lmao |
23:11:13 | FromDiscord | <Bubblie> this will give me a decent idea on how to use nim well |
23:11:14 | FromDiscord | <Bubblie> I think |
23:11:19 | FromDiscord | <Bubblie> it seems like a nice project to do |
23:11:43 | FromDiscord | <Bubblie> vulkan requires me to write like |
23:11:48 | FromDiscord | <Bubblie> 500 lines initially though |
23:11:50 | FromDiscord | <Bubblie> then it gets easier |
23:11:51 | FromDiscord | <Bubblie> LMAO |
23:12:03 | FromDiscord | <Elegantbeef> I still say just use opengl |
23:12:04 | FromDiscord | <Shinyzenith> Anyways, my bed is too eager for me to lay down 🥴 5 am |
23:12:05 | FromDiscord | <Bubblie> (edit) "500" => "1000+" |
23:12:11 | FromDiscord | <Bubblie> In reply to @Elegantbeef "I still say just": Im never dealing with state again |
23:12:12 | FromDiscord | <Shinyzenith> gn! |
23:12:13 | FromDiscord | <Elegantbeef> State machine sucks, but man is it easier 😛 |
23:12:13 | FromDiscord | <Elegantbeef> Buh bye |
23:12:14 | FromDiscord | <Bubblie> horrible experience |
23:12:19 | FromDiscord | <Bubblie> In reply to @Elegantbeef "State machine sucks, but": true |
23:12:20 | FromDiscord | <Shinyzenith> 👋 |
23:12:25 | FromDiscord | <Bubblie> gn |
23:13:34 | FromDiscord | <Bubblie> I do need to get better at vulkan |
23:13:53 | FromDiscord | <Bubblie> Its verbose as shit right |
23:13:54 | FromDiscord | <Bubblie> But |
23:14:00 | FromDiscord | <Bubblie> It has a lot of stuff to compensate for it |
23:14:14 | FromDiscord | <Elegantbeef> My understanding is you can use macros/templates to really make it easier to use |
23:14:20 | FromDiscord | <Bubblie> Yeah |
23:14:23 | FromDiscord | <Elegantbeef> But i've not used vulkan so no clue how true that is |
23:14:55 | FromDiscord | <Bubblie> Im gonna have to read the vulkan c++ tutorial again and convert it to code I can use in nim |
23:15:31 | FromDiscord | <Bubblie> Might not be too hard |
23:15:36 | FromDiscord | <Bubblie> I say that now |
23:15:47 | FromDiscord | <Bubblie> To help others ill make it a github repo |
23:15:58 | FromDiscord | <Elegantbeef> Eh the Nim code will be nicer i'm certain! |
23:16:09 | FromDiscord | <Elegantbeef> Port a tutorial to Nim and document it 😛 |
23:16:44 | FromDiscord | <Elegantbeef> Anything you dont know you can then replace with "I asked some fucker on the real time chat and he said '...'" |
23:17:03 | FromDiscord | <Bubblie> LOL |
23:17:41 | FromDiscord | <Bubblie> I think the problem is in how I write the nim code since im reading a tutorial thats C++ |
23:18:08 | FromDiscord | <Elegantbeef> You write it the same way then ask someone that knows Nim to suggest how to make it idiomatic is one way |
23:18:36 | FromDiscord | <Bubblie> Yeah |
23:18:59 | FromDiscord | <Elegantbeef> Or just write it idiomatically to start with |
23:19:19 | FromDiscord | <Bubblie> I mean yall can review it once i finish it 😄 |
23:19:25 | FromDiscord | <Bubblie> If you want |
23:19:27 | FromDiscord | <Bubblie> Of course |
23:19:38 | FromDiscord | <Bubblie> Ill post the github when its done |
23:19:45 | FromDiscord | <Bubblie> So people can make prs |
23:20:16 | FromDiscord | <Shinyzenith> Screenshot\_20220320-044920\_DuckDuckGo.jpg https://media.discordapp.net/attachments/371759389889003532/954882028103426058/Screenshot_20220320-044920_DuckDuckGo.jpg |
23:20:18 | FromDiscord | <Shinyzenith> Before i leave |
23:20:31 | FromDiscord | <Shinyzenith> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: can you explain the reasoning for this? |
23:20:33 | FromDiscord | <Elegantbeef> `var` is a mutable reference |
23:20:47 | FromDiscord | <Shinyzenith> Why do we need a mutable reference here |
23:20:56 | FromDiscord | <Shinyzenith> I didn't see it in the header |
23:21:01 | FromDiscord | <Elegantbeef> Cause `wl_listener` is small enough it's passed by copy |
23:21:20 | FromDiscord | <Shinyzenith> Huh I see |
23:21:31 | FromDiscord | <Shinyzenith> Is there anyway to check for this condition? |
23:21:39 | FromDiscord | <Elegantbeef> Nim has an optimization that anything smaller than 3floats is passed by copy, |
23:21:58 | FromDiscord | <Shinyzenith> I see↵And what if instead of var I used ptr? |
23:22:06 | FromDiscord | <Shinyzenith> Would that be a possible fix too? |
23:22:09 | FromDiscord | <Elegantbeef> you've done nothing to abstract it |
23:22:17 | FromDiscord | <Elegantbeef> It'd fix it but you've done nothing to abstract the function |
23:22:30 | FromDiscord | <Shinyzenith> I see |
23:22:39 | FromDiscord | <Elegantbeef> You could make it a template |
23:22:44 | FromDiscord | <Elegantbeef> then drop the `var` |
23:23:06 | FromDiscord | <Shinyzenith> I honestly don't understand templates completely just yet |
23:23:10 | FromDiscord | <Elegantbeef> Templates are code subsitution |
23:23:11 | FromDiscord | <Elegantbeef> That's it |
23:23:14 | FromDiscord | <Shinyzenith> So a macro? |
23:23:18 | FromDiscord | <Elegantbeef> No |
23:23:21 | FromDiscord | <Elegantbeef> Macros are introspective |
23:23:42 | FromDiscord | <Elegantbeef> templates just take the arguments and paste them every place they appear inside the body |
23:24:09 | FromDiscord | <Elegantbeef> every is bolded cause it's every place, they do not take any semantics into account on the pasting |
23:24:22 | FromDiscord | <Shinyzenith> I don't get how that's different from a proc |
23:24:36 | FromDiscord | <Shinyzenith> If I take a as a param |
23:24:41 | FromDiscord | <Shinyzenith> a will be used everywhere I call 8t |
23:24:42 | FromDiscord | <Elegantbeef> templates are expanded at compile time |
23:24:47 | FromDiscord | <Shinyzenith> Oh I see |
23:25:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SUr |
23:25:40 | FromDiscord | <Elegantbeef> So they're like C macros, but they're strongly typed |
23:25:56 | FromDiscord | <Elegantbeef> you cannot do `doThing"hello"` |
23:25:56 | FromDiscord | <Shinyzenith> Makes sense now, got it. |
23:26:19 | FromDiscord | <Shinyzenith> Ik I'm asking a lot of questions ahah but would you mind explaining one last thing? |
23:26:36 | FromDiscord | <Elegantbeef> That's kinda what i do here |
23:26:37 | FromDiscord | <Elegantbeef> Fix Nim bugs, write shitty code and answer questions |
23:26:51 | FromDiscord | <Shinyzenith> 🤣 |
23:27:07 | FromDiscord | <Bubblie> I love this community |
23:27:09 | FromDiscord | <Shinyzenith> Well then\: can you explain the fieldparentptr template you made today ? |
23:27:21 | FromDiscord | <Elegantbeef> What's to be explained |
23:27:44 | FromDiscord | <Shinyzenith> I don't completely understand how it works.↵I'll take a ss 1 sex |
23:27:47 | FromDiscord | <Shinyzenith> Sex |
23:27:48 | FromDiscord | <Shinyzenith> Sec |
23:27:49 | FromDiscord | <Shinyzenith> My Gos |
23:27:50 | FromDiscord | <Bubblie> LMAO |
23:28:28 | FromDiscord | <Elegantbeef> `fieldParentPtr(HerbServer,new_output, listener)` is turned into `cast[ptr HerbServer](cast[int](listener) - offsetOf(HerbServer, new_output))` |
23:28:54 | FromDiscord | <Shinyzenith> Screenshot\_20220320-045831\_DuckDuckGo.jpg https://media.discordapp.net/attachments/371759389889003532/954884198869663744/Screenshot_20220320-045831_DuckDuckGo.jpg |
23:28:59 | FromDiscord | <Shinyzenith> This snippet |
23:29:14 | FromDiscord | <Bubblie> Question, if a variable is assigned based on a pointer, must I use a pointer in nim to access it? |
23:29:16 | FromDiscord | <Elegantbeef> What dont you understand? |
23:29:17 | FromDiscord | <Shinyzenith> Why turn it to int and then back to pointer of t |
23:29:26 | FromDiscord | <Bubblie> (edit) "pointer," => "pointer in the c/c++ code," |
23:29:28 | FromDiscord | <Elegantbeef> Cause Nim doesnt have built in pointer atithmetic |
23:29:48 | FromDiscord | <Bubblie> Shouldnt that be a thing they could add? |
23:30:03 | FromDiscord | <Elegantbeef> A lot of Nim is done in userspace so yes |
23:30:03 | FromDiscord | <Shinyzenith> So what does that line achieve |
23:30:07 | FromDiscord | <Elegantbeef> I dont like pointer arithmetic |
23:30:16 | FromDiscord | <Shinyzenith> Same |
23:30:18 | FromDiscord | <Elegantbeef> Say you have pointer 10 |
23:30:20 | FromDiscord | <Bubblie> Me neither |
23:30:29 | FromDiscord | <Bubblie> But it may be beneficial in nim maybe |
23:30:34 | FromDiscord | <Elegantbeef> that will offset that 10 by the field offset of `field` |
23:30:39 | FromDiscord | <Elegantbeef> so say that offset is 5 |
23:30:49 | FromDiscord | <Elegantbeef> we go back 5 bytes then convert that to a pointer of the base type |
23:30:50 | FromDiscord | <Bubblie> In reply to @Shinyzenith "Screenshot\_20220320-045831\_DuckDuckGo.jpg": Because this kind of looks messy |
23:30:58 | FromDiscord | <Elegantbeef> Sure but that's not how you'd do it |
23:30:59 | FromDiscord | <Shinyzenith> Ahh |
23:31:04 | FromDiscord | <Shinyzenith> Got it |
23:31:10 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Sure but that's not": Oh |
23:31:14 | FromDiscord | <Bubblie> So there is a different way |
23:31:20 | FromDiscord | <Elegantbeef> Normal Nim doesnt really use pointers only low level does |
23:31:33 | FromDiscord | <Elegantbeef> If you want to use ptr math you can do https://github.com/kaushalmodi/ptr_math |
23:31:41 | FromDiscord | <Bubblie> 👀 |
23:31:46 | FromDiscord | <Elegantbeef> I personally hate it |
23:31:48 | FromDiscord | <abdu> sent a code paste, see https://play.nim-lang.org/#ix=3SUt |
23:31:59 | FromDiscord | <Bubblie> I get that |
23:32:04 | FromDiscord | <Elegantbeef> But like i said Nim is a heavily extensible language which can mostly be done in userspace |
23:32:20 | FromDiscord | <Elegantbeef> There is no reason for the stdlib to have ptr math imo |
23:32:58 | FromDiscord | <Shinyzenith> So basically ↵Turn t to int -\> get offset between field and t -\> walk back those bytes and then convert back to base type pointer |
23:33:01 | FromDiscord | <Elegantbeef> Hell reverse indexing is 100% user space so if you wanted to do `3` for backwards index you coulld |
23:33:04 | FromDiscord | <Elegantbeef> Yep |
23:33:06 | FromDiscord | <Elegantbeef> You've got it |
23:33:15 | FromDiscord | <Shinyzenith> Thanks!! |
23:33:15 | FromDiscord | <abdu> How do we have a function static variable, just like in C function static variable ? |
23:33:21 | FromDiscord | <Elegantbeef> You have the pointer to the field and want the pointer to the object |
23:33:33 | FromDiscord | <Elegantbeef> `var myVar {.global.} = defaultValue` |
23:33:45 | FromDiscord | <Elegantbeef> It's not a `static` but it's a global state just like `static` |
23:34:53 | FromDiscord | <Elegantbeef> Generally buublie you can do `cast[ptr UncheckedArray[T]](myPointer)` then just treat it liike an array |
23:35:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SUv |
23:36:01 | FromDiscord | <Elegantbeef> Maybe with a proper cast |
23:36:18 | FromDiscord | <Elegantbeef> But eitherway that's how you generally get around pointer arithmetic in a cleaner way |
23:36:56 | FromDiscord | <Elegantbeef> But for Nim native types we also have `openArray` which is a slice |
23:38:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SUw |