<< 24-05-2021 >>

00:14:05*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:15:06*pbb joined #nim
00:20:39FromGitter<glyh> Hello, guys! Can anyone tell me how to edit this piece of code so that it compiles? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Thanks a lot! [https://gitter.im/nim-lang/Nim?at=60aaf157df5c362d4be94499]
00:21:40FromGitter<glyh> I know that I can nest enums, but it requires another discriminator to be defined
00:21:48FromGitter<glyh> 1) nest cases
00:22:04FromDiscord<ElegantBeef> Nim presently doesnt allow duplicate fields in different variants, so the `s: int` in both cases causes the error
00:22:40FromGitter<glyh> So the only way I can do it is to use inheritance of OOP?
00:22:54FromDiscord<Rika> no, you can just change the names and make a template
00:23:03FromDiscord<Rika> (given that the fields are still the same type
00:23:12FromDiscord<ElegantBeef> ^ or if it's for all all variants https://play.nim-lang.org/#ix=3nHa
00:23:51FromGitter<glyh> I have more complex situations, where s is not for all cases
00:24:09FromGitter<glyh> How to use templates to fix is?
00:25:03FromGitter<glyh> This is the real situation: ```nim ⏎ Token* = object ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=60aaf25f850bfa2d3bdd45af]
00:25:24FromGitter<glyh> This is the real situation: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60aaf27343fc4a24c5c04fe6]
00:26:44FromDiscord<Rika> thats fine
00:26:50FromDiscord<Rika> you just error on other cases with the template
00:27:52FromGitter<glyh> Can you provide a snippet of code to show how it works? Thanks a lot!
00:28:15FromDiscord<ElegantBeef> You can do it this way or with a single pos https://play.nim-lang.org/#ix=3nHd
00:29:03Zoom[m]Hey, is it possible to create an enum-addressable tuple const in a code like this: https://play.nim-lang.org/#ix=3nHc ?
00:29:14FromGitter<glyh> Thanks a lot!
00:30:22Zoom[m]I kind of understand the first part of what I'd like to write is different type depending on an enum, but they are all enumerable containers. It works with `case`
00:31:04FromDiscord<ElegantBeef> I mean you're almost there, just make an enum indexxed array
00:31:55Zoom[m]Arrays are homogenous containers
00:32:23FromDiscord<ElegantBeef> So make it a seq of `array[3,int]`
00:32:50FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3nHg
00:33:21FromDiscord<Rika> is there a reason you need the arrays to be of different sizes
00:33:27FromDiscord<Rika> and cannot use a seq
00:34:37FromDiscord<Rika> @ElegantBeef nonexistent btw
00:34:42FromDiscord<ElegantBeef> I know
00:34:55FromDiscord<ElegantBeef> I make spelling mistakes and see them but live with them
00:35:00Zoom[m]I'm just pushing it. Wanted to not avoid using seqs at all in the code just for funsies.
00:35:31FromDiscord<ElegantBeef> Well then you can always use a variant
00:35:43FromDiscord<ElegantBeef> Or my variant generator which is still not polished 😄
00:36:33Zoom[m]I'd like to know why it doesn't work. If I returned the whole array from a func even case wouldn't work, for obvious reasons, but as soon as we append addressing to the branches it all works.
00:36:53Zoom[m]So, by extension, I'd expect a straight enum addressing to work too
00:38:03FromDiscord<Rika> i dont understand what you dont understand
00:38:34FromDiscord<Rika> because `array[1, array[3, int]] != array[2, array[3, int]]`?
00:39:56FromDiscord<ElegantBeef> The issue seems to be that the `k.ord` is done at CT so just using a static param allows you to get around that https://play.nim-lang.org/#ix=3nHj
00:40:00FromDiscord<Rika> or `array[3, T]` != `array[Kind, T]`?
00:40:08Zoom[m]Yep, but it's just a transient type, when we split the paths in `case` no one cares what they are as long as we extract a value from them.
00:40:20FromDiscord<Rika> oh, k.ord
00:40:22FromDiscord<Rika> i see
00:41:49FromDiscord<ElegantBeef> The issue being that tuple access like that is the same as field access, so you have to have it done statically
00:42:02Zoom[m]@ElegantBeef: that's great. Thanks a lot.
00:42:30FromDiscord<ElegantBeef> I'd say the object variant method is better in this case just since it allows runtime changes in access
00:43:42Zoom[m]So, by marking a parameter with static we just signal it must be known at compile time?
00:43:54FromDiscord<ElegantBeef> Yep
00:44:05FromDiscord<ElegantBeef> Which means you cannot do runtime operations to change the accessing
00:44:56Zoom[m]That's fine by me. It's just a LUT
00:45:54Zoom[m]If you could show the preferred method with object variants, it would be super cool.
00:47:02Zoom[m]I don't really get why the compiler doesn't infer that `static` there, btw.
00:47:14FromDiscord<ElegantBeef> It doesnt do backward inference
00:47:22Zoom[m]On the second thought, I don't really get why the compiler does anything
00:47:35*noeontheend quit (Ping timeout: 246 seconds)
00:50:54FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3nHo
00:50:58FromDiscord<ElegantBeef> Something like this should do the trick
00:52:23FromDiscord<ElegantBeef> Now to do this with my variant generator for a test 😄
00:52:51*Tlangir joined #nim
00:53:20FromGitter<BracketMaster> I have: ⏎ ⏎ ```var fb = FrameBuffer[400, 400]``` ⏎ ⏎ nim is quite unhappy and complains with: `Error: invalid type: 'type FrameBuffer[system.int, system.int]' for var` [https://gitter.im/nim-lang/Nim?at=60aaf90043fc4a24c5c05cf3]
00:53:45FromDiscord<ElegantBeef> `=` should be `var fb: FrameBuffer[400, 400`
00:53:46Zoom[m]That's just silly. I wanted to decrease the LOC! :D
00:54:04FromDiscord<Rika> loc?
00:54:07FromGitter<BracketMaster> oh!
00:54:10Zoom[m]lines of code
00:54:12FromDiscord<ElegantBeef> And also probably need `static int`
00:54:17FromGitter<BracketMaster> spent all day yesterday in scala
00:54:21FromDiscord<Rika> oh i mistook you for bracketmaster
00:54:27FromGitter<BracketMaster> why `static int`?
00:54:54Zoom[m]BTW, just marking the kind `static` didn't work in the actual code.
00:55:43*nphg joined #nim
00:55:52FromDiscord<ElegantBeef> Well like i said the values have to be compile time evaluated
00:56:09FromDiscord<ElegantBeef> Static int since it's apart of the type so it needs to be statically known
00:57:26*nphg1 quit (Ping timeout: 240 seconds)
01:00:28FromGitter<BracketMaster> how might I write a byte literal in Nim?
01:00:32*noeontheend joined #nim
01:00:53FromDiscord<ElegantBeef> `1u8`
01:07:32*pbb quit (Remote host closed the connection)
01:08:19FromGitter<BracketMaster> If I didn't use static[int], you're saying that Nim doesn't know what to do with int indexes at compile time?
01:08:45FromGitter<BracketMaster> or rather - are you saying that the size of the array can't change?
01:08:49*pbb joined #nim
01:08:53FromGitter<BracketMaster> and NIm wants me to be explicit about that?
01:09:14FromDiscord<Rika> static int == `Type[100]`
01:09:19FromDiscord<Rika> int == `Type[int]`
01:09:32FromDiscord<ElegantBeef> `static` is to say "it's a generic based off a compile time value"
01:10:14FromGitter<BracketMaster> you probably get this question alot, but still not seeing any behavioral differences between objects and ref objects..
01:10:47FromDiscord<ElegantBeef> The only behavioural difference that you'll notice is you dont need `var` to mutate fields in a procedure and `ref` can be nil
01:17:19Zoom[m]Gah, still can't grok why it doesn't work.
01:18:38FromDiscord<ElegantBeef> Are you giving it a runtime value of the enum?
01:18:46Zoom[m]The enum is a finite set, I just want to associate some compile-time data with this enum
01:20:00Zoom[m]Yes? Let's say I generate some data which gets classified as one of the enum
01:22:11Zoom[m]Why wouldn't the addressing just transform into the giant `case` I need for a runtime
01:23:58Zoom[m]Ok, perhaps not me, not today. CS:1 / Zoom:0
01:27:51FromDiscord<Hi02Hi> DivBy0Error :p
01:28:41FromGitter<BracketMaster> ```code paste, see link``` ⏎ ⏎ `` Error: expression 'paint' is of type 'proc (){.gcsafe, locks: 0.}' and has to be used (or discarded);`` ⏎ ⏎ How might I discard? [https://gitter.im/nim-lang/Nim?at=60ab01480ff6de262b25e6d7]
01:30:17FromGitter<BracketMaster> oh - it wanted me to add parantheses at the end
01:31:27FromDiscord<ElegantBeef> Yea `paint` is a function name so in that case it was a hanging value
01:49:13FromGitter<BracketMaster> trying to write a simple triangle rasterizer in Nim: https://github.com/BracketMaster/nimRasterizer/blob/main/src/nimRasterizer.nim#L3 ⏎ ⏎ If you delete line 3 and 4, nim goes bezerk: ⏎ ⏎ Error: type mismatch: got <SDL_Return> ... [https://gitter.im/nim-lang/Nim?at=60ab0619a10461235d95f3a9]
01:49:41FromGitter<BracketMaster> Why would I have to import sdl2 in the top file `nimRasterizer.nim` when its already in `framebuffer.nim`?
01:56:34FromDiscord<treeform> In reply to @zetashift "<@107140179025735680> do you have": I have added dashes to Pixie: https://github.com/treeform/pixie/pull/202 pull and try it out!
01:58:05FromGitter<bung87> @BracketMaster it's imported but not exported
01:59:49FromGitter<BracketMaster> @bung87, well yes. I would think nim would understand that when calling ``frambuffer.paint()``, nim should compile the paint function in the context of ``framebuffer.nim``
02:00:03FromGitter<BracketMaster> I could have a fundamental misunderstanding of how niw works however
02:00:53FromGitter<bung87> you should think more deeper, why need export, it not you will get all symbols available in your current module
02:01:22FromGitter<bung87> "if not"
02:02:46FromGitter<bung87> its same behavior like py, js etc
02:03:26FromGitter<BracketMaster> Perhaps I should ask, In my particular scenario, what is the right way to do imports?
02:04:23FromGitter<bung87> you check the module exported symbols
02:05:02FromGitter<BracketMaster> are you saying that framebuffer.nim should export sdl2?
02:05:12FromGitter<BracketMaster> frambuffer already exports paint - I would think that woudl be enough?
02:05:56FromGitter<bung87> imported module only visible in that module, when you import that module , you get exported symbols from that module , not that module imported.
02:06:43FromGitter<bung87> you can have a entry module that export all you need symobls or import modules seperately
02:06:45FromDiscord<ElegantBeef> I could be wrong but that's unrelated eh?
02:06:50FromGitter<BracketMaster> right. but I have to also import sdl2 before the paint function works
02:07:20FromDiscord<ElegantBeef> You import files in the module you need them, and export functionality where you need to
02:10:02FromGitter<BracketMaster> Which is what I usually do. I'm confused as to why I need to import sdl2 into nimRasterize.nim, when its already imported into frambuffer.nim, and nimRasterize.nim imports framebuffer.nim. ⏎ ⏎ I don't call any sdl2 specific things directly in nimRasterizer.nim. I do however call frambuffer.paint(), which is defined in frambuffer.nim, and uses sdl2 specific things, again within framebuffer.nim
02:10:58FromGitter<BracketMaster> if it helps, I'm running `nim c src/nimRasterizer`
02:11:20FromDiscord<ElegantBeef> Yea ofc, let me diagnose the issue here and i'll get back to you 😄
02:12:04FromGitter<bung87> if you do right, then problem is in your framebuffer.nim file or your sdl lib broken.
02:12:56FromDiscord<ElegantBeef> `sdl2.init` returns a `SDL_Return` so i dont see how importing sdl2 in the root changes anything
02:15:24FromGitter<bung87> the error message shows you have no compare proc on some types or converter sometime to bool.
02:16:32FromGitter<BracketMaster> ElegantBeef: You weren't able to get it working as is committed?
02:16:51FromGitter<BracketMaster> It works for me
02:16:56FromDiscord<ElegantBeef> adding an explict `toBool` call on line 60, and line 26 solves this issue
02:17:13FromDiscord<ElegantBeef> Nah it works as committed which is just odd, converters are scary
02:17:24FromGitter<BracketMaster> convertors?
02:17:42FromDiscord<ElegantBeef> there are `toBool` converters for `SDL_Return` so it implictly converts
02:18:00FromDiscord<ElegantBeef> Which somehow broke when removing the import in the main file, 0 clue why/how
02:18:50FromGitter<BracketMaster> ah
02:18:56FromDiscord<Rika> because converters are basically implicitly used functions?
02:19:08FromDiscord<Rika> well theyre fucky anyway
02:19:14FromDiscord<Rika> i wouldnt be surprised if this was just a bug
02:20:14FromDiscord<ElegantBeef> Oh i think i see how the bug is invoked
02:20:22FromDiscord<ElegantBeef> This is silly if the case
02:27:30FromDiscord<ElegantBeef> Nope was not the case 😄
02:37:44ForumUpdaterBotNew thread by Alexeypetrushin: Why union type for proc argument fails to compile?, see https://forum.nim-lang.org/t/8019
02:53:21FromGitter<BracketMaster> it seems nim's countup doesn't like floats
02:53:46*noeontheend quit (Ping timeout: 240 seconds)
02:54:15FromDiscord<Rika> if you think about it, how would that work? floats are imprecise and there will be accumulated error for large amounts of increments
02:59:34FromDiscord<ElegantBeef> Well it could just be int countup but converting to floats after
03:08:17FromGitter<BracketMaster> I've now made FrameBUffer a ref: https://github.com/BracketMaster/nimRasterizer/blob/3a874299b747d659de363587337994c0c2071c47/src/framebuffer.nim#L10 ⏎ ⏎ but now ``for r_index, row in fb:`` no longer works: https://github.com/BracketMaster/nimRasterizer/blob/3a874299b747d659de363587337994c0c2071c47/src/framebuffer.nim#L50
03:09:28FromGitter<BracketMaster> I made FrameBuffer a ref so that I could use it in ``proc line``: https://github.com/BracketMaster/nimRasterizer/blob/3a874299b747d659de363587337994c0c2071c47/src/draw.nim#L3
03:12:23FromDiscord<ElegantBeef> Do you need reference semantics?
03:13:19FromDiscord<ElegantBeef> You could just use a normal object and pass `fb: var Framebuffer`
03:13:51FromDiscord<ElegantBeef> And yes `a: T` is the convention, i did `a : T` when i first wrote nim aswell and think Rika or yardanico got annoyed 😄
03:25:18*spiderstew_ joined #nim
03:25:22FromDiscord<Rika> In reply to @ElegantBeef "Well it could just": But that defeats the purpose of having a float increment
03:25:53FromDiscord<Rika> In reply to @ElegantBeef "And yes `a: T`": Did I? I don’t think I was harsh on you from the start
03:25:59FromDiscord<Rika> Bet it was Yardanico
03:26:50*spiderstew quit (Ping timeout: 246 seconds)
03:37:56*blackpawn_ joined #nim
03:39:02*blackpawn quit (Ping timeout: 252 seconds)
03:54:08FromGitter<BracketMaster> ok - so the var thing work
03:54:35FromGitter<BracketMaster> tha tis `fb : var FrameBuffer`
03:57:03FromDiscord<ElegantBeef> It's a mutable reference to be accurate
03:57:46FromGitter<BracketMaster> and by making FrameBuffer an ref, it becomes a mutable reference by default
03:58:10FromDiscord<ElegantBeef> Nah it just becomes a reference 😛
03:58:39FromGitter<BracketMaster> BUt why did making FrameBuffer a ref not allow me to do iteration?
03:59:51FromDiscord<Rika> because there are iterators for `array` but none for `ref array`
04:03:55FromDiscord<ElegantBeef> if you did `.. in fb[]` i'd work since you'd be dereferencing the reference, but yea in most cases you dont need reference, you use object + var and it's 0 difference
04:04:06FromDiscord<ElegantBeef> We use references when we want reference behaviour
04:15:53*vicfred joined #nim
04:27:58*letto quit (Ping timeout: 265 seconds)
04:50:12*mal`` quit (Quit: Leaving)
05:03:48*pietroppeter joined #nim
05:05:54*rockcavera quit (Remote host closed the connection)
05:13:47*voltist quit (Quit: The Lounge - https://thelounge.chat)
05:16:15*mal`` joined #nim
05:21:52*vicfred quit (Quit: Leaving)
05:23:36*voltist joined #nim
05:24:01*narimiran joined #nim
05:36:20ForumUpdaterBotNew Nimble package! ptr_math - Pointer arithmetic library, see https://github.com/kaushalmodi/ptr_math
06:14:09ForumUpdaterBotNew thread by Araq: C2nim -- minor update, see https://forum.nim-lang.org/t/8020
06:15:39*NimBot joined #nim
06:18:24ForumUpdaterBotNew Nimble package! distances - Distances is a high performance Nim library for calculating distances., see https://github.com/ayman-albaz/distances
06:18:25ForumUpdaterBotNew Nimble package! winimx - Winim minified code generator, see https://github.com/khchen/winimx
06:18:28ForumUpdaterBotNew Nimble package! svvpi - Wrapper for SystemVerilog VPI headers vpi_user.h and sv_vpi_user.h, see https://github.com/kaushalmodi/nim-svvpi
06:27:15FromDiscord<leeooox> is there any good plotting library in Nim. such as matplotlib?
06:28:56FromDiscord<ElegantBeef> Wrapper for that lib https://github.com/ruivieira/matplotnim
06:29:15FromDiscord<ElegantBeef> A pure port of ggplot2 https://github.com/Vindaar/ggplotnim
06:32:18FromDiscord<leeooox> @ElegantBeef Thanks.
06:52:03*letto joined #nim
07:10:51*Vladar joined #nim
07:13:34*pietroppeter quit (Quit: Connection closed for inactivity)
07:46:18ForumUpdaterBotNew thread by Leeooox: How to get the compile time as a const string?, see https://forum.nim-lang.org/t/8021
08:14:06*Arrrrrrrr joined #nim
08:14:31*azed joined #nim
08:30:18*Tlangir quit (Quit: Leaving)
09:02:08*willyboar joined #nim
09:15:13*azed quit (Quit: WeeChat 3.1)
09:18:53FromDiscord<jseb> hello, can the copy be faster than iterating each elements ?↵https://play.nim-lang.org/#ix=3nID
09:24:12FromDiscord<ElegantBeef> Hard to benchmark with those small values but you could do `copyMem(pbuf[0].addr, ga[0].addr, ga.len`
09:25:52FromDiscord<jseb> thank you !
09:51:18FromDiscord<jseb> i think i can pass directly buffer, instead of pbuf[0].addr then ? `copyMem(buffer.addr,ga[0].addr,ga.len`
09:52:07FromDiscord<jseb> i've tried and it seems ok, the cast to ptr UncheckedArray is pointless when copying chunk of memory
09:53:31FromDiscord<Rika> yes you can directly pass buffer
10:03:42FromDiscord<jseb> ok
10:12:37ForumUpdaterBotNew thread by Konradmb: Accessing object in seq of parent type, see https://forum.nim-lang.org/t/8022
10:14:08*Yinaru[m] joined #nim
10:14:08*Yinaru[m] is now known as ||[m]
10:18:01||[m]any chance someone can make a matrix library for nim please
10:22:50FromDiscord<Rika> matrix as in matrix or Matrix
10:23:23||[m]Matrix
10:34:21FromDiscord<mlokis> Where can i find the nim doc markdown rules
10:36:37leorize[m]it's mostly RST with a sprinkle of markdown
10:36:49leorize[m]i don't think we have a proper reference for it anywhere
10:39:32FromDiscord<exelotl> There's a reference on the forum: https://forum.nim-lang.org/about/rst
10:48:46ForumUpdaterBotNew thread by Inv2004: CPU Benchmark test via Nim-compilation, see https://forum.nim-lang.org/t/8023
10:55:21*arkurious joined #nim
11:00:44*tane joined #nim
11:16:52*sagax quit (Ping timeout: 265 seconds)
11:27:09FromDiscord<willyboar> hm... parsetoml don't work with js
12:15:46*rockcavera joined #nim
12:22:11FromDiscord<ajusa> Are concepts and interfaces the same? Are Nim's concepts compile time, or do they have runtime overhead?
12:29:20FromDiscord<Rika> compiletime
12:29:22FromDiscord<Rika> so not the same
12:38:47*lpirl joined #nim
12:51:38lpirlDear Nim community: how can one get the type of a procedure which is stored as a field of an object (as in ``myProcType = myObjectType.myProcField``)?
12:52:51Oddmongertype(mObjectType.myProcField) doesn't work ?
12:59:52lpirlUnfortunately not. Nim gives "type mismatch: got <type MyObjectType> but expected 'myProcField = proc (…): …'" and my assumption is that ``type(myObjectType.myProcField)`` translates to ``type(myProcField(myObjectType))``. Not sure. myObjectType is declared in another module and the manual states "Within the module x.f is then always
12:59:53lpirlinterpreted as field access and outside the module it is interpreted as an accessor proc call.".
13:00:38FromDiscord<Rika> are you sure the line the error refers to is the same line youre thinking of
13:03:25lpirlHmm yes. Nim points to the dot in its error message (source.nim(x, y)).
13:05:34leorize[m]what are you trying to do?
13:06:14leorize[m]typeof should work no matter if it's rewritten into an accessor or not
13:14:51FromDiscord<zetashift> In reply to @treeform "I have added dashes": Sweeeett!! I've messed around a lot with Pixie for this PR: https://github.com/Vindaar/ginger/pull/28 and with linestyles and dashes I'm almost done 😄
13:19:01lpirlLearning Nim :) Seriously: I created Nim bindings for a C interface specification. This works so far, i.e., C-compatible libraries can be written in Nim. Now, I want add wrappers, so users implementing such libraries don't need to deal with C types but with Nim types only. For this, I want to write an setter of an object field (say
13:19:02lpirl``MyObj.myProc``), so I can wrap ``myProc``. For this, I tried ``proc `myProc=`*(o: var MyObj, v: type(myObj.myProc))`` which gives "type mismatch: got <type MyObj> but expected 'myProc = proc (…"
13:19:38*Arrrrrrrr quit (Ping timeout: 265 seconds)
13:20:33FromDiscord<Rika> what is `myObj`? i thought we were dealing with `MyObj`
13:22:45lpirlTrue, ``MyObj`` and ``typeof`` instead of ``type``. Human errors in translating identifiers.
13:23:15FromDiscord<Rika> okay so thats not the issue
13:23:35FromDiscord<Rika> i think the issue is dot opping a type? but i dont know
13:24:57lpirlMy idea would be to somehow force field access instead of proc calling but I don't know… Thanks for your help, in any case.
13:25:09FromDiscord<Rika> try `o.myProc`
13:25:32FromDiscord<Rika> i dont remember
13:25:35FromDiscord<Rika> i dont know anymore
13:25:37FromDiscord<Rika> xd
13:27:23lpirlthat makes the whole thing an identifier → undeclared identifier "foo.bar"
13:34:24lpirlIt seems to work when the proc type is declared separately (see below, compiles but couldn't run it yet) but I am still confused that one cannot get the type of a proc in an object field.
13:34:24lpirltype
13:34:25lpirl  MyProc = proc …
13:34:25lpirl  MyObj = object
13:34:26lpirl    myProc = MyProc
13:34:26lpirlproc `myProc=`*(o: var MyObj, v: MyProc) =
13:34:27lpirl  …
13:59:45*nerthus quit (Read error: Connection reset by peer)
14:08:59*noeontheend joined #nim
14:21:55*letto quit (Quit: Konversation terminated!)
14:23:46*letto joined #nim
14:49:16*npham[m] joined #nim
14:59:55*Arrrrrrrr joined #nim
15:01:26*noeontheend quit (Ping timeout: 240 seconds)
15:01:39*arecaceae quit (Remote host closed the connection)
15:03:19*arecaceae joined #nim
15:11:39FromGitter<bung87> @willyboar you there? have you check that project I send you/
15:13:41FromGitter<bung87> I've create serveral PRs to karax , when merged we can have good development experience on ssr
15:15:05FromGitter<bung87> go to bed now.
15:16:20*letto quit (Ping timeout: 268 seconds)
15:28:50*letto joined #nim
15:33:58*narimiran_ joined #nim
15:36:56*narimiran quit (Ping timeout: 246 seconds)
16:13:29FromDiscord<ajusa> In reply to @bung87 "I've create serveral PRs": Thank you so much for this bung87, many longstanding bugs have been addressed by you 😄
16:18:17*bluemax[m] joined #nim
16:58:37*aenesidemus joined #nim
16:59:34*lpirl quit (Quit: Connection closed)
17:05:53FromGitter<BracketMaster> Any insight as to what this push pragma does?
17:05:53FromGitter<BracketMaster> https://github.com/nim-lang/sdl2/blob/ed842e0092ab1c45176e95ab35d6d244ef48a509/src/sdl2/joystick.nim#L66
17:06:13FromGitter<BracketMaster> And for context, still having issues getting nimSDL2 to find the dylib on MacOS
17:06:48FromGitter<BracketMaster> Somehow, `dlOpen()` is getting called with a path to `usr/local/lib` when it should be getting `opt/local/lib`
17:07:11FromGitter<BracketMaster> My guess is that Nim is emitting the dlOpen call
17:08:17FromDiscord<zidsal> in a macro is there a way to refer to a static parameter in a quote do? or do I need to turn that static value into a ident node first?
17:13:31*aenesidemus quit (Quit: Leaving)
17:14:17*superbia joined #nim
17:14:22FromGitter<kaushalmodi> @BracketMaster Stuff in push pragma gets auto-added to all pragmas after than push, until you call a pop pragma
17:14:59*superbia quit (Client Quit)
17:15:18FromGitter<kaushalmodi> https://nim-lang.github.io/Nim/manual#pragmas-push-and-pop-pragmas
17:15:33*superbia joined #nim
17:23:27FromDiscord<willyboar> In reply to @bung87 "<@527930042555170833> you there? have": I am watching it. TBH I wasn't planning to use Karax on my ssg (not hotdog)
17:24:55FromDiscord<sin> hi everyone!↵so im using nimgl / imgui but it gives:↵could not load: cimgui.so
17:25:14FromDiscord<sin> and i have installed cimgui
17:26:19FromDiscord<sin> is it cause it installed it too: `/usr/local/cimgui.so`
17:35:41FromGitter<BracketMaster> I'm wondering if it should be in /usr/local/lib/cimgui.so
17:38:51FromGitter<BracketMaster> Also, I really can't find any info on Nim's `dynlib` pragma
17:40:42FromGitter<BracketMaster> So essentially my issue boils down to nim generating a dlOpen pointing to `/usr/local/lib` whilst libraries on my machine reside in `/opt/local/lib`
17:43:11FromGitter<kaushalmodi> @BracketMaster ⏎ ⏎ > Also, I really can't find any info on Nim's `dynlib` pragma ⏎ ⏎ https://nim-lang.github.io/Nim/manual#foreign-function-interface-dynlib-pragma-for-import [https://gitter.im/nim-lang/Nim?at=60abe5afa10461235d98150f]
17:43:50FromGitter<kaushalmodi> Also see this note in there ⏎ ⏎ > A dynlib import can be overridden with the --dynlibOverride:name command-line option. The Compiler User Guide contains further information.
17:44:33FromGitter<kaushalmodi> @BracketMaster Btw are you the same person developing HDL in Nim?
17:45:36FromGitter<BracketMaster> @kaushalmodi yeah
17:45:50FromGitter<BracketMaster> Also - `dynlibOverride` isn't really a good option for sdl2
17:45:59FromGitter<BracketMaster> as sdl2 has roughly 5 differentl libraries
17:46:26FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3nKT
17:46:26FromGitter<BracketMaster> I'm used to running `nim c -r prog.nim` adding 5 `dynlibOverride` isn't really portable
17:47:02FromGitter<BracketMaster> What nim needs is a way to generate dlLoads that go through common paths, sort of how CMAKE can search for dylibs on config
17:48:09FromGitter<BracketMaster> Nim defaulting to emitting `usr/local/lib` for DLLs isn't particularly reasonable as many package managers have their preffered locations
17:48:18FromGitter<kaushalmodi> @BracketMaster I am not very experienced with dynlibs (for imports); the manual reading is all the knowledge I have regarding that. May be add the dynlibOverride switches that work for you, to a config.nims?
17:58:16FromDiscord<zidsal> @exelotl boo, the problem with that, can be seen in the following code https://play.nim-lang.org/#ix=3nKX↵writing the macro explicitly works as `selectType` is static and all cases have been encountered, however doing this in the quote version fails. I can only think that's because by converting it to a literal its now a runtime type?
18:00:21FromGitter<BracketMaster> ok - the config.nims is a good idea
18:02:17FromDiscord<exelotl> @zidsal I don't think the issue is related to `nLit` there. You can't have a case statement with different types at the end of each branch.
18:02:43FromDiscord<zidsal> really, but the firsy example works
18:02:49FromDiscord<zidsal> (edit) "firsy" => "first"
18:03:20FromDiscord<exelotl> yep, because in the first example, the type returned from each branch is `NimNode`
18:03:28FromDiscord<exelotl> (edit) "yep, because in the first example, the type ... returned" added "of value"
18:03:32FromDiscord<zidsal> ah ofc! thanks exeltl
18:03:41FromDiscord<exelotl> np :)
18:05:24*noeontheend joined #nim
18:20:26*noeontheend quit (Ping timeout: 240 seconds)
18:24:50*noeontheend joined #nim
18:28:03ArrrrrrrrEnum autoreordering for nim 4.0 please
18:34:07ForumUpdaterBotNew thread by Mrhdias: How to read GeoLite2 mmdb files?, see https://forum.nim-lang.org/t/8026
18:34:27*Jesin quit (Quit: Leaving)
18:37:37*Jesin joined #nim
18:38:18*sagax joined #nim
19:05:56*noeontheend quit (Ping timeout: 252 seconds)
19:14:12*Arrrrrrrr quit (Quit: Arrrrrrrr)
19:22:49FromDiscord<sh_oe> Anyone know of a recent syntax plugin for neovim for nim?
19:23:40FromDiscord<zetashift> I use https://github.com/alaviss/nim.nvim
19:23:54FromDiscord<zetashift> Might also play around with treesitter oneday
19:24:05FromDiscord<sh_oe> Any major issues with the current version of nim?
19:24:24FromDiscord<zetashift> Not that I know of
19:24:37FromDiscord<zetashift> In reply to @sh_oe "Any major issues with": Do you mean in general or with the plugin?
19:24:55FromDiscord<sh_oe> With the plugin
19:25:08FromDiscord<sh_oe> Sorry
19:25:57FromDiscord<zetashift> Erhm not really, sometimes highlighting stops working when there is an error but that's about it
19:26:54FromDiscord<sh_oe> Alright good enough thanks! Got it working
19:27:37FromDiscord<zetashift> If you're running up against something post here or on the forum, the maker of the nim plugin is an awesome dude and active here (under the name of leorize)
19:28:21FromDiscord<inv> Anyone with M1 here?
19:37:34FromGitter<BracketMaster> Yes
19:37:38FromGitter<BracketMaster> I have M1
19:38:09FromGitter<BracketMaster> Also - NimScript config.nims doesn't seem happy with import fileExists from os: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60ac00a1801b07264e68c31d]
19:38:29FromGitter<BracketMaster> ``config.nims(2, 16) Error: undeclared identifier: 'fileExists'``
19:40:54FromDiscord<willyboar> In reply to @BracketMaster "I have M1": do they worth?
19:41:38FromGitter<BracketMaster> I'm sorry - I don't understand what you're saying
19:42:02FromGitter<BracketMaster> if "do they work" -> "yes? I'm using one to type this message rn"
19:42:23FromGitter<BracketMaster> if "are they worth it" -> "depends. fastest machine I've ever used in my life"
19:42:39FromDiscord<willyboar> second
19:45:19FromDiscord<willyboar> do you have any issues with nim environment?
19:45:32FromGitter<BracketMaster> I'm able to build the nim, nimble, nimgrep, nimpretty, and nimsuggest in 80s
19:45:42FromGitter<BracketMaster> No problems
19:45:48FromGitter<BracketMaster> `brew install nim`
19:45:58FromGitter<BracketMaster> installs in about 15 seconds
19:46:09FromGitter<BracketMaster> plugins including completion work out of the box in VsCode
19:46:35FromGitter<BracketMaster> Although, for some reason, clicking `go to source` for builtins seems to have stopped working this week
19:46:51FromDiscord<willyboar> which model you have?
19:47:09FromGitter<BracketMaster> MacbookPro M1, 8GB, 8cor GPU, 256GB
19:47:13FromGitter<kaushalmodi> @BracketMaster You don't need to import os for fileExists.. there's a nimscript-specific fileExists: https://nim-lang.github.io/Nim/nimscript#fileExists%2Cstring
19:47:27FromGitter<kaushalmodi> Just commenting out line 2 from your snippet will work
19:47:36FromGitter<BracketMaster> thanks!
19:48:36FromGitter<kaushalmodi> @BracketMaster I have been a vocal fan of config.nims. You can find mine here: https://github.com/kaushalmodi/nim_config/blob/master/config.nims
19:49:34FromGitter<BracketMaster> I'm definitely digging nimscript in general
19:49:41FromGitter<kaushalmodi> also `defined` is a compile-time check, so do `when defined(..)` instead of `if ..`
19:49:43FromGitter<BracketMaster> I wonder if nimScript is faster than Ruby
19:50:32FromGitter<BracketMaster> Homebrew is my favorite package manager hands down except for the fact that Ruby is noticeable slow - a general nim based package manager would be cool
19:50:38leorize[m]definitely not
19:51:18FromGitter<BracketMaster> leorize, are you saying nimscript is slower than Ruby?
19:51:26leorize[m]as far as nimvm goes, it's not very fast, and doesn't have a JIT
19:51:39leorize[m]so yes, it's very likely that ruby is faster
19:51:54FromGitter<BracketMaster> some benchmarks are in order
19:52:14FromGitter<BracketMaster> But in general, my experience has been that Ruby is the slowest language ever
19:52:20FromGitter<BracketMaster> So ruby isn't hard to beat
19:52:51leorize[m]I heard ruby 3.0 is supposed to pack quite a punch, haven't read much into it though
19:53:10FromGitter<kaushalmodi> Hello leorize 👋 :)
19:53:22leorize[m]o/ long time no see
19:53:28FromGitter<BracketMaster> https://crystal-lang.org -> supposed to be a static version of Ruby
19:54:12FromGitter<kaushalmodi> leorize: My Nim code is quite stable and didn't need to fiddle with it in a while. But this time, I started learning macros and I got sucked right back in :)
19:54:15FromGitter<kaushalmodi> Macros are fun
19:54:42leorize[m]yes they are :)
20:05:13FromGitter<kaushalmodi> leorize: I had a basic C question for you (again) .. ⏎ ⏎ If I am translating some C code that's doing malloc to construct some array and saving the ptr to that on the C side, in Nim, that would be equivalent to creating a ref obj and saving the ref on the C side and then `GC_ref(that ref obj)`?
20:06:24ForumUpdaterBotNew thread by Kobi: Is there a way to stream json?, see https://forum.nim-lang.org/t/8027
20:06:27FromGitter<kaushalmodi> To add material to that question, here's the C code dealing with `arg_array` : https://github.com/kaushalmodi/nim-systemverilog-vpi/blob/main/get_arg_handle/orig/get_arg_handle_vpi_efficient.c . And here's the Nim code where I have the same args as a seq in an obj: https://github.com/kaushalmodi/nim-systemverilog-vpi/blob/main/common.nim
20:07:20FromGitter<kaushalmodi> I first tried just creating a `var someseq: seq[TYPE]` but I learned that GC_ref doesn't work on base seq vars.. Nim always garbage collected that
20:19:26reversem3what can I use in the stdlib to sort columns in a ascii file and convert to xls?
20:21:39reversem3would i use getFilePos?
20:23:31*uvegbot quit (Ping timeout: 265 seconds)
20:35:23FromDiscord<inv> In reply to @BracketMaster "I have M1": Can you benchmark it? https://github.com/inv2004/bench_nim_build
20:45:18*narimiran_ quit (Ping timeout: 252 seconds)
20:48:12*superbia quit (Ping timeout: 272 seconds)
20:50:32*tane quit (Quit: Leaving)
20:53:07*willyboar quit (Quit: Konversation terminated!)
21:04:32ForumUpdaterBotNew thread by Masiarek2: Add total ratings for all Candidates (STAR Voting) , see https://forum.nim-lang.org/t/8028
21:05:56reversem3so with multiple columns all in ascii would you create a table and put the file into the table?
21:06:14reversem3I suppose that wouldn't work either
21:07:10FromDiscord<zidsal> sent a code paste, see https://play.nim-lang.org/#ix=3nLI
21:07:30FromDiscord<zidsal> (edit) "https://play.nim-lang.org/#ix=3nLI" => "https://play.nim-lang.org/#ix=3nLJ"
21:13:12*Gustavo6046 quit (Remote host closed the connection)
21:14:00*Gustavo6046 joined #nim
21:15:44FromDiscord<zidsal> I think it's to do with the tuple unpacking in for loop as if I manually unpack it, it doesn't error
21:20:59*uvegbot joined #nim
21:24:19*noeontheend joined #nim
21:25:42FromDiscord<Vindaar> So you say the playground example there fails on your machine? If so what Nim version do you have locally?
21:26:37FromDiscord<zidsal> I'm on devel
21:26:37FromDiscord<slymilano> how can I use `ref` as a type field name?
21:26:59FromDiscord<slymilano> https://play.nim-lang.org/#ix=3nLL
21:27:21FromDiscord<zidsal> obv my machine example is slightly more complicated but I've binary chopped it so I know its panicing on the getSubjects proc
21:27:31FromDiscord<zidsal> and those procs are identical
21:30:12*Vladar quit (Remote host closed the connection)
21:40:58FromDiscord<ElegantBeef> @slymilano https://nim-lang.org/docs/manual.html#lexical-analysis-stropping
21:43:21FromDiscord<slymilano> We started out first Nim repo at Papa today! We are building a GitHub bot for on demand deploys to k8s
21:44:40*NimBot joined #nim
21:47:31FromDiscord<ElegantBeef> Congrats, have fun 😄
21:47:40PrestigeNice!
21:48:40FromGitter<BracketMaster> What's Papa?
21:49:21Prestigehttps://www.papa.co/
22:00:52FromGitter<BracketMaster> slymilano: very cool to see Nim in a production capacity!
22:04:26*noeontheend quit (Ping timeout: 240 seconds)
22:13:50FromDiscord<treeform> In reply to @zetashift "Sweeeett!! I've messed around": Based on your PR, would you have feature requests for us or some thing we can make more clear?
22:22:28FromDiscord<ElegantBeef> Why did i have to see pixie, just makes me want to work on my node editor library idea i had 😄
22:23:00FromDiscord<ElegantBeef> Will i ever work on a single project, find out next project
22:27:52*zedeus joined #nim
22:47:20FromGitter<bung87> @ajusa :)
22:49:36FromDiscord<treeform> has any one used https://replit.com/languages/nim ? From https://news.ycombinator.com/item?id=27269292
22:50:15FromDiscord<treeform> In reply to @ElegantBeef "Why did i have": I suffer from the same thing
22:50:37FromDiscord<ElegantBeef> Lol, well i mean i'm going to start working on it cause i wanted it for a puzzle game
22:50:37FromDiscord<dom96> I wonder why they chose Zig as the example
22:50:56FromDiscord<ElegantBeef> So hopefully i can make a very good renderer agnostic node graph editor 😛
22:51:14FromDiscord<treeform> Why renderer agnostic, juse use pixie?
22:51:35FromDiscord<ElegantBeef> Cause i like Nico, Pixie and Raylib
22:51:48FromDiscord<ElegantBeef> So if i can use it in any of them i'll be happy
22:51:49FromGitter<BracketMaster> so imgui is render agnostic and has good node support
22:51:54FromGitter<BracketMaster> as well as nuklear
22:52:01FromGitter<BracketMaster> both have Nim bindings
22:52:09FromDiscord<treeform> In reply to @ElegantBeef "Cause i like Nico,": Only one of these is pure Nim though 🙂
22:52:35FromDiscord<treeform> Oh sorry Nico is pure nim too
22:52:38FromDiscord<dom96> oh, I see, they actually add Zig in there
22:52:42FromDiscord<ElegantBeef> Yea was going to say
22:52:43FromDiscord<dom96> via the shell
22:53:15FromDiscord<ElegantBeef> Calm down guys it's going to be a rather simple abstraction of library draw/input functions, it's not going to be mega complex
22:57:31FromGitter<BracketMaster> ElegantBeef: how will your library work? imgui and nuklear seem to have a good approach that uses triangle rasterization
22:59:27FromDiscord<ElegantBeef> You hook up render functions and then it'll call them when you tell the nodes to render
23:03:15FromDiscord<zetashift> In reply to @treeform "Based on your PR,": Uhm not really, this is the first time ever I tried to work with a graphics library that works at the same level as Pixie (never touched Skia or Cairo) and since the Context API dropped everything has been very nice
23:03:39FromDiscord<zetashift> I did see Layers added recently and was wondering what they exactly are?
23:05:29FromDiscord<treeform> Its mainly for clipping, and operations that might be useful in UIs.
23:05:46FromDiscord<treeform> So for example you have a window you want to stuff to stay inside that window, you can use clip
23:05:59FromDiscord<treeform> but then the clip operation will apply to everything individually - slow
23:06:05FromDiscord<treeform> so you use a layer
23:06:12FromDiscord<zetashift> In reply to @treeform "has any one used": I have used repl it early on, but if you use Linux/Mac Nix is really cool and worth a look. I found replit only a nice way to share quick code snippets
23:06:16FromDiscord<treeform> then just clip the layer as one operation
23:07:24FromDiscord<treeform> another one is you want a transparent window but don't want stuff inside to be transparent with each other.
23:07:28FromDiscord<zetashift> Ah alright, thanks for Pixie tho, the fact that I could make that PR in very little time with very little knowledge speaks volumes about how cool Nim + a coherent graphics library is
23:07:29FromDiscord<treeform> so you use a layer to draw everything
23:07:44FromDiscord<treeform> then draw it with transparency back to the main screen.
23:08:12FromDiscord<zetashift> Ah I see
23:08:38FromGitter<BracketMaster> inv: I added the benchmark
23:08:42FromGitter<BracketMaster> M1 to the top!!
23:08:47FromGitter<BracketMaster> https://github.com/inv2004/bench_nim_build/issues/25
23:17:50*rockcavera quit (Remote host closed the connection)
23:19:34*astronavt quit (Quit: ...)
23:19:52*astronavt joined #nim
23:21:26*arecaceae quit (Ping timeout: 240 seconds)
23:22:41*arecaceae joined #nim
23:23:43*arkurious quit (Quit: Leaving)
23:30:28FromDiscord<gavr> In reply to @BracketMaster "M1 to the top!!": can you share console screenshot?
23:31:02FromGitter<BracketMaster> yes, i'll run it again - already deleted it
23:31:06FromGitter<BracketMaster> gimme a couple mins
23:34:12FromGitter<BracketMaster> (https://files.gitter.im/5602f03e0fc9f982beb19f61/lAkV/image.png)
23:34:14FromGitter<BracketMaster> (https://files.gitter.im/5602f03e0fc9f982beb19f61/9naV/image.png)
23:34:16FromGitter<BracketMaster> done
23:34:29FromDiscord<gavr> thanks
23:34:36FromGitter<BracketMaster> sure!
23:34:38FromGitter<BracketMaster> why do you ask?
23:34:59FromDiscord<gavr> looks unbelievable, and why other M1 bench so much slower
23:35:06*noeontheend joined #nim
23:36:49FromGitter<BracketMaster> All the M1 benchmarks I've seen are really fast
23:36:54FromGitter<BracketMaster> M! is unbelievably fast
23:36:59FromGitter<BracketMaster> **M1
23:37:15FromGitter<BracketMaster> After using M1 computers, I literally don't think I can go back to intel machines
23:37:41FromGitter<BracketMaster> Everything is instantaneous
23:38:14FromDiscord<gavr> Heh yea
23:38:25FromDiscord<gavr> btw my is Ryzen 1600 there
23:39:37FromGitter<BracketMaster> You may have seen slow M1 benchmarks if people were using intel mode
23:39:57FromGitter<BracketMaster> The only app that I run in intel mode is GTKWave
23:41:02FromGitter<BracketMaster> And JVM - sometime ARM JVM spawns intel child processes inconsistenly
23:47:54*rockcavera joined #nim
23:51:52FromDiscord<ElegantBeef> @treeform what's the function to figure out how much horizontal space a string will take up in pixie?
23:52:53FromDiscord<treeform> if you are using new context is measure text
23:52:59FromDiscord<treeform> (edit) "measure text" => "ctx.measureText"
23:53:02FromDiscord<ElegantBeef> Ok
23:53:39FromDiscord<treeform> https://nimdocs.com/treeform/pixie/pixie/context.html#measureText%2CContext%2Cstring
23:54:11FromDiscord<treeform> That aims to mimic Canvas/Cairo API
23:54:18FromDiscord<treeform> you can also use computeBounds: https://nimdocs.com/treeform/pixie/pixie/fonts.html#computeBounds%2CFont%2Cstring
23:54:23PrestigeIs newContext not in 2.0.0?
23:54:34FromDiscord<ElegantBeef> It seemed like it was not
23:54:41FromDiscord<treeform> No its only in devel right now
23:54:47PrestigeKk
23:55:32FromDiscord<Hi02Hi> In reply to @treeform "has any one used": i use it, did you have a question or sth?
23:55:41FromDiscord<dom96> @treeform curious: have you run any rendering benchmarks for pixie (or better yet, typography) against other libraries?
23:56:32FromGitter<BracketMaster> @kaushalmodi : https://github.com/kaushalmodi/nim-systemverilog-dpic
23:56:36FromGitter<BracketMaster> so you're a hardware guy?
23:57:49FromDiscord<ElegantBeef> Pixie is bottom left 0,0 right?
23:58:05FromGitter<BracketMaster> Rust has Rustaceans, does Nim have Nimmers?
23:58:18FromDiscord<dom96> Nimians/Nimsters
23:58:30FromDiscord<dom96> we should probably have a vote eventually about which one we use
23:58:44FromGitter<BracketMaster> Nimster is clearly better