<< 25-04-2020 >>

00:00:53*ftsf joined #nim
00:07:13FromGitter<jason_koch_twitter> nim-fswatch
00:07:17FromGitter<jason_koch_twitter> lol oops
00:13:57*xet7 joined #nim
00:41:03*dchem quit (Quit: WeeChat 2.4)
00:48:55*abm joined #nim
00:53:28*rockcavera quit (Remote host closed the connection)
00:59:42*revere quit (Ping timeout: 256 seconds)
01:04:06*revere joined #nim
01:04:07*fredrik92 quit (Ping timeout: 260 seconds)
01:12:05*zacharycarter joined #nim
01:12:28FromDiscord_<Varriount> rayman22201: So I was looking over the Rust article on async procedures
01:13:00FromDiscord_<Varriount> They actually do something quite similar to Nim, just with more optimizations.
01:13:26rayman22201no. It's fairly different.
01:13:33rayman22201yes, they do more optimizations
01:13:55rayman22201but the fundamental idea is different.
01:14:21zacharycarterI'm using kakoune + nimlsp but jump to definition doesn't seem to be working at all
01:15:05FromDiscord_<Varriount> rayman22201: The whole state machine thing is just another optimization. The Nim compiler could do it with closure procedures and iterators.
01:15:34rayman22201Yes, the nim compiler can do it. No it's not just another optimization.
01:15:56rayman22201It's run-time dispatch vs. compile time dispatch
01:16:08rayman22201like comparing templates to interfaces
01:16:13rayman22201in C++
01:16:20FromDiscord_<Varriount> I don't follow. Which one is doing the compile time dispatch?
01:16:26rayman22201the state machine
01:16:31rayman22201the rust thing
01:16:47rayman22201I'm going to try and draw a crappy picture lol.
01:17:58FromDiscord_<Varriount> From what I can tell, the current async machinery uses static dispatch. Yes, it makes liberal use of procedure pointers, however it still creates a future via static dispatch.
01:19:26FromDiscord_<Varriount> The biggest difference I can see is one of organization. Nim's async system seems to involve passing closures down the stack into the event loop. From what I can tell, Rust doesn't do that, it just calls the "root" closure, which calls the next, and the next, etc.
01:19:32rayman22201Nim allocates a new Future every time await is called.
01:19:35rayman22201at run time
01:19:45rayman22201and a new future callback
01:20:02FromDiscord_<Varriount> Yes. That's not compile time or static dispatch. That's heap vs stack allocation.
01:20:23rayman22201Yes. I applogize. It was meant as an analogy. Not a direct comparison
01:20:43rayman22201heap vs. stack is the correct distinction. You are correct.
01:20:50FromDiscord_<Varriount> Unfortunately, I can't think of an easy way to do that in Nim, as there's not a good way at getting the type of a closure environment.
01:20:57*opal joined #nim
01:21:06rayman22201Araq and I have a way. I can do it. I just don't have time
01:21:13FromDiscord_<Varriount> You could probably use cast and a bunch of other hacks though.
01:21:47FromDiscord_<Varriount> I apologize if I'm coming off as a bit abrupt. It's been a long week.
01:22:19rayman22201The heap vs. stack is a huge optimization though. It's worth doing. It has fundamentally different (better) characteristics, in terms of memory, runtime, and lifetime managment.
01:22:22rayman22201no worries :-)
01:22:34rayman22201hard to explain this stuff over text also
01:22:38FromDiscord_<Varriount> I agree.
01:22:55FromDiscord_<Varriount> I'm on Mumble, though disruptek seems to be silent.
01:23:40rayman22201lol. I can get on, but only for a bit :-)
01:26:46*dchem joined #nim
01:26:53*dchem quit (Client Quit)
01:27:24*dchem joined #nim
01:27:39*arecaceae quit (Remote host closed the connection)
01:28:26*arecaceae joined #nim
01:34:26zacharycarterif I'm using `--gc:arc` with `--threads:on` and I create a ref object, is it allocated on a thread-local help or a shared heap by default?
01:34:44disruptekshared.
01:34:58zacharycarterthanks
01:35:21disruptekbasically, it's happy with a thread accessing it if the whole subgraph can move.
01:35:31zacharycartergotcha
01:35:51FromDiscord_<Elegant Beef> So why in some cases does generating procs inside a for loop make it so only the last iterated value get's passed to the procs?
01:36:12disruptekwhat value do you think they should have?
01:36:13FromDiscord_<Elegant Beef> ` var keyConf = newKeyConfig(keycode.cuint, Mod4Mask,proc() = goToWorkspace(actualNum))`
01:36:13FromDiscord_<Elegant Beef> This line for instance
01:36:25FromDiscord_<Elegant Beef> it only calls the last iterated value IE 8 in this case
01:37:05FromDiscord_<Elegant Beef> actual num is an immutable value declared at the for loop level
01:37:25FromDiscord_<Elegant Beef> for loop child level*
01:37:50FromDiscord_<Elegant Beef> Full loop here
01:37:50FromDiscord_<Elegant Beef> https://hatebin.com/eawrmrsdpc
01:40:50*rockcavera joined #nim
01:41:48FromDiscord_<codic> Nim in action is an amazing book!
01:42:01FromDiscord_<codic> Props to whoever made it
01:42:08FromDiscord_<codic> Props to whoever wrote it
01:42:17FromDiscord_<codic> A very good beginner resource
01:42:57leorize[m]@Elegant Beef use sugar.capture
01:43:10FromDiscord_<codic> So is https://narimiran.github.io/nim-basics/, and of course the original nim docs
01:47:48dchemhi does anyone know whether nim-chronos has something similar to addQuitProc (like in asyncdispatch)? Or does one use addSignal proc for SIGTERM handler?
01:49:25*abm quit (Read error: Connection reset by peer)
01:51:20rayman22201@Varriount: one last thing. The chronos impl: https://github.com/status-im/nim-chronos/pull/45
01:51:21disbot[WIP]: AsyncChannels[T].
01:51:27rayman22201ok. dinner. bye :-)
01:53:41*voltist joined #nim
01:54:58voltistAny ideas as to why the jsffi example (https://nim-lang.org/docs/jsffi.html) is throwing the error `Error: invalid extern name: '$(#)'.`?
01:54:59*chemist69_ joined #nim
01:55:41codicHey, example on https://nimyaml.org/ ues an object, would using a table also work for this purpose?
01:55:45codic * Hey, example on https://nimyaml.org/ uses an object, would using a table also work for this purpose?
01:56:12codic(double message because matrix edits transfer to irc reposts beginning with a star)
01:57:59*chemist69 quit (Ping timeout: 265 seconds)
02:05:19dchemvoltist, try this: {.importcpp: "$$(#)".}
02:06:38dchemHere's more doc for escape characters for js interop: https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#javascript-interoperability
02:06:54voltistdchem: That works, thanks. Do you also happen to know why my compiled JS doesn't contain any of the procs I defined?
02:08:03dchemvoltist, not sure
02:08:49voltistOk. It's a weird issue...
02:10:38dchemvoltist, I mean the example says jQuery, but I'm not seeing where they're importing the jquery stuff
02:11:40voltistIt's the `proc jq(selector: JsObject): JsObject {.importcpp: "$(#)".}`
02:12:50dchemno I mean I get that, but how is jquery source being pulled in?
02:13:16dchemor is it just making a delegate call
02:13:35voltistI have no idea
02:13:36dchemI guess it's assuming jquery is loaded already?
02:13:45*muffindrake quit (Ping timeout: 272 seconds)
02:14:59voltistMy problem now is that despite defining a proc in my nim, the output JS is just a few lines of header code without any functions
02:15:11dchemh
02:15:13dchemah
02:15:57*muffindrake joined #nim
02:17:07dchemwell
02:17:24dchemvoltist, the js ffi is to use js library from within nim executible, isn't it?
02:18:35dchemvoltist, what are you trying to do? compile the nim code into js or use js library in nim?
02:20:04voltistThis isn't a problem with jsffi, it's just that the Nim compiler (with the JS target) isn't generating the needed code
02:23:09voltistAh I've solved it
02:23:17voltistForgot to include {.exportc.} :/
02:23:55*disruptek is now known as asd
02:25:58dchemAh, ok, that will do it :D
02:26:07*asd is now known as disruptek
02:26:17shashlick@voltist hey buddy, finally figured out a reliable way to wrap openssl
02:27:03voltistshashlick: Neat!
02:27:18voltistSomething quicker and easier than the rig we had going?
02:27:35shashlickhttps://github.com/nimterop/nimterop/blob/master/tests/rsa.nim
02:28:37shashlickI've not yet figured out a way to update nimssl since there's no sensible way to import all headers, takes a while to wrap it
02:29:02shashlickRendered output is several tens of thousands of lines
02:29:53voltistHave you implemented that recursive header import thing in nimterop, or just figured out how to do without it?
02:30:45shashlickNope not doing that
02:31:16shashlickBut this way, if you specify five headers that should be imported, they get processed and duplicates get eliminated
02:31:25shashlickIncluding with recursion
02:31:40shashlickUnlike multiple cimport calls
02:31:50voltistAh cool
02:32:25shashlickNo need to include in any particular order
02:34:53voltistI see
02:35:16voltistSounds good
02:35:25FromDiscord_<Elegant Beef> Also sorry leorize didnt say thanks 😄
02:38:04shashlickon the flip side though, cannot create an rsa.nim, pem.nim, abc.nim and what not and import them separately since we end up with duplicates again
02:38:09shashlickso unclear what to do with nimssl
02:38:28*waleee-cl quit (Quit: Connection closed for inactivity)
02:39:28*madpata_ joined #nim
02:43:03*madpata quit (Ping timeout: 260 seconds)
02:50:11*zacharycarter quit (Ping timeout: 265 seconds)
02:51:23*leorize quit (Ping timeout: 240 seconds)
02:54:51*leorize joined #nim
02:55:13FromDiscord_<Zed> What cool things have you guys made with nim?
02:56:39dchemvoltist, for what it's worth: https://github.com/nim-lang/Nim/pull/14111
02:56:40disbotFixes #14110
02:56:55voltistNice one
02:57:30FromDiscord_<Elegant Beef> Zed, im currently working on a tiling window manager using nim
02:58:03voltistElegant Beef, woah!
02:58:05dchemZed, I'm using nim for cryptoassets exchange - orderbook management and matching engine
02:58:23FromDiscord_<Elegant Beef> What voltist?
02:58:31FromDiscord_<Elegant Beef> It's using xlib so not amazing but nearly "done"
02:58:31FromDiscord_<Zed> Those both sound insanely cool
02:59:20voltistWell I love Nim and I love tiling window managers, so it's right up my alley
03:00:13FromDiscord_<Elegant Beef> Nice, the code is currently astray, but here <https://github.com/beef331/goodwm>
03:00:38FromDiscord_<Elegant Beef> It uses imgui for the status bar, so it's silly as hell
03:28:29*voltist quit (Quit: Leaving)
03:45:51*zacharycarter joined #nim
03:52:09*hax-scramper quit (Ping timeout: 250 seconds)
03:54:26PrestigeAre there any details about how nim handles moving elements in a sequence? I'm curious about efficiency
03:54:57disruptekseqs involves a lot of movement and efficiency has never been a goal.
03:55:23disruptekdetails are probably inappropriate for this channel.
03:56:10PrestigeMaybe I should just dig through the source to find out how it's handled
03:57:02disruptekif you can keep your seq to a fixed size, you don't have to worry about performance.
03:57:25Prestigehm okay, it will be fixed at least when I'm wanting to reorder elements
03:57:39disrupteksorting is fast.
03:59:04zacharycarterso if I'm using `--gc:arc` with `--threads:on` since ref objects are allocated on the shared heap - shouldn't I be able to pass them between threads?
04:00:37zacharycarterah okay - I can, but I think as you said disruptek, the subgraph needs to be able to be moved as well
04:00:46zacharycarterand if the ref object as a member property that is a sequence this doesn't work
04:02:05disruptekmy understanding is that as long as the graph is distinct, you can move the whole thing.
04:02:42zacharycarterhmm
04:04:43zacharycarterhttps://play.nim-lang.org/#ix=2jrv - works but https://play.nim-lang.org/#ix=2jru does not
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:42*supakeen joined #nim
04:07:21disruptekyeah; you cannot share the graph between threads.
04:07:29skrylar[m]https://ourmachinery.com/post/dll-hot-reloading-in-theory-and-practice/ cute
04:08:19zacharycarterah okay I need to move it gotcha
04:10:01disruptekthere are tricks and stuff, but yeah.
04:14:26*Hexeratops quit (Remote host closed the connection)
04:33:03*hax-scramper joined #nim
04:35:54*Gabriella joined #nim
04:38:04*dddddd quit (Ping timeout: 258 seconds)
04:38:15*Gabriella quit (Client Quit)
04:46:05*nsf joined #nim
05:15:34*zacharycarter quit (Ping timeout: 240 seconds)
05:21:34*silvernode joined #nim
05:31:32*silvernode quit (Ping timeout: 256 seconds)
06:19:43*rockcavera quit (Remote host closed the connection)
06:25:09FromGitter<bung87> @Araq I added ci https://travis-ci.org/github/bung87/htmlparser , I can sleep now
06:31:25*solitudesf joined #nim
06:51:10*xcm is now known as Guest12832
06:51:10*Guest12832 quit (Killed (weber.freenode.net (Nickname regained by services)))
06:51:55PrestigeElegant Beef: did you have any issues with input events not working on window? Seems like I'm not getting key events
06:52:45*chemist69_ quit (Ping timeout: 240 seconds)
06:53:00*xcm joined #nim
06:53:08*chemist69 joined #nim
06:56:30PrestigeLooks like you call XSetInputFocus on any window that gets input events, didn't know that was necessary
07:00:00*gmpreussner quit (Quit: kthxbye)
07:02:49*narimiran joined #nim
07:05:05*gmpreussner joined #nim
07:06:49FromDiscord_<Varriount> Araq: Does Nim do any sort of escape analysis on closures and closure iterators?
07:07:08FromDiscord_<Varriount> So that it can allocate their environments on the stack, rather than on the heap?
07:12:55*oculux joined #nim
07:27:51FromDiscord_<Elegant Beef> Yea my selection right now is iffy, my XWarpPointer borked and some other things
07:28:01FromDiscord_<Elegant Beef> but generally i just use OnEnterEvents to figure out what to focus
07:32:55PrestigeI think I just need XGrabKey explicitly instead of adding an eventMask for KeyPress events on the parent window
07:32:59PrestigeGoing to give that a shot tomorrow
07:33:24FromDiscord_<Elegant Beef> Yea XGrabKey will grab any key aslong as you also look for the event
07:33:31FromDiscord_<Elegant Beef> well anykey you specify
07:35:03PrestigeFor some reason I thought just adding the KeyPress mask to the window's parent frame would work, but it doesn't :P so I'll get that fixed up tomorrow
07:35:28FromDiscord_<Elegant Beef> From my understanding XGrabKey intercepts key strokes before they go out to applications
07:35:33PrestigeIs goodwm going to be workspace-based or tag-based?
07:35:41FromDiscord_<Elegant Beef> Huh?
07:36:12Prestigea lot of WMs use workspaces but some use tags (I'll be using tags, gives the user a little more power)
07:36:18FromDiscord_<Elegant Beef> I plan on having support for classes/names to move them automaticaly to specific work spaces, if that's what you mean
07:36:31Prestigeah okay
07:36:44FromDiscord_<Elegant Beef> The workplaces can have any name, just each monitor has 9
07:36:52FromDiscord_<Elegant Beef> which can change if i refine the workspaces
07:37:35FromDiscord_<Elegant Beef> I do like the idea of using Mod4+number to iterate over that monitors workspaces
07:37:37PrestigeTags are interesting, windows can have multiple tags assigned to them (sort of like displaying a window on multiple workspaces)
07:37:48Prestigethen you can decide to display 1 or more tags at a time
07:37:56FromDiscord_<Elegant Beef> Ah so like awesomewm has?
07:37:59FromDiscord_<Elegant Beef> I dont really like that
07:38:01PrestigeYeah, and dwm
07:38:24FromDiscord_<Elegant Beef> The one thing i really liked about awesomewm is the predefined layouts which i've implemented
07:38:41FromDiscord_<Elegant Beef> Do need to make a main/stacked, but i got the one i really like which is alternating splits
07:39:06PrestigeI only ever use one layout and fullscreen, but I'm planning on creating a way for users to define their own layouts in a config file that the WM can handle
07:39:26FromDiscord_<Elegant Beef> One think that really annoys me with awesomewm is that in the spiral config, the new window goes at the bottom of the stack instead of top
07:39:28FromDiscord_<Elegant Beef> thong*
07:39:37FromDiscord_<Elegant Beef> thing**
07:39:39Prestigehehe
07:39:42FromDiscord_<Elegant Beef> God damn i cant spell
07:39:56Prestigefinger betrayal
07:40:28PrestigeI'm going to have a dir for layouts, and a file for each layout. Let the user decide if windows are spawned at the top or bottom of the stack, etc
07:41:11FromDiscord_<Elegant Beef> Im very much a person that likes the strict mathematical layouts
07:41:35FromDiscord_<Elegant Beef> I dislike spiral, but am using it in awesomewm at the moment
07:41:35Prestigeoh I noticed something in your wm, I think this XMapWindow call isn't needed: https://github.com/beef331/goodwm/blob/master/goodwm.nim#L554
07:42:11PrestigeThe docs say XReparentWindow will call XMapWindow on the child
07:42:15Prestigeiirc
07:43:12FromDiscord_<Elegant Beef> Well it seems like it is
07:45:03FromDiscord_<Elegant Beef> Do you have any clue why my XWarpPointer isnt moving the mouse anymore?
07:46:10PrestigeHm are you sure it's being invoked still?
07:46:14FromDiscord_<Elegant Beef> Yea
07:46:25FromDiscord_<Elegant Beef> Certainly is just doesnt want to move
07:46:57PrestigeLol, not sure I'd have to check it out. So long as it's being called and avtiveWindow().rawWindow is valid (and the expected window), I'm not sure
07:49:14PrestigeactiveWindow().rawWindow* I also can't type
07:49:17FromDiscord_<Elegant Beef> Yea, it wildly just stopped moving my cursor today
07:49:22FromDiscord_<Elegant Beef> Yea i knew what you meant
07:50:04Prestigeprobably requires some actual debugging
07:50:17FromDiscord_<Elegant Beef> *Actual debuggin* Heh
07:50:52FromDiscord_<Benumbed> Is there a way to make a custom constructor for a new type I've defined? AKA I'd like doing `var shrtStr:ShortString = "some string here"` to check if the incoming string is 255 characters or less
07:51:39FromDiscord_<Benumbed> I know the 'standard' is `newShortString` but I'm very meh about that, and a custom constructor would be cleaner
07:51:51FromDiscord_<mratsim> there is no constructor
07:52:01FromDiscord_<Elegant Beef> could write a converter
07:52:16FromDiscord_<mratsim> I don't remember the rationale but it had some composability issue
07:52:39FromDiscord_<Benumbed> 🤔 Wait I could write a custom assignment operator for that type
07:52:51FromDiscord_<Benumbed> I just wasn't thinking creatively enough
07:53:01FromDiscord_<Elegant Beef> Also prestiege have you figured out how to check if a window wants to go fullscreen?
07:53:51Prestigenah not there yet, sorry
07:54:23FromDiscord_<Elegant Beef> Also hopefully my wm actually helps and isnt just a poorly coded mess
07:55:04PrestigeIt helps to see how xlib is supposed to be interacted with, thanks :)
07:55:16FromDiscord_<Elegant Beef> You say supposed to, but i dont know if that's true
07:55:34FromDiscord_<Elegant Beef> Im doing the exact same thing i do anything, attempt what makes sense and see what happens, then go from there
07:57:04PrestigeYou're further along than my WM but you I'm tracking my progress on github via issues if you wanted to see
07:57:45Prestigeissues/milestones
07:58:39*dchem quit (Quit: WeeChat 2.4)
07:59:35FromDiscord_<Elegant Beef> Yea this is a pain
07:59:46FromDiscord_<Elegant Beef> I makes 0 sense, no errors and it just doesnt work 😄
08:01:09FromDiscord_<Elegant Beef> I really prefer hard crashes over non-compliant code
08:07:46*martinium quit (Ping timeout: 260 seconds)
08:12:16*lritter joined #nim
08:15:22*natrys joined #nim
08:42:57*fredrik92 joined #nim
08:49:45FromDiscord_<Elegant Beef> So i feel dumb, apparently inside xephyr mouse movement doesnt work
08:49:59FromDiscord_<Elegant Beef> So that was an hour of my time wasted
08:50:50PrestigeReally? That's weird
08:54:08FromDiscord_<Elegant Beef> Yep
09:02:06FromGitter<awr1> @Benumed you probably want a generalized raw str literal
09:02:07FromGitter<awr1> https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals
09:02:18FromGitter<awr1> @Benumbed
09:04:15FromGitter<awr1> custom assignment operator is kinda....idk
09:04:17FromGitter<awr1> i wouldn't do it
09:05:35FromGitter<awr1> in any case i've grown accustomed to nim's generalized philosophy of "all ctors are explicit"
09:07:15FromDiscord_<Rika> @Benumbed you can just change the name and do `var shrtStr = ss"some string here"` given the name of the proc was `ss`
09:07:20skrylar[m]so i found out the convoluted nightmare that powers armorpaints hot reloading
09:07:30FromDiscord_<Rika> ?
09:07:39skrylar[m]they have some runtime written in haxe-ish that in turn loads a javascript vm and then the application code is haxe compiled to javascript which they then swap the javascript :headbandage:
09:09:08FromDiscord_<Rika> what
09:09:16FromDiscord_<Rika> thats nightmarish
09:11:14skrylar[m]i still haven't tested nim hcr on windoze
09:11:28FromDiscord_<Rika> windoze zzzzzz
09:11:43PrestigeBeef: are you trying fullscreen outside of xephyr btw?
09:11:45skrylar[m]v hcr doesnot work
09:12:05PrestigeWhen I start up my hotkey daemon inside of xephyr I get an error: Could not resolve keysym XF86FullScreen
09:15:10skrylar[m]write your compiler in ocaml to compile to javascript to run on a jit vm :dies:
09:26:51*kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in)
09:27:09*kitech1 joined #nim
09:32:04*Vladar joined #nim
09:45:40*dddddd joined #nim
09:46:56*xet7 quit (Quit: Leaving)
09:48:35*arecaceae quit (Remote host closed the connection)
09:48:44*xet7 joined #nim
09:48:54*arecaceae joined #nim
09:49:58*madpata_ quit (Ping timeout: 260 seconds)
10:38:48*NimBot joined #nim
11:11:29FromGitter<Bennyelg> Hi, I created a tiny API using Jester, and I want to add swagger to it, do we have anything ?
11:18:39*Guest28090 quit (Ping timeout: 265 seconds)
11:20:09*dadada joined #nim
11:20:32*dadada is now known as Guest96344
11:23:20FromDiscord_<flywind> No. Maybe just write docs in the json form and render it using swagger or redocs.
11:40:46*krux02 joined #nim
11:41:42FromGitter<Bennyelg> Thanks
11:42:36FromGitter<Bennyelg> Another question: ⏎ What is the best practice of validating apiKey ? ⏎ for every endpoint I should check again ? something like: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ea4222bf6a6e539797698a8]
11:43:41skrylar[m]i would imagine so, unless you have a proxy which does it for you
11:44:35FromGitter<Bennyelg> ok, if proxy is best practice, I'll try to implement it
11:44:36skrylar[m]some of the newer "service mesh" stuff does have micro proxies that checks keys/cookies and then hands vlaid reuests downstream to microservices
11:44:52FromGitter<Bennyelg> any example somewhere?
11:46:32skrylar[m]i dont know of a perfect one off the top of my head. might look in to lemonldap or authy or lasso since they are based on getting nginx or apache to route stuff to the authenticator before letting the calls through
11:47:02FromGitter<Bennyelg> thanks
11:49:26*natrys quit (Ping timeout: 256 seconds)
11:49:34FromDiscord_<flywind> use hooks maybe, https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/tests/alltest.nim#L172
11:49:54*natrys joined #nim
11:57:45*madpata joined #nim
11:58:41madpataI can't compile programs using the ncurses module (info: https://pastebin.com/vck4v977). Anyone else have that problem and maybe a solution?
12:00:33dom96looks like the package is broken, maybe trying to type cast a large int to an int that cannot fit it?
12:01:29madpatayeah, that seems to be the problem. Sadly not the only problem with the package as its .nimble file is malformed, too.
12:05:08madpataAny suggestions for creating text mode applications in nim? (keeping in mind that the standard ncurses doesn't work)
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:47*supakeen joined #nim
12:08:55solitudesf!repo illwill
12:08:57disbothttps://github.com/johnnovak/illwill -- 9illwill: 11 15 99⭐ 9🍴 & 1 more...
12:11:27dom96madpata, I created this a while back, it uses nimbox, maybe you can use it too: https://github.com/dom96/deauther
12:39:11FromDiscord_<Recruit_main707> generics cant know their type based on the expected one in their implementation?
12:50:18*fredrik92 is now known as couven92
12:54:00FromGitter<Bennyelg> > *<FromDiscord_>* <flywind> use hooks maybe, https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/tests/alltest.nim#L172 ⏎ ⏎ This is wonderful, thanks
12:54:53FromDiscord_<flywind> no problem.
13:06:39*xcm quit (Remote host closed the connection)
13:08:54*xcm joined #nim
13:08:56FromDiscord_<Technicae Circuit> https://dev.to/juancarlospaco/ode-to-nimpy-4753
13:09:04FromDiscord_<Technicae Circuit> Proves that Nim is best lang
13:11:07*liblq-dev joined #nim
13:11:29*lritter quit (Read error: Connection reset by peer)
13:15:53FromGitter<sheerluck> +1
13:16:59FromDiscord_<Recruit_main707> specifying a generic parameter makes this code dont work: `t.Get[uoffset](t.Pos)`
13:17:15FromDiscord_<Recruit_main707> is this a bug?
13:17:26FromDiscord_<Rika> how would we know w/o the rest of the code tho
13:18:02FromDiscord_<Recruit_main707> the error message is about type mismatch
13:18:30FromDiscord_<Recruit_main707> this is the error message: https://play.nim-lang.org/#ix=2juj
13:19:18FromDiscord_<Rika> its right there
13:19:22FromDiscord_<Rika> the error is right there
13:19:50FromDiscord_<Rika> youre either missing the Vtable or the Offsets
13:20:16FromDiscord_<Recruit_main707> but they are both there
13:20:58FromDiscord_<Rika> no they are not
13:21:13FromDiscord_<Rika> you only have one parameter
13:21:33FromDiscord_<Recruit_main707> t.Get[uoffset](t.Pos)
13:21:33FromDiscord_<Recruit_main707> ^ ^
13:21:40FromDiscord_<Rika> ah, misread
13:21:50*madpata quit (Ping timeout: 260 seconds)
13:21:50FromDiscord_<Rika> ah
13:21:52FromDiscord_<Rika> i know now
13:21:57FromDiscord_<Rika> `t.Get[:uoffset](t.Pos)`
13:21:59FromDiscord_<Rika> do that
13:23:23FromDiscord_<Rika> how it's resolved:
13:23:23FromDiscord_<Rika> ```
13:23:23FromDiscord_<Rika> t.Get[uoffset](t.Pos)
13:23:23FromDiscord_<Rika> { } is the proc
13:23:23FromDiscord_<Rika> { } is the proc `[]` w/ argument uoffset
13:23:24FromDiscord_<Rika> { } runs whatever is given "as a proc if it could" with t.Pos as argument
13:23:25FromDiscord_<Rika> ```
13:23:46FromDiscord_<Rika> @Recruit_main707 ^
13:24:04FromDiscord_<Recruit_main707> i see, thanks
13:38:13*PMunch joined #nim
13:38:52FromDiscord_<flywind> https://dev.to/xflywind/write-a-simple-web-framework-in-nim-language-from-scratch-ma0
13:46:14PMunchCool article flywind :)
13:49:08FromDiscord_<flywind> thanks.
13:53:32*madpata joined #nim
14:01:58FromDiscord_<Recruit_main707> i will have a look at it, it looks promising
14:03:26FromDiscord_<Recruit_main707> leorize: yesterday you said `cast[T](b)` was wrong, but what about `cast[ptr T](b)[]`?
14:06:01FromDiscord_<Recruit_main707> i am having a look at this thread btw https://forum.nim-lang.org/t/2626
14:06:46FromDiscord_<Recruit_main707> which also shows bit shifting is the slowest also
14:06:48*hax-scramper quit (Ping timeout: 256 seconds)
14:06:51*waleee-cl joined #nim
14:07:32*hax-scramper joined #nim
14:12:03FromDiscord_<codic> Hey, I was thinking of using nimpy to write a module, It's gonna be using https://nimyaml.org/ and nim's json library. Here's the problem: Nim types (like tables) are NOT python types (like dicts). Will the types auto transfer?
14:12:54FromDiscord_<Recruit_main707> nim types are converted to python dictionaries iirc
14:14:10FromDiscord_<Technicae Circuit> @codic nimpy auto converts between types iirc
14:14:22FromDiscord_<Technicae Circuit> That's what it does with strings and ints at least
14:14:35FromDiscord_<Technicae Circuit> And arrays
14:15:20PMunch@codic, according to the tests it seems to convert them: https://github.com/yglukhov/nimpy/blob/master/tests/nimfrompy.nim#L51 and calling that from Python https://github.com/yglukhov/nimpy/blob/master/tests/tnimfrompy.py#L64
14:17:12FromDiscord_<Recruit_main707> i maintain my point, nim types will work as dictionaries in python, which works well if you are not planning on using them as classes in python, and more like data structures.
14:17:59*kenran joined #nim
14:18:17*kenran quit (Client Quit)
14:19:09FromDiscord_<codic> Oh, great that's amazing!
14:19:30FromDiscord_<codic> Also, assuming I have this function, why does discord highlight it wrong?
14:19:30FromDiscord_<codic> ```nim
14:19:30FromDiscord_<codic> proc thing(a: int): string {.cdecl, exportc} =
14:19:31FromDiscord_<codic> if a == 1:
14:19:31FromDiscord_<codic> return "NO U"
14:19:31FromDiscord_<codic> else:
14:19:31FromDiscord_<codic> return "NO ME"
14:19:33FromDiscord_<codic> ```
14:19:50FromDiscord_<codic> But if I use a period after exportc, it highlights right
14:19:53PMunchPlease don't paste code into discord
14:20:02FromDiscord_<codic> i'm using a modified version of the example on http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html
14:20:02FromDiscord_<codic> Alright ,sorry
14:20:02FromDiscord_<Recruit_main707> try not to paste code in here, its a pain for irc users, use https://play.nim-lang.org/
14:20:20FromDiscord_<codic> Huh, play.nim-lang.org highlights it right
14:20:23FromDiscord_<codic> That's... strange
14:20:27FromDiscord_<Rika> @codic likely the syntax highlighter doesnt know that both syntaxes are valid
14:20:28FromDiscord_<Recruit_main707> you are missing a dot
14:20:37FromDiscord_<Rika> its not required to have the last dot]
14:20:41FromDiscord_<codic> The example at http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html doesn't show it
14:20:43FromDiscord_<Recruit_main707> ah
14:20:46PMunchIt isn't?
14:20:47FromDiscord_<codic> Ah, so it's not an issue with my ode?
14:20:49FromDiscord_<codic> Ah, so it's not an issue with my code?
14:20:49FromDiscord_<Rika> no its not
14:20:52FromDiscord_<codic> ah
14:20:54FromDiscord_<codic> okay, thanks
14:21:06PMunchOh, and try not to edit your messages either
14:21:11FromDiscord_<Rika> try running it, it'll work both ways
14:21:32PMunchIt sends a duplicate (yes the Discord bridge is stupid, yes we're planning on fixing that)
14:21:36FromDiscord_<codic> Alright, I won't
14:21:36*kenran joined #nim
14:21:42FromDiscord_<codic> I think that's because Irc doesn't have edits
14:21:47PMunchCorrect
14:21:59FromDiscord_<codic> If you join an irc channel from matrix and edit something, matrix duplicates the message
14:21:59PMunchBut it could detect single character edits and just not send them or something
14:22:03FromDiscord_<codic> True
14:22:21FromDiscord_<Rika> you think it'll be easier to port RxPY than RxCpp? or RxJs
14:22:25PMunchOr try to be smart and convert that message to just "code*" which is what most people on IRC would end up doing
14:22:44PMunchRika, RxCpp would probably be the easiest
14:22:52FromDiscord_<Rika> im not wrapping
14:22:55FromDiscord_<Rika> im full porting
14:23:06PMunchOh porting
14:23:24FromDiscord_<Rika> wrapping sounds like it wouldnt work with asyncdispatch
14:23:29PMunchWell the Python or JS interface is likely to be closer to a pragmatic Nim approach
14:23:29FromDiscord_<Technicae Circuit> I love Nim
14:23:45FromDiscord_<codic> Also, since I was reading http://bootstrap.me.uk/programming-languages/2017/07/09/nim-for-the-discerning-rubyist.html this brought up a question. Do you think that NimYAML/json for nim will auto convert to ruby types as well?
14:23:46FromDiscord_<Rika> this is gonna be an intense and large project i guess
14:23:50FromDiscord_<Technicae Circuit> Nim can write not only Python extensions, but Ruby aswell
14:23:52FromDiscord_<codic> (I do know that ints and strings convert proper)
14:23:54FromDiscord_<Recruit_main707> on the other hand, figuring types is gonna be painful
14:24:30FromDiscord_<Rika> rxcpp prolly is more tuned for optimized performance than readability so thats prolly an issue
14:24:33FromDiscord_<Rika> there's also rxjava
14:24:51FromDiscord_<Recruit_main707> for flatbuffers, i am basing on python, but have constant looks at the go implementation to check types
14:24:55FromDiscord_<Rika> http://reactivex.io/languages.html hmmmmmmm
14:25:01FromDiscord_<codic> So basically I'm asking if ruby hashes are converted to nim tables
14:25:08FromDiscord_<codic> Since ints and strings are
14:25:24FromDiscord_<codic> (Oh, also, discord.nim is broken)
14:25:28FromDiscord_<Rika> we know
14:25:30FromDiscord_<Technicae Circuit> @codic they should, but test it
14:25:31FromDiscord_<codic> (Oh, also, discord.nim is broken, zlib error)
14:25:36FromDiscord_<Technicae Circuit> Everyone already knows
14:25:41FromDiscord_<codic> Oh
14:25:42FromDiscord_<codic> eh
14:25:42FromDiscord_<Technicae Circuit> It's common knowledge :p
14:26:00PMunchWell, since yesterday :P
14:26:06FromDiscord_<codic> Seems to be an upstream issue
14:26:08FromDiscord_<codic> https://github.com/nim-lang/zip/issues/39
14:26:09disbotZlibStreamError due to size mismatch of data types (Linux) ; snippet at 12https://play.nim-lang.org/#ix=2iJQ
14:26:27FromDiscord_<codic> That's pretty cool
14:26:37FromDiscord_<codic> (The bot)
14:26:42PMunchNot quite sure if hashes would convert to tables, but I doubt it
14:26:45FromDiscord_<Sophie> what is nim's situation regarding IDE support and debugging
14:26:51FromDiscord_<codic> Why do you think that?
14:26:52PMunchOh disbot, yeah he has some neat tricks
14:26:59FromDiscord_<codic> Yeah
14:27:04FromDiscord_<Recruit_main707> @Sophie we have quite a few
14:27:05FromDiscord_<codic> also ***dis***bot, ***dis***cord
14:27:09FromDiscord_<codic> lol
14:27:22PMunchcodic, because it isn't built for it
14:27:34FromDiscord_<codic> ah
14:27:40FromDiscord_<Rika> its prolly disbot because ***dis*** ruptek
14:27:43FromDiscord_<Rika> the maker? i think
14:27:44FromDiscord_<codic> so i'd have to somehow do it manually?
14:27:47FromDiscord_<codic> hah
14:27:48FromDiscord_<codic> haha
14:27:49PMunchThe Nim <-> Ruby code in that article is actually more like Nim <-> Dll <-> Ruby
14:28:09FromDiscord_<codic> ~~Eh, nah, more like Nim <-> .so <-> ruby since unix rules~~
14:28:13PMunchSo Ruby just thinks its playing around with a regular dynamic library
14:28:30FromDiscord_<codic> yeah, that's true..
14:28:31FromDiscord_<Recruit_main707> vscode, sublime text, vim, neovim... (something with jetbrains iiirc?)
14:28:32PMunchYeah :P so just sounds so weird :P
14:28:43FromDiscord_<codic> What does?
14:28:54FromDiscord_<Recruit_main707> and a bunch of outdated ones :p
14:29:01PMunchI'm on Linux and I keep calling them dlls simply because it easier to understand what it is
14:29:03FromDiscord_<codic> and atom
14:29:08FromDiscord_<codic> ah haha
14:29:19FromDiscord_<Technicae Circuit> Is there something like Nimpy but for Ruby? (Basically Nimrb)
14:29:23FromDiscord_<Sophie> for jetbrains I could only find one that doesn't seem has been updated in a few years
14:29:30PMunchSophie, we also have nimlsp so any editor with LSP can get Nim stuff in it
14:29:41FromDiscord_<codic> That wouldn't be that hard to code
14:30:08FromDiscord_<codic> The hardest challenge, to be honest, would be auto generating the attach_function calls
14:30:12PMunch(But no syntax highlighting since LSP doesn't really support that, working on implementing the unofficial highlight extension though)
14:30:25FromDiscord_<Recruit_main707> i use vscode, it works pretty well, also, Gary M is working on fixing some issues of the current main plug in
14:30:33FromDiscord_<Technicae Circuit> :p
14:30:34FromDiscord_<Sophie> great, that works
14:30:59FromDiscord_<codic> They use the format `attach_function(:functionName, [:an, :array, :of, :argument, :TYPES], :returnValueType)`
14:31:11FromDiscord_<Technicae Circuit> Hmmmm
14:31:23FromDiscord_<Technicae Circuit> Welp
14:31:33FromDiscord_<codic> Doesn't matter honestly, just one extra line per function
14:31:41FromDiscord_<Technicae Circuit> You could just check how Nimpy does it :p
14:31:51FromDiscord_<codic> Python ffi is different
14:31:53FromDiscord_<codic> But I'll check it out
14:32:00FromDiscord_<Technicae Circuit> Yeah but porting things like https://github.com/juancarlospaco/faster-than-requests would be a pain
14:32:12FromDiscord_<codic> Not raeally
14:32:14FromDiscord_<codic> Not really
14:32:25FromDiscord_<codic> Let's see
14:32:33FromDiscord_<Technicae Circuit> Stop editing :p
14:32:33FromDiscord_<codic> https://github.com/juancarlospaco/faster-than-requests/blob/master/src/faster_than_requests.nim is 345 lines
14:32:39FromDiscord_<codic> Oh yeah
14:32:52FromDiscord_<codic> So I should average about like 20 lines of attach_function, which isn't a lot
14:32:58FromDiscord_<codic> or more
14:33:00FromDiscord_<codic> like 50
14:33:03FromDiscord_<codic> or 60
14:33:05FromDiscord_<Technicae Circuit> Eh
14:33:12FromDiscord_<Technicae Circuit> So
14:33:15FromDiscord_<Technicae Circuit> Basically
14:33:16FromDiscord_<codic> Yeah I'll look at nimpy
14:33:23FromDiscord_<Technicae Circuit> Nim is now my go-to language
14:33:33FromDiscord_<codic> Nope, I can't port this
14:33:36FromDiscord_<codic> It uses python apis
14:33:41FromDiscord_<Technicae Circuit> @codic remember that Python can import c modules
14:33:43FromDiscord_<Technicae Circuit> Yeah :p
14:33:47FromDiscord_<codic> Yeah, like any language can
14:33:55FromDiscord_<codic> via ffi
14:33:57FromDiscord_<Technicae Circuit> But Python has an api so
14:34:04FromDiscord_<codic> So does ruby
14:34:07FromDiscord_<codic> and most other languages
14:34:10FromDiscord_<Technicae Circuit> Unless Ruby has an API like Python
14:34:10FromDiscord_<codic> and most other interpreted languages
14:34:13FromDiscord_<codic> It does
14:34:22FromDiscord_<Technicae Circuit> Why don't you write a custom Nimrb module
14:34:28FromDiscord_<codic> https://docs.ruby-lang.org/en/2.7.0/extension_rdoc.html
14:34:31FromDiscord_<Technicae Circuit> That is similar to Python's
14:34:32FromDiscord_<codic> I just don't want to learn the whole api
14:34:38FromDiscord_<codic> :|
14:34:40FromDiscord_<Technicae Circuit> :p
14:35:14FromDiscord_<codic> I wish I could use some hacky regexp to get something like this
14:35:48FromDiscord_<codic> ```
14:35:48FromDiscord_<codic> :functionName ( :argtype1, :argtype2 ) :returnType```
14:35:53FromDiscord_<codic> If I could that to ruby is easy
14:36:43FromDiscord_<Technicae Circuit> You probably could
14:37:11PMunchTechnicae Circuit, welcome to the club :)
14:38:09*drewr joined #nim
14:38:21FromDiscord_<Recruit_main707> does someone know whats leorize's timezome aprox?
14:38:50*madpata quit (Ping timeout: 260 seconds)
14:39:35FromDiscord_<Technicae Circuit> :p
14:40:05FromDiscord_<Technicae Circuit> I mean, Nim is just so simple to make libs for any lang
14:41:47FromDiscord_<codic> Yeah
14:42:00FromDiscord_<codic> And with a much nicer syntax than languages like C, or C++
14:42:21FromDiscord_<Technicae Circuit> Mhm
14:42:37FromGitter<codenoid> how things going folks
14:42:51PMunchGoing good
14:43:18PMunchDid a miss a big article or something? All of a sudden so many new people around here :)
14:43:28FromDiscord_<Recruit_main707> struggling with code,
14:43:28FromDiscord_<Recruit_main707> for a change :p
14:43:32FromDiscord_<Technicae Circuit> Very nice
14:43:34FromDiscord_<Technicae Circuit> Oof
14:44:41FromDiscord_<Recruit_main707> https://dev.to/xflywind/write-a-simple-web-framework-in-nim-language-from-scratch-ma0 this is the only new thing i know of
14:46:16FromDiscord_<codic> haha
14:47:03PMunchI meant more like the past week(s)
14:47:24FromDiscord_<codic> play.nim-lang.org is soo useful
14:47:24FromDiscord_<Recruit_main707> idk then ¯\_(ツ)_/¯
14:47:26PMunchI guess maybe it's just the pandemic :P
14:47:39PMunchcodic, yeah it's a nice tool :)
14:47:56FromDiscord_<codic> Oh. Um, I had a string with `&"string{thing}"
14:47:58FromDiscord_<Recruit_main707> btw, do you see this: ¯\_(ツ)_/¯ in irc, or just `/shrug`?
14:48:06*madpata joined #nim
14:48:15PMunchI see the expanded form
14:48:21PMunch¯\_(ツ)_/¯
14:48:22FromDiscord_<Technicae Circuit> They should see the actual shruggie
14:48:32FromDiscord_<codic> I got this error: https://hastebin.com/gamufamigo.pl
14:48:37FromDiscord_<codic> (no, it's not perl)
14:48:38FromDiscord_<Recruit_main707> PMunch: thats the same one in discord :p
14:48:40FromDiscord_<Technicae Circuit> Since discord sends the message content as the shruggie
14:49:00disrupteki see dead people.
14:49:05FromDiscord_<codic> as soon as you press enter, on the client side, /shrug is converted to the shrug before it is sent to the server
14:49:06FromDiscord_<Technicae Circuit> Oof
14:49:09PMunchWhere?!
14:49:17*PMunch frantically looks around
14:49:38FromDiscord_<Technicae Circuit> ~~Me-~~
14:49:45FromDiscord_<Recruit_main707> lmao
14:49:46PMunchAre you dead?
14:49:51FromDiscord_<Technicae Circuit> Inside yes
14:50:13FromDiscord_<Recruit_main707> thats because you are not coding in nim probably
14:50:21FromDiscord_<Technicae Circuit> Probably
14:50:40FromDiscord_<codic> sad story
14:50:47FromDiscord_<Recruit_main707> xD
14:51:00FromDiscord_<codic> Ahhh
14:51:16FromDiscord_<codic> When I replace & with fmt I get undeclared identifier
14:51:23FromDiscord_<codic> Is it because my compilation target is cpp
14:51:23FromDiscord_<Technicae Circuit> Oof
14:51:27FromDiscord_<codic> Nope, same with c
14:51:33FromDiscord_<codic> /usercode/in.nim(2, 53) Error: undeclared identifier: 'fmt'
14:51:36FromDiscord_<Technicae Circuit> Did you impoet strutils
14:51:43narimiran*strformat
14:51:46FromDiscord_<Technicae Circuit> Import*
14:51:47FromDiscord_<Technicae Circuit> O
14:51:48FromDiscord_<codic> Oh
14:51:52FromDiscord_<codic> import strformat
14:51:55FromDiscord_<codic> me stupid
14:52:00FromDiscord_<codic> :P
14:52:07FromDiscord_<Technicae Circuit> :p
14:52:21FromDiscord_<codic> there, all is nice and happy, until...
14:52:22FromDiscord_<codic> /usercode/in.nim(4, 19) Error: undeclared identifier: 'table'
14:52:23FromDiscord_<codic> :gasp:
14:52:30FromDiscord_<codic> What is the table type called?
14:52:35narimiranimport tables
14:52:38FromDiscord_<codic> o
14:52:42narimiranc'mon man, do some imports :D
14:52:57FromDiscord_<codic> changed my import to `import strformat, tables`
14:53:03FromDiscord_<codic> Still get undeclared identifier: table
14:53:06FromDiscord_<codic> (I'm using table as a type)
14:53:09narimiranTable
14:53:12narimirancapital T
14:53:20FromDiscord_<codic> Oh, why was that chosen?
14:53:27narimiranbecause sanity
14:53:31FromDiscord_<codic> COMPILATION SUCCESS. 🚀
14:53:31FromDiscord_<Recruit_main707> types w/ capital obv
14:53:40FromDiscord_<codic> then why not `Int` and `String`?/
14:54:00FromDiscord_<Technicae Circuit> ~~Because sanity~~
14:54:06narimiranfinally, a non-trivial question :)
14:54:17FromDiscord_<codic> 😠
14:54:18FromDiscord_<codic> :P
14:54:29FromDiscord_<Recruit_main707> that would be ugly imo
14:54:40PMunchAll the basic built in types are lower-case
14:54:48PMunchAnything more complicated have uppercase
14:54:56FromDiscord_<Technicae Circuit> Coolio
14:54:57FromDiscord_<Recruit_main707> so i change my statement to, complex types w/ capital
14:54:59PMunch(by convention)
14:55:21FromDiscord_<Recruit_main707> ie: primitives, no, the rest, yes :p
14:55:29PMunchYeah, pretty much
14:56:21PMunchIf they live in a module, uppercase
15:00:14FromDiscord_<Recruit_main707> why are the first ones right, but the second ones ambiguous? https://play.nim-lang.org/#ix=2juJ
15:00:42*so quit (*.net *.split)
15:00:43*go|dfish quit (*.net *.split)
15:01:30*go|dfish joined #nim
15:01:31narimiran@codic look at the paste above, and uppercase function names. that's not sanity.
15:01:35*so joined #nim
15:01:50FromDiscord_<codic> I'm a bit confused. I have this in helloWorld.nim: https://play.nim-lang.org/#ix=2juL
15:01:50FromDiscord_<codic> I compiled it to libhelloWorld.so and used this ruby code: https://hastebin.com/idicetewuw.rb
15:01:50FromDiscord_<codic> Now, ruby complains: function 'testInts' not found in [./libhelloWorld.so] (FFI::NotFoundError)
15:02:08FromDiscord_<codic> it actually makes sense to me, coming from Golang, since exported methods are capitalized
15:02:15PMunch{.exportc.}
15:02:18FromDiscord_<Recruit_main707> ^
15:02:33FromDiscord_<Recruit_main707> if not, nim compiler will use an "optimized" name
15:02:37*vesper11 quit (Ping timeout: 264 seconds)
15:02:38narimiranexported procs in nim have `*` at the end (in the case you didn't stumble on that one yet)
15:02:54FromDiscord_<Technicae Circuit> End of the name specifically
15:02:57FromDiscord_<Recruit_main707> at the end... of the name
15:03:02narimiranyep
15:03:03*vesper11 joined #nim
15:03:11PMunchNot really optimised, just done for technical reasons
15:03:30PMunchNim can overload procedures for example
15:03:33PMunchWhile C can't
15:03:39FromDiscord_<codic> oh, i forgot about the cdecl lol
15:03:43FromDiscord_<codic> and ah, I see
15:03:49PMunchSo it would be impossible to always use the same C name as the Nim name
15:04:01FromDiscord_<Recruit_main707> makes sense now
15:04:02PMunchOh yeah, and cdecl to ensure that it uses the C calling convention
15:04:18FromDiscord_<Recruit_main707> and dynlib since its gonna be inside a dll?
15:04:19PMunchnimcall default to fastcall when available IIRC
15:04:33PMunchShouldn't need dynlib for exporting I think
15:05:03FromDiscord_<Recruit_main707> but that was not intended, that was a bug iirc
15:05:10FromDiscord_<Recruit_main707> and it was fixed
15:05:28PMunchHuh, apparently it should be used, not sure what it does though: https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export
15:05:32FromDiscord_<codic> Exact same error, I added this pragma: `{.cdecl, exportc.}`
15:05:37FromDiscord_<codic> then removed my .so and recompiled
15:05:49FromDiscord_<Recruit_main707> add dynlib
15:06:03PMunchCheck with `nm -a` to see if the procedure exists with the name you expect
15:06:09*madprops quit (*.net *.split)
15:06:26*db93858 joined #nim
15:06:50FromDiscord_<codic> On the .so file?
15:07:14FromDiscord_<codic> That gives me https://hatebin.com/edlpobihkp
15:07:23FromDiscord_<codic> junk
15:07:28PMunchNot junk
15:07:35PMunchThose are all the symbols defined in your so
15:07:50FromDiscord_<codic> How do I find if testInts exists?
15:08:02PMunchYou can see it on line249
15:08:02FromDiscord_<codic> wait, do I add `*` after the proc definition
15:08:06FromDiscord_<codic> to export it
15:08:10PMunchSo it is there
15:08:14FromDiscord_<codic> like `testInts*(signature)`
15:08:15FromDiscord_<codic> Ah
15:08:18FromDiscord_<Recruit_main707> ctrl + f testInts
15:08:22FromDiscord_<codic> > 0000000000012d70 t testInts
15:08:23FromDiscord_<codic> yeah
15:08:32FromDiscord_<codic> So what could be the issue?
15:08:48PMunchAh, but it is lowercase
15:08:55FromDiscord_<codic> Indeed
15:09:02PMunchThe `t` is lowercase, meaning it's local to that library
15:09:13PMunchDid you add the * before compiling the .so?
15:09:40FromDiscord_<Recruit_main707> `testInts*` <- this way
15:09:51FromDiscord_<codic> Nope I didn't that's what I was asking
15:09:52FromDiscord_<codic> Haha
15:09:53FromDiscord_<Technicae Circuit> Like `proc func*(stuff):type =`
15:09:58FromDiscord_<codic> trying now
15:10:00FromDiscord_<codic> Yeah, I already said tht
15:10:02FromDiscord_<Technicae Circuit> We said that before :p
15:10:03FromDiscord_<codic> *that
15:10:06FromDiscord_<codic> I said that before
15:10:11FromDiscord_<codic> https://discordapp.com/channels/371759389889003530/371759389889003532/703623364039802910
15:10:13FromDiscord_<Technicae Circuit> :p
15:10:39FromDiscord_<codic> Welp, no success still
15:11:49FromDiscord_<Technicae Circuit> Oof
15:12:06*ftsf quit (Ping timeout: 265 seconds)
15:12:14PMunchWorks fine here..
15:12:59FromDiscord_<Technicae Circuit> @codic
15:13:01PMunchhttp://ix.io/2juR
15:13:11PMunch@codic ^
15:13:17FromDiscord_<codic> Hmmm
15:13:22FromDiscord_<codic> Ohhh
15:13:27FromDiscord_<codic> I didn't add dynlib
15:13:47FromDiscord_<codic> haha
15:13:49FromDiscord_<Recruit_main707> *overdramatically facepalms*
15:13:59FromDiscord_<Technicae Circuit> Hahaha
15:14:09FromDiscord_<codic> ¯\_(ツ)_/¯
15:14:16FromDiscord_<codic> Finally!
15:14:21FromDiscord_<Recruit_main707> happens to the best of us
15:14:21PMunchAh yeah, without `dynlib` it seems to be local to the library (lowercase t in nm -a output)
15:14:27FromDiscord_<codic> I have been waiting for glorious 2 for years
15:14:29FromDiscord_<codic> Ah okay
15:14:30FromDiscord_<codic> Thanks!
15:14:43PMunchBy the way, I can almost guarantee you that strings and tables won't work that way :P
15:14:50FromDiscord_<codic> Let's try
15:15:06FromDiscord_<codic> and....
15:15:13FromDiscord_<codic> It doesn't even recognize the method!
15:15:23FromDiscord_<codic> oh
15:15:25FromDiscord_<Recruit_main707> strings maybe, Tables (ie: complex types) i bet not
15:15:26FromDiscord_<codic> Nvm, I didn't attach_function
15:15:34PMunchStrings are basically struct {int64_t len; int64_t cap; char *data};
15:15:47PMunchAnd tables are a complex object
15:15:57PMunchBoth of course under the control of the Nim GC
15:16:06FromDiscord_<codic> Boom! I got the most readable output ever!
15:16:09FromDiscord_<codic> `�`
15:16:15PMunchHaha
15:16:27FromDiscord_<codic> from `puts(Nim::testStrings("a", "b"))` where testStrings was `proc testStrings*(a:string,b:string):string {.cdecl, dynlib, exportc.} = return &"concentated string: {a}{b}"`
15:16:28FromDiscord_<codic> So sad
15:16:30FromDiscord_<Rika> i ? unicode
15:16:53PMunchYou're not passing it strings though..
15:16:59PMunchAt best those would be cstring
15:17:02FromDiscord_<codic> I am
15:17:05FromDiscord_<codic> but they're ruby strings
15:17:09FromDiscord_<codic> Not Nim strings
15:17:12PMunchYeah :P
15:17:17FromDiscord_<Rika> then thats the issue
15:17:22PMunchSo not the "string" type in Nim
15:17:26FromDiscord_<codic> But how do I construct a Nim string? can I make a proc to do that?
15:17:28FromDiscord_<Rika> use cstring
15:17:36FromDiscord_<codic> Ruby's cstring?
15:17:38FromDiscord_<Rika> also return cstring, i assume
15:17:38FromDiscord_<Rika> no
15:17:40FromDiscord_<Rika> nim cstring
15:17:52FromDiscord_<codic> Oh, in the method
15:17:59FromDiscord_<Rika> procedure
15:18:00FromDiscord_<Recruit_main707> wherever you used string in nim, use cstring
15:18:08FromDiscord_<codic> How do I convert my return value to a cstring?
15:18:26FromDiscord_<Recruit_main707> it should automatically work iirc
15:18:28PMunchThat actually worked
15:18:35FromDiscord_<codic> Oh, let's see
15:18:47FromDiscord_<codic> Worked!!!
15:18:58FromDiscord_<codic> Yesssssssss, now to try glorious tables
15:19:09FromDiscord_<Rika> G L H F with that
15:19:10FromDiscord_<Recruit_main707> let him realise
15:19:16PMunchhttp://ix.io/2juU
15:19:21PMunchHaha
15:20:12FromDiscord_<codic> NOOOOOOOOOOOOOo
15:20:13FromDiscord_<codic> /home/codic/.gem/ruby/2.7.0/gems/ffi-1.12.2/lib/ffi/types.rb:69:in `find_type': unable to resolve type 'Table' (TypeError)
15:20:13PMunchHere's the type definition if you want to try and wrap it codic: https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/collections/tables.nim#L224
15:20:15FromDiscord_<Rika> should i go with TDD for porting RxPY?
15:20:21FromDiscord_<codic> oh, thanks
15:20:37PMunchA tuple is essentially a C struct
15:20:42FromDiscord_<codic> but I have no idea how
15:20:59FromDiscord_<Recruit_main707> i think... you should vreate that type in ruby
15:21:04FromDiscord_<codic> Wait, I can use C libraries in Nim and compile to C?
15:21:11FromDiscord_<codic> If so, I can use Ruby's C api in nim
15:21:13FromDiscord_<codic> Yeah but Idk how
15:21:14FromDiscord_<Rika> or make a helper that creates it in nim and passes it to ruby
15:21:20FromDiscord_<codic> a type definition in ruby is just
15:21:22PMunchYup
15:21:29FromDiscord_<codic> class whatever; end
15:21:38FromDiscord_<Recruit_main707> ye, you can use Ruby's c api
15:21:46FromDiscord_<Rika> Nim is compiled to C after all
15:21:50FromDiscord_<codic> oh, great!
15:21:57FromDiscord_<codic> I think a helper would be easier first though
15:21:59FromDiscord_<Rika> well, by default its to C
15:22:03FromDiscord_<Technicae Circuit> Is there a `del` function in Nim
15:22:14FromDiscord_<Technicae Circuit> To delete a variable?
15:22:15FromDiscord_<codic> How'd I make a nim helper that returns a tableref?
15:22:17FromDiscord_<Technicae Circuit> Doubt it
15:22:18FromDiscord_<Technicae Circuit> But eh
15:22:26FromDiscord_<codic> I don't think so
15:22:39FromDiscord_<Rika> nope
15:22:46FromDiscord_<codic> If Nim has a free function to free mem, tho, you can use that
15:22:46FromDiscord_<Rika> just dont use the variable
15:22:53FromDiscord_<Rika> not a good idea
15:22:58FromDiscord_<Recruit_main707> i didnt Desire to die enough to try to create python libraries yet with nim, having in mind we dont actually have classes
15:23:02FromDiscord_<Rika> you might bamboozle the GC
15:23:02PMunchTechnicae, what do you mean "delete a variable"?
15:23:40FromDiscord_<Technicae Circuit> Free up the memory that the variable or function is using
15:23:41PMunchJust out of curiosity, why are you trying to use Nim in Ruby?
15:23:56PMunchTechnicae, that's the GC's job
15:24:00FromDiscord_<Rika> @Technicae Circuit put it in a block then make that block go out of scope
15:25:19FromDiscord_<codic> Just for fun, so I can write one library that works in python, ruby, and nim
15:25:35FromDiscord_<Recruit_main707> https://tenor.com/view/press-f-pay-respect-coffin-burial-gif-12855021
15:25:39FromDiscord_<Recruit_main707> in advance
15:25:41PMunchHaha, good enough reason that :P
15:26:10PMunchBut I've gotta run now
15:26:11PMunchTTYL
15:26:15*PMunch quit (Quit: leaving)
15:26:23FromDiscord_<Recruit_main707> i procced to re-ask my question:
15:26:23FromDiscord_<Recruit_main707> why are the first ones right, but the second ones ambiguous? https://play.nim-lang.org/#ix=2juJ
15:26:33FromDiscord_<Recruit_main707> proceed* :p
15:26:45FromDiscord_<codic> Why the coffin?
15:27:03FromDiscord_<codic> 😢 😢 😢 😢
15:27:17*xcm quit (Remote host closed the connection)
15:27:34FromDiscord_<Rika> first ones?
15:27:38FromDiscord_<Rika> which are the first ones
15:27:38FromDiscord_<Recruit_main707> my favourite part is that innocent "for fun" xD
15:27:42FromDiscord_<Rika> and which are the second ones
15:27:44FromDiscord_<Recruit_main707> WriteVal
15:27:48FromDiscord_<Recruit_main707> and GetVal
15:28:23FromDiscord_<Rika> because procs must not be ambiguous when no generic params are filled
15:28:33FromDiscord_<Rika> a generic param is not required
15:28:52FromDiscord_<codic> Argh. I'm stuck on what to port to nim
15:29:29FromDiscord_<Recruit_main707> > a generic param is not required
15:29:30FromDiscord_<Recruit_main707> wdym?
15:29:30*xcm joined #nim
15:29:51solitudesf@Recruit_main707, because it is ambiguous, generic parameter cant be inferred from arugments and you dont provide it explicitly
15:30:09solitudesfin WriteVal its is inferred from `n`
15:30:15*livcd quit (Ping timeout: 250 seconds)
15:30:29solitudesfand you cant overload like this
15:30:59FromDiscord_<Technicae Circuit> :p
15:31:10FromDiscord_<Rika> because generic params are usually inferred no?
15:31:43solitudesfthey are inferred is there is something to infer from, but in this case there isn't
15:31:58FromDiscord_<Recruit_main707> `generic parameter cant be inferred from arugments` but the first to functions are the ones that do that and they work fine
15:32:00FromDiscord_<Rika> i think he wants to force using it explicitly
15:32:16FromDiscord_<Rika> > `generic parameter cant be inferred from arugments` but the first to functions are the ones that do that and they work fine
15:32:16FromDiscord_<Rika> @Recruit_main707 because there it can
15:32:18FromDiscord_<Rika> 2nd cannot
15:32:48FromDiscord_<Rika> 1st can (because the generic is used in the arguments) but 2nd it cannot (since generic isnt used in the arguments)
15:32:50*solitudesf quit (Quit: Leaving)
15:32:57FromDiscord_<Recruit_main707> > i think he wants to force using it explicitly
15:32:57FromDiscord_<Recruit_main707> id rather not actually
15:33:51FromDiscord_<Rika> how would you decide what return type to use then??
15:34:38FromDiscord_<Technicae Circuit> So, how do I make a class in Nim?
15:34:39FromDiscord_<Recruit_main707> well, since i cant it doesnt matter :p, but the one the code that calls it expects
15:35:11FromDiscord_<Recruit_main707> @Technicae Circuit my python boy, "classes" in nim dont exist as such
15:35:25FromDiscord_<Technicae Circuit> So what should i do? :P
15:35:33FromDiscord_<Technicae Circuit> Can i define a function inside a function?
15:35:44FromDiscord_<Recruit_main707> wait a sec
15:36:12FromDiscord_<Recruit_main707> https://nim-by-example.github.io/oop/
15:37:18FromDiscord_<Technicae Circuit> Uh
15:37:19FromDiscord_<Recruit_main707> that example always uses `ref object of ...` not that ref is optional
15:37:28FromDiscord_<Recruit_main707> note*
15:37:29*livcd joined #nim
15:38:21FromDiscord_<Technicae Circuit> So how would `class Test: def hi(): print("Hi")` look like in Nim?
15:38:53FromDiscord_<Technicae Circuit> Assuming it was valid
15:39:11FromDiscord_<Technicae Circuit> I don't wanna add newlines cuz of the irc users
15:39:35FromDiscord_<Recruit_main707> https://play.nim-lang.org/#ix=2jv4
15:40:07FromDiscord_<Technicae Circuit> Thanks
15:40:09FromDiscord_<Recruit_main707> essentially its the same but without a class body
15:40:23FromDiscord_<Technicae Circuit> So would self have to be passed?
15:40:48narimiranyou can do `self.hi` in nim
15:40:59narimiranif you're after that kind of syntax
15:41:17FromDiscord_<Technicae Circuit> I want the the user to be able to do `x = class_name("bot token")` (yes I'm working on nimcord)
15:41:29FromDiscord_<Rika> not possible
15:41:33FromDiscord_<Technicae Circuit> Damn
15:41:42FromDiscord_<Rika> you'll have to do with initClassName("token")
15:42:00FromDiscord_<Technicae Circuit> That could still work
15:42:22FromDiscord_<Recruit_main707> he can do it like: `class_name(field_name: "bot token")`
15:42:47dom96convention is to use initTypeName or newTypeName, please do follow the conventions :)
15:42:49FromDiscord_<Rika> that doesnt guarantee that the other fields are initialized as wanted
15:43:11FromDiscord_<Rika> for example, there might be custom code that sets some field differently to it's `default(type)` value
15:43:15FromDiscord_<Technicae Circuit> Hm
15:43:24FromDiscord_<Recruit_main707> dom96: but the function will do that wont it
15:43:33FromDiscord_<Rika> see my messages
15:43:37FromDiscord_<Rika> not necessarily
15:43:41FromDiscord_<Technicae Circuit> Damn
15:44:01FromDiscord_<Recruit_main707> then how?
15:44:15FromDiscord_<Rika> how what?
15:44:15dom96what function?
15:44:45FromDiscord_<Recruit_main707> about how to call hi:
15:44:45FromDiscord_<Recruit_main707> `var atest: Test`
15:44:45FromDiscord_<Recruit_main707> `atest.hi()` (if it doesnt need to be initialised)
15:44:55FromDiscord_<Recruit_main707> the initTypeName() function
15:45:02FromDiscord_<Recruit_main707> dom96 ^
15:45:30FromDiscord_<Technicae Circuit> I need to be able to pass variables to the 'class'
15:45:54FromDiscord_<Rika> thats fine, procs can be passed varialbes of course
15:46:30FromDiscord_<Technicae Circuit> But then how would i define functions for the 'class' and pass those variables to the functions
15:46:35FromDiscord_<Technicae Circuit> Like python's self
15:46:53FromDiscord_<Recruit_main707> for instance: https://play.nim-lang.org/#ix=2jv7
15:46:57narimiranyouself.funcName(par1, par2, par3)
15:47:02FromDiscord_<Rika> just make procs with the type as first parameter
15:47:04narimiranyou'd call it as: self.funcName(par1, par2, par3)
15:47:10*rockcavera joined #nim
15:47:31narimiranand define it as `proc funcName(self, par1, par2, par3)` (with types, of course)
15:47:54FromDiscord_<Technicae Circuit> I don't understand ;-;
15:48:14narimiranIMO, take a break of what you're trying to do and read some nim tutorial. you'll be faster in the end
15:48:17FromDiscord_<codic> You're trying to figure out how to get classes in nim?
15:48:18FromDiscord_<Rika> stop thinking in terms of classes, start thinking in terms of structs, i guess?
15:48:27FromDiscord_<codic> This is what I understand so far:
15:48:34FromDiscord_<Technicae Circuit> Basically
15:48:36FromDiscord_<Technicae Circuit> Hmm
15:49:41FromDiscord_<codic> Quick question
15:49:55FromDiscord_<codic> Reading https://matthiashager.com/nim-object-oriented-programming, why is it `node: var Node`, not `node: Node`?
15:50:07narimiranmutable vs imutable
15:50:13FromDiscord_<codic> yeah
15:50:22FromDiscord_<Recruit_main707> var Node means its initialised iirc
15:50:30FromDiscord_<codic> but does it matter if ya leave out var?
15:50:35FromDiscord_<Rika> no its not recruit
15:50:41FromDiscord_<codic> ?
15:50:45FromDiscord_<Rika> @codic yes, you cannot change fields in node
15:50:47narimiranit does if you plan to modify `node` inside of a proc
15:50:55FromDiscord_<Rika> w/o var
15:51:09FromDiscord_<codic> Ah ok
15:52:22narimiranhttps://narimiran.github.io/nim-basics/#_declaring_a_procedure
15:52:29narimiransee the fourth (or so) example
15:53:31FromDiscord_<Recruit_main707> @Technicae Circuit have a look at this, take it as a way (probably not the most nim-ish one) of using "classes" or OOP rather: https://play.nim-lang.org/#ix=2jvd
15:53:38FromDiscord_<Technicae Circuit> Is there such that as global vars?
15:53:45FromDiscord_<codic> Can you export a type with the exportpy pragma?
15:53:59FromDiscord_<codic> (To python)
15:54:02narimiran"Is there such that as global vars?" RTFM, please
15:54:09FromDiscord_<Technicae Circuit> Thanks
15:54:18FromDiscord_<Recruit_main707> nimpy still doesnt support exporting types yet
15:54:33narimiran(and yes, there are global variables)
15:54:35FromDiscord_<codic> aw, so making a nim "class" and exporting it to python is impossible
15:54:38FromDiscord_<Technicae Circuit> :p
15:54:45FromDiscord_<Technicae Circuit> Damn it
15:54:46FromDiscord_<codic> But can you just use a table to store your information?
15:54:51FromDiscord_<Technicae Circuit> We can
15:54:55FromDiscord_<codic> Have a function that returns a table
15:55:01FromDiscord_<codic> Then have other functions calling that
15:55:05FromDiscord_<Rika> yes
15:55:06FromDiscord_<Technicae Circuit> Then we can use AttrDict on that table
15:55:10FromDiscord_<codic> ...
15:55:16FromDiscord_<Technicae Circuit> In Python
15:55:16FromDiscord_<codic> Nim does not have attrdict
15:55:20FromDiscord_<codic> Oh
15:55:43FromDiscord_<Technicae Circuit> Basically we are using a stupid workaround to classes
15:55:51narimiran"we"
15:55:56FromDiscord_<Recruit_main707> xD
15:55:56FromDiscord_<Rika> you
15:55:59FromDiscord_<Technicae Circuit> Me and Codic
15:56:07FromDiscord_<Technicae Circuit> We are working on a project :p
15:56:14FromDiscord_<Rika> are you two friends
15:56:15FromDiscord_<Recruit_main707> 👀
15:56:17FromDiscord_<Technicae Circuit> Yup
15:56:33narimiranyou two should work on reading tutorials, and then your workarounds won't be stupid anymore ;)
15:56:35FromDiscord_<Rika> recruit lets work on a project too even if i barely know you
15:56:37FromDiscord_<Rika> (jk)
15:56:43FromDiscord_<codic> lmao
15:56:45FromDiscord_<Technicae Circuit> :p
15:56:50FromDiscord_<Recruit_main707> well, im up for it :P
15:57:00FromDiscord_<Rika> nah im jokin, ill spare you headaches
15:57:06FromDiscord_<Rika> still trying to port Rx
15:57:15FromDiscord_<Recruit_main707> im w/ flatbuffers rn
15:57:52FromDiscord_<Recruit_main707> > nah im jokin, ill spare you headaches
15:57:52FromDiscord_<Recruit_main707> lame excuse ngl ;)
15:58:33FromDiscord_<Rika> eeeeeh
15:58:51FromDiscord_<Rika> ree
15:59:39FromDiscord_<Recruit_main707> what a polite ree xd
16:00:09FromDiscord_<Rika> what, you want a WRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
16:00:10FromDiscord_<Rika> ?
16:01:03FromDiscord_<Recruit_main707> idk 😭
16:03:39*nsf quit (Quit: WeeChat 2.8)
16:04:21*xcm quit (Read error: Connection reset by peer)
16:06:20FromDiscord_<Recruit_main707> how do i create an string out of a byte sequence?
16:06:33FromDiscord_<Rika> cast lul
16:06:35*xcm joined #nim
16:07:16FromDiscord_<Technicae Circuit> If i define a table outside of a function, how would i access it inside the function
16:07:28FromDiscord_<Rika> wdym? can you playground it
16:07:34FromDiscord_<Technicae Circuit> Okay
16:08:26FromDiscord_<Technicae Circuit> https://play.nim-lang.org/#ix=2jvk
16:08:48FromDiscord_<Technicae Circuit> I want to access the table `a` inside of my function
16:08:54FromDiscord_<Technicae Circuit> So i can modify it
16:09:02FromDiscord_<Rika> put the proc below var a
16:09:14FromDiscord_<Rika> ah
16:09:14FromDiscord_<Technicae Circuit> But then a can't access the function
16:09:15FromDiscord_<Rika> wait
16:09:28FromDiscord_<Rika> thats weird, dont do that
16:09:42*narimiran gives up
16:09:42FromDiscord_<Recruit_main707> why do you want test to be inside the table though
16:09:44FromDiscord_<Technicae Circuit> It's the only way i can pass a 'class' to Python
16:10:10FromDiscord_<Rika> tables cant hold different types in its value
16:10:20FromDiscord_<Technicae Circuit> Oh
16:10:26FromDiscord_<Rika> so b has to be a proc(int):void too
16:10:33FromDiscord_<Technicae Circuit> That's fine
16:11:25FromDiscord_<Technicae Circuit> Damn it
16:11:33FromDiscord_<Technicae Circuit> This is complicated
16:12:22FromDiscord_<Rika> christ, dont emulate python in nim please
16:12:41FromDiscord_<Rika> at least dont do it when you have no idea what you're doing
16:15:26FromDiscord_<Recruit_main707> if you want to interop with python
16:15:44FromDiscord_<Technicae Circuit> Use the C API i assume
16:15:46FromDiscord_<Technicae Circuit> :p
16:15:49FromDiscord_<Recruit_main707> using the C api and a bit of c code
16:16:11FromDiscord_<Recruit_main707> that way you have actual classes and actual python classes
16:16:20FromDiscord_<Technicae Circuit> Hm
16:16:48FromDiscord_<Recruit_main707> i thought of writing a macro for converting nim types into python classes, but i have abandoned that project for now
16:17:07FromDiscord_<Technicae Circuit> Oof
16:17:32FromDiscord_<Rika> i thought of a way to emulate python classes but it has heavy use of `pointer`
16:17:32FromDiscord_<Recruit_main707> into python classes using the c api
16:17:52FromDiscord_<Rika> then also i cant think of solutions to certain problems youll hit with my idea
16:18:37FromDiscord_<Recruit_main707> there is also the solution to create the class in python and making its functions call nim functions
16:18:51FromDiscord_<Recruit_main707> but that will only work with primitives basically
16:19:15*hax-scramper quit (Ping timeout: 240 seconds)
16:19:39FromDiscord_<Technicae Circuit> :p
16:19:55*pbb_ quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
16:21:13*hax-scramper joined #nim
16:21:30FromDiscord_<Recruit_main707> someone also wrapped the c api for nim, although i didnt manage to make it work as intended, but its worth having a look at it
16:21:42FromDiscord_<Recruit_main707> https://github.com/matkuki/python3
16:22:03FromDiscord_<Technicae Circuit> Cool
16:23:54*pbb joined #nim
16:25:39*AudreyanaMi joined #nim
16:28:17*AudreyanaMi quit (Client Quit)
16:29:12*silvernode joined #nim
16:59:53FromDiscord_<Technicae Circuit> Is there a pragma for no closure?
17:00:46FromDiscord_<Rika> not adding the closure pragma is how to get non-closure procs
17:00:56FromDiscord_<Technicae Circuit> Oh
17:01:11FromDiscord_<Rika> lambda/anonymous procs or procs as types must be closures though afaik
17:01:32FromDiscord_<Technicae Circuit> For some reason I can't return a table if the proc that is returning it is available to python
17:02:37leorizespecify a calling convention that's not closure and it won't be closure
17:07:33FromDiscord_<Varriount> Or use CFFI from Python
17:13:18*zacharycarter joined #nim
17:17:46*zacharycarter quit (Ping timeout: 256 seconds)
17:18:37FromDiscord_<Technicae Circuit> Does the name of a proc affect it at all?
17:19:06FromDiscord_<Technicae Circuit> I doubt it
17:24:33FromDiscord_<Rika> no
17:27:26liblq-dev@Technicae Circuit if you want to enforce a proc to not be a closure use {.nimcall.}. use {.cdecl.} if you need to pass the proc to C code
17:27:42*enthus1ast joined #nim
17:27:45liblq-dev@Rika Nim will automatically create a closure if you capture and variables
17:27:50enthus1asthi all
17:27:55liblq-devhello
17:28:38enthus1astwhen i create a type with a macro (which depends on other types) can i somehow call the macro in a type block?
17:28:58enthus1astthe workaround is to also create the other type
17:29:08disruptekpragma macro
17:29:58FromDiscord_<Rika> liblq-dev "and"?
17:30:13enthus1astwhat exactly do you mean disruptek?
17:30:26liblq-dev@Rika you said you needed to add the {.closure.} pragma explicitly.
17:30:27FromDiscord_<Rika> im pretty sure i think i know what you mean
17:30:38FromDiscord_<Rika> no i did not
17:31:23liblq-dev> not adding the closure pragma is how to get non-closure procs
17:31:38liblq-devI understood this statement like that. if that's not what you meant, then sorry.
17:31:44FromDiscord_<Rika> no
17:31:45FromDiscord_<Rika> its not
17:32:27FromDiscord_<Rika> the person i was talking to may not be aware about closures
17:32:35FromDiscord_<Rika> though i guess it would have been better to mention that
17:38:02*Trustable joined #nim
17:38:52FromGitter<zacharycarter> I have a question regarding move semantics and reference counting. I understand that if I move a ref var that the ref var will no longer point to the original allocated memory, and will be a nil ref. What if I want to however move a value to another ref var and still retain a copy.
17:39:05leorizeenthus1ast: Nim recently added type section macro
17:39:08*kenran quit (Quit: leaving)
17:39:44leorizein 1.2 you can annotate a type with `{.yourMacro.}` and it will call `yourMacro()` with the type definition
17:39:56FromGitter<zacharycarter> Like if I want to pass a value to another thread and still have a copy of the value on the main thread. I realize move is probably the wrong assignment to use here, but what do I use instead?
17:40:17FromDiscord_<Rika> copy it?
17:40:22leorizedeepcopy, if it's still a thing
17:40:27FromGitter<zacharycarter> Just deep copy?
17:40:38FromGitter<zacharycarter> Hmm okay I'll try that thanks
17:41:04leorize!issues deepCopy
17:41:05disbothttps://github.com/nim-lang/Nim/issues/13997 -- 3ARC: deepCopy in new runtime feature missing, do we have alternatives?
17:41:06disbothttps://github.com/nim-lang/Nim/issues/7108 -- 3deepCopy bug
17:41:06disbothttps://github.com/nim-lang/Nim/issues/8525 -- 3Global variable breaks spawn with overloaded deepCopy 7& 26 more...
17:41:10enthus1astsounds interesting leorize any idea where this is documented?
17:41:46FromGitter<zacharycarter> Ah okay so basically I can't do this yet
17:42:07FromGitter<zacharycarter> I still need pointers and sync primitives
17:43:21leorizeenthus1ast: ask Araq I guess :P
17:43:43enthus1astor where do you have seen this? :)
17:43:47leorizeyou can probably make do by using `{.dumpTree.}` on the type definition to know what you're going to deal with
17:44:15leorize[m]it's in the change log
17:44:30leorize[m]one really helpful line: `macro pragma` is now supported for type sections :)
17:44:34*natrys quit (Quit: natrys)
17:49:41enthus1astthank you leorize[m] i will try to find something
17:50:06enthus1ast( i also created a forum post: https://forum.nim-lang.org/t/6254 )
17:51:18*PMunch joined #nim
17:51:46*xcm quit (Remote host closed the connection)
17:53:43FromGitter<Bennyelg> (https://files.gitter.im/nim-lang/Nim/sLm6/image.png)
17:53:55*xcm joined #nim
17:54:08FromGitter<Bennyelg> Anyone can assist why I can create some "global" envs without getting a GC warning ?
17:55:11leorizewdym?
17:55:30leorizealso the gc warning doesn't appear if the proc don't have {.gcsafe.}
17:56:53*zacharycarter joined #nim
17:56:56FromGitter<Bennyelg> (https://files.gitter.im/nim-lang/Nim/pYxY/image.png)
17:57:02*narimiran quit (Quit: leaving)
17:57:58leorizeI'm still unsure what's your question
18:00:14FromDiscord_<Recruit_main707> leorize now that you are online, ive been investigating, and using this: `cast[ptr T](unsafeAddr b[0])[]` works
18:00:50leorizeyes it does, but you're going to interpret the bytes as the native endian
18:01:10FromDiscord_<Recruit_main707> i can live w/ that :P
18:01:16FromDiscord_<Recruit_main707> for now
18:02:53FromGitter<Bennyelg> My Question is I see warning or kind of error on the route and this is what it wrote (in the image) this is because I initialize something above the routes which is not. a gc safe
18:03:31leorizecompile the file
18:03:41leorizethat error snippet is totally meaningless
18:03:50leorizeprobably someone didn't add all the error messages in...
18:04:31leorizewell the vscode extension is not actively maintained, so I'm not too surprised
18:04:46*Intensity4 joined #nim
18:05:40*livcd quit (Changing host)
18:05:40*livcd joined #nim
18:06:49*Intensity quit (Ping timeout: 264 seconds)
18:06:50*Intensity4 is now known as Intensity
18:07:47FromDiscord_<Recruit_main707> Gary M is working on fixing the errors of the current one
18:07:56FromDiscord_<Recruit_main707> his can already be used
18:07:58FromDiscord_<Varriount> Anyone know a way to get the "type" of a closure iterator's environment at compile time?
18:09:09leorizeI don't think you can
18:09:16leorizewdym by the "type" of the environment?
18:10:27FromDiscord_<Varriount> Currently a closure iterator's environment is always allocated on the heap, as a separate allocation. I would like to embed the data in the environment of another closure iterator, rather than suffer another pointer indirection.
18:14:11leorize[m]I take it that you are going to exploit the "having to pass param everytime you call the iter"?
18:27:59FromDiscord_<Technicae Circuit> Will proper classes be implemented in Nim anytime soon?
18:27:59*Faulander quit (Read error: Connection reset by peer)
18:28:06Yardanicowdym "proper classes"?
18:28:07Yardanicothey are there
18:28:26disrupteki guess we need more classes.
18:28:28Yardanicowe have inheritance with runtime dispatch and also multimethods (with --multimethods:on)
18:28:28zacharycartercan anyone help me understand why I'm encountering this error from asan sporadically?
18:28:28*Faulander joined #nim
18:28:29disruptekon why oop is dead.
18:28:31zacharycarterhttps://play.nim-lang.org/#ix=2jwL
18:30:11zacharycarterI'm not sure why reallocation is going on either
18:30:14zacharycarteror a copy
18:30:40Yardanicohttps://github.com/nim-lang/Nim/pull/12085 just got merged yay
18:30:41FromDiscord_<Technicae Circuit> Hm
18:30:41disbotMake await a template
18:32:07zacharycarterI'm compiling with `--gc:arc` in my example
18:32:17Yardanico-d:useMalloc ?
18:32:38dom96yay
18:33:01FromDiscord_<Technicae Circuit> Why do tables only accept one type pair?
18:33:15Yardanicobecause nim is statically typed ?
18:33:56zacharycarterooo I didn't realize I needed to use `-d:useMalloc` to use the shared heap
18:34:01Yardanicono, it's not for that
18:34:08Yardanicoit's to make tools like valgrind happier
18:34:17Yardanicoso that nim will use OS's own allocation functions
18:34:19zacharycarteroh
18:34:41Yardanico"Works with valgrind and clang's address sanitizers, compile with --gc:arc -d:useMalloc (and maybe with --debuginfo) for enabling this feature."
18:34:43Yardanicohttps://forum.nim-lang.org/t/5734
18:34:53zacharycarterthe docs say - ```use an alternative runtime that uses destructors and that uses a shared heap via -d:useMalloc
18:35:36zacharycarterinterestingly with useMalloc the error seems to not reoccur
18:35:48Yardanicowell that means that everything's fine :P
18:36:03zacharycarterlol
18:36:31zacharycarterhttps://cdn.vox-cdn.com/thumbor/y_Zt9t_J2sS3RKS-h6SYp3Wzi14=/0x0:900x500/1820x1213/filters:focal(378x178:522x322)/cdn.vox-cdn.com/uploads/chorus_image/image/49493993/this-is-fine.0.jpg
18:36:56Yardanicoxd
18:37:00FromDiscord_<Technicae Circuit> > <Yardanico> because nim is statically typed ?
18:37:00FromDiscord_<Technicae Circuit> @gitterirc golang is statically typed and it accepts multiple types in arrays and maps (tables basically)
18:37:13Yardanicocan you show an example? via a paste service please
18:37:17zacharycarterdoes it?
18:37:22FromDiscord_<Technicae Circuit> Mhm
18:37:31zacharycarterpretty sure hashmaps in go are heterogenous
18:37:31FromDiscord_<Technicae Circuit> Sure
18:37:52FromDiscord_<Technicae Circuit> Let me get the code
18:37:56zacharycartererr not heterogeneous
18:37:58dom96Go allows interface {} probably
18:38:05dom96and you can do the same in Nim
18:38:09dom96Just use RootObject
18:38:16dom96I think I said this to someone already
18:38:19FromDiscord_<Technicae Circuit> How does RootObject work?
18:38:29leorizedon't use RootObj for a hash map
18:38:50leorizethat's like, requiring your objects to be as big as RootObj (which is empty itself)?
18:39:04Yardanicolol
18:39:07PMunchRootObject basically adds some hidden runtime type information to the object
18:39:19Yardanicodo tables understand it?
18:39:24skrylar[m]yup `interface {}` is basically a void pointer
18:39:42leorizeYardanico: if you use `ref`, then yes
18:39:50dom96while RootObject is likely to work, I wouldn't recommend it
18:41:00FromDiscord_<Technicae Circuit> How would the recommended way to be able to use all types be then?
18:41:14leorizedon't
18:41:18dom96You don't ever need all types
18:41:19rayman22201Varriount I think you can do closure.rawEnv to get the environment ptr
18:41:32dom96Explain your use case and we can suggest something concrete
18:42:14FromDiscord_<Technicae Circuit> I need to be able to use multiple types for discord's API
18:42:25Yardanicoobject variants :P
18:42:30FromDiscord_<Technicae Circuit> So i can send an integer with a steing in the same map
18:42:30leorizecertainly
18:42:39leorizeyea object variants
18:42:39FromDiscord_<Technicae Circuit> How does that work? :P
18:42:45leorizelook it up :P
18:42:47leorizeit's in the manual
18:43:07dom96You can likely get away with just using JsonNode
18:43:16FromDiscord_<Technicae Circuit> Oki
18:43:19dom96maybe Discord's API even uses JSON
18:43:32leorize!repo discord
18:43:34disbothttps://github.com/Krognol/discordnim -- 9discordnim: 11Discord library for nim 15 52⭐ 10🍴 7& 6 more...
18:43:41leorize^ you can consult that too
18:43:44Yardanicoit does
18:43:46Yardanicoover websockets
18:44:02dom96of course it does, so there is no excuse not to use JsonNode anyway
18:44:43Yardanicoand it works without any object variants/inheritance (I mean the API objects themselves)
18:44:58*madpata quit (Remote host closed the connection)
18:51:42FromGitter<Bennyelg> ```CC: stdlib_json.nim ⏎ CC: dal.nim`````` [https://gitter.im/nim-lang/Nim?at=5ea486bee5ed621d4dde24ee]
18:52:05Yardanicoyou don't need to care about these warnings unless you use threads
18:52:16FromDiscord_<codic> yeah but that doesn't export to python lol
18:52:47Yardanico?
18:53:00FromGitter<Bennyelg> Buf if i'll want my server to run threads probably I need to apply something ?
18:53:31zacharycarterso if I don't want to use the implicit result var I just use {.noinit.} ?
18:53:37FromGitter<Bennyelg> single threaded server is poor i guess
18:53:49Yardanicoif it's async - not really
18:54:02Yardanicoalso if you use jester you won't need to worry since it uses httpbeast on supported OSes which is multithreade
18:54:03Yardanicod
18:54:08FromGitter<Bennyelg> Yea well, dbs are sync :|
18:54:34dom96benchmark your code before enabling threads
18:54:35FromGitter<Bennyelg> I must learn more on this area
18:54:50FromGitter<Bennyelg> how to @dom96
18:56:00Yardanicowrk2
18:56:04leorizezacharycarter: you will always use the implicit result var :)
18:56:23Yardanicozacharycarter: if you pass noinit that implicit "result" var just won't be initialized at all
18:56:23zacharycarterso how I can I create and return a threadvar in a proc?
18:56:54leorizewhat's your use case?
18:57:15enthus1astleorize i got it working https://forum.nim-lang.org/t/6254
18:57:28enthus1astthank you for hinting me
18:57:37zacharycarterI guess this works? https://play.nim-lang.org/#ix=2jwZ
18:57:38leorizenp :)
18:59:09leorizezacharycarter: lol no
18:59:26leorizethough I'm not sure what you mean by "creating a thread var"
18:59:44leorizethreadvar in procs are {.global.}
18:59:46zacharycarterI want to create something on the thread local heap
18:59:59zacharycarterlike in thread local storage
19:00:06*tane joined #nim
19:00:38leorizeI'm still not sure what you're trying to do
19:00:47zacharycarternormally I'd use `pthread_setspecific`
19:00:52zacharycarterin C
19:01:02leorizewell make a template for this one :P
19:01:21leorizenative threadvars are declared
19:01:39leorizenot a thread-specific hash map
19:02:06zacharycarterokay
19:03:04skrylar[m]isn't a thread specific hash map exactly how pthreads does it
19:09:05zacharycarterso I could just use a global table threadvar then I guess?
19:11:20*luis_ joined #nim
19:16:53zacharycarteroh nevermind I think I get how threadvar works now
19:17:45FromDiscord_<Technicae Circuit> Is there a way to make a function with arguments if you don't know the type?
19:18:02FromDiscord_<Technicae Circuit> Doubt it but it'd be nice
19:18:25Yardanicowell there's "auto" or you can just use generics but pls don't
19:18:54YardanicoI mean I don't think "make a function with arguments if you don't know the type" is a good thing
19:20:19FromDiscord_<Technicae Circuit> How do I use auto?
19:20:35FromDiscord_<Technicae Circuit> And i kinda have to for a python module that I'm testing in Nim
19:20:45Yardanicoyou don't have to
19:20:50Yardanico"proc a(myarg: auto)"
19:21:38FromDiscord_<Technicae Circuit> Thanks :p
19:21:42*luis_ quit (Quit: luis_)
19:22:09*luis_ joined #nim
19:23:28*Jesin quit (Quit: Leaving)
19:23:46*hax-scramper quit (Ping timeout: 244 seconds)
19:24:46FromDiscord_<Technicae Circuit> Apparently auto is invalid
19:24:53Yardanicowell what are you trying to do?
19:25:01Yardanicowe can't help without code
19:26:12*luis_ quit (Client Quit)
19:26:17FromDiscord_<Technicae Circuit> Let me paste it in playground
19:26:41*luis_ joined #nim
19:27:50FromDiscord_<Rika> auto only works when the type is inferrable in compile time no?
19:27:56Yardanicoyes of course
19:28:03FromDiscord_<Rika> same thing with generics
19:28:06FromDiscord_<Recruit_main707> thats what i thought
19:28:06Yardanicoyep
19:28:09FromDiscord_<Rika> so that might be techni's issue
19:29:59*Jesin joined #nim
19:30:03FromDiscord_<Recruit_main707> im gonna need help with this generics, my head hurts already and i dont know what i am doing wrong, pls help
19:30:03FromDiscord_<Recruit_main707> https://play.nim-lang.org/#ix=2jxg
19:30:03FromDiscord_<Recruit_main707> youd rather get this into an actual editor to see the errors without compiling/checking
19:30:34Yardanicowell the error exactly tells you what's wrong
19:30:44Yardanicoyou have two func GetVal*[T] with same definition
19:31:01FromDiscord_<Recruit_main707> there are 35 errors though :P
19:33:51Yardanicowell the errors related to "Get" are very clear too
19:34:07Yardanico compiler doesn't know which T you're talking about because you're only using it as return type
19:34:14Yardanicoyou'll need to explicitly specify it like [:type] too
19:34:18Yardanicofor each .get call
19:34:29FromDiscord_<Recruit_main707> when i do i get other error
19:34:43FromDiscord_<Rika> which is
19:34:51FromDiscord_<Recruit_main707> cannot instantiate: 'Get[voffset]'; got 1 type(s) but expected 2
19:34:51FromDiscord_<Recruit_main707> in expression 'Get[voffset][voffset](t, t.Pos)': identifier expected, but found 'Get[voffset]'
19:35:06FromDiscord_<Recruit_main707> (for this code: `t.Get[:voffset](t.Pos)`)
19:35:40Yardanicoah well
19:35:45Yardanicoyou can fix Get definition pretty easily
19:35:47Yardanicoyou used generics wrong
19:35:50Yardanico"func Get*[T: Offsets](t: Vtable, off: T): T ="
19:36:50FromDiscord_<Recruit_main707> that would work for that example, but Get should also work with ints and etc
19:37:09Yardanicowell I really don't understand what are you trying to do with all this code
19:37:30*madpata joined #nim
19:37:34FromDiscord_<Recruit_main707> ill get you the original code
19:37:56Yardanicoalso you have to remember
19:38:03Yardanicoyou can't do overloading on return type in Nim
19:38:06skrylar[m]this is probably grossly wasteful but my current draft of this [nim] text layout does basically what tex does; makes a box of ex. all the text on one line. although interestingly it does let you get the size of a string as well as lay out the string without processing the string twice as most apis do :think:
19:38:33FromDiscord_<Recruit_main707> Yardanico: i already have only one GetVal function, thats fixed :)
19:38:39Yardanicowell show the code
19:39:04Yardanicobut did you really look into skflatbuffers?
19:39:21FromDiscord_<Recruit_main707> skflatbuffer uses Streams
19:39:24Yardanicoso?
19:39:48FromDiscord_<Recruit_main707> dont really want to use them
19:40:01skrylar[m]i think the suggestion is you yoink the rest of the code that already does what you're doing :b
19:40:06Yardanicoyes
19:40:11FromDiscord_<Recruit_main707> https://github.com/google/flatbuffers/blob/master/go/encode.go all this gets and writes, but as generics
19:40:11Yardanicoyou can easily remove streams from skflatbuffers
19:40:25FromDiscord_<Rika> streams are useful as hell though
19:40:47FromDiscord_<Rika> and you can make a string stream easily anyway so i dont see the issue with having them
19:41:01Yardanico@Recruit as I said there's no return type overloading in Nim
19:41:08leorizestreams are super useful
19:41:13skrylar[m]skcbor actually doesn't use streams and instead uses an "actuator" which is a closure that gets fed a control code and bytes
19:41:24Yardanicoso if you have func Get[T](data: seq[byte]): T = you'll always have to specify what T you're referring to
19:42:00FromDiscord_<Recruit_main707> ye, i know
19:42:14FromDiscord_<Recruit_main707> but the places i do it it errors with that other thing
19:42:20leorizethe way I prefer is Get(data: seq[byte], T: typedesc): T
19:42:28Yardanicooh yeah
19:42:53FromDiscord_<Recruit_main707> Get(data: seq[byte], off: offsets, T: typedesc): T rather?
19:43:14YardanicoGet(T: typedesc, data: seq[byte], off: offsets): T
19:43:22Yardanicoso you'll have the type as first argument, just for easier reading :P
19:43:47leorizedata should be the first argument imo
19:43:52FromDiscord_<Recruit_main707> ok, i thought of this, but it didnt seem very nim-ish
19:43:57Yardanicowhy?
19:44:08FromDiscord_<Recruit_main707> having generics
19:44:10*zacharycarter quit (Ping timeout: 246 seconds)
19:44:22FromDiscord_<Rika> generics wont work with what you want
19:44:23Yardanico"streams" stdlib module has procs like readInt, readUint, etc
19:45:01Yardanicoit uses generics only with arguments with that generic type
19:45:03FromDiscord_<Rika> Yardanico, do you think readXXX() is better over read(typ: typedesc) ?
19:45:12YardanicoI would actually prefer readXXX() ngl
19:45:14FromDiscord_<Recruit_main707> skflatbuffers are not wrong, im just trying to get flatbuffers that are more similar to the "official" ones
19:45:36*matti_ quit ()
19:45:36FromDiscord_<Recruit_main707> so that hopefully i can adapt flatc to support nim
19:45:37Yardanicoyou can always create read(typ: typedesc) and then create procs like readUint which just call the original one
19:45:38FromDiscord_<Rika> why?
19:45:45FromDiscord_<Recruit_main707> which is something essential imo
19:46:31*matti_ joined #nim
19:46:55*matti_ quit (Client Quit)
19:47:26*matti joined #nim
19:47:47FromDiscord_<Elegant Beef> Well prestige if you figure out how to use XGetWindowProperty, let me know, i am currently doing this and it hates me for it https://hatebin.com/reqfgqqdvt
19:47:55FromDiscord_<Elegant Beef> Complains about a nil
19:48:06*Vladar quit (Quit: Leaving)
19:48:10skrylar[m]read(x: var T) :)
19:48:26Yardanico@Elegant Beef what is PPcuchar ?
19:48:33Yardanicoand how does it complain
19:48:43skrylar[m]pointer to a pointer to c characters
19:49:25Yardanicoyou can just not have it as "nil" and it'll be initialized to zeroes which would mean the same in this case
19:51:48skrylar[m]wondering how derpy literate nim would be
19:52:08Yardanicowdym
19:52:13*zacharycarter joined #nim
19:52:44FromDiscord_<Rika> why *is* there no generic hash proc for objects?
19:52:45skrylar[m]eh was thinking of having a script that eats comment lines and turns them in to adoc instead, and then the non-comments become code sections
19:52:58skrylar[m]theres slightly more to literate tools than that, but not much
19:53:46FromDiscord_<Elegant Beef> I mean all the values from my understanding will be intialized by XGetWindowProperty
19:54:05*hax-scramper joined #nim
20:00:15Yardanicowell but what's the error
20:00:38FromDiscord_<Elegant Beef> Attempt to read from nil
20:01:55Yardanicocan you post *full* error? with code too :P
20:02:31FromDiscord_<Elegant Beef> https://hatebin.com/lzsoisjsum
20:02:33FromDiscord_<Elegant Beef> That is the full error
20:02:45FromDiscord_<Elegant Beef> That line causes a attempt to read from nil error
20:03:42Yardanicowhat's on line 694
20:04:18Yardanicoand is the source itself open?
20:04:28FromDiscord_<Elegant Beef> XGetWindowProperty
20:04:37FromDiscord_<Elegant Beef> I posted the full code of that function
20:05:23Yardanicobut I mean the full code of your project so I can test :P
20:05:25FromDiscord_<Elegant Beef> I ensure that activeTWindow cannot be niil
20:05:36FromDiscord_<Elegant Beef> I mean i dont have the nimble setup yet
20:05:37FromDiscord_<Elegant Beef> but
20:05:37FromDiscord_<Elegant Beef> https://github.com/beef331/goodwm
20:06:09FromDiscord_<Technicae Circuit> I'm back
20:06:11FromDiscord_<Technicae Circuit> https://play.nim-lang.org/#ix=2jxf
20:06:18FromDiscord_<Elegant Beef> Need imgui and xlib iirc
20:06:20FromDiscord_<Technicae Circuit> That's the code I'm struggling with
20:06:35*zacharycarter quit (Ping timeout: 246 seconds)
20:08:46FromDiscord_<Rika> @Technicae Circuit client's type cant be inferred with the known data
20:09:13Yardanicodid you check https://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184?
20:09:15Yardanicohttps://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184
20:09:20FromDiscord_<Technicae Circuit> Okay, but if i do `ref PyObject` i get the the following error
20:09:27FromDiscord_<Technicae Circuit> Lemme see
20:12:58FromDiscord_<Technicae Circuit> Nothing there that helps me
20:13:07Yardanicoand what is "coroutine"?
20:14:02FromDiscord_<Technicae Circuit> A coroutine is an asyncronous function
20:14:08Yardanicoi mean in python
20:14:10Yardanicohow is it defined
20:14:19FromDiscord_<Technicae Circuit> In older Python functions async def doesn't exist
20:14:45YardanicoI know
20:14:49FromDiscord_<Technicae Circuit> So the alternative is `func_name = types.coroutine(func_name)`
20:14:56FromDiscord_<Technicae Circuit> O
20:15:27FromDiscord_<Technicae Circuit> It's defined like `let coroutine = pyImport("types").coroutine`
20:15:51FromDiscord_<Technicae Circuit> ~/data/data/com.termux/files/home/hata.nim(14, 33) Error: type mismatch: got <proc (client: ref PyObject, message: ref PyObject){.locks: <unknown>.}> but expected 'PyObject = ref PyObject:ObjectType'` i have gotten this error using ref PyObject
20:15:51disbotno footnotes for `/data/data/com.termux/files/home/hata.nim(14,`. 🙁
20:16:30FromDiscord_<Technicae Circuit> What?
20:17:05FromDiscord_<Technicae Circuit> Disbot shouldn't respond to that :p
20:17:13Yardanicoit should
20:17:13leorizewell disbot don't care :P
20:17:28disruptekdisbot: don't gaf.
20:17:30disboton it. 👍
20:17:43Yardanicotry https://play.nim-lang.org/#ix=2ija @Technicae
20:17:48Yardanicobut really use nim discord libs instead
20:18:04skrylar[m]huh. doesn't work too bad actually
20:18:31skrylar[m]python script that just looks for comment lines that start with `#- ` and then a little bit of switching to put in the `[source,nim]` fences
20:19:07FromDiscord_<Technicae Circuit> O
20:20:17FromDiscord_<Technicae Circuit> Oki
20:20:52FromDiscord_<Technicae Circuit> > <Yardanico> try https://play.nim-lang.org/#ix=2ija @Technicae
20:20:52FromDiscord_<Technicae Circuit> Uh
20:20:56FromDiscord_<Technicae Circuit> Wrong link?
20:21:25Yardanicono, seems like playground lagged or something like that
20:21:31Yardanicohttps://play.nim-lang.org/#ix=2jxI
20:21:32FromDiscord_<Rika> how do i have a generic type X[T, U] also accept one generic? like saying `type X[T] = X[T, T]` or something like that
20:22:35FromDiscord_<Technicae Circuit> Oki
20:23:07Yardanicoalso I wouldn't really be so sure that async from Python side will work properly with nimpy
20:24:43FromDiscord_<Technicae Circuit> I've gotten `Traceback (most recent call last)
20:24:43FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/hata.nim(9) hata
20:24:43FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1198) callMethodAux
20:24:43FromDiscord_<Technicae Circuit> SIGSEGV: Illegal storage access. (Attempt to read from nil?)`
20:24:47FromDiscord_<Technicae Circuit> Yeah i know :p
20:25:06*luis_ quit (Remote host closed the connection)
20:25:11Yardanicowell then I don't know, I don't really use nimpy or python
20:25:45FromDiscord_<Technicae Circuit> Damn
20:25:49FromDiscord_<Technicae Circuit> Okay, thanks anyway
20:25:54Yardanicoi mean idk how to solve that error, maybe try opening an issue in nimpy repo to ask yglukhov how to deal with async and stuff like that
20:26:31Yardanicobut I really recommend you to just use a pure-nim discord lib
20:27:22FromDiscord_<codic> but none exist that work, lol
20:27:28Yardanicowdym
20:27:35FromDiscord_<codic> Discord.nim doesn't work
20:27:48FromDiscord_<Technicae Circuit> I think it's the library side
20:27:50Yardanicoand the other one?
20:27:55FromDiscord_<codic> Which other one?
20:28:03Yardanicohttps://github.com/krisppurg/dimscord
20:28:15FromDiscord_<codic> i didn't even know that exists, lol
20:28:22FromDiscord_<codic> Oh that's maintained, great!
20:28:22FromDiscord_<Technicae Circuit> It's quite complicated :p
20:28:33FromDiscord_<codic> Seems pretty simple
20:28:42FromDiscord_<Technicae Circuit> Not to me ;-;
20:28:45FromDiscord_<codic> What seems complicated about it?
20:29:33Yardanicoit's much less complicated than using nimpy to call into python
20:29:44FromDiscord_<Technicae Circuit> True
20:29:51FromDiscord_<Technicae Circuit> But I'll probably write my own kib
20:29:53FromDiscord_<Technicae Circuit> Lib*
20:29:55FromDiscord_<codic> It seems very simple to me
20:30:05FromDiscord_<codic> Simpler than every async based library I've seen so far
20:30:20FromDiscord_<codic> (not in nim, just in general)
20:30:28FromDiscord_<Rika> most async libraries in nim have looked simpler than any non-nim async library ive seen
20:30:52madpatacheckout lface.gif in dimscord's example folder. Not very professional
20:31:27FromDiscord_<codic> lolwat
20:31:29FromDiscord_<codic> https://github.com/krisppurg/dimscord/blob/master/examples/lface.gif
20:31:33FromDiscord_<Rika> hm?
20:31:41FromDiscord_<codic> Yeah... sadly, that doesn't help me :P
20:33:18*zacharycarter joined #nim
20:33:30FromDiscord_<codic> I wish it had much better designed examples than what it currently has
20:33:38FromDiscord_<codic> > The docs will be out soon or later.
20:33:41FromDiscord_<codic> Welp, no docs
20:33:57Yardanicoit's not so hard to check source code
20:34:05FromDiscord_<codic> true
20:34:20FromDiscord_<codic> I wonder when voice support will come
20:34:23FromDiscord_<codic> > will be added on later
20:35:41FromDiscord_<Rika> ugh, im still heavily irked by the lack of a generic `hash(object): Hash` proc in `hashes`
20:35:50FromDiscord_<Rika> is there a reason this doesnt exist?
20:36:58FromDiscord_<patasuss> you mean a hash function that could hash anything you give it?
20:37:40FromDiscord_<codic> how can i have a `varargs` supporting all types? `varargs[`$`]`?
20:37:43*zacharycarter quit (Ping timeout: 246 seconds)
20:37:49FromDiscord_<Rika> yes patasuss
20:38:15leorizeRika: because no one really need one
20:38:31FromDiscord_<Rika> it wouldnt hurt to have one would it?
20:38:46leorizeyes it would :)
20:39:10leorizeto this day the generic `$` for objects is still considered one of the harmful inventions
20:39:27FromDiscord_<codic> but is that right?
20:39:27FromDiscord_<patasuss> hashing is something that should be well thought about. Not just sth to be generated willy nilly
20:39:46*xcm quit (Read error: Connection reset by peer)
20:40:07FromDiscord_<codic> WAIT, so could I even just use ````thing: `$` ``` for any sort of type? Or would i do `[T](thing:T)` (generics)?
20:40:20FromDiscord_<Rika> we're not talking to you codic
20:40:49FromDiscord_<codic> I know, just thought of it because leorize said
20:40:49FromDiscord_<codic> > <leorize> to this day the generic $ for objects is still considered one of the harmful inventions
20:41:04FromDiscord_<Rika> you misunderstood leorize then
20:41:11Yardanicowell with [T](thing: T) you will be able to accept any type, yes
20:41:18FromDiscord_<Rika> leorize, why is it harmful? i fail to see
20:41:26Yardanicobut you'll need to check inside the proc for different types with "when" statements
20:41:41Yardanicowhich is the same to just writing the overloaded procs for different types
20:41:41FromDiscord_<codic> So generics, gotcha. So can I do `[T](thing: varargs[T])`?
20:41:46Yardaniconot sure
20:41:50*xcm joined #nim
20:41:55FromDiscord_<codic> Yup I know I'd have to check inside proc
20:41:56FromDiscord_<Rika> you can, but you can only still accept one type then
20:42:01FromDiscord_<codic> Alright, I'd try myself
20:42:02FromDiscord_<codic> Oh
20:42:09FromDiscord_<codic> So using a $ is the only way for varargs?
20:42:19FromDiscord_<Rika> using a $ will convert them all into strings
20:42:27FromDiscord_<patasuss> $ has nothing to do with generics or varargs
20:42:30Yardanicoyes, so in the end you'll only deal with one type
20:42:32FromDiscord_<Rika> if you think that's useful, then sure
20:42:34Yardanicocoz $ returns a string
20:42:37FromDiscord_<codic> o
20:42:40FromDiscord_<codic> welp
20:43:00FromDiscord_<Recruit_main707> about generics dont gtting value assigned by return type, will that be a thing?
20:43:06Yardaniconot really
20:43:10FromDiscord_<Recruit_main707> it would be so cool
20:43:18FromDiscord_<Rika> i dont understand your question
20:43:32Yardanicosee https://forum.nim-lang.org/t/3025
20:44:30leorizereturn type overloading is evil
20:44:37leorizeand no sane prog land has never done it
20:44:39Yardanico@Rika basically you'll have proc myproc[T](data: int): T and if you call it like "let myint: string = myproc(5)" myrpoc will get "string" for T
20:44:42leorizelang*
20:45:12leorizeRika: it causes trouble with generic binding, and even more trouble to people who like to import modules partially
20:45:14FromDiscord_<Recruit_main707> no sane lang has this metaprogramming either
20:45:31Yardanicodepends on what you mean by "metaprogramming"
20:45:39leorizewell lisp have it, even more than us
20:45:41Yardanicoand yeah, I don't think we need return type overloading, you already have "var" types
20:45:49FromDiscord_<Rika> lisp is super insane tho 😛
20:45:55*silvernode quit (Ping timeout: 244 seconds)
20:45:55leorizeit's not about var type tbh
20:46:14FromDiscord_<Rika> Yardanico: damn, i see, that looks evil
20:46:15madpatawill things like this ever be possible? https://play.nim-lang.org/#ix=2jxQ
20:46:16Yardanico@Rika not really
20:46:34leorizeit's about how `foo()` means different thing in different context with no visible way to distinguish them
20:46:35madpataoh wait, didn't read the forum post
20:46:47FromDiscord_<Rika> madpata, you can just discard since none() is default 😛
20:47:23madpatadamn, never thought about it
20:47:33madpatabut thanks
20:47:38leorizeif you wanna use none, it's none(T)
20:47:53FromDiscord_<Rika> madpata, https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/options.nim#L124 LOL
20:48:02FromDiscord_<Rika> none() is literally a discard LOL
20:48:14Yardanicothat is an implementation detail
20:48:34PMunchYou can also just call "return" or even "return result". The default value for Option[T] is none(T)
20:48:51madpatayeah, never looked into it. was just a bad habit of mine I guess
20:48:58FromDiscord_<Rika> i said that PMunch
20:49:01FromDiscord_<Rika> smhhhh T_T
20:49:58PMunchYou said you could "discard" which is also true
20:50:11PMunchI was just offering up some more ways of doing it :)
20:50:33FromDiscord_<Rika> i seem to have recalled sending a message i never actually sent
20:50:40madpatabut maybe I'll stick to "return none[T]()" because it's a bit more explicit about that something gets returned
20:50:44FromDiscord_<Rika> my memory is as reliable as discord...
20:51:06PMunchmadpata, to anyone familiar with Nim you know that it has default return values
20:51:10PMunchSo it shouldn't be an issue
20:51:31PMunchBut yeah, you can also do none(T) instead of none[T]() which is a lot easier to type (at least on this layout)
20:53:26madpataI'm not always a fan on default returns values (or result being returned implicitly). My C/C++/Java experience might have ruined me in that aspect, but I like being explicit there.
20:54:04leorizeinstead of typing `return smt`, you can do: `proc foo(): Option[int] = none int`
20:57:24FromDiscord_<Ahri Fox> im new to nim. trying to get a proc to accept a type i defined, it doesnt wanna (maybe theres some syntax i dont understand to do that). for those curious, writing a genetic algorithm. https://play.nim-lang.org/#ix=2jxT
20:57:59Yardanico"creature = array2d" should be "creature: array2d"
20:58:11FromDiscord_<Ahri Fox> thank you
20:58:23PMunchmadpata, you get used to it, and it's actually quite a nice feature once you know how to wield it
20:58:29Yardanicoah I see what you're trying to do
20:59:15PMunchAnd `result` is great, it means one less thing to name, and you can easily follow what you're returning through the entire procedure. Not to mention the performance benefit
20:59:17madpataPMunch I'll try my best to change my habit
20:59:31Yardanicodo you really need to return something from "runCode"?
20:59:39PMunchI mean there's nothing wrong with being explicit about returns in Nim
20:59:54madpatayeah result is great, already been using that. just have been returning them explicitly :p
20:59:59FromDiscord_<Ahri Fox> yes, to return the altered array (err... nothing is altered yet, havent wrote it yet)
21:00:03FromDiscord_<Rika> how do i check if a type complies with a concept on compile time?
21:00:43Yardanicothen something like https://play.nim-lang.org/#ix=2jy0 @Ahri
21:00:47PMunchmadpata aah, that would indeed look a bit strange :P Here's an article on using the implicit return thing in some neat ways by the way: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html
21:01:04FromDiscord_<Ahri Fox> thank you
21:01:58Yardanicoalso you can always do randomize() to randomize by a different value each time
21:02:11Yardanicowithout arguments I mean, to have a different seed each time
21:02:45FromDiscord_<Ahri Fox> thanks for the tip. for now i want it deterministic though, but when the code is completed then i'll switch it to that
21:04:42Yardanicoah ok
21:04:57PMunchRika, you could to a when compiles statement..
21:05:03PMunchBit of a hack though..
21:05:12FromDiscord_<Rika> eeh...
21:08:01madpataPMunch, nice article. Have been using inline if and stuff. Very nice.
21:08:20Yardanicomadpata: also don't forget you can have case expressions too :)
21:08:34Yardanicoif you cover all cases of course
21:08:36PMunchThanks, yeah I was surprised myself when I started researching that article about how deep it goes
21:08:51PMunchIt was prompted by someone asking for a default value for things that could throw
21:09:20PMunchSo I tried `var x = try: parseFloat("hello") except: 0.0` and it worked :)
21:09:43madpataAnother question: Would there be any reason to not allow thngs like this? https://play.nim-lang.org/#ix=2jy2
21:09:46YardanicoI guess "let a = try: parseFloat("100.0") except ValueError: 0.0" works because otherwise the code will throw so "a" won't really get used later anyway?
21:09:46PMunchYardanico, that's also mentioned in the article :)
21:09:52*zacharycarter joined #nim
21:09:56madpataPMunch I love nim for those small productivity things
21:10:09Yardanicomadpata: Foo[int](val: 1)
21:10:17Yardanicoalso "return" is not needed here :)
21:10:36PMunchYardanico, what do you mean? That statement will never throw, it will be the result of the parse if it succeeds, otherwise 0.0
21:10:40madpataYardanico I know what the fix would be. I just wondered why the [int9 is needed
21:11:50madpatajust seems like sth the compiler could infer/assume
21:11:51PMunchYou could also do it like this: https://play.nim-lang.org/#ix=2jy4
21:12:07madpataoh damn, nice.
21:12:13PMunchWell "1" can be int, uint, int64, uint8, etc
21:13:07madpatajust make number suffixes required /s
21:13:13FromDiscord_<Rika> lol
21:13:31FromDiscord_<Recruit_main707> No
21:14:18PMunchHmm, seems like Nim is just picky in this case: https://play.nim-lang.org/#ix=2jy5
21:14:20*zacharycarter quit (Ping timeout: 244 seconds)
21:15:10FromDiscord_<Recruit_main707> That seems like it should work
21:15:28madpatabut sadly doesn't
21:15:53FromDiscord_<Recruit_main707> What happens if you don’t fill the generic?
21:16:19FromDiscord_<Recruit_main707> (Don’t specify [int])
21:16:46madpatathrows an error. Missing generic argument
21:18:05FromDiscord_<Recruit_main707> And Foo[int](val:... ?
21:18:29FromDiscord_<Technicae Circuit> How would i not include the stdlib in Nim?
21:19:20FromDiscord_<Recruit_main707> You guys are trying hard, respect, but I don’t think that’s possible
21:19:20madpataTechnicae Circuit --os:standalone maybe?
21:19:31FromDiscord_<Technicae Circuit> Thanks
21:19:49FromDiscord_<Recruit_main707> Maybe it is :P
21:20:00*hax-scramper quit (Read error: Connection reset by peer)
21:20:17*hax-scramper joined #nim
21:20:21Yardanicothere's also --os:any
21:20:30Yardanicoand what do you mean by "not include the stdlib"?
21:20:33Yardanicoyou mean C stdlib or wat?
21:20:42madpataprobably means the system module
21:20:44Yardaniconim "system" module is ALWAYS included in your files
21:20:49Yardanicoimported* :)
21:20:52*letto_ joined #nim
21:21:05Yardanicobut of course it has a lot of "when" stuff to differentiate between different OSes and stuff
21:23:18*letto quit (Ping timeout: 265 seconds)
21:24:50*hax-scramper quit (Ping timeout: 260 seconds)
21:25:27*hax-scramper joined #nim
21:29:20FromDiscord_<Technicae Circuit> I don't want to include anything at all that I don't use :p
21:30:22*tane quit (Quit: Leaving)
21:31:47leorizedead code elimination is on by default
21:31:52leorizeif you don't use something, it won't get in
21:34:48*hax-scramper quit (Read error: Connection reset by peer)
21:35:07*hax-scramper joined #nim
21:35:38enthus1astdoes one know how to use the macros.quote do with other quoting chars than ``? No char i use seem to work.
21:35:44enthus1asti want do do []=(`entity`.world.`storeName`, `entity.id`, `componentObj`)
21:35:52enthus1astto do
21:38:00FromDiscord_<Technicae Circuit> Can someone explain what ```Traceback (most recent call last)
21:38:00FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1026) testPy_wrapper
21:38:01FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1015) noinline
21:38:01FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/hata_cmds.nim(7) test
21:38:01FromDiscord_<Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1223) getAttr
21:38:01FromDiscord_<Technicae Circuit> SIGSEGV: Illegal storage access. (Attempt to read from nil?)``` means?
21:38:08FromDiscord_<Technicae Circuit> Oop-
21:38:21FromDiscord_<Technicae Circuit> I forgot to use playground 😅
21:38:29liblq-devit means that you tried to read/write to a nil value.
21:38:57liblq-deveg. a null pointer, or an uninitialized ref object
21:39:26Yardanicoso is it a bug or not if json.to macro doesn't work if the type to deserialize has a field like "myfield: Option[MyOtherTyp]" where MyOtherTyp is "ref object" ?
21:39:38Yardanicoit works if it's "object" but not when it's "ref object"
21:39:39FromDiscord_<Technicae Circuit> How would i fix that then?
21:39:45FromDiscord_<Technicae Circuit> Hm
21:39:58enthus1astYardanico nope ref will not work
21:40:22Yardanicoenthus1ast: strange, I thought it would work, isn't it easy to initialize a "ref object" in json.to macro?
21:40:28Yardanicojust add a "new" call before assigning stuff
21:41:11enthus1asti tried to patch json for one of my game projects but the macro stuff there blew my mind
21:41:51enthus1astalso the serializer and deserializer is limited
21:41:59YardanicoI know, it's for discord api lib
21:42:05Yardanicothere's A LOT of optional fields
21:42:54dom96You don't need to define them all up front
21:43:02dom96also, they more than likely shouldn't be refs
21:43:12Yardanico@dom96 well I know, it's just that this lib used them as "ref object" :)
21:43:28dom96yes, and that's a bug
21:43:35dom96should get a better error message at least
21:43:58Yardanicoyeah it crashed at runtime because of assertion in options.nim so I was a bit confused for a few mins :P
21:44:54enthus1astdom96 do you maybe know how i could use `[]=` in macro.quote ?
21:45:30dom96nope
21:45:46*zacharycarter joined #nim
21:46:51enthus1astmh ok; there is a parameter to change the quoting chars, but nothing i type in there seems to be allowed? dont kno
21:46:52enthus1astw
21:47:45*liblq-dev quit (Ping timeout: 240 seconds)
21:47:58FromGitter<dumjyl> The custom quote op acts like a prefix operator, not something that surrounds like backticks.
21:49:06PMunchenthus1ast, yeah I've asked about that before
21:49:09FromDiscord_<sealegs> Yardanico, its fixed on the devel branch
21:49:15Yardaniconot for Embed though
21:49:20PMunchSeems like no one knows how to pass that parameter..
21:49:38Yardanicoall "EmbedThumbnail" etc should be just "object" to
21:49:39Yardanicoo
21:49:41enthus1astmaybe
21:49:44Yardanicoalso I've found a few other bugs
21:50:01enthus1astthere should be an equivalent for every []= and friends in the stdlib
21:50:09FromDiscord_<sealegs> For embed, all fields are options as the discord dics say
21:50:18FromDiscord_<Yardanico> no, you didn't understand me
21:50:26*zacharycarter quit (Ping timeout: 260 seconds)
21:50:33FromDiscord_<Yardanico> the types should be "EmbedThumbnail = object" and so on for all types which are used in other fields as Option[Type]
21:50:45FromDiscord_<Yardanico> you did this to types like User but not for Embed subfields
21:50:47*liblq-dev joined #nim
21:51:35FromDiscord_<Yardanico> @sealegs line 613 in object.nim -> should be "get(result.party).size = $data["party"]["size"][0].getInt()" if you want to get CurrentSize or you might want to parse them both
21:51:39PMunchenthus1ast, you an do this: https://play.nim-lang.org/#ix=2jyd
21:52:10PMunchcan*
21:52:18FromDiscord_<Yardanico> PRESENCE_UPDATE line 385 - you should have checks for "cl.cache.guilds[presence.guild_id]" and "guild.members[presence.user.id]" because for me they crashed because they key wasn't there
21:52:25FromDiscord_<Yardanico> so I had to add two checks for the existence of these keys
21:52:55FromDiscord_<sealegs> huh for some reason its workinf for me
21:53:00enthus1astah i see PMunch nice workaround
21:53:03enthus1astthank you
21:53:11FromDiscord_<sealegs> sorry for the typos btw
21:53:13FromDiscord_<Yardanico> I ran it in this Nim server so there's quite a lot of people with different presence updates and stuff
21:53:26FromDiscord_<Yardanico> I was porting https://github.com/Yardanico/ircord to your lib
21:53:44FromDiscord_<sealegs> Ohhhh wait, I know why
21:54:21FromDiscord_<Yardanico> also all handlers should have {.async.} and you should "await" them in your event handling instead of just calling, because making them synchronous doesn't make sense
21:54:26PMunchenthus1ast, I could've sworn that I found another workaround when I was creating macroutils
21:54:34PMunchBut I can't figure out what that was
21:54:35FromDiscord_<Yardanico> it's easy to change, I did that for message_create and message_update and it just worked
21:55:01FromDiscord_<sealegs> I see.
21:55:31FromDiscord_<sealegs> If a guild reaches a lot of members the library doesn't handle uncached members.
21:55:58FromDiscord_<Yardanico> Also for some reason message_update events weren't handled because of this return here https://github.com/krisppurg/dimscord/blob/devel/dimscord/gateway.nim#L598
21:55:58FromDiscord_<Yardanico> after removing it I could handle message_update events
21:56:25FromDiscord_<Yardanico> well actually I didn't just remove it, I moved it to "if cl.cache.preferences.cache_dm_channels and cl.cache.dmChannels.hasKey(msg.channel_id)" on line 609
21:56:38FromDiscord_<Yardanico> but I removed the return
21:57:16FromDiscord_<sealegs> Okay
21:57:32YardanicoI'll try making a PR with some of these changes so you can easier understand what I meant
21:57:34Yardanicoto "devel" branch
21:58:00FromDiscord_<sealegs> Thanks, really appeciate it.
21:59:03FromDiscord_<Ahri Fox> beginner ahri again, sorry for intruding. i got a cannot evaluate at compile time for n in a for loop , i imagine its due to me messing up something with creatureArray, somehow https://play.nim-lang.org/#ix=2jyf
21:59:05*hax-scramper quit (Read error: Connection reset by peer)
21:59:30*NimBot joined #nim
21:59:52*hax-scramper joined #nim
22:00:57PMunchAhri Fox: https://play.nim-lang.org/#ix=2jyj
22:01:27PMunchYour array3d type is an array of your creatureArray tuple
22:02:05PMunchTuples can be accessed by [], but only when the value is known at compile-time
22:02:33PMunchSo that .code could be replaced by [1]
22:02:44PMunchThat's why the error might be a bit confusing
22:02:53PMunch@Ahri Fox ^
22:03:44FromDiscord_<Ahri Fox> oh alright, thanks!
22:04:15PMunchOh well, I'm off
22:04:17PMunchHave fun
22:04:18*PMunch quit (Quit: leaving)
22:06:50*couven92 quit (Ping timeout: 260 seconds)
22:14:15*hax-scramper quit (Ping timeout: 240 seconds)
22:15:06FromDiscord_<Generic> on request of @Recruit_main707: https://cdn.discordapp.com/attachments/371759607934353448/703729945586696212/unknown.png
22:16:43*hax-scramper joined #nim
22:20:13*couven92 joined #nim
22:23:46FromDiscord_<codic> :O
22:26:02*liblq-dev quit (Quit: WeeChat 2.7.1)
22:32:26dom96Generic: love it.
22:33:15FromDiscord_<Recruit_main707> go out there and hit your work partners and bosses with the nim or nothin'
22:35:08FromDiscord_<sealegs> Nice image
22:36:51FromDiscord_<Ahri Fox> why cant creature.vars[whatever] by assigned to? tuples are mutable right https://play.nim-lang.org/#ix=2jyW
22:37:49Yardanicobecause you need to pass it as "var T" if you want it to be mutable in the procedure
22:37:58Yardanicohttps://play.nim-lang.org/#ix=2jzo
22:38:34*someunknownuser joined #nim
22:39:11FromDiscord_<Ahri Fox> oh adding a var, i guess that makes sense
22:39:30FromDiscord_<Ahri Fox> sorry for asking so much
22:40:36Yardanicoit's okay
22:40:46YardanicoBut I'd suggest you to read https://narimiran.github.io/nim-basics/
22:46:30FromDiscord_<Rika> TUPLES ARE MUTABLE?!
22:47:13Yardanicoehm of course lol?
22:47:17Yardanicoif you declare them as "var"
22:47:19Yardanicoand pass them as "var"
22:48:06FromDiscord_<Rika> . -.
22:48:32FromDiscord_<Rika> my disappointment is immeasurable and my day is ruined
22:48:59Yardanicowell I got that reference
22:50:25FromDiscord_<Recruit_main707> lol Rika
22:51:35FromDiscord_<Rika> Man and here i was, thinking "no way tuples can be mutable" then Mr "var" comes along and says "lol no"
22:51:40skrylar[m]welp. greedy wrap done. now for the uh, less fun ones.
22:51:42FromDiscord_<Recruit_main707> That’s why we have a let
22:52:09skrylar[m]let annoys me because i want to replace a previous let binding with a new one line any sane language with let bindings
22:52:11skrylar[m]but it says ARRR U NO DO
22:53:10skrylar[m]oh well it beats an army of match statements in v/rust to deal with errors from every function call
22:53:33FromDiscord_<Rika> What
22:53:37FromDiscord_<Rika> I don't understand your issue
22:54:29skrylar[m]was trying to shadow a `let` with another `let` in the same block and it wouldn't let me do it
22:54:33skrylar[m]elixir lets you do it
22:56:31*zacharycarter joined #nim
22:56:50FromDiscord_<Rika> That just violates the point of a let tho no?
22:57:15skrylar[m]noh. it doesn't change the original value, it changes the binding
22:57:47skrylar[m]let a = 5 #a1 is now 5
22:57:47skrylar[m]let a = a + 5 #a1 is still 5 but any code from this line down gets a2
22:58:54FromDiscord_<Venator> I'm getting this warning: game_types.nim(13, 8) Warning: method has lock level <unknown>, but another method has 0 [LockLevel]
22:59:13FromDiscord_<Venator> is there any info about this lock level stuff? I was only able to find one github issue when searching
23:00:41FromDiscord_<Rika> Yeah I think that defeats the purpose of a let
23:04:21*FromGitter quit (Remote host closed the connection)
23:04:21*oprypin quit (Quit: Bye)
23:04:39*oprypin joined #nim
23:04:51*FromGitter joined #nim
23:13:43skrylar[m]https://gist.github.com/Skrylar/179648d5856ae49087ad34a87d0740f9 will probably regret using TeX as the basis for this layout system, but we'll see
23:18:07*xcm is now known as Guest21104
23:18:07*Guest21104 quit (Killed (orwell.freenode.net (Nickname regained by services)))
23:19:55*xcm joined #nim
23:25:30*someunknownuser quit (Quit: someunknownuser)
23:29:43*leorize quit (Ping timeout: 240 seconds)
23:30:55*enthus1ast quit (Remote host closed the connection)
23:34:44FromDiscord_<Technicae Circuit> ~~Imagine if Nim could make haxe code~~
23:35:51zacharycarterWhy not just use Haxe?
23:35:51*rockcavera quit (Remote host closed the connection)
23:36:53FromDiscord_<Technicae Circuit> ~~Because Nim is superior!~~
23:37:02FromDiscord_<Technicae Circuit> And i wasn't saying it should
23:37:08FromDiscord_<Technicae Circuit> I'm just saying imagine
23:37:25FromDiscord_<Technicae Circuit> If Nim could though that could be OP
23:37:47FromDiscord_<Technicae Circuit> Not only would it be able to make C, C++, ObjC and JS
23:38:00FromDiscord_<Technicae Circuit> But it would have access to anything Haxe could
23:38:14FromDiscord_<Technicae Circuit> But i prefer Nim how it is now
23:38:17zacharycarterI don't really get the appeal
23:38:31FromDiscord_<Technicae Circuit> Wdym?
23:38:40FromDiscord_<Technicae Circuit> Appeal of Haxe?
23:38:43zacharycarterI don't understand why you'd want to generate Haxe from Nim
23:38:49zedeuswell, you can do the opposite https://github.com/RapidFingers/Craxe
23:38:52FromDiscord_<Technicae Circuit> I don't either
23:38:54zacharycarterif it can already compile to C/C++
23:38:59FromDiscord_<Technicae Circuit> Oo cool
23:39:29zacharycarterseems kind of pointless - why not just compile Haxe straight to C/C++?
23:39:43zacharycarternone of this makes much sense to me
23:40:08FromDiscord_<Technicae Circuit> Yeah
23:40:16FromDiscord_<Technicae Circuit> Neither to me :p
23:40:34*Guest96344 quit (Ping timeout: 265 seconds)
23:41:15skrylar[m]you have to remember haxe was made by `ambitious frenchmen` who had to deal with shitty software stacks on hand and made haxe to medicate their suffering
23:41:41zacharycarterI think if you like Java and you don't want to deal with C/C++ then Haxe might be useful
23:42:05skrylar[m]well haxe also was to replace actionscript
23:42:08zacharycarteryeah well Haxe's syntax and OO rigidness induces suffering IMO
23:42:21skrylar[m]so your flash games and the server shared the same code
23:42:36skrylar[m]i don't know that it makes much sense to use the java/c#/php backends anymore
23:43:18skrylar[m]haxecpp does produce pure c++ (and its builds are slooooow) and hashlink can either run in jit mode or transpile to c
23:44:59zacharycarterI remember when people said that everyone would be reusing JS with NodeJS
23:45:26FromDiscord_<Technicae Circuit> Wdym?
23:45:51zacharycarterThat client and server JS apps would be sharing code
23:46:14FromDiscord_<Technicae Circuit> They do if you use NodeJS for the server :p
23:46:15skrylar[m]dont some of them
23:46:34FromDiscord_<Technicae Circuit> I use Python for both most of the time
23:46:35*leorize joined #nim
23:46:46FromDiscord_<Technicae Circuit> But I'm switching to Nim slowly
23:46:47zacharycarterSharing code != using the same language
23:46:54zacharycarterit means actually reusing code
23:46:59FromDiscord_<Technicae Circuit> Ik
23:47:18zacharycarteryou might reuse some small portions of your code but for the most part the problem domains are so different you're not resuing much
23:47:53FromDiscord_<Technicae Circuit> True
23:47:56skrylar[m]i kind of liked haxe.. also they have stuff like flixel
23:48:08zacharycarterit's too much like Java for me
23:48:22skrylar[m]hmm i didn't mind its c#-ness
23:49:34skrylar[m]v is interesting a little
23:49:38FromDiscord_<Technicae Circuit> :p
23:49:42*martinium joined #nim
23:50:09zacharycarterV is interesting in that it's making money and is essentially vaporware
23:50:36skrylar[m]i mean. you can use it to make stuff. and its tiny
23:50:45skrylar[m]Red is more vaporish than V
23:51:52skrylar[m]hcr doesnt work on windoze
23:54:27*krux02_ joined #nim
23:54:44*enthus1ast joined #nim
23:54:56*rockcavera joined #nim
23:57:15*krux02 quit (Ping timeout: 240 seconds)