<< 02-06-2021 >>

00:04:09*uvegbot quit (*.net *.split)
00:04:09*cornfeedhobo quit (*.net *.split)
00:04:09*snowolf quit (*.net *.split)
00:04:09*Onionhammer quit (*.net *.split)
00:04:09*BlitzWorks quit (*.net *.split)
00:04:09*dv^_^ quit (*.net *.split)
00:06:22*cornfeedhobo_ joined #nim
00:09:09*rockcavera quit (Read error: Connection reset by peer)
00:09:23*snowolf joined #nim
00:11:07*rockcavera joined #nim
00:11:15*snowolf is now known as Guest42529
00:16:14*zuckerberg[m] quit (Ping timeout: 245 seconds)
00:17:13*bfgcoding[m] quit (Ping timeout: 245 seconds)
00:17:13*dom96 quit (Ping timeout: 245 seconds)
00:18:19*npham[m] quit (Ping timeout: 245 seconds)
00:19:26*bfgcoding[m] joined #nim
00:19:39*vsantana quit (Ping timeout: 258 seconds)
00:19:59*Avahe[m] quit (Ping timeout: 245 seconds)
00:20:11*asdflkj quit (Ping timeout: 245 seconds)
00:20:11*Oddmonger quit (Ping timeout: 245 seconds)
00:20:17*Oddmonge1 joined #nim
00:20:24*Zoom[m] quit (Ping timeout: 245 seconds)
00:20:49*euantorano quit (Ping timeout: 245 seconds)
00:21:14*npham[m] joined #nim
00:22:25*euantorano joined #nim
00:22:52*zuckerberg[m] joined #nim
00:23:19*crem1 quit (Ping timeout: 245 seconds)
00:23:22*Avahe[m] joined #nim
00:23:23*customer[m] quit (Ping timeout: 245 seconds)
00:23:46*Zoom[m] joined #nim
00:23:50*dom96 joined #nim
00:23:50*dom96 quit (Changing host)
00:23:50*dom96 joined #nim
00:25:28*crem1 joined #nim
00:25:54*customer[m] joined #nim
00:25:58*asdflkj joined #nim
00:30:56*Tanger joined #nim
00:37:37*letto_ joined #nim
00:38:41*letto quit (Ping timeout: 260 seconds)
00:53:31*cornfeedhobo_ is now known as cornfeedhobo
00:56:01*nphg1 joined #nim
00:56:32*surma quit (Read error: Connection reset by peer)
00:56:34*koltrast quit (Quit: ZNC - http://znc.in)
00:56:42*surma joined #nim
00:57:19*koltrast joined #nim
00:58:58*nphg quit (Ping timeout: 252 seconds)
01:21:39*NimBot joined #nim
01:29:26*junland quit (Quit: %ZNC Disconnected%)
01:30:18*junland joined #nim
01:30:31*arkurious quit (Quit: Leaving)
01:40:08*junland quit (Quit: %ZNC Disconnected%)
02:08:23*krux02 quit (Remote host closed the connection)
02:48:37*Tlangir joined #nim
02:51:10*Tanger quit (Ping timeout: 252 seconds)
03:18:09*vsantana joined #nim
03:20:54*konradmb[m] joined #nim
03:22:23*spiderstew joined #nim
03:23:43*spiderstew_ quit (Ping timeout: 258 seconds)
03:38:35*Guest21384 quit (Read error: Connection reset by peer)
04:34:12*vsantana quit (Ping timeout: 252 seconds)
05:08:49*beshr joined #nim
05:10:57*narimiran joined #nim
05:30:59*beshr quit (Quit: Leaving)
05:31:14*beshr joined #nim
06:21:05*PMunch joined #nim
06:33:30*Vladar joined #nim
06:49:47*rockcavera quit (Remote host closed the connection)
07:32:34*vsantana joined #nim
07:48:54*krux02 joined #nim
09:06:01*Jesin quit (Ping timeout: 260 seconds)
09:07:17*arecaceae quit (Remote host closed the connection)
09:08:02*arecaceae joined #nim
10:17:29*CodeBitCookie[m] quit (Ping timeout: 245 seconds)
10:17:54ForumUpdaterBotNew question by Dub Awakener: Compile C-code which was generated by Nim, see https://stackoverflow.com/questions/67803147/compile-c-code-which-was-generated-by-nim
10:19:01*CodeBitCookie[m] joined #nim
10:19:08*Tlanger joined #nim
10:21:36*Tlangir quit (Ping timeout: 260 seconds)
10:28:30*Guest42529 quit (Ping timeout: 240 seconds)
10:28:30*snowolf joined #nim
10:36:25*ZoomZoomZoom joined #nim
10:38:13ZoomZoomZoomWelp, matrix bridge isn't working, right?
10:38:59PMunchI can see you?
10:39:17ZoomZoomZoomAt least m>irc. That's explains me being ignored for a while
10:39:28ZoomZoomZoomDo you see messages from Zoom[m]?
10:41:14ZoomZoomZoomPMunch, nah, I don't see my matrix messages in irc.
10:41:31PMunchNope :P
10:41:32ZoomZoomZoomMay be I was shadowbanned? :)
10:41:56PMunchHmm, it appears you're still logged in as Zoom[m]
10:42:07PMunchDid you do anything worth banning you over?
10:42:15ZoomZoomZoomDamn, I was asking a few questions here a couple of days ago and was greeted with dead silence
10:42:54ZoomZoomZoomWhat do you think? :P I did, but I haven't posted about it here!
10:43:25PMunchI mean I haven't seen anything worth banning you over, otherwise I would've banned you :P
10:43:43ZoomZoomZoomGood to know!
10:44:00PMunch26/05 is the last time I can see you've written anything
10:44:24PMunchUnless you got banned for saying Andreas should get a mic I think you're good :P
10:44:52*krux02 quit (*.net *.split)
10:44:52*spiderstew quit (*.net *.split)
10:44:59ZoomZoomZoomSo, the bridge crapped out
10:45:29PMunchSeems like it
10:46:44ZoomZoomZoomIf it didn't work at all I would have thought it has something to do with freenode perturbations, but it works irc>matrix.
10:47:27ZoomZoomZoomOk, going to repost my last question first:
10:47:51ZoomZoomZoomIs xflywind here under some other nick? I have a question regarding new channel docs and the coming blog post.
10:47:57ZoomZoomZoomShouldn't we give some examples on how to use them without globals? It's probably ok for short snippets, but it's the only option present in the main and only example in the docs, which looks like it's the preferred way to use them.
10:48:55ZoomZoomZoomI've already posted this on GH after no one answered. Would have preferred to ask here first of course.
10:55:24FromDiscord<Zachary Carter> Not sure what you're referring to...
10:55:28PMunchI don't think they're here under another nick, but I think they're usually on later in the day
10:55:43FromDiscord<Zachary Carter> Can you link to the github thread?
10:56:17ZoomZoomZoom@Zachary Carter https://github.com/nim-lang/website/pull/274
10:57:17FromDiscord<Zachary Carter> Thanks
10:57:48ZoomZoomZoomI just saw the question regarding this on the forums a few days ago and thought that could be a good addition to the article
10:58:33*krux02 joined #nim
10:58:33*spiderstew joined #nim
10:59:09ZoomZoomZoomSo, I made a thing
10:59:14FromDiscord<Zachary Carter> I haven't missed channels since ORC was released... Haven't once thought to myself I wish I had channels.
10:59:17FromDiscord<Zachary Carter> Gotcha
11:00:01PMunchI really wish ARC/ORC with threads was a bit better explained somewhere, so I knew what would be safe to do and not..
11:00:02ZoomZoomZoom@Zachary Carter I just used them as an event queue in that thing I'm going to write about
11:00:11PMunchDo you just lock a seq and put stuff in there?
11:00:25ZoomZoomZoomhttps://github.com/indiscipline/tetronimia
11:00:37ZoomZoomZoomI'd like you all to tell me all the ways in which my code sucks
11:00:53ZoomZoomZoom...before I post it on the forums and embarass myself
11:04:25PMunchNice description :P
11:04:29PMunchThat game
11:04:32FromDiscord<Zachary Carter> In reply to @PMunch "Do you just lock": I guess it depends on the situation, the compiler is pretty good about inserting moves and sinks, etc... for you. Of course if you're not transferring ownership of objects via move semantics, you still need to use shared memory. The main difference is now not every thread has its own local heap, everything gets allocated on a shared heap so it's much more straightforward to reason about.
11:04:43FromDiscord<Zachary Carter> And yeah, you still need concurrency primitives
11:05:05*Jesin joined #nim
11:05:27PMunchYeah I was just wondering how you transfer an object from one thread to another
11:05:57ZoomZoomZoomPMunch, you move it through a channel?
11:06:08PMunchBut he said he wasn't using channels with ORC
11:06:14FromDiscord<Zachary Carter> No... you just pass it to the thread func as an argument
11:06:31PMunchAah, I was thinking of a consumer/producer scenario
11:06:33FromDiscord<Zachary Carter> assuming you don't reference that object after the move
11:06:38ZoomZoomZoom@Zachary Carter But the thread is already running!
11:06:40FromDiscord<flywind> In reply to @ZoomZoomZoom "Is xflywind here under": Thanks for your suggestions, there is a severe problem(https://github.com/nim-lang/Nim/issues/17392). So I'm not sure when to publish the article.
11:06:43PMunchI see
11:06:51FromDiscord<Zachary Carter> then have some shared memory the thread can read from
11:07:10FromDiscord<Zachary Carter> you still don't "need" channels
11:07:28PMunchYeah so just put it in a seq guarded by a lock or something?
11:07:41FromDiscord<Zachary Carter> sure, but the seq has to be allocated on the shared heap
11:07:47FromDiscord<Zachary Carter> can't be thread local or whatever
11:07:52PMunchSure
11:08:03FromDiscord<Zachary Carter> but yeah, it's generally as simple as that
11:08:12PMunchDamn, that's awesome
11:08:30PMunchI still struggle a bit understanding how it all works though..
11:08:32FromDiscord<Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3oy7
11:08:40FromDiscord<Zachary Carter> yeah it's nice, and also loading symbols from dynamic libraries and passing objects to function pointers is no longer an issue
11:08:48PMunchLike when you put it in a global sequence, who owns it then?
11:08:49FromDiscord<Zachary Carter> so hot reloading just works now
11:09:13PMunchLoading symbols from a dynamic library used to be an issue?
11:09:25FromDiscord<Zachary Carter> well in that case there is no real ownership unless you enforce something - which people are doing with unique / shared ptr
11:09:45FromDiscord<Zachary Carter> In reply to @PMunch "Loading symbols from a": yeah that's why no one could ever really get hot reloading working
11:09:57PMunchOh like passing GCed data through the dynamic library bridge?
11:10:02FromDiscord<Zachary Carter> because each DLL had its own nim runtime library
11:10:04FromDiscord<Zachary Carter> yeah exactly
11:10:10FromDiscord<Zachary Carter> so multiple GCs that just stomp on one another
11:10:11FromDiscord<konsumlamm> In reply to @Zachary Carter "sure, but the seq": isn't that essentially a channel though?
11:10:25ZoomZoomZoom@flywind Thanks a lot! Completely missed this issue. Great work anyway.
11:10:34PMunchI've been doing quite a bit with dynamic libraries, but one side has always been written in C so no GCed memory crossed in or out of it
11:10:50FromDiscord<Zachary Carter> In reply to @konsumlamm "isn't that essentially a": Sure, just more primitive I suppose
11:11:10FromDiscord<Zachary Carter> In reply to @PMunch "I've been doing quite": ah yeah, in my project I use it to reload all my game code on the fly
11:11:22PMunchZoomZoomZoom, Wwhy don't you import the rest of `math`?
11:13:09ZoomZoomZoomPMunch, I don't know, tbh. I would have rewritten it all for implicit `from x import y` to control how much stuff I'm using but it's just too many lines :P
11:13:19FromDiscord<Zachary Carter> Nim takes care of that for you
11:14:16FromDiscord<Zachary Carter> Nim will only include symbols you depend on, so even if you `import math` but only ever use the `pi` constant defined in it, that's all that will be included in the generated C sources
11:14:28PMunch`for (i, x) in a.pairs(): result[i] = p(x)` can be written as `for i, x in a: result[i] = p(x)`
11:14:28FromDiscord<Zachary Carter> Nim won't bring in the entire `math` module
11:15:07ZoomZoomZoom@Zachary Carter I understand that, but this is just for me to stumble upon any new function I pull from the std.
11:15:31FromDiscord<Zachary Carter> Ah gotcha
11:16:45ZoomZoomZoomI like the compiler to slap me every time the code grows unintentinally. On the other hand, I use cligen, so it doesn't matter for this project already :)
11:17:46FromDiscord<Rika> In reply to @アイザヱイ "so after `##` need": ## doc comments can only be placed in certain places
11:18:23FromDiscord<Aiz> thanks, i guess i would have to use `#`
11:18:33FromDiscord<Aiz> for `# TODO`
11:18:40PMunchhttps://github.com/indiscipline/tetronimia/blob/main/src/tetronimia.nim#L117 -> If you define LT as array[TetronimoKind, whatever type this is] you could just do LT[tk][rotation]
11:19:16ZoomZoomZoomPMunch, nope, rotation arrays are of different length
11:19:39PMunchOh that's a tuple..
11:20:07PMunchI mean you could make them sequences
11:20:29ZoomZoomZoomThat's a small achievement for me here. No seqs in the code at all, if you disqualify strings
11:20:55FromDiscord<Rika> no seqs in the code != good code
11:20:59ZoomZoomZoomF*ck the heap, y'know?
11:21:07ZoomZoomZoomThat's for fun
11:21:25FromDiscord<Rika> if you do not understand why you should not use the heap then did you really improve as a programmer
11:22:05ZoomZoomZoomThis whole code won't be seen by more than 5 people and the program maybe run by 50. But I had a challenge and fun implementing it
11:22:08PMunchAnd tuple indexing by numbers only works for static integers IIRC
11:22:25ZoomZoomZoomPMunch, yep, this is why it doesn't work as I want it
11:23:04ZoomZoomZoomYeah, Beef made a nice suggestion with Object Variants, but it's so lengthy it defeats the purpose
11:23:30PMunchYou could use a template
11:23:35ZoomZoomZoomHere it is: https://play.nim-lang.org/#ix=3nHo
11:23:59PMunchAh wait, no you can't..
11:24:21PMunchYou could generate that case statement in a macro, but the macro would probably be about as long :P
11:24:29PMunchIt would work dynamically though
11:25:07*abm joined #nim
11:25:28ZoomZoomZoomTBH, I still don't really get why it can't work statically. I wan't my lookup table to be indexed by enums. They are finite and known at CT
11:26:51PMunchI mean that is essentially what you're doing
11:27:27PMunchSince rotation isn't static you have to check it on runtime
11:27:39ZoomZoomZoomIt doesn't fail on a `[n]` indexing even though it can be OOB easily and no problem, but I wan't to address a tuple with a known number of fields with an enum with a known same number of fields and it doesn't compile
11:29:38*Tlanger quit (Ping timeout: 252 seconds)
11:30:43PMunchThat's only because that case statement isn't auto-generated
11:30:48ZoomZoomZoomIf it checked the rotation, the `case` statement wouldn't compile.
11:31:03PMunchBut it's exactly the same thing your code would be doing if it allowed [] with a runtime number
11:31:32ZoomZoomZoomThat's what I want, isn't it?
11:33:09PMunchWell I guess
11:33:36ZoomZoomZoomI suppose for this piece of code it isn't worth it, but I saw some lenghty enums, such as colors, keycodes and such. Wouldn't it be great if you didn't need to write a lengthy table _and_ equally lengthy case statement for them?
11:34:17PMunchWell you could write a macro to generate them for you automatically
11:35:59ldleworkHello, are there any hand-holdy resources for doing simple web-canvas javascript coding with Nim?
11:36:01ZoomZoomZoomYeah, but I still can't wrap my head around the difference. As I said the last time, Zoom:0/CS:1 again.
11:37:11PMunchWell there is no difference, but it's quite an edge case
11:37:22FromDiscord<Rika> i dont understand the issue
11:37:45PMunchYou could also make all the arrays four elements long, it wouldn't OOB though, just create some weird behaviour
11:38:05ZoomZoomZoom@Rika, https://github.com/indiscipline/tetronimia/blob/main/src/tetronimia.nim#L117
11:38:26ZoomZoomZoomPMunch, I thought about it, but it's the same as giving up
11:39:03FromDiscord<Rika> what does apply(tOffsets) do?
11:39:51ZoomZoomZoom@Rika replaces u16 with an array of point tuples for each set bit in the number
11:40:25ZoomZoomZoomSo I don't have ugly sets of coordinates for bitmaps of pieces in my code
11:40:57*ldlework shrugs.
11:41:17ZoomZoomZoomI like this `apply` a lot and all this CT processing feels cool to me
11:43:32ZoomZoomZoomTo clarify, each piece is a 4x4 grid and I encode them as uint16 bitmaps in the code for easy manual entering. I thought I may have to encode different sets of pieces for optional rotational systems (there's a bunch of them)
11:43:54FromDiscord<StrangeQuarkAL> wow. Nice bot
11:43:58FromDiscord<Rika> zoomzoomzoom: you say a `LT[n][rotation]` works with n: int?
11:45:19FromDiscord<Rika> because when i tried, it does fail with an n indexing using int
11:45:28ZoomZoomZoom@Rika nope, I think it doesn't. But I don't want to use int, I want to use an enum, `ord` of which is in a subrange known at CT
11:45:50FromDiscord<Rika> if you really want that to work, you make the tk parameter static
11:46:08PMunchThe problem is that LT[n] can't have a proper type, because the arrays are of different length
11:46:24FromDiscord<Rika> yes, unless its evaluated on compile time
11:46:47ZoomZoomZoomBut the function gets used in the dynamic code to give proper results depending on an object TetronimoKind
11:46:47FromDiscord<Rika> In reply to @StrangeQuarkAL "wow. Nice bot -": haha, dont worry about it
11:47:19FromDiscord<Rika> well then there really isnt a solution to this that would "look nice" because of how the types work
11:48:08ZoomZoomZoomI get that, I just don't get why. :D I think I need a textbook or something, I feel dumb
11:48:41ZoomZoomZoomIn my head, that case which gives different results depending on an enum is the same bloody thing and it works
11:50:38ZoomZoomZoomAt this point I just accepted it all as it is, but it doesn't feel good :D
11:51:25PMunchIf you had something like LT.runForIt(n, it[rotation]) you could make it work
11:51:55PMunchWhere runForIt auto-generates the case statement
11:52:10FromDiscord<Rika> `LT` -> same type, doesnt need case↵`LT[enum]` -> different type, needs case↵`LT[enum][rot]` -> same type again, still needs case because all types above need to be same type
11:52:48FromDiscord<Rika> if enum were static, LT and LT[enum] wouldnt matter because the compiler would convert it to a "literal"
11:53:23FromDiscord<Rika> okay, the explanatiojn doesnt work too well
11:53:26FromDiscord<Rika> okay one moment
11:55:16FromDiscord<Rika> `LT[enum]` -> type can change depending on what enum can be; must be compile time↵`LT[enum][int]` -> type is the same no matter what values enum or int are, BUT part of it (`LT[enum]`) must be evaluated in compile time or hand-evaluated (the case statement)
11:55:59FromDiscord<Rika> does this help?
11:57:08PMunch@ldlework, not that I know of..
11:57:38ZoomZoomZoom@Rika, Yeah, thanks a lot. The part when I stumble is why can't this hand evaluation be generated automatically
11:58:19PMunchldlework, have you seen this? https://github.com/define-private-public/HTML5-Canvas-Nim/blob/master/test.nim
11:59:26PMunchZoomZoomZoom, because it doesn't know that you want to do [rotation] when it tries to figure out what LT[n] is supposed to be. I guess it technically could, but it's just not how Nim works. But as I said you could write a macro for it
12:00:17ldleworkPMunch: ah nifty, thanks mate
12:00:48ZoomZoomZoomPMunch, I think this is a nice edge case. I'll save it as a question for interviewing coders in the future.
12:01:37*ZoomZoomZoom giggles maniacally
12:01:40FromDiscord<Rika> because then `aTuple[anInt].aProc` becomes a runtime error if `aProc` does not support whatever type `aTuple[anInt]` returns
12:02:02FromDiscord<Rika> defeats the purpose of typing
12:04:48ZoomZoomZoomI think I'm 85% there, so it's fine. I'd like you to pick on my other code as well :D
12:05:08FromDiscord<Rika> sure, whats it
12:05:56ZoomZoomZoomThe same link as above. https://github.com/indiscipline/tetronimia/blob/main/src/tetronimia.nim I feel it starts to be too much intertwined to my taste
12:06:14FromDiscord<Rika> i mean what lines
12:07:22ZoomZoomZoomYeah, that's too much to glance over. I don't have any specific questions, unfortunately
12:08:03ZoomZoomZoomJust the main loop seems a bit too branch-heavy
12:09:04FromDiscord<Airbus5717> Does gdb work with nim ?
12:09:22FromDiscord<Rika> yes
12:09:51FromDiscord<Airbus5717> Cool
12:09:51FromDiscord<Rika> i dont know what you need to do past `--debugger:native --gc:orc` in the flags for it to be nice with gdb
12:10:03FromDiscord<Airbus5717> 👀
12:10:11FromDiscord<Airbus5717> In nimble too?
12:10:18FromDiscord<Rika> no idea
12:10:23FromDiscord<Rika> i dont use nimble to compile
12:12:57FromDiscord<Rika> In reply to @ZoomZoomZoom "Just the main loop": break it up into more functions?
12:16:35*arkurious joined #nim
12:18:45*sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in)
12:19:02PMunchZoomZoomZoom, it's a bit janky but eh: https://play.nim-lang.org/#ix=3oyp
12:19:11*sacredfrog joined #nim
12:20:52ZoomZoomZoomPMunch, that's fun! I still am at level 0 with macros, this is a nice one to get through
12:21:48ldleworkPMunch: a while ago I made http://type-tetris.ldlework.com/challenges/
12:22:02ldleworkI wonder if something similar would be possible for Nim
12:22:09FromDiscord<Rika> why not
12:23:19PMunchSure it would
12:23:52ZoomZoomZoomldlework, having a blinking cursor which doesn't work is evil! :D
12:24:12ldleworkIt was quite low-effort for Typescript because the VSCode component Monaco already had support for Typescript.
12:24:34ldleworkSo I could ask Monaco if there were any errors to check if the user succeeded.
12:25:27ldleworkSo maybe it is a matter of just figuring out how to add VSCode extensions to Monaco or something. To add a Nimlang one, if there is one.
12:27:59FromDiscord<Zachary Carter> o/ Idlework, long time no see
12:35:54ZoomZoomZoomCan we have some notification for matrix users the bridge isn't working currently? I'm not alone using it
12:36:20*noeontheend joined #nim
12:48:54PMunchIs the Matrix bridge a Nim thing?
12:48:58*nxnl[m] joined #nim
12:49:00PMunchI thought it was just a general Freenode thing
12:59:02*narimiran quit (Ping timeout: 258 seconds)
13:05:52*spiderstew quit (Ping timeout: 245 seconds)
13:06:14*spiderstew joined #nim
13:06:40*bru_no joined #nim
13:09:02*bru_no quit (Client Quit)
13:40:12FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3oyL
13:43:09FromDiscord<Zachary Carter> should be fine
13:43:12FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=3oyM
13:43:40FromDiscord<jtiai> Okay, testing...
13:43:55FromDiscord<Zachary Carter> oh you can change the return type to `int32` if you don't want to use `cint` as well
13:44:04FromDiscord<Zachary Carter> I tend to favor using the actual type names and not the aliases
13:44:14FromDiscord<Zachary Carter> except for `cstring` of course
13:45:02FromDiscord<jtiai> Errr... That proc already exists in library. I'm just trying to use it.
13:46:38FromDiscord<Zachary Carter> yeah I get that, are you asking how to invoke it?
13:47:00FromDiscord<Zachary Carter> the `cdecl` and `importc` pragmas should tell the Nim compiler that it's externally defined
13:47:19FromDiscord<Zachary Carter> and then the `dynlib` pragma tells Nim to load the symbol for that function from a dynamic library
13:47:30FromDiscord<Zachary Carter> I guess I'm not really sure what your problem is heh
13:49:42FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3oyO
13:52:09FromDiscord<jtiai> Specially `pixels` is a bit hazy since it's basically pointer to begining of pixel memory area so how I can set individual values there nicely like usually I've done something like this: `pixels[y width + x] = color`
13:54:01*rockcavera joined #nim
13:55:12FromDiscord<Zachary Carter> You probably want to store pixels in memory as an array or sequence and then cast an individual element to a pointer, like this
13:56:37FromDiscord<Zachary Carter> sent a code paste, see https://play.nim-lang.org/#ix=3oyQ
13:56:53FromDiscord<jtiai> oh that waY...
13:58:37FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3oyS
13:59:10FromDiscord<jtiai> Because if I understood that `pixels` pointer is changed to point pixel data.
13:59:38FromDiscord<Zachary Carter> okay then do
13:59:59FromDiscord<Zachary Carter> `cast[pointer](addr(pixels[0]))`
14:01:28FromDiscord<jtiai> Getting close.
14:01:31FromDiscord<jtiai> sent a code paste, see https://paste.rs/9w3
14:04:44*aeverr quit (Ping timeout: 252 seconds)
14:04:55*aeverr joined #nim
14:12:16FromDiscord<jtiai> Bummer. Missing something so basically lockTexture pixels is changed to point memory of bytes that I want to access as a sequence (or something similar to manipulate contents of pixels). I think it's `void pixels` in C code.
14:25:47FromDiscord<Zachary Carter> well yes it's looking for a pointer to some allocated memory. You could store the pixel data in an array, a sequence, whatever. The important thing here is to pass a pointer to the first element of the collection, to the C code.
14:28:44*noeontheend quit (Ping timeout: 258 seconds)
14:29:50FromDiscord<Rika> it might want a var pointer?
14:30:24*noeontheend joined #nim
14:37:47Prestigenot sure what "ptr pointer" would be
14:38:32PrestigeRika might be right actually, that's the only thing that makes sense
14:39:45Prestigehttps://play.nim-lang.org/#ix=3oz5 ?
14:42:27FromDiscord<Rika> i dont know why it would want a var pointer
14:42:39FromDiscord<Rika> you dont have many use cases for such a thing
14:42:54PrestigeYeah it's pretty odd
14:47:52ForumUpdaterBotNew thread by Ingo: Select a type, see https://forum.nim-lang.org/t/8073
14:49:43FromDiscord<treeform> In reply to @Rika "i'd love to try": Text typesetting happens here: https://github.com/treeform/pixie/blob/master/src/pixie/fonts.nim#L157 , You would probably need to insert couple of ifs here: https://github.com/treeform/pixie/blob/master/src/pixie/fonts.nim#L228 I would check if current char fits in the bounds or not, if its the first char i would move to the left till it fits, if its not the first char I would wrap.
14:50:18FromDiscord<Rika> well, i'm looking for min. jaggedness: https://xxyxyz.org/line-breaking/
14:50:32FromDiscord<Rika> i'm dissecting this
15:04:30*noeontheend quit (Ping timeout: 252 seconds)
15:14:23FromDiscord<Zachary Carter> int SDL_LockTexture(SDL_Texture texture, const SDL_Rect rect, void pixels, int pitch);↵↵Is the signature... Sorry @jtiai#7104 I missed the double pointer. You do indeed want a pointer to a pointer. The pointer that points to the pointer can be managed by Nim, so as suggested by Rika and PMunch you could use a var pointer.
15:15:54FromDiscord<jtiai> In reply to @Zachary Carter "int SDL_LockTexture(SDL_Texture * texture,": so `var pixels = var pointer` ?
15:22:34*willyboar joined #nim
15:23:30*ZoomZoomZoom quit (Read error: Connection reset by peer)
15:26:52PMunchAs suggested by me?
15:27:34FromDiscord<Zachary Carter> Mmm, I will type it up in 15 mins or so if no one beats me to it
15:29:27FromDiscord<Zachary Carter> In reply to @PMunch "As suggested by me?": Sorry, I thought you had. I should have typed Prestige. My bad.
15:29:38PMunchHaha, I realised after I wrote that :P
15:29:53PMunchI was wondering if this was a reply to something that happened ages ago :P
15:30:26FromDiscord<jtiai> I tried to do what Prestige did but somehow it just "doesn't work".
15:31:11FromDiscord<jtiai> Don't get any errors but modifying pixels doesn't cause any effect on texture. So some pointer must be wrong.
15:33:52FromDiscord<Zachary Carter> PMunch: nope haha, I think the robot Avatar on discord had me confused
15:34:26FromDiscord<Zachary Carter> If you two don't have the same one it's the same color at least
15:34:27PMunchAah right, to you we all look the same :P
15:34:55PMunchThe robot avatar is just the one for the IRC bridge I think
15:35:08PMunchAlways fun when someone thinks that we're actual bots
15:35:21FromDiscord<Zachary Carter> Lol
15:35:53PMunchHas happened more than once :P
15:36:05PMunchI think if the Nim IRC channel had sentient bots it would be in the news
15:38:14FromDiscord<Rika> you're telling me you're not sentient robots
15:41:05PMunchBleep bloop, sorry I didn't get that question
15:41:27*abm quit (Quit: Leaving)
15:41:40FromDiscord<Rika> a true sentient bot would have understood that
15:41:41FromDiscord<Rika> smh
15:51:04*zedeus quit (Ping timeout: 252 seconds)
15:57:15*tane joined #nim
15:59:31FromDiscord<Zachary Carter> Well @jtiai I just typed everything up for you and clicked the share button on the nim playground and got a 522 error (I think that was the code anyway)
15:59:46FromDiscord<Zachary Carter> I'll type it up again when I have a spare moment
16:00:11PMunchUgh, those errors are the worst.. I should really fix that
16:23:04FromDiscord<Zachary Carter> No worries, I should have copied it to the clipboard first 🙂
16:23:25FromDiscord<Zachary Carter> Anywho, I wrote up a pretty thorough (hopefully) explanation of how this works @jtiai : https://play.nim-lang.org/#ix=3ozz
16:23:30FromDiscord<Zachary Carter> Please let me know if you have questions
16:30:41*BusterBlue[m] joined #nim
16:32:19ForumUpdaterBotNew thread by Alexeypetrushin: Nim JSON parsing is 30 times slower than Node.JS, see https://forum.nim-lang.org/t/8074
16:59:30*rockcavera quit (Read error: Connection reset by peer)
17:00:23*rockcavera joined #nim
17:17:42FromDiscord<jtiai> In reply to @Zachary Carter "Please let me know": After a bit of debugging it turns out that `px[0]` still points to original address and not one that came to `ppx` was set to after calling `lockTexture`.
17:18:37FromDiscord<jtiai> so if I do change contents of `px` array it goes to "black hole". I should be changing values pointed by `ppx` but I've no clue how.
17:19:35FromDiscord<Zachary Carter> I really don't know what you're trying to do...
17:19:49FromDiscord<Zachary Carter> Px isn't going to be modified
17:20:37FromDiscord<Zachary Carter> Well maybe it will be, but you're passing in a pointer to a pointer.
17:21:05FromDiscord<Zachary Carter> The 0th element of px isn't a pointer, so it doesn't point to anything...
17:21:34FromDiscord<jtiai> lockTexture returns memory area to `pixels` to be modified (write only).
17:22:29FromDiscord<jtiai> In C you give pointer to a pointer which then is modified by underlying code and then you can use that pointer to modify contents.
17:25:46*rockcavera quit (Remote host closed the connection)
17:29:57FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3ozO
17:32:44FromDiscord<Zachary Carter> Okay I will modify my example. Give me a few minutes please
17:40:00FromDiscord<jtiai> I'm not in hurry so please, take your time.
18:01:33FromDiscord<quarternion> > Note: Channels are designed for the Thread type. They are unstable when used with spawn.
18:01:40FromDiscord<quarternion> What does unstable mean here?
18:02:21FromDiscord<quarternion> Does it mean undefined result or?
18:02:42FromDiscord<treeform> Usually that means API will change, but I don't know what it means in that context.
18:07:25FromDiscord<willyboar> When conf.nim-lang.org will be updated?
18:13:49*SebastianM joined #nim
18:28:44*willyboar quit (Remote host closed the connection)
18:29:09*willyboar joined #nim
18:36:39*SebastianM quit (Quit: -a- Bye Bye)
18:52:09FromDiscord<kintrix> Recently started looking into Nim, and joined this discord like yesterday...↵Is this the channel to ask noob technical questions?
18:52:42FromDiscord<kintrix> Or should I go to #offtopic, or is there a channel I'm missing?
18:52:51FromDiscord<willyboar> I guess this one
18:53:22FromDiscord<willyboar> Unless is related w/ another like gamedev/webdev etc
18:53:30FromDiscord<kintrix> alright, thanks
18:54:27FromDiscord<kintrix> So, I'm somehow failed to get intellisense/autocompletion to work with the nim VSCode extension.
18:54:45FromDiscord<kintrix> I'm using linux, Ubuntu, if that is somehow related
18:54:54FromDiscord<kintrix> From I quick google I didn't really find stuff
18:55:21FromDiscord<kintrix> (edit) "From I quick google I didn't really find stuff ... " added "(or I'm just blind)"
18:56:29FromDiscord<kintrix> does anyone have an idea what could cause this?
18:58:16FromDiscord<ElegantBeef> Is nimsuggest in your path?
18:59:04FromDiscord<kintrix> yep
19:00:25FromDiscord<jtiai> I've had good experience with intellij idea and it's nim plugin.
19:00:38FromDiscord<ElegantBeef> What extension?
19:00:41FromDiscord<kintrix> I also downloaded a pre-built version
19:01:04FromDiscord<kintrix> In reply to @ElegantBeef "What extension?": https://marketplace.visualstudio.com/items?itemName=kosz78.nim
19:01:15FromDiscord<kintrix> This had the most downloads
19:01:28FromDiscord<kintrix> it didn't work with the other one that was also called "nim"
19:01:31FromDiscord<kintrix> (edit) "it didn't work with the other one that was also called "nim" ... " added "either"
19:02:17FromDiscord<willyboar> https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode is more active i think
19:02:37FromDiscord<ElegantBeef> Yea it's better but it doesnt change the active problem
19:02:42FromDiscord<ElegantBeef> `nimsuggest -v`?
19:03:26FromDiscord<kintrix> sent a code paste, see https://play.nim-lang.org/#ix=3oAt
19:04:24FromDiscord<mlokis> how can i connect additional udp channel after i established tcp connection? There is the acceptAddr method which blocks. If i call accept on one listener and then on another there is a chance of deadlock as server has no guarantee that client will also try to establish second connection.
19:04:54FromDiscord<ElegantBeef> With nimsaem's there is an `enable nim suggest` toggle ensure that's on, otherwise you have a borked pc
19:05:51FromDiscord<kintrix> it is on, check
19:06:39FromDiscord<kintrix> I feel like I'm probably missing something incredibly obvious
19:08:16FromDiscord<kintrix> Oh wait
19:08:32FromDiscord<kintrix> Is it bad if I'm adding it to the PATH in `.bashrc`
19:10:31PrestigeYes
19:10:49FromDiscord<kalekale> if its in your bashrc then start vscode from bash
19:11:19PrestigeIf you need something in your path you should probably add it to your .xprofile instead of your .bashrc
19:11:38FromDiscord<kintrix> alright
19:11:42FromDiscord<kintrix> let me try that
19:12:21PrestigeOr .profile if you have that
19:12:32PrestigeWill require you to relogin
19:13:57FromDiscord<kintrix> Alright
19:14:04FromDiscord<kintrix> I'll log out and log in quickly
19:18:53FromDiscord<kintrix> Oh, nice! It seems to be working. Thank you guys
19:19:19PrestigeAny time!
19:19:24FromDiscord<kintrix> Obviously it's because of a dumb mistake 🤣
19:22:45FromDiscord<Alea> should I be concerned about this? https://media.discordapp.net/attachments/371759389889003532/849729769711861760/unknown.png
19:23:12FromDiscord<Alea> straight off the main website
19:23:23FromDiscord<hugogranstrom.nim> I got the same
19:23:39PrestigeIt's a false positive, there's an open issue on GitHub about it
19:23:58PrestigeOpen last I saw*
19:27:49leorize[m]looks like the only way out is to submit the file to microsoft as false positive
19:28:24leorize[m]i read a bit and it said any detection with `!` in the name means that it's flagged by the AI
19:31:03*xet7 quit (Remote host closed the connection)
19:33:25*xet7 joined #nim
19:38:47FromDiscord<jtiai> In reply to @Prestige "Will require you to": Actually you can do `source ~/.profile`... Works most of the time.
19:39:39PrestigeOnly in your terminal afaik
19:40:01FromDiscord<jtiai> Does someone use anything else? 😮
19:40:11PrestigeThey were using vscode
19:40:23FromDiscord<jtiai> I always start it from terminal.
19:40:31FromDiscord<jtiai> `code .`
19:40:54PrestigeI figured that was unlikely to be the case, I don't think most people would do that
19:42:36FromDiscord<jtiai> Wonder why I didn't get nimble flagged...
19:42:45FromDiscord<ElegantBeef> Well throwing it in bashrc is only an issue if your .profile doesnt load the bashrc 😄
19:43:52Prestigehm mine does not 🤔 maybe it's common but I haven't seen it
19:44:04FromDiscord<kintrix> In reply to @jtiai "I always start it": I only most of the time do↵sometimes I just do `alt + F2`, and type code
19:44:15FromDiscord<kintrix> since I know what I had last open is what I want to open \:P
19:44:20FromDiscord<kintrix> (edit) "since" => "In case"
19:44:35FromDiscord<kintrix> (edit) "code" => "`code`"
19:46:29FromDiscord<jtiai> I'm just more productive with terminal. Probably I got brainwashed with microcomputer era back in 80s when only thing you had was "terminal".
19:48:50FromDiscord<kintrix> I mean, there isn't much of a difference as far as opening VSCode goes \:P
19:55:38FromGitter<ynfle> `-d:lto` doesn't work on macOS. I get an error of `clang: error: invalid linker name in argument '-fuse-ld=lld'` Judging from https://stackoverflow.com/questions/60944732/using-fuse-ld-lld-with-clang-on-macos it should be `-fuse-ld=ld`
19:55:45FromGitter<ynfle> Bug report?
19:56:55*superbia joined #nim
20:02:19*superbia quit (Quit: WeeChat 3.1)
20:08:19*jfondren[m] left #nim (#nim)
20:15:46*narimiran joined #nim
20:27:56*willyboar quit ()
20:37:44*vsantana quit (Read error: Connection reset by peer)
20:50:08FromDiscord<jtiai> Bummer. Still stuck with `ptr pointer` stuff...
20:52:29*narimiran quit (Ping timeout: 248 seconds)
20:52:45PMunchWhat're you trying to do?
20:53:52*tane quit (Quit: Leaving)
20:54:42FromDiscord<jtiai> SDL2 library has proc that modifies one parameter pointer. In C it's `void pixels`, on Nim side it's defined as `pixels: ptr pointer`
20:55:13FromDiscord<jtiai> So I don't know how to define variables so that I can manipulate memory area pointed by pixels.
20:58:12FromDiscord<jtiai> This is closest help that is almost working:↵https://play.nim-lang.org/#ix=3ozz↵↵Issue with that is `ppx` is changed as expected when call from `lockTexture` returns. But I `px` array still lives it's own memory area so it really doesn't work.
21:05:30FromDiscord<ElegantBeef> `ptr T` is implictly converted to `pointer`
21:05:39FromDiscord<ElegantBeef> Oh wait, that's a `ptr Pointer` uhhh
21:06:07FromDiscord<jtiai> In reply to @ElegantBeef "Oh wait, that's a": Yea...
21:06:46PMunchpixels there is supposed to just be a pointer to pixel data, which will be set by the call (so you shouldn't set it at all). Then after the lock call you can access the locked pixels with the pointer
21:07:48FromDiscord<jtiai> In reply to @PMunch "pixels there is supposed": And the questions is: how to do that?
21:07:53PMunchAnd your texture needs to be created before you do that call
21:08:04FromDiscord<jtiai> That all is already working.
21:08:13FromDiscord<jtiai> Problem is just I can't manipulate pixel data.
21:09:14FromDiscord<codic> what syntax does nim inline asm use? intel or atnt?
21:10:12PMunchjtiai why can't you manipulate it?
21:11:07*zyklon quit (Quit: Konversation terminated!)
21:11:09FromDiscord<jtiai> I don't know how. For example how I can set some 8 bit value to second pixel that `ppx` points to.
21:11:56PMunchSimply cast ppx[] to ptr UncheckedArray[uint8] and modify it?
21:12:08FromDiscord<jtiai> Ooo...
21:12:17FromDiscord<exelotl> yep, that's the way ^
21:12:36FromDiscord<codic> another question, can I get the file descriptor of a File (from system/io)?
21:13:48PMunch@codic: https://nim-lang.org/docs/io.html#getOsFileHandle%2CFile
21:14:10FromDiscord<jtiai> In reply to @exelotl "yep, that's the way": \o/
21:14:52PMunchSorry I didn't help you earlier jtiai, seems like you've been stuck on this for a while..
21:15:05FromDiscord<jtiai> Plasma. 🙂 https://media.discordapp.net/attachments/371759389889003532/849758039284121650/unknown.png
21:15:13FromDiscord<Recruit_main707> nice
21:15:26FromDiscord<exelotl> _demoscene intensifies_
21:15:34FromDiscord<jtiai> I just had great idea to redo all demoscene stuff I did back in 90s.
21:15:51FromDiscord<jtiai> Just wait for text scrollers... 😄
21:16:05PMunchNice :P
21:24:28FromDiscord<Zachary Carter> Glad you got it working @jtiai ! Sorry I've had a busy afternoon!
21:29:13FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3oBd
21:33:11*Vladar quit (Quit: Leaving)
21:33:30FromDiscord<codic> hmm, no `perror` wrapper in stdlib?
21:38:47PMunchproc perror*(s: cstring): void {.importc, header: "<stdio.h>".}
21:40:41FromDiscord<ElegantBeef> Doesnt lazy exception handling do the same?
21:43:37FromDiscord<codic> yeah, just interfacing with C
21:43:40FromDiscord<codic> hmm
21:43:56FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3oBl
21:43:58FromDiscord<ElegantBeef> `_` to start at ype name
21:44:03FromDiscord<ElegantBeef> (edit) "at ype" => "a type"
21:44:11FromDiscord<codic> so I have to use the backticks?
21:44:12FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3oBm
21:44:20FromDiscord<ElegantBeef> Nim doesnt allow `_` as a identifier starting character, so yes
21:45:31FromDiscord<codic> same error
21:45:51FromDiscord<codic> with `profile_idc: `u8``
21:46:12FromDiscord<codic> (edit) "with `profile_idc: `u8``" => "sent a code paste, see https://play.nim-lang.org/#ix=3oBn"
21:46:19FromDiscord<ElegantBeef> Well then stropping doesnt help
21:46:21FromDiscord<codic> (edit) "https://play.nim-lang.org/#ix=3oBn" => "https://play.nim-lang.org/#ix=3oBo"
21:46:34FromDiscord<ElegantBeef> that type needs to drop the underscores then afaik
21:49:50*D_ quit (Remote host closed the connection)
21:52:48FromDiscord<codic> it's a linux header
21:52:53FromDiscord<codic> too much work i'll just use C for now lol
21:54:53FromDiscord<ElegantBeef> You can just do `type u8 {.importC: "u8".} = cint` or w/e
21:55:22leorize[m]`= cint`, really? :P
21:55:23FromDiscord<codic> perhaps yeah
21:55:33FromDiscord<ElegantBeef> Leorize i dont know C
21:55:42FromDiscord<codic> it's probably `uint8`
21:55:50FromDiscord<ElegantBeef> Probably
21:55:59FromDiscord<codic> it's some Linux header thing though, not a C thing
21:56:08leorize[m]FFI still requires a precise mapping to a equivalent Nim type
21:56:16FromDiscord<ElegantBeef> Sounds like a C thing
21:56:21FromDiscord<ElegantBeef> Hence why i said " or whatever it is"
21:56:52FromDiscord<codic> ah ok, so it comes from linux/types.h
21:57:16FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3oBq
21:57:23FromDiscord<codic> no u8 what
21:58:59FromDiscord<codic> Honestly I just want to use opencv for this, looks much easier to tackle
22:04:14*NimBot joined #nim
22:11:09*D_ joined #nim
22:25:45*konradmb[m] left #nim (#nim)
22:26:04*konradmb[m] joined #nim
22:42:20FromDiscord<Alea> which one of the nim extensions is the best for vscode?
22:42:26FromDiscord<Alea> I assume the one by saem?
22:42:57FromDiscord<ElegantBeef> It's in my view
23:04:53*opKoCElzujO joined #nim
23:04:53*opKoCElzujO left #nim (#nim)
23:12:18*PMunch quit (Quit: leaving)
23:19:14*xet7 quit (Remote host closed the connection)