00:00:53 | * | ftsf joined #nim |
00:07:13 | FromGitter | <jason_koch_twitter> nim-fswatch |
00:07:17 | FromGitter | <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:28 | FromDiscord_ | <Varriount> rayman22201: So I was looking over the Rust article on async procedures |
01:13:00 | FromDiscord_ | <Varriount> They actually do something quite similar to Nim, just with more optimizations. |
01:13:26 | rayman22201 | no. It's fairly different. |
01:13:33 | rayman22201 | yes, they do more optimizations |
01:13:55 | rayman22201 | but the fundamental idea is different. |
01:14:21 | zacharycarter | I'm using kakoune + nimlsp but jump to definition doesn't seem to be working at all |
01:15:05 | FromDiscord_ | <Varriount> rayman22201: The whole state machine thing is just another optimization. The Nim compiler could do it with closure procedures and iterators. |
01:15:34 | rayman22201 | Yes, the nim compiler can do it. No it's not just another optimization. |
01:15:56 | rayman22201 | It's run-time dispatch vs. compile time dispatch |
01:16:08 | rayman22201 | like comparing templates to interfaces |
01:16:13 | rayman22201 | in C++ |
01:16:20 | FromDiscord_ | <Varriount> I don't follow. Which one is doing the compile time dispatch? |
01:16:26 | rayman22201 | the state machine |
01:16:31 | rayman22201 | the rust thing |
01:16:47 | rayman22201 | I'm going to try and draw a crappy picture lol. |
01:17:58 | FromDiscord_ | <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:26 | FromDiscord_ | <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:32 | rayman22201 | Nim allocates a new Future every time await is called. |
01:19:35 | rayman22201 | at run time |
01:19:45 | rayman22201 | and a new future callback |
01:20:02 | FromDiscord_ | <Varriount> Yes. That's not compile time or static dispatch. That's heap vs stack allocation. |
01:20:23 | rayman22201 | Yes. I applogize. It was meant as an analogy. Not a direct comparison |
01:20:43 | rayman22201 | heap vs. stack is the correct distinction. You are correct. |
01:20:50 | FromDiscord_ | <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:06 | rayman22201 | Araq and I have a way. I can do it. I just don't have time |
01:21:13 | FromDiscord_ | <Varriount> You could probably use cast and a bunch of other hacks though. |
01:21:47 | FromDiscord_ | <Varriount> I apologize if I'm coming off as a bit abrupt. It's been a long week. |
01:22:19 | rayman22201 | The 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:22 | rayman22201 | no worries :-) |
01:22:34 | rayman22201 | hard to explain this stuff over text also |
01:22:38 | FromDiscord_ | <Varriount> I agree. |
01:22:55 | FromDiscord_ | <Varriount> I'm on Mumble, though disruptek seems to be silent. |
01:23:40 | rayman22201 | lol. 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:26 | zacharycarter | if 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:44 | disruptek | shared. |
01:34:58 | zacharycarter | thanks |
01:35:21 | disruptek | basically, it's happy with a thread accessing it if the whole subgraph can move. |
01:35:31 | zacharycarter | gotcha |
01:35:51 | FromDiscord_ | <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:12 | disruptek | what value do you think they should have? |
01:36:13 | FromDiscord_ | <Elegant Beef> ` var keyConf = newKeyConfig(keycode.cuint, Mod4Mask,proc() = goToWorkspace(actualNum))` |
01:36:13 | FromDiscord_ | <Elegant Beef> This line for instance |
01:36:25 | FromDiscord_ | <Elegant Beef> it only calls the last iterated value IE 8 in this case |
01:37:05 | FromDiscord_ | <Elegant Beef> actual num is an immutable value declared at the for loop level |
01:37:25 | FromDiscord_ | <Elegant Beef> for loop child level* |
01:37:50 | FromDiscord_ | <Elegant Beef> Full loop here |
01:37:50 | FromDiscord_ | <Elegant Beef> https://hatebin.com/eawrmrsdpc |
01:40:50 | * | rockcavera joined #nim |
01:41:48 | FromDiscord_ | <codic> Nim in action is an amazing book! |
01:42:01 | FromDiscord_ | <codic> Props to whoever made it |
01:42:08 | FromDiscord_ | <codic> Props to whoever wrote it |
01:42:17 | FromDiscord_ | <codic> A very good beginner resource |
01:42:57 | leorize[m] | @Elegant Beef use sugar.capture |
01:43:10 | FromDiscord_ | <codic> So is https://narimiran.github.io/nim-basics/, and of course the original nim docs |
01:47:48 | dchem | hi 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:20 | rayman22201 | @Varriount: one last thing. The chronos impl: https://github.com/status-im/nim-chronos/pull/45 |
01:51:21 | disbot | ➥ [WIP]: AsyncChannels[T]. |
01:51:27 | rayman22201 | ok. dinner. bye :-) |
01:53:41 | * | voltist joined #nim |
01:54:58 | voltist | Any 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:41 | codic | Hey, example on https://nimyaml.org/ ues an object, would using a table also work for this purpose? |
01:55:45 | codic | * Hey, example on https://nimyaml.org/ uses an object, would using a table also work for this purpose? |
01:56:12 | codic | (double message because matrix edits transfer to irc reposts beginning with a star) |
01:57:59 | * | chemist69 quit (Ping timeout: 265 seconds) |
02:05:19 | dchem | voltist, try this: {.importcpp: "$$(#)".} |
02:06:38 | dchem | Here's more doc for escape characters for js interop: https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#javascript-interoperability |
02:06:54 | voltist | dchem: That works, thanks. Do you also happen to know why my compiled JS doesn't contain any of the procs I defined? |
02:08:03 | dchem | voltist, not sure |
02:08:49 | voltist | Ok. It's a weird issue... |
02:10:38 | dchem | voltist, I mean the example says jQuery, but I'm not seeing where they're importing the jquery stuff |
02:11:40 | voltist | It's the `proc jq(selector: JsObject): JsObject {.importcpp: "$(#)".}` |
02:12:50 | dchem | no I mean I get that, but how is jquery source being pulled in? |
02:13:16 | dchem | or is it just making a delegate call |
02:13:35 | voltist | I have no idea |
02:13:36 | dchem | I guess it's assuming jquery is loaded already? |
02:13:45 | * | muffindrake quit (Ping timeout: 272 seconds) |
02:14:59 | voltist | My 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:11 | dchem | h |
02:15:13 | dchem | ah |
02:15:57 | * | muffindrake joined #nim |
02:17:07 | dchem | well |
02:17:24 | dchem | voltist, the js ffi is to use js library from within nim executible, isn't it? |
02:18:35 | dchem | voltist, what are you trying to do? compile the nim code into js or use js library in nim? |
02:20:04 | voltist | This 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:09 | voltist | Ah I've solved it |
02:23:17 | voltist | Forgot to include {.exportc.} :/ |
02:23:55 | * | disruptek is now known as asd |
02:25:58 | dchem | Ah, ok, that will do it :D |
02:26:07 | * | asd is now known as disruptek |
02:26:17 | shashlick | @voltist hey buddy, finally figured out a reliable way to wrap openssl |
02:27:03 | voltist | shashlick: Neat! |
02:27:18 | voltist | Something quicker and easier than the rig we had going? |
02:27:35 | shashlick | https://github.com/nimterop/nimterop/blob/master/tests/rsa.nim |
02:28:37 | shashlick | I'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:02 | shashlick | Rendered output is several tens of thousands of lines |
02:29:53 | voltist | Have you implemented that recursive header import thing in nimterop, or just figured out how to do without it? |
02:30:45 | shashlick | Nope not doing that |
02:31:16 | shashlick | But this way, if you specify five headers that should be imported, they get processed and duplicates get eliminated |
02:31:25 | shashlick | Including with recursion |
02:31:40 | shashlick | Unlike multiple cimport calls |
02:31:50 | voltist | Ah cool |
02:32:25 | shashlick | No need to include in any particular order |
02:34:53 | voltist | I see |
02:35:16 | voltist | Sounds good |
02:35:25 | FromDiscord_ | <Elegant Beef> Also sorry leorize didnt say thanks 😄 |
02:38:04 | shashlick | on 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:09 | shashlick | so 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:13 | FromDiscord_ | <Zed> What cool things have you guys made with nim? |
02:56:39 | dchem | voltist, for what it's worth: https://github.com/nim-lang/Nim/pull/14111 |
02:56:40 | disbot | ➥ Fixes #14110 |
02:56:55 | voltist | Nice one |
02:57:30 | FromDiscord_ | <Elegant Beef> Zed, im currently working on a tiling window manager using nim |
02:58:03 | voltist | Elegant Beef, woah! |
02:58:05 | dchem | Zed, I'm using nim for cryptoassets exchange - orderbook management and matching engine |
02:58:23 | FromDiscord_ | <Elegant Beef> What voltist? |
02:58:31 | FromDiscord_ | <Elegant Beef> It's using xlib so not amazing but nearly "done" |
02:58:31 | FromDiscord_ | <Zed> Those both sound insanely cool |
02:59:20 | voltist | Well I love Nim and I love tiling window managers, so it's right up my alley |
03:00:13 | FromDiscord_ | <Elegant Beef> Nice, the code is currently astray, but here <https://github.com/beef331/goodwm> |
03:00:38 | FromDiscord_ | <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:26 | Prestige | Are there any details about how nim handles moving elements in a sequence? I'm curious about efficiency |
03:54:57 | disruptek | seqs involves a lot of movement and efficiency has never been a goal. |
03:55:23 | disruptek | details are probably inappropriate for this channel. |
03:56:10 | Prestige | Maybe I should just dig through the source to find out how it's handled |
03:57:02 | disruptek | if you can keep your seq to a fixed size, you don't have to worry about performance. |
03:57:25 | Prestige | hm okay, it will be fixed at least when I'm wanting to reorder elements |
03:57:39 | disruptek | sorting is fast. |
03:59:04 | zacharycarter | so 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:37 | zacharycarter | ah okay - I can, but I think as you said disruptek, the subgraph needs to be able to be moved as well |
04:00:46 | zacharycarter | and if the ref object as a member property that is a sequence this doesn't work |
04:02:05 | disruptek | my understanding is that as long as the graph is distinct, you can move the whole thing. |
04:02:42 | zacharycarter | hmm |
04:04:43 | zacharycarter | https://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:21 | disruptek | yeah; you cannot share the graph between threads. |
04:07:29 | skrylar[m] | https://ourmachinery.com/post/dll-hot-reloading-in-theory-and-practice/ cute |
04:08:19 | zacharycarter | ah okay I need to move it gotcha |
04:10:01 | disruptek | there 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:09 | FromGitter | <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:55 | Prestige | Elegant 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:30 | Prestige | Looks 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:49 | FromDiscord_ | <Varriount> Araq: Does Nim do any sort of escape analysis on closures and closure iterators? |
07:07:08 | FromDiscord_ | <Varriount> So that it can allocate their environments on the stack, rather than on the heap? |
07:12:55 | * | oculux joined #nim |
07:27:51 | FromDiscord_ | <Elegant Beef> Yea my selection right now is iffy, my XWarpPointer borked and some other things |
07:28:01 | FromDiscord_ | <Elegant Beef> but generally i just use OnEnterEvents to figure out what to focus |
07:32:55 | Prestige | I think I just need XGrabKey explicitly instead of adding an eventMask for KeyPress events on the parent window |
07:32:59 | Prestige | Going to give that a shot tomorrow |
07:33:24 | FromDiscord_ | <Elegant Beef> Yea XGrabKey will grab any key aslong as you also look for the event |
07:33:31 | FromDiscord_ | <Elegant Beef> well anykey you specify |
07:35:03 | Prestige | For 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:28 | FromDiscord_ | <Elegant Beef> From my understanding XGrabKey intercepts key strokes before they go out to applications |
07:35:33 | Prestige | Is goodwm going to be workspace-based or tag-based? |
07:35:41 | FromDiscord_ | <Elegant Beef> Huh? |
07:36:12 | Prestige | a lot of WMs use workspaces but some use tags (I'll be using tags, gives the user a little more power) |
07:36:18 | FromDiscord_ | <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:31 | Prestige | ah okay |
07:36:44 | FromDiscord_ | <Elegant Beef> The workplaces can have any name, just each monitor has 9 |
07:36:52 | FromDiscord_ | <Elegant Beef> which can change if i refine the workspaces |
07:37:35 | FromDiscord_ | <Elegant Beef> I do like the idea of using Mod4+number to iterate over that monitors workspaces |
07:37:37 | Prestige | Tags are interesting, windows can have multiple tags assigned to them (sort of like displaying a window on multiple workspaces) |
07:37:48 | Prestige | then you can decide to display 1 or more tags at a time |
07:37:56 | FromDiscord_ | <Elegant Beef> Ah so like awesomewm has? |
07:37:59 | FromDiscord_ | <Elegant Beef> I dont really like that |
07:38:01 | Prestige | Yeah, and dwm |
07:38:24 | FromDiscord_ | <Elegant Beef> The one thing i really liked about awesomewm is the predefined layouts which i've implemented |
07:38:41 | FromDiscord_ | <Elegant Beef> Do need to make a main/stacked, but i got the one i really like which is alternating splits |
07:39:06 | Prestige | I 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:26 | FromDiscord_ | <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:28 | FromDiscord_ | <Elegant Beef> thong* |
07:39:37 | FromDiscord_ | <Elegant Beef> thing** |
07:39:39 | Prestige | hehe |
07:39:42 | FromDiscord_ | <Elegant Beef> God damn i cant spell |
07:39:56 | Prestige | finger betrayal |
07:40:28 | Prestige | I'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:11 | FromDiscord_ | <Elegant Beef> Im very much a person that likes the strict mathematical layouts |
07:41:35 | FromDiscord_ | <Elegant Beef> I dislike spiral, but am using it in awesomewm at the moment |
07:41:35 | Prestige | oh 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:11 | Prestige | The docs say XReparentWindow will call XMapWindow on the child |
07:42:15 | Prestige | iirc |
07:43:12 | FromDiscord_ | <Elegant Beef> Well it seems like it is |
07:45:03 | FromDiscord_ | <Elegant Beef> Do you have any clue why my XWarpPointer isnt moving the mouse anymore? |
07:46:10 | Prestige | Hm are you sure it's being invoked still? |
07:46:14 | FromDiscord_ | <Elegant Beef> Yea |
07:46:25 | FromDiscord_ | <Elegant Beef> Certainly is just doesnt want to move |
07:46:57 | Prestige | Lol, 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:14 | Prestige | activeWindow().rawWindow* I also can't type |
07:49:17 | FromDiscord_ | <Elegant Beef> Yea, it wildly just stopped moving my cursor today |
07:49:22 | FromDiscord_ | <Elegant Beef> Yea i knew what you meant |
07:50:04 | Prestige | probably requires some actual debugging |
07:50:17 | FromDiscord_ | <Elegant Beef> *Actual debuggin* Heh |
07:50:52 | FromDiscord_ | <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:39 | FromDiscord_ | <Benumbed> I know the 'standard' is `newShortString` but I'm very meh about that, and a custom constructor would be cleaner |
07:51:51 | FromDiscord_ | <mratsim> there is no constructor |
07:52:01 | FromDiscord_ | <Elegant Beef> could write a converter |
07:52:16 | FromDiscord_ | <mratsim> I don't remember the rationale but it had some composability issue |
07:52:39 | FromDiscord_ | <Benumbed> 🤔 Wait I could write a custom assignment operator for that type |
07:52:51 | FromDiscord_ | <Benumbed> I just wasn't thinking creatively enough |
07:53:01 | FromDiscord_ | <Elegant Beef> Also prestiege have you figured out how to check if a window wants to go fullscreen? |
07:53:51 | Prestige | nah not there yet, sorry |
07:54:23 | FromDiscord_ | <Elegant Beef> Also hopefully my wm actually helps and isnt just a poorly coded mess |
07:55:04 | Prestige | It helps to see how xlib is supposed to be interacted with, thanks :) |
07:55:16 | FromDiscord_ | <Elegant Beef> You say supposed to, but i dont know if that's true |
07:55:34 | FromDiscord_ | <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:04 | Prestige | You're further along than my WM but you I'm tracking my progress on github via issues if you wanted to see |
07:57:45 | Prestige | issues/milestones |
07:58:39 | * | dchem quit (Quit: WeeChat 2.4) |
07:59:35 | FromDiscord_ | <Elegant Beef> Yea this is a pain |
07:59:46 | FromDiscord_ | <Elegant Beef> I makes 0 sense, no errors and it just doesnt work 😄 |
08:01:09 | FromDiscord_ | <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:45 | FromDiscord_ | <Elegant Beef> So i feel dumb, apparently inside xephyr mouse movement doesnt work |
08:49:59 | FromDiscord_ | <Elegant Beef> So that was an hour of my time wasted |
08:50:50 | Prestige | Really? That's weird |
08:54:08 | FromDiscord_ | <Elegant Beef> Yep |
09:02:06 | FromGitter | <awr1> @Benumed you probably want a generalized raw str literal |
09:02:07 | FromGitter | <awr1> https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals |
09:02:18 | FromGitter | <awr1> @Benumbed |
09:04:15 | FromGitter | <awr1> custom assignment operator is kinda....idk |
09:04:17 | FromGitter | <awr1> i wouldn't do it |
09:05:35 | FromGitter | <awr1> in any case i've grown accustomed to nim's generalized philosophy of "all ctors are explicit" |
09:07:15 | FromDiscord_ | <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:20 | skrylar[m] | so i found out the convoluted nightmare that powers armorpaints hot reloading |
09:07:30 | FromDiscord_ | <Rika> ? |
09:07:39 | skrylar[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:08 | FromDiscord_ | <Rika> what |
09:09:16 | FromDiscord_ | <Rika> thats nightmarish |
09:11:14 | skrylar[m] | i still haven't tested nim hcr on windoze |
09:11:28 | FromDiscord_ | <Rika> windoze zzzzzz |
09:11:43 | Prestige | Beef: are you trying fullscreen outside of xephyr btw? |
09:11:45 | skrylar[m] | v hcr doesnot work |
09:12:05 | Prestige | When I start up my hotkey daemon inside of xephyr I get an error: Could not resolve keysym XF86FullScreen |
09:15:10 | skrylar[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:29 | FromGitter | <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:20 | FromDiscord_ | <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:42 | FromGitter | <Bennyelg> Thanks |
11:42:36 | FromGitter | <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:41 | skrylar[m] | i would imagine so, unless you have a proxy which does it for you |
11:44:35 | FromGitter | <Bennyelg> ok, if proxy is best practice, I'll try to implement it |
11:44:36 | skrylar[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:52 | FromGitter | <Bennyelg> any example somewhere? |
11:46:32 | skrylar[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:02 | FromGitter | <Bennyelg> thanks |
11:49:26 | * | natrys quit (Ping timeout: 256 seconds) |
11:49:34 | FromDiscord_ | <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:41 | madpata | I can't compile programs using the ncurses module (info: https://pastebin.com/vck4v977). Anyone else have that problem and maybe a solution? |
12:00:33 | dom96 | looks like the package is broken, maybe trying to type cast a large int to an int that cannot fit it? |
12:01:29 | madpata | yeah, that seems to be the problem. Sadly not the only problem with the package as its .nimble file is malformed, too. |
12:05:08 | madpata | Any 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:55 | solitudesf | !repo illwill |
12:08:57 | disbot | https://github.com/johnnovak/illwill -- 9illwill: 11 15 99⭐ 9🍴 & 1 more... |
12:11:27 | dom96 | madpata, I created this a while back, it uses nimbox, maybe you can use it too: https://github.com/dom96/deauther |
12:39:11 | FromDiscord_ | <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:00 | FromGitter | <Bennyelg> > *<FromDiscord_>* <flywind> use hooks maybe, https://github.com/dom96/jester/blob/d8a03aa4c681bc8514bb7bbf4953d380d86f5bd6/tests/alltest.nim#L172 ⏎ ⏎ This is wonderful, thanks |
12:54:53 | FromDiscord_ | <flywind> no problem. |
13:06:39 | * | xcm quit (Remote host closed the connection) |
13:08:54 | * | xcm joined #nim |
13:08:56 | FromDiscord_ | <Technicae Circuit> https://dev.to/juancarlospaco/ode-to-nimpy-4753 |
13:09:04 | FromDiscord_ | <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:53 | FromGitter | <sheerluck> +1 |
13:16:59 | FromDiscord_ | <Recruit_main707> specifying a generic parameter makes this code dont work: `t.Get[uoffset](t.Pos)` |
13:17:15 | FromDiscord_ | <Recruit_main707> is this a bug? |
13:17:26 | FromDiscord_ | <Rika> how would we know w/o the rest of the code tho |
13:18:02 | FromDiscord_ | <Recruit_main707> the error message is about type mismatch |
13:18:30 | FromDiscord_ | <Recruit_main707> this is the error message: https://play.nim-lang.org/#ix=2juj |
13:19:18 | FromDiscord_ | <Rika> its right there |
13:19:22 | FromDiscord_ | <Rika> the error is right there |
13:19:50 | FromDiscord_ | <Rika> youre either missing the Vtable or the Offsets |
13:20:16 | FromDiscord_ | <Recruit_main707> but they are both there |
13:20:58 | FromDiscord_ | <Rika> no they are not |
13:21:13 | FromDiscord_ | <Rika> you only have one parameter |
13:21:33 | FromDiscord_ | <Recruit_main707> t.Get[uoffset](t.Pos) |
13:21:33 | FromDiscord_ | <Recruit_main707> ^ ^ |
13:21:40 | FromDiscord_ | <Rika> ah, misread |
13:21:50 | * | madpata quit (Ping timeout: 260 seconds) |
13:21:50 | FromDiscord_ | <Rika> ah |
13:21:52 | FromDiscord_ | <Rika> i know now |
13:21:57 | FromDiscord_ | <Rika> `t.Get[:uoffset](t.Pos)` |
13:21:59 | FromDiscord_ | <Rika> do that |
13:23:23 | FromDiscord_ | <Rika> how it's resolved: |
13:23:23 | FromDiscord_ | <Rika> ``` |
13:23:23 | FromDiscord_ | <Rika> t.Get[uoffset](t.Pos) |
13:23:23 | FromDiscord_ | <Rika> { } is the proc |
13:23:23 | FromDiscord_ | <Rika> { } is the proc `[]` w/ argument uoffset |
13:23:24 | FromDiscord_ | <Rika> { } runs whatever is given "as a proc if it could" with t.Pos as argument |
13:23:25 | FromDiscord_ | <Rika> ``` |
13:23:46 | FromDiscord_ | <Rika> @Recruit_main707 ^ |
13:24:04 | FromDiscord_ | <Recruit_main707> i see, thanks |
13:38:13 | * | PMunch joined #nim |
13:38:52 | FromDiscord_ | <flywind> https://dev.to/xflywind/write-a-simple-web-framework-in-nim-language-from-scratch-ma0 |
13:46:14 | PMunch | Cool article flywind :) |
13:49:08 | FromDiscord_ | <flywind> thanks. |
13:53:32 | * | madpata joined #nim |
14:01:58 | FromDiscord_ | <Recruit_main707> i will have a look at it, it looks promising |
14:03:26 | FromDiscord_ | <Recruit_main707> leorize: yesterday you said `cast[T](b)` was wrong, but what about `cast[ptr T](b)[]`? |
14:06:01 | FromDiscord_ | <Recruit_main707> i am having a look at this thread btw https://forum.nim-lang.org/t/2626 |
14:06:46 | FromDiscord_ | <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:03 | FromDiscord_ | <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:54 | FromDiscord_ | <Recruit_main707> nim types are converted to python dictionaries iirc |
14:14:10 | FromDiscord_ | <Technicae Circuit> @codic nimpy auto converts between types iirc |
14:14:22 | FromDiscord_ | <Technicae Circuit> That's what it does with strings and ints at least |
14:14:35 | FromDiscord_ | <Technicae Circuit> And arrays |
14:15:20 | PMunch | @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:12 | FromDiscord_ | <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:09 | FromDiscord_ | <codic> Oh, great that's amazing! |
14:19:30 | FromDiscord_ | <codic> Also, assuming I have this function, why does discord highlight it wrong? |
14:19:30 | FromDiscord_ | <codic> ```nim |
14:19:30 | FromDiscord_ | <codic> proc thing(a: int): string {.cdecl, exportc} = |
14:19:31 | FromDiscord_ | <codic> if a == 1: |
14:19:31 | FromDiscord_ | <codic> return "NO U" |
14:19:31 | FromDiscord_ | <codic> else: |
14:19:31 | FromDiscord_ | <codic> return "NO ME" |
14:19:33 | FromDiscord_ | <codic> ``` |
14:19:50 | FromDiscord_ | <codic> But if I use a period after exportc, it highlights right |
14:19:53 | PMunch | Please don't paste code into discord |
14:20:02 | FromDiscord_ | <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:02 | FromDiscord_ | <codic> Alright ,sorry |
14:20:02 | FromDiscord_ | <Recruit_main707> try not to paste code in here, its a pain for irc users, use https://play.nim-lang.org/ |
14:20:20 | FromDiscord_ | <codic> Huh, play.nim-lang.org highlights it right |
14:20:23 | FromDiscord_ | <codic> That's... strange |
14:20:27 | FromDiscord_ | <Rika> @codic likely the syntax highlighter doesnt know that both syntaxes are valid |
14:20:28 | FromDiscord_ | <Recruit_main707> you are missing a dot |
14:20:37 | FromDiscord_ | <Rika> its not required to have the last dot] |
14:20:41 | FromDiscord_ | <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:43 | FromDiscord_ | <Recruit_main707> ah |
14:20:46 | PMunch | It isn't? |
14:20:47 | FromDiscord_ | <codic> Ah, so it's not an issue with my ode? |
14:20:49 | FromDiscord_ | <codic> Ah, so it's not an issue with my code? |
14:20:49 | FromDiscord_ | <Rika> no its not |
14:20:52 | FromDiscord_ | <codic> ah |
14:20:54 | FromDiscord_ | <codic> okay, thanks |
14:21:06 | PMunch | Oh, and try not to edit your messages either |
14:21:11 | FromDiscord_ | <Rika> try running it, it'll work both ways |
14:21:32 | PMunch | It sends a duplicate (yes the Discord bridge is stupid, yes we're planning on fixing that) |
14:21:36 | FromDiscord_ | <codic> Alright, I won't |
14:21:36 | * | kenran joined #nim |
14:21:42 | FromDiscord_ | <codic> I think that's because Irc doesn't have edits |
14:21:47 | PMunch | Correct |
14:21:59 | FromDiscord_ | <codic> If you join an irc channel from matrix and edit something, matrix duplicates the message |
14:21:59 | PMunch | But it could detect single character edits and just not send them or something |
14:22:03 | FromDiscord_ | <codic> True |
14:22:21 | FromDiscord_ | <Rika> you think it'll be easier to port RxPY than RxCpp? or RxJs |
14:22:25 | PMunch | Or try to be smart and convert that message to just "code*" which is what most people on IRC would end up doing |
14:22:44 | PMunch | Rika, RxCpp would probably be the easiest |
14:22:52 | FromDiscord_ | <Rika> im not wrapping |
14:22:55 | FromDiscord_ | <Rika> im full porting |
14:23:06 | PMunch | Oh porting |
14:23:24 | FromDiscord_ | <Rika> wrapping sounds like it wouldnt work with asyncdispatch |
14:23:29 | PMunch | Well the Python or JS interface is likely to be closer to a pragmatic Nim approach |
14:23:29 | FromDiscord_ | <Technicae Circuit> I love Nim |
14:23:45 | FromDiscord_ | <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:46 | FromDiscord_ | <Rika> this is gonna be an intense and large project i guess |
14:23:50 | FromDiscord_ | <Technicae Circuit> Nim can write not only Python extensions, but Ruby aswell |
14:23:52 | FromDiscord_ | <codic> (I do know that ints and strings convert proper) |
14:23:54 | FromDiscord_ | <Recruit_main707> on the other hand, figuring types is gonna be painful |
14:24:30 | FromDiscord_ | <Rika> rxcpp prolly is more tuned for optimized performance than readability so thats prolly an issue |
14:24:33 | FromDiscord_ | <Rika> there's also rxjava |
14:24:51 | FromDiscord_ | <Recruit_main707> for flatbuffers, i am basing on python, but have constant looks at the go implementation to check types |
14:24:55 | FromDiscord_ | <Rika> http://reactivex.io/languages.html hmmmmmmm |
14:25:01 | FromDiscord_ | <codic> So basically I'm asking if ruby hashes are converted to nim tables |
14:25:08 | FromDiscord_ | <codic> Since ints and strings are |
14:25:24 | FromDiscord_ | <codic> (Oh, also, discord.nim is broken) |
14:25:28 | FromDiscord_ | <Rika> we know |
14:25:30 | FromDiscord_ | <Technicae Circuit> @codic they should, but test it |
14:25:31 | FromDiscord_ | <codic> (Oh, also, discord.nim is broken, zlib error) |
14:25:36 | FromDiscord_ | <Technicae Circuit> Everyone already knows |
14:25:41 | FromDiscord_ | <codic> Oh |
14:25:42 | FromDiscord_ | <codic> eh |
14:25:42 | FromDiscord_ | <Technicae Circuit> It's common knowledge :p |
14:26:00 | PMunch | Well, since yesterday :P |
14:26:06 | FromDiscord_ | <codic> Seems to be an upstream issue |
14:26:08 | FromDiscord_ | <codic> https://github.com/nim-lang/zip/issues/39 |
14:26:09 | disbot | ➥ ZlibStreamError due to size mismatch of data types (Linux) ; snippet at 12https://play.nim-lang.org/#ix=2iJQ |
14:26:27 | FromDiscord_ | <codic> That's pretty cool |
14:26:37 | FromDiscord_ | <codic> (The bot) |
14:26:42 | PMunch | Not quite sure if hashes would convert to tables, but I doubt it |
14:26:45 | FromDiscord_ | <Sophie> what is nim's situation regarding IDE support and debugging |
14:26:51 | FromDiscord_ | <codic> Why do you think that? |
14:26:52 | PMunch | Oh disbot, yeah he has some neat tricks |
14:26:59 | FromDiscord_ | <codic> Yeah |
14:27:04 | FromDiscord_ | <Recruit_main707> @Sophie we have quite a few |
14:27:05 | FromDiscord_ | <codic> also ***dis***bot, ***dis***cord |
14:27:09 | FromDiscord_ | <codic> lol |
14:27:22 | PMunch | codic, because it isn't built for it |
14:27:34 | FromDiscord_ | <codic> ah |
14:27:40 | FromDiscord_ | <Rika> its prolly disbot because ***dis*** ruptek |
14:27:43 | FromDiscord_ | <Rika> the maker? i think |
14:27:44 | FromDiscord_ | <codic> so i'd have to somehow do it manually? |
14:27:47 | FromDiscord_ | <codic> hah |
14:27:48 | FromDiscord_ | <codic> haha |
14:27:49 | PMunch | The Nim <-> Ruby code in that article is actually more like Nim <-> Dll <-> Ruby |
14:28:09 | FromDiscord_ | <codic> ~~Eh, nah, more like Nim <-> .so <-> ruby since unix rules~~ |
14:28:13 | PMunch | So Ruby just thinks its playing around with a regular dynamic library |
14:28:30 | FromDiscord_ | <codic> yeah, that's true.. |
14:28:31 | FromDiscord_ | <Recruit_main707> vscode, sublime text, vim, neovim... (something with jetbrains iiirc?) |
14:28:32 | PMunch | Yeah :P so just sounds so weird :P |
14:28:43 | FromDiscord_ | <codic> What does? |
14:28:54 | FromDiscord_ | <Recruit_main707> and a bunch of outdated ones :p |
14:29:01 | PMunch | I'm on Linux and I keep calling them dlls simply because it easier to understand what it is |
14:29:03 | FromDiscord_ | <codic> and atom |
14:29:08 | FromDiscord_ | <codic> ah haha |
14:29:19 | FromDiscord_ | <Technicae Circuit> Is there something like Nimpy but for Ruby? (Basically Nimrb) |
14:29:23 | FromDiscord_ | <Sophie> for jetbrains I could only find one that doesn't seem has been updated in a few years |
14:29:30 | PMunch | Sophie, we also have nimlsp so any editor with LSP can get Nim stuff in it |
14:29:41 | FromDiscord_ | <codic> That wouldn't be that hard to code |
14:30:08 | FromDiscord_ | <codic> The hardest challenge, to be honest, would be auto generating the attach_function calls |
14:30:12 | PMunch | (But no syntax highlighting since LSP doesn't really support that, working on implementing the unofficial highlight extension though) |
14:30:25 | FromDiscord_ | <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:33 | FromDiscord_ | <Technicae Circuit> :p |
14:30:34 | FromDiscord_ | <Sophie> great, that works |
14:30:59 | FromDiscord_ | <codic> They use the format `attach_function(:functionName, [:an, :array, :of, :argument, :TYPES], :returnValueType)` |
14:31:11 | FromDiscord_ | <Technicae Circuit> Hmmmm |
14:31:23 | FromDiscord_ | <Technicae Circuit> Welp |
14:31:33 | FromDiscord_ | <codic> Doesn't matter honestly, just one extra line per function |
14:31:41 | FromDiscord_ | <Technicae Circuit> You could just check how Nimpy does it :p |
14:31:51 | FromDiscord_ | <codic> Python ffi is different |
14:31:53 | FromDiscord_ | <codic> But I'll check it out |
14:32:00 | FromDiscord_ | <Technicae Circuit> Yeah but porting things like https://github.com/juancarlospaco/faster-than-requests would be a pain |
14:32:12 | FromDiscord_ | <codic> Not raeally |
14:32:14 | FromDiscord_ | <codic> Not really |
14:32:25 | FromDiscord_ | <codic> Let's see |
14:32:33 | FromDiscord_ | <Technicae Circuit> Stop editing :p |
14:32:33 | FromDiscord_ | <codic> https://github.com/juancarlospaco/faster-than-requests/blob/master/src/faster_than_requests.nim is 345 lines |
14:32:39 | FromDiscord_ | <codic> Oh yeah |
14:32:52 | FromDiscord_ | <codic> So I should average about like 20 lines of attach_function, which isn't a lot |
14:32:58 | FromDiscord_ | <codic> or more |
14:33:00 | FromDiscord_ | <codic> like 50 |
14:33:03 | FromDiscord_ | <codic> or 60 |
14:33:05 | FromDiscord_ | <Technicae Circuit> Eh |
14:33:12 | FromDiscord_ | <Technicae Circuit> So |
14:33:15 | FromDiscord_ | <Technicae Circuit> Basically |
14:33:16 | FromDiscord_ | <codic> Yeah I'll look at nimpy |
14:33:23 | FromDiscord_ | <Technicae Circuit> Nim is now my go-to language |
14:33:33 | FromDiscord_ | <codic> Nope, I can't port this |
14:33:36 | FromDiscord_ | <codic> It uses python apis |
14:33:41 | FromDiscord_ | <Technicae Circuit> @codic remember that Python can import c modules |
14:33:43 | FromDiscord_ | <Technicae Circuit> Yeah :p |
14:33:47 | FromDiscord_ | <codic> Yeah, like any language can |
14:33:55 | FromDiscord_ | <codic> via ffi |
14:33:57 | FromDiscord_ | <Technicae Circuit> But Python has an api so |
14:34:04 | FromDiscord_ | <codic> So does ruby |
14:34:07 | FromDiscord_ | <codic> and most other languages |
14:34:10 | FromDiscord_ | <Technicae Circuit> Unless Ruby has an API like Python |
14:34:10 | FromDiscord_ | <codic> and most other interpreted languages |
14:34:13 | FromDiscord_ | <codic> It does |
14:34:22 | FromDiscord_ | <Technicae Circuit> Why don't you write a custom Nimrb module |
14:34:28 | FromDiscord_ | <codic> https://docs.ruby-lang.org/en/2.7.0/extension_rdoc.html |
14:34:31 | FromDiscord_ | <Technicae Circuit> That is similar to Python's |
14:34:32 | FromDiscord_ | <codic> I just don't want to learn the whole api |
14:34:38 | FromDiscord_ | <codic> :| |
14:34:40 | FromDiscord_ | <Technicae Circuit> :p |
14:35:14 | FromDiscord_ | <codic> I wish I could use some hacky regexp to get something like this |
14:35:48 | FromDiscord_ | <codic> ``` |
14:35:48 | FromDiscord_ | <codic> :functionName ( :argtype1, :argtype2 ) :returnType``` |
14:35:53 | FromDiscord_ | <codic> If I could that to ruby is easy |
14:36:43 | FromDiscord_ | <Technicae Circuit> You probably could |
14:37:11 | PMunch | Technicae Circuit, welcome to the club :) |
14:38:09 | * | drewr joined #nim |
14:38:21 | FromDiscord_ | <Recruit_main707> does someone know whats leorize's timezome aprox? |
14:38:50 | * | madpata quit (Ping timeout: 260 seconds) |
14:39:35 | FromDiscord_ | <Technicae Circuit> :p |
14:40:05 | FromDiscord_ | <Technicae Circuit> I mean, Nim is just so simple to make libs for any lang |
14:41:47 | FromDiscord_ | <codic> Yeah |
14:42:00 | FromDiscord_ | <codic> And with a much nicer syntax than languages like C, or C++ |
14:42:21 | FromDiscord_ | <Technicae Circuit> Mhm |
14:42:37 | FromGitter | <codenoid> how things going folks |
14:42:51 | PMunch | Going good |
14:43:18 | PMunch | Did a miss a big article or something? All of a sudden so many new people around here :) |
14:43:28 | FromDiscord_ | <Recruit_main707> struggling with code, |
14:43:28 | FromDiscord_ | <Recruit_main707> for a change :p |
14:43:32 | FromDiscord_ | <Technicae Circuit> Very nice |
14:43:34 | FromDiscord_ | <Technicae Circuit> Oof |
14:44:41 | FromDiscord_ | <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:16 | FromDiscord_ | <codic> haha |
14:47:03 | PMunch | I meant more like the past week(s) |
14:47:24 | FromDiscord_ | <codic> play.nim-lang.org is soo useful |
14:47:24 | FromDiscord_ | <Recruit_main707> idk then ¯\_(ツ)_/¯ |
14:47:26 | PMunch | I guess maybe it's just the pandemic :P |
14:47:39 | PMunch | codic, yeah it's a nice tool :) |
14:47:56 | FromDiscord_ | <codic> Oh. Um, I had a string with `&"string{thing}" |
14:47:58 | FromDiscord_ | <Recruit_main707> btw, do you see this: ¯\_(ツ)_/¯ in irc, or just `/shrug`? |
14:48:06 | * | madpata joined #nim |
14:48:15 | PMunch | I see the expanded form |
14:48:21 | PMunch | ¯\_(ツ)_/¯ |
14:48:22 | FromDiscord_ | <Technicae Circuit> They should see the actual shruggie |
14:48:32 | FromDiscord_ | <codic> I got this error: https://hastebin.com/gamufamigo.pl |
14:48:37 | FromDiscord_ | <codic> (no, it's not perl) |
14:48:38 | FromDiscord_ | <Recruit_main707> PMunch: thats the same one in discord :p |
14:48:40 | FromDiscord_ | <Technicae Circuit> Since discord sends the message content as the shruggie |
14:49:00 | disruptek | i see dead people. |
14:49:05 | FromDiscord_ | <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:06 | FromDiscord_ | <Technicae Circuit> Oof |
14:49:09 | PMunch | Where?! |
14:49:17 | * | PMunch frantically looks around |
14:49:38 | FromDiscord_ | <Technicae Circuit> ~~Me-~~ |
14:49:45 | FromDiscord_ | <Recruit_main707> lmao |
14:49:46 | PMunch | Are you dead? |
14:49:51 | FromDiscord_ | <Technicae Circuit> Inside yes |
14:50:13 | FromDiscord_ | <Recruit_main707> thats because you are not coding in nim probably |
14:50:21 | FromDiscord_ | <Technicae Circuit> Probably |
14:50:40 | FromDiscord_ | <codic> sad story |
14:50:47 | FromDiscord_ | <Recruit_main707> xD |
14:51:00 | FromDiscord_ | <codic> Ahhh |
14:51:16 | FromDiscord_ | <codic> When I replace & with fmt I get undeclared identifier |
14:51:23 | FromDiscord_ | <codic> Is it because my compilation target is cpp |
14:51:23 | FromDiscord_ | <Technicae Circuit> Oof |
14:51:27 | FromDiscord_ | <codic> Nope, same with c |
14:51:33 | FromDiscord_ | <codic> /usercode/in.nim(2, 53) Error: undeclared identifier: 'fmt' |
14:51:36 | FromDiscord_ | <Technicae Circuit> Did you impoet strutils |
14:51:43 | narimiran | *strformat |
14:51:46 | FromDiscord_ | <Technicae Circuit> Import* |
14:51:47 | FromDiscord_ | <Technicae Circuit> O |
14:51:48 | FromDiscord_ | <codic> Oh |
14:51:52 | FromDiscord_ | <codic> import strformat |
14:51:55 | FromDiscord_ | <codic> me stupid |
14:52:00 | FromDiscord_ | <codic> :P |
14:52:07 | FromDiscord_ | <Technicae Circuit> :p |
14:52:21 | FromDiscord_ | <codic> there, all is nice and happy, until... |
14:52:22 | FromDiscord_ | <codic> /usercode/in.nim(4, 19) Error: undeclared identifier: 'table' |
14:52:23 | FromDiscord_ | <codic> :gasp: |
14:52:30 | FromDiscord_ | <codic> What is the table type called? |
14:52:35 | narimiran | import tables |
14:52:38 | FromDiscord_ | <codic> o |
14:52:42 | narimiran | c'mon man, do some imports :D |
14:52:57 | FromDiscord_ | <codic> changed my import to `import strformat, tables` |
14:53:03 | FromDiscord_ | <codic> Still get undeclared identifier: table |
14:53:06 | FromDiscord_ | <codic> (I'm using table as a type) |
14:53:09 | narimiran | Table |
14:53:12 | narimiran | capital T |
14:53:20 | FromDiscord_ | <codic> Oh, why was that chosen? |
14:53:27 | narimiran | because sanity |
14:53:31 | FromDiscord_ | <codic> COMPILATION SUCCESS. 🚀 |
14:53:31 | FromDiscord_ | <Recruit_main707> types w/ capital obv |
14:53:40 | FromDiscord_ | <codic> then why not `Int` and `String`?/ |
14:54:00 | FromDiscord_ | <Technicae Circuit> ~~Because sanity~~ |
14:54:06 | narimiran | finally, a non-trivial question :) |
14:54:17 | FromDiscord_ | <codic> 😠 |
14:54:18 | FromDiscord_ | <codic> :P |
14:54:29 | FromDiscord_ | <Recruit_main707> that would be ugly imo |
14:54:40 | PMunch | All the basic built in types are lower-case |
14:54:48 | PMunch | Anything more complicated have uppercase |
14:54:56 | FromDiscord_ | <Technicae Circuit> Coolio |
14:54:57 | FromDiscord_ | <Recruit_main707> so i change my statement to, complex types w/ capital |
14:54:59 | PMunch | (by convention) |
14:55:21 | FromDiscord_ | <Recruit_main707> ie: primitives, no, the rest, yes :p |
14:55:29 | PMunch | Yeah, pretty much |
14:56:21 | PMunch | If they live in a module, uppercase |
15:00:14 | FromDiscord_ | <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:31 | narimiran | @codic look at the paste above, and uppercase function names. that's not sanity. |
15:01:35 | * | so joined #nim |
15:01:50 | FromDiscord_ | <codic> I'm a bit confused. I have this in helloWorld.nim: https://play.nim-lang.org/#ix=2juL |
15:01:50 | FromDiscord_ | <codic> I compiled it to libhelloWorld.so and used this ruby code: https://hastebin.com/idicetewuw.rb |
15:01:50 | FromDiscord_ | <codic> Now, ruby complains: function 'testInts' not found in [./libhelloWorld.so] (FFI::NotFoundError) |
15:02:08 | FromDiscord_ | <codic> it actually makes sense to me, coming from Golang, since exported methods are capitalized |
15:02:15 | PMunch | {.exportc.} |
15:02:18 | FromDiscord_ | <Recruit_main707> ^ |
15:02:33 | FromDiscord_ | <Recruit_main707> if not, nim compiler will use an "optimized" name |
15:02:37 | * | vesper11 quit (Ping timeout: 264 seconds) |
15:02:38 | narimiran | exported procs in nim have `*` at the end (in the case you didn't stumble on that one yet) |
15:02:54 | FromDiscord_ | <Technicae Circuit> End of the name specifically |
15:02:57 | FromDiscord_ | <Recruit_main707> at the end... of the name |
15:03:02 | narimiran | yep |
15:03:03 | * | vesper11 joined #nim |
15:03:11 | PMunch | Not really optimised, just done for technical reasons |
15:03:30 | PMunch | Nim can overload procedures for example |
15:03:33 | PMunch | While C can't |
15:03:39 | FromDiscord_ | <codic> oh, i forgot about the cdecl lol |
15:03:43 | FromDiscord_ | <codic> and ah, I see |
15:03:49 | PMunch | So it would be impossible to always use the same C name as the Nim name |
15:04:01 | FromDiscord_ | <Recruit_main707> makes sense now |
15:04:02 | PMunch | Oh yeah, and cdecl to ensure that it uses the C calling convention |
15:04:18 | FromDiscord_ | <Recruit_main707> and dynlib since its gonna be inside a dll? |
15:04:19 | PMunch | nimcall default to fastcall when available IIRC |
15:04:33 | PMunch | Shouldn't need dynlib for exporting I think |
15:05:03 | FromDiscord_ | <Recruit_main707> but that was not intended, that was a bug iirc |
15:05:10 | FromDiscord_ | <Recruit_main707> and it was fixed |
15:05:28 | PMunch | Huh, 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:32 | FromDiscord_ | <codic> Exact same error, I added this pragma: `{.cdecl, exportc.}` |
15:05:37 | FromDiscord_ | <codic> then removed my .so and recompiled |
15:05:49 | FromDiscord_ | <Recruit_main707> add dynlib |
15:06:03 | PMunch | Check 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:50 | FromDiscord_ | <codic> On the .so file? |
15:07:14 | FromDiscord_ | <codic> That gives me https://hatebin.com/edlpobihkp |
15:07:23 | FromDiscord_ | <codic> junk |
15:07:28 | PMunch | Not junk |
15:07:35 | PMunch | Those are all the symbols defined in your so |
15:07:50 | FromDiscord_ | <codic> How do I find if testInts exists? |
15:08:02 | PMunch | You can see it on line249 |
15:08:02 | FromDiscord_ | <codic> wait, do I add `*` after the proc definition |
15:08:06 | FromDiscord_ | <codic> to export it |
15:08:10 | PMunch | So it is there |
15:08:14 | FromDiscord_ | <codic> like `testInts*(signature)` |
15:08:15 | FromDiscord_ | <codic> Ah |
15:08:18 | FromDiscord_ | <Recruit_main707> ctrl + f testInts |
15:08:22 | FromDiscord_ | <codic> > 0000000000012d70 t testInts |
15:08:23 | FromDiscord_ | <codic> yeah |
15:08:32 | FromDiscord_ | <codic> So what could be the issue? |
15:08:48 | PMunch | Ah, but it is lowercase |
15:08:55 | FromDiscord_ | <codic> Indeed |
15:09:02 | PMunch | The `t` is lowercase, meaning it's local to that library |
15:09:13 | PMunch | Did you add the * before compiling the .so? |
15:09:40 | FromDiscord_ | <Recruit_main707> `testInts*` <- this way |
15:09:51 | FromDiscord_ | <codic> Nope I didn't that's what I was asking |
15:09:52 | FromDiscord_ | <codic> Haha |
15:09:53 | FromDiscord_ | <Technicae Circuit> Like `proc func*(stuff):type =` |
15:09:58 | FromDiscord_ | <codic> trying now |
15:10:00 | FromDiscord_ | <codic> Yeah, I already said tht |
15:10:02 | FromDiscord_ | <Technicae Circuit> We said that before :p |
15:10:03 | FromDiscord_ | <codic> *that |
15:10:06 | FromDiscord_ | <codic> I said that before |
15:10:11 | FromDiscord_ | <codic> https://discordapp.com/channels/371759389889003530/371759389889003532/703623364039802910 |
15:10:13 | FromDiscord_ | <Technicae Circuit> :p |
15:10:39 | FromDiscord_ | <codic> Welp, no success still |
15:11:49 | FromDiscord_ | <Technicae Circuit> Oof |
15:12:06 | * | ftsf quit (Ping timeout: 265 seconds) |
15:12:14 | PMunch | Works fine here.. |
15:12:59 | FromDiscord_ | <Technicae Circuit> @codic |
15:13:01 | PMunch | http://ix.io/2juR |
15:13:11 | PMunch | @codic ^ |
15:13:17 | FromDiscord_ | <codic> Hmmm |
15:13:22 | FromDiscord_ | <codic> Ohhh |
15:13:27 | FromDiscord_ | <codic> I didn't add dynlib |
15:13:47 | FromDiscord_ | <codic> haha |
15:13:49 | FromDiscord_ | <Recruit_main707> *overdramatically facepalms* |
15:13:59 | FromDiscord_ | <Technicae Circuit> Hahaha |
15:14:09 | FromDiscord_ | <codic> ¯\_(ツ)_/¯ |
15:14:16 | FromDiscord_ | <codic> Finally! |
15:14:21 | FromDiscord_ | <Recruit_main707> happens to the best of us |
15:14:21 | PMunch | Ah yeah, without `dynlib` it seems to be local to the library (lowercase t in nm -a output) |
15:14:27 | FromDiscord_ | <codic> I have been waiting for glorious 2 for years |
15:14:29 | FromDiscord_ | <codic> Ah okay |
15:14:30 | FromDiscord_ | <codic> Thanks! |
15:14:43 | PMunch | By the way, I can almost guarantee you that strings and tables won't work that way :P |
15:14:50 | FromDiscord_ | <codic> Let's try |
15:15:06 | FromDiscord_ | <codic> and.... |
15:15:13 | FromDiscord_ | <codic> It doesn't even recognize the method! |
15:15:23 | FromDiscord_ | <codic> oh |
15:15:25 | FromDiscord_ | <Recruit_main707> strings maybe, Tables (ie: complex types) i bet not |
15:15:26 | FromDiscord_ | <codic> Nvm, I didn't attach_function |
15:15:34 | PMunch | Strings are basically struct {int64_t len; int64_t cap; char *data}; |
15:15:47 | PMunch | And tables are a complex object |
15:15:57 | PMunch | Both of course under the control of the Nim GC |
15:16:06 | FromDiscord_ | <codic> Boom! I got the most readable output ever! |
15:16:09 | FromDiscord_ | <codic> `�` |
15:16:15 | PMunch | Haha |
15:16:27 | FromDiscord_ | <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:28 | FromDiscord_ | <codic> So sad |
15:16:30 | FromDiscord_ | <Rika> i ? unicode |
15:16:53 | PMunch | You're not passing it strings though.. |
15:16:59 | PMunch | At best those would be cstring |
15:17:02 | FromDiscord_ | <codic> I am |
15:17:05 | FromDiscord_ | <codic> but they're ruby strings |
15:17:09 | FromDiscord_ | <codic> Not Nim strings |
15:17:12 | PMunch | Yeah :P |
15:17:17 | FromDiscord_ | <Rika> then thats the issue |
15:17:22 | PMunch | So not the "string" type in Nim |
15:17:26 | FromDiscord_ | <codic> But how do I construct a Nim string? can I make a proc to do that? |
15:17:28 | FromDiscord_ | <Rika> use cstring |
15:17:36 | FromDiscord_ | <codic> Ruby's cstring? |
15:17:38 | FromDiscord_ | <Rika> also return cstring, i assume |
15:17:38 | FromDiscord_ | <Rika> no |
15:17:40 | FromDiscord_ | <Rika> nim cstring |
15:17:52 | FromDiscord_ | <codic> Oh, in the method |
15:17:59 | FromDiscord_ | <Rika> procedure |
15:18:00 | FromDiscord_ | <Recruit_main707> wherever you used string in nim, use cstring |
15:18:08 | FromDiscord_ | <codic> How do I convert my return value to a cstring? |
15:18:26 | FromDiscord_ | <Recruit_main707> it should automatically work iirc |
15:18:28 | PMunch | That actually worked |
15:18:35 | FromDiscord_ | <codic> Oh, let's see |
15:18:47 | FromDiscord_ | <codic> Worked!!! |
15:18:58 | FromDiscord_ | <codic> Yesssssssss, now to try glorious tables |
15:19:09 | FromDiscord_ | <Rika> G L H F with that |
15:19:10 | FromDiscord_ | <Recruit_main707> let him realise |
15:19:16 | PMunch | http://ix.io/2juU |
15:19:21 | PMunch | Haha |
15:20:12 | FromDiscord_ | <codic> NOOOOOOOOOOOOOo |
15:20:13 | FromDiscord_ | <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:13 | PMunch | Here'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:15 | FromDiscord_ | <Rika> should i go with TDD for porting RxPY? |
15:20:21 | FromDiscord_ | <codic> oh, thanks |
15:20:37 | PMunch | A tuple is essentially a C struct |
15:20:42 | FromDiscord_ | <codic> but I have no idea how |
15:20:59 | FromDiscord_ | <Recruit_main707> i think... you should vreate that type in ruby |
15:21:04 | FromDiscord_ | <codic> Wait, I can use C libraries in Nim and compile to C? |
15:21:11 | FromDiscord_ | <codic> If so, I can use Ruby's C api in nim |
15:21:13 | FromDiscord_ | <codic> Yeah but Idk how |
15:21:14 | FromDiscord_ | <Rika> or make a helper that creates it in nim and passes it to ruby |
15:21:20 | FromDiscord_ | <codic> a type definition in ruby is just |
15:21:22 | PMunch | Yup |
15:21:29 | FromDiscord_ | <codic> class whatever; end |
15:21:38 | FromDiscord_ | <Recruit_main707> ye, you can use Ruby's c api |
15:21:46 | FromDiscord_ | <Rika> Nim is compiled to C after all |
15:21:50 | FromDiscord_ | <codic> oh, great! |
15:21:57 | FromDiscord_ | <codic> I think a helper would be easier first though |
15:21:59 | FromDiscord_ | <Rika> well, by default its to C |
15:22:03 | FromDiscord_ | <Technicae Circuit> Is there a `del` function in Nim |
15:22:14 | FromDiscord_ | <Technicae Circuit> To delete a variable? |
15:22:15 | FromDiscord_ | <codic> How'd I make a nim helper that returns a tableref? |
15:22:17 | FromDiscord_ | <Technicae Circuit> Doubt it |
15:22:18 | FromDiscord_ | <Technicae Circuit> But eh |
15:22:26 | FromDiscord_ | <codic> I don't think so |
15:22:39 | FromDiscord_ | <Rika> nope |
15:22:46 | FromDiscord_ | <codic> If Nim has a free function to free mem, tho, you can use that |
15:22:46 | FromDiscord_ | <Rika> just dont use the variable |
15:22:53 | FromDiscord_ | <Rika> not a good idea |
15:22:58 | FromDiscord_ | <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:02 | FromDiscord_ | <Rika> you might bamboozle the GC |
15:23:02 | PMunch | Technicae, what do you mean "delete a variable"? |
15:23:40 | FromDiscord_ | <Technicae Circuit> Free up the memory that the variable or function is using |
15:23:41 | PMunch | Just out of curiosity, why are you trying to use Nim in Ruby? |
15:23:56 | PMunch | Technicae, that's the GC's job |
15:24:00 | FromDiscord_ | <Rika> @Technicae Circuit put it in a block then make that block go out of scope |
15:25:19 | FromDiscord_ | <codic> Just for fun, so I can write one library that works in python, ruby, and nim |
15:25:35 | FromDiscord_ | <Recruit_main707> https://tenor.com/view/press-f-pay-respect-coffin-burial-gif-12855021 |
15:25:39 | FromDiscord_ | <Recruit_main707> in advance |
15:25:41 | PMunch | Haha, good enough reason that :P |
15:26:10 | PMunch | But I've gotta run now |
15:26:11 | PMunch | TTYL |
15:26:15 | * | PMunch quit (Quit: leaving) |
15:26:23 | FromDiscord_ | <Recruit_main707> i procced to re-ask my question: |
15:26:23 | FromDiscord_ | <Recruit_main707> why are the first ones right, but the second ones ambiguous? https://play.nim-lang.org/#ix=2juJ |
15:26:33 | FromDiscord_ | <Recruit_main707> proceed* :p |
15:26:45 | FromDiscord_ | <codic> Why the coffin? |
15:27:03 | FromDiscord_ | <codic> 😢 😢 😢 😢 |
15:27:17 | * | xcm quit (Remote host closed the connection) |
15:27:34 | FromDiscord_ | <Rika> first ones? |
15:27:38 | FromDiscord_ | <Rika> which are the first ones |
15:27:38 | FromDiscord_ | <Recruit_main707> my favourite part is that innocent "for fun" xD |
15:27:42 | FromDiscord_ | <Rika> and which are the second ones |
15:27:44 | FromDiscord_ | <Recruit_main707> WriteVal |
15:27:48 | FromDiscord_ | <Recruit_main707> and GetVal |
15:28:23 | FromDiscord_ | <Rika> because procs must not be ambiguous when no generic params are filled |
15:28:33 | FromDiscord_ | <Rika> a generic param is not required |
15:28:52 | FromDiscord_ | <codic> Argh. I'm stuck on what to port to nim |
15:29:29 | FromDiscord_ | <Recruit_main707> > a generic param is not required |
15:29:30 | FromDiscord_ | <Recruit_main707> wdym? |
15:29:30 | * | xcm joined #nim |
15:29:51 | solitudesf | @Recruit_main707, because it is ambiguous, generic parameter cant be inferred from arugments and you dont provide it explicitly |
15:30:09 | solitudesf | in WriteVal its is inferred from `n` |
15:30:15 | * | livcd quit (Ping timeout: 250 seconds) |
15:30:29 | solitudesf | and you cant overload like this |
15:30:59 | FromDiscord_ | <Technicae Circuit> :p |
15:31:10 | FromDiscord_ | <Rika> because generic params are usually inferred no? |
15:31:43 | solitudesf | they are inferred is there is something to infer from, but in this case there isn't |
15:31:58 | FromDiscord_ | <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:00 | FromDiscord_ | <Rika> i think he wants to force using it explicitly |
15:32:16 | FromDiscord_ | <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:16 | FromDiscord_ | <Rika> @Recruit_main707 because there it can |
15:32:18 | FromDiscord_ | <Rika> 2nd cannot |
15:32:48 | FromDiscord_ | <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:57 | FromDiscord_ | <Recruit_main707> > i think he wants to force using it explicitly |
15:32:57 | FromDiscord_ | <Recruit_main707> id rather not actually |
15:33:51 | FromDiscord_ | <Rika> how would you decide what return type to use then?? |
15:34:38 | FromDiscord_ | <Technicae Circuit> So, how do I make a class in Nim? |
15:34:39 | FromDiscord_ | <Recruit_main707> well, since i cant it doesnt matter :p, but the one the code that calls it expects |
15:35:11 | FromDiscord_ | <Recruit_main707> @Technicae Circuit my python boy, "classes" in nim dont exist as such |
15:35:25 | FromDiscord_ | <Technicae Circuit> So what should i do? :P |
15:35:33 | FromDiscord_ | <Technicae Circuit> Can i define a function inside a function? |
15:35:44 | FromDiscord_ | <Recruit_main707> wait a sec |
15:36:12 | FromDiscord_ | <Recruit_main707> https://nim-by-example.github.io/oop/ |
15:37:18 | FromDiscord_ | <Technicae Circuit> Uh |
15:37:19 | FromDiscord_ | <Recruit_main707> that example always uses `ref object of ...` not that ref is optional |
15:37:28 | FromDiscord_ | <Recruit_main707> note* |
15:37:29 | * | livcd joined #nim |
15:38:21 | FromDiscord_ | <Technicae Circuit> So how would `class Test: def hi(): print("Hi")` look like in Nim? |
15:38:53 | FromDiscord_ | <Technicae Circuit> Assuming it was valid |
15:39:11 | FromDiscord_ | <Technicae Circuit> I don't wanna add newlines cuz of the irc users |
15:39:35 | FromDiscord_ | <Recruit_main707> https://play.nim-lang.org/#ix=2jv4 |
15:40:07 | FromDiscord_ | <Technicae Circuit> Thanks |
15:40:09 | FromDiscord_ | <Recruit_main707> essentially its the same but without a class body |
15:40:23 | FromDiscord_ | <Technicae Circuit> So would self have to be passed? |
15:40:48 | narimiran | you can do `self.hi` in nim |
15:40:59 | narimiran | if you're after that kind of syntax |
15:41:17 | FromDiscord_ | <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:29 | FromDiscord_ | <Rika> not possible |
15:41:33 | FromDiscord_ | <Technicae Circuit> Damn |
15:41:42 | FromDiscord_ | <Rika> you'll have to do with initClassName("token") |
15:42:00 | FromDiscord_ | <Technicae Circuit> That could still work |
15:42:22 | FromDiscord_ | <Recruit_main707> he can do it like: `class_name(field_name: "bot token")` |
15:42:47 | dom96 | convention is to use initTypeName or newTypeName, please do follow the conventions :) |
15:42:49 | FromDiscord_ | <Rika> that doesnt guarantee that the other fields are initialized as wanted |
15:43:11 | FromDiscord_ | <Rika> for example, there might be custom code that sets some field differently to it's `default(type)` value |
15:43:15 | FromDiscord_ | <Technicae Circuit> Hm |
15:43:24 | FromDiscord_ | <Recruit_main707> dom96: but the function will do that wont it |
15:43:33 | FromDiscord_ | <Rika> see my messages |
15:43:37 | FromDiscord_ | <Rika> not necessarily |
15:43:41 | FromDiscord_ | <Technicae Circuit> Damn |
15:44:01 | FromDiscord_ | <Recruit_main707> then how? |
15:44:15 | FromDiscord_ | <Rika> how what? |
15:44:15 | dom96 | what function? |
15:44:45 | FromDiscord_ | <Recruit_main707> about how to call hi: |
15:44:45 | FromDiscord_ | <Recruit_main707> `var atest: Test` |
15:44:45 | FromDiscord_ | <Recruit_main707> `atest.hi()` (if it doesnt need to be initialised) |
15:44:55 | FromDiscord_ | <Recruit_main707> the initTypeName() function |
15:45:02 | FromDiscord_ | <Recruit_main707> dom96 ^ |
15:45:30 | FromDiscord_ | <Technicae Circuit> I need to be able to pass variables to the 'class' |
15:45:54 | FromDiscord_ | <Rika> thats fine, procs can be passed varialbes of course |
15:46:30 | FromDiscord_ | <Technicae Circuit> But then how would i define functions for the 'class' and pass those variables to the functions |
15:46:35 | FromDiscord_ | <Technicae Circuit> Like python's self |
15:46:53 | FromDiscord_ | <Recruit_main707> for instance: https://play.nim-lang.org/#ix=2jv7 |
15:46:57 | narimiran | youself.funcName(par1, par2, par3) |
15:47:02 | FromDiscord_ | <Rika> just make procs with the type as first parameter |
15:47:04 | narimiran | you'd call it as: self.funcName(par1, par2, par3) |
15:47:10 | * | rockcavera joined #nim |
15:47:31 | narimiran | and define it as `proc funcName(self, par1, par2, par3)` (with types, of course) |
15:47:54 | FromDiscord_ | <Technicae Circuit> I don't understand ;-; |
15:48:14 | narimiran | IMO, take a break of what you're trying to do and read some nim tutorial. you'll be faster in the end |
15:48:17 | FromDiscord_ | <codic> You're trying to figure out how to get classes in nim? |
15:48:18 | FromDiscord_ | <Rika> stop thinking in terms of classes, start thinking in terms of structs, i guess? |
15:48:27 | FromDiscord_ | <codic> This is what I understand so far: |
15:48:34 | FromDiscord_ | <Technicae Circuit> Basically |
15:48:36 | FromDiscord_ | <Technicae Circuit> Hmm |
15:49:41 | FromDiscord_ | <codic> Quick question |
15:49:55 | FromDiscord_ | <codic> Reading https://matthiashager.com/nim-object-oriented-programming, why is it `node: var Node`, not `node: Node`? |
15:50:07 | narimiran | mutable vs imutable |
15:50:13 | FromDiscord_ | <codic> yeah |
15:50:22 | FromDiscord_ | <Recruit_main707> var Node means its initialised iirc |
15:50:30 | FromDiscord_ | <codic> but does it matter if ya leave out var? |
15:50:35 | FromDiscord_ | <Rika> no its not recruit |
15:50:41 | FromDiscord_ | <codic> ? |
15:50:45 | FromDiscord_ | <Rika> @codic yes, you cannot change fields in node |
15:50:47 | narimiran | it does if you plan to modify `node` inside of a proc |
15:50:55 | FromDiscord_ | <Rika> w/o var |
15:51:09 | FromDiscord_ | <codic> Ah ok |
15:52:22 | narimiran | https://narimiran.github.io/nim-basics/#_declaring_a_procedure |
15:52:29 | narimiran | see the fourth (or so) example |
15:53:31 | FromDiscord_ | <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:38 | FromDiscord_ | <Technicae Circuit> Is there such that as global vars? |
15:53:45 | FromDiscord_ | <codic> Can you export a type with the exportpy pragma? |
15:53:59 | FromDiscord_ | <codic> (To python) |
15:54:02 | narimiran | "Is there such that as global vars?" RTFM, please |
15:54:09 | FromDiscord_ | <Technicae Circuit> Thanks |
15:54:18 | FromDiscord_ | <Recruit_main707> nimpy still doesnt support exporting types yet |
15:54:33 | narimiran | (and yes, there are global variables) |
15:54:35 | FromDiscord_ | <codic> aw, so making a nim "class" and exporting it to python is impossible |
15:54:38 | FromDiscord_ | <Technicae Circuit> :p |
15:54:45 | FromDiscord_ | <Technicae Circuit> Damn it |
15:54:46 | FromDiscord_ | <codic> But can you just use a table to store your information? |
15:54:51 | FromDiscord_ | <Technicae Circuit> We can |
15:54:55 | FromDiscord_ | <codic> Have a function that returns a table |
15:55:01 | FromDiscord_ | <codic> Then have other functions calling that |
15:55:05 | FromDiscord_ | <Rika> yes |
15:55:06 | FromDiscord_ | <Technicae Circuit> Then we can use AttrDict on that table |
15:55:10 | FromDiscord_ | <codic> ... |
15:55:16 | FromDiscord_ | <Technicae Circuit> In Python |
15:55:16 | FromDiscord_ | <codic> Nim does not have attrdict |
15:55:20 | FromDiscord_ | <codic> Oh |
15:55:43 | FromDiscord_ | <Technicae Circuit> Basically we are using a stupid workaround to classes |
15:55:51 | narimiran | "we" |
15:55:56 | FromDiscord_ | <Recruit_main707> xD |
15:55:56 | FromDiscord_ | <Rika> you |
15:55:59 | FromDiscord_ | <Technicae Circuit> Me and Codic |
15:56:07 | FromDiscord_ | <Technicae Circuit> We are working on a project :p |
15:56:14 | FromDiscord_ | <Rika> are you two friends |
15:56:15 | FromDiscord_ | <Recruit_main707> 👀 |
15:56:17 | FromDiscord_ | <Technicae Circuit> Yup |
15:56:33 | narimiran | you two should work on reading tutorials, and then your workarounds won't be stupid anymore ;) |
15:56:35 | FromDiscord_ | <Rika> recruit lets work on a project too even if i barely know you |
15:56:37 | FromDiscord_ | <Rika> (jk) |
15:56:43 | FromDiscord_ | <codic> lmao |
15:56:45 | FromDiscord_ | <Technicae Circuit> :p |
15:56:50 | FromDiscord_ | <Recruit_main707> well, im up for it :P |
15:57:00 | FromDiscord_ | <Rika> nah im jokin, ill spare you headaches |
15:57:06 | FromDiscord_ | <Rika> still trying to port Rx |
15:57:15 | FromDiscord_ | <Recruit_main707> im w/ flatbuffers rn |
15:57:52 | FromDiscord_ | <Recruit_main707> > nah im jokin, ill spare you headaches |
15:57:52 | FromDiscord_ | <Recruit_main707> lame excuse ngl ;) |
15:58:33 | FromDiscord_ | <Rika> eeeeeh |
15:58:51 | FromDiscord_ | <Rika> ree |
15:59:39 | FromDiscord_ | <Recruit_main707> what a polite ree xd |
16:00:09 | FromDiscord_ | <Rika> what, you want a WRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY |
16:00:10 | FromDiscord_ | <Rika> ? |
16:01:03 | FromDiscord_ | <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:20 | FromDiscord_ | <Recruit_main707> how do i create an string out of a byte sequence? |
16:06:33 | FromDiscord_ | <Rika> cast lul |
16:06:35 | * | xcm joined #nim |
16:07:16 | FromDiscord_ | <Technicae Circuit> If i define a table outside of a function, how would i access it inside the function |
16:07:28 | FromDiscord_ | <Rika> wdym? can you playground it |
16:07:34 | FromDiscord_ | <Technicae Circuit> Okay |
16:08:26 | FromDiscord_ | <Technicae Circuit> https://play.nim-lang.org/#ix=2jvk |
16:08:48 | FromDiscord_ | <Technicae Circuit> I want to access the table `a` inside of my function |
16:08:54 | FromDiscord_ | <Technicae Circuit> So i can modify it |
16:09:02 | FromDiscord_ | <Rika> put the proc below var a |
16:09:14 | FromDiscord_ | <Rika> ah |
16:09:14 | FromDiscord_ | <Technicae Circuit> But then a can't access the function |
16:09:15 | FromDiscord_ | <Rika> wait |
16:09:28 | FromDiscord_ | <Rika> thats weird, dont do that |
16:09:42 | * | narimiran gives up |
16:09:42 | FromDiscord_ | <Recruit_main707> why do you want test to be inside the table though |
16:09:44 | FromDiscord_ | <Technicae Circuit> It's the only way i can pass a 'class' to Python |
16:10:10 | FromDiscord_ | <Rika> tables cant hold different types in its value |
16:10:20 | FromDiscord_ | <Technicae Circuit> Oh |
16:10:26 | FromDiscord_ | <Rika> so b has to be a proc(int):void too |
16:10:33 | FromDiscord_ | <Technicae Circuit> That's fine |
16:11:25 | FromDiscord_ | <Technicae Circuit> Damn it |
16:11:33 | FromDiscord_ | <Technicae Circuit> This is complicated |
16:12:22 | FromDiscord_ | <Rika> christ, dont emulate python in nim please |
16:12:41 | FromDiscord_ | <Rika> at least dont do it when you have no idea what you're doing |
16:15:26 | FromDiscord_ | <Recruit_main707> if you want to interop with python |
16:15:44 | FromDiscord_ | <Technicae Circuit> Use the C API i assume |
16:15:46 | FromDiscord_ | <Technicae Circuit> :p |
16:15:49 | FromDiscord_ | <Recruit_main707> using the C api and a bit of c code |
16:16:11 | FromDiscord_ | <Recruit_main707> that way you have actual classes and actual python classes |
16:16:20 | FromDiscord_ | <Technicae Circuit> Hm |
16:16:48 | FromDiscord_ | <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:07 | FromDiscord_ | <Technicae Circuit> Oof |
16:17:32 | FromDiscord_ | <Rika> i thought of a way to emulate python classes but it has heavy use of `pointer` |
16:17:32 | FromDiscord_ | <Recruit_main707> into python classes using the c api |
16:17:52 | FromDiscord_ | <Rika> then also i cant think of solutions to certain problems youll hit with my idea |
16:18:37 | FromDiscord_ | <Recruit_main707> there is also the solution to create the class in python and making its functions call nim functions |
16:18:51 | FromDiscord_ | <Recruit_main707> but that will only work with primitives basically |
16:19:15 | * | hax-scramper quit (Ping timeout: 240 seconds) |
16:19:39 | FromDiscord_ | <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:30 | FromDiscord_ | <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:42 | FromDiscord_ | <Recruit_main707> https://github.com/matkuki/python3 |
16:22:03 | FromDiscord_ | <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:53 | FromDiscord_ | <Technicae Circuit> Is there a pragma for no closure? |
17:00:46 | FromDiscord_ | <Rika> not adding the closure pragma is how to get non-closure procs |
17:00:56 | FromDiscord_ | <Technicae Circuit> Oh |
17:01:11 | FromDiscord_ | <Rika> lambda/anonymous procs or procs as types must be closures though afaik |
17:01:32 | FromDiscord_ | <Technicae Circuit> For some reason I can't return a table if the proc that is returning it is available to python |
17:02:37 | leorize | specify a calling convention that's not closure and it won't be closure |
17:07:33 | FromDiscord_ | <Varriount> Or use CFFI from Python |
17:13:18 | * | zacharycarter joined #nim |
17:17:46 | * | zacharycarter quit (Ping timeout: 256 seconds) |
17:18:37 | FromDiscord_ | <Technicae Circuit> Does the name of a proc affect it at all? |
17:19:06 | FromDiscord_ | <Technicae Circuit> I doubt it |
17:24:33 | FromDiscord_ | <Rika> no |
17:27:26 | liblq-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:45 | liblq-dev | @Rika Nim will automatically create a closure if you capture and variables |
17:27:50 | enthus1ast | hi all |
17:27:55 | liblq-dev | hello |
17:28:38 | enthus1ast | when i create a type with a macro (which depends on other types) can i somehow call the macro in a type block? |
17:28:58 | enthus1ast | the workaround is to also create the other type |
17:29:08 | disruptek | pragma macro |
17:29:58 | FromDiscord_ | <Rika> liblq-dev "and"? |
17:30:13 | enthus1ast | what exactly do you mean disruptek? |
17:30:26 | liblq-dev | @Rika you said you needed to add the {.closure.} pragma explicitly. |
17:30:27 | FromDiscord_ | <Rika> im pretty sure i think i know what you mean |
17:30:38 | FromDiscord_ | <Rika> no i did not |
17:31:23 | liblq-dev | > not adding the closure pragma is how to get non-closure procs |
17:31:38 | liblq-dev | I understood this statement like that. if that's not what you meant, then sorry. |
17:31:44 | FromDiscord_ | <Rika> no |
17:31:45 | FromDiscord_ | <Rika> its not |
17:32:27 | FromDiscord_ | <Rika> the person i was talking to may not be aware about closures |
17:32:35 | FromDiscord_ | <Rika> though i guess it would have been better to mention that |
17:38:02 | * | Trustable joined #nim |
17:38:52 | FromGitter | <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:05 | leorize | enthus1ast: Nim recently added type section macro |
17:39:08 | * | kenran quit (Quit: leaving) |
17:39:44 | leorize | in 1.2 you can annotate a type with `{.yourMacro.}` and it will call `yourMacro()` with the type definition |
17:39:56 | FromGitter | <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:17 | FromDiscord_ | <Rika> copy it? |
17:40:22 | leorize | deepcopy, if it's still a thing |
17:40:27 | FromGitter | <zacharycarter> Just deep copy? |
17:40:38 | FromGitter | <zacharycarter> Hmm okay I'll try that thanks |
17:41:04 | leorize | !issues deepCopy |
17:41:05 | disbot | https://github.com/nim-lang/Nim/issues/13997 -- 3ARC: deepCopy in new runtime feature missing, do we have alternatives? |
17:41:06 | disbot | https://github.com/nim-lang/Nim/issues/7108 -- 3deepCopy bug |
17:41:06 | disbot | https://github.com/nim-lang/Nim/issues/8525 -- 3Global variable breaks spawn with overloaded deepCopy 7& 26 more... |
17:41:10 | enthus1ast | sounds interesting leorize any idea where this is documented? |
17:41:46 | FromGitter | <zacharycarter> Ah okay so basically I can't do this yet |
17:42:07 | FromGitter | <zacharycarter> I still need pointers and sync primitives |
17:43:21 | leorize | enthus1ast: ask Araq I guess :P |
17:43:43 | enthus1ast | or where do you have seen this? :) |
17:43:47 | leorize | you can probably make do by using `{.dumpTree.}` on the type definition to know what you're going to deal with |
17:44:15 | leorize[m] | it's in the change log |
17:44:30 | leorize[m] | one really helpful line: `macro pragma` is now supported for type sections :) |
17:44:34 | * | natrys quit (Quit: natrys) |
17:49:41 | enthus1ast | thank you leorize[m] i will try to find something |
17:50:06 | enthus1ast | ( 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:43 | FromGitter | <Bennyelg> (https://files.gitter.im/nim-lang/Nim/sLm6/image.png) |
17:53:55 | * | xcm joined #nim |
17:54:08 | FromGitter | <Bennyelg> Anyone can assist why I can create some "global" envs without getting a GC warning ? |
17:55:11 | leorize | wdym? |
17:55:30 | leorize | also the gc warning doesn't appear if the proc don't have {.gcsafe.} |
17:56:53 | * | zacharycarter joined #nim |
17:56:56 | FromGitter | <Bennyelg> (https://files.gitter.im/nim-lang/Nim/pYxY/image.png) |
17:57:02 | * | narimiran quit (Quit: leaving) |
17:57:58 | leorize | I'm still unsure what's your question |
18:00:14 | FromDiscord_ | <Recruit_main707> leorize now that you are online, ive been investigating, and using this: `cast[ptr T](unsafeAddr b[0])[]` works |
18:00:50 | leorize | yes it does, but you're going to interpret the bytes as the native endian |
18:01:10 | FromDiscord_ | <Recruit_main707> i can live w/ that :P |
18:01:16 | FromDiscord_ | <Recruit_main707> for now |
18:02:53 | FromGitter | <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:31 | leorize | compile the file |
18:03:41 | leorize | that error snippet is totally meaningless |
18:03:50 | leorize | probably someone didn't add all the error messages in... |
18:04:31 | leorize | well 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:47 | FromDiscord_ | <Recruit_main707> Gary M is working on fixing the errors of the current one |
18:07:56 | FromDiscord_ | <Recruit_main707> his can already be used |
18:07:58 | FromDiscord_ | <Varriount> Anyone know a way to get the "type" of a closure iterator's environment at compile time? |
18:09:09 | leorize | I don't think you can |
18:09:16 | leorize | wdym by the "type" of the environment? |
18:10:27 | FromDiscord_ | <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:11 | leorize[m] | I take it that you are going to exploit the "having to pass param everytime you call the iter"? |
18:27:59 | FromDiscord_ | <Technicae Circuit> Will proper classes be implemented in Nim anytime soon? |
18:27:59 | * | Faulander quit (Read error: Connection reset by peer) |
18:28:06 | Yardanico | wdym "proper classes"? |
18:28:07 | Yardanico | they are there |
18:28:26 | disruptek | i guess we need more classes. |
18:28:28 | Yardanico | we have inheritance with runtime dispatch and also multimethods (with --multimethods:on) |
18:28:28 | zacharycarter | can anyone help me understand why I'm encountering this error from asan sporadically? |
18:28:28 | * | Faulander joined #nim |
18:28:29 | disruptek | on why oop is dead. |
18:28:31 | zacharycarter | https://play.nim-lang.org/#ix=2jwL |
18:30:11 | zacharycarter | I'm not sure why reallocation is going on either |
18:30:14 | zacharycarter | or a copy |
18:30:40 | Yardanico | https://github.com/nim-lang/Nim/pull/12085 just got merged yay |
18:30:41 | FromDiscord_ | <Technicae Circuit> Hm |
18:30:41 | disbot | ➥ Make await a template |
18:32:07 | zacharycarter | I'm compiling with `--gc:arc` in my example |
18:32:17 | Yardanico | -d:useMalloc ? |
18:32:38 | dom96 | yay |
18:33:01 | FromDiscord_ | <Technicae Circuit> Why do tables only accept one type pair? |
18:33:15 | Yardanico | because nim is statically typed ? |
18:33:56 | zacharycarter | ooo I didn't realize I needed to use `-d:useMalloc` to use the shared heap |
18:34:01 | Yardanico | no, it's not for that |
18:34:08 | Yardanico | it's to make tools like valgrind happier |
18:34:17 | Yardanico | so that nim will use OS's own allocation functions |
18:34:19 | zacharycarter | oh |
18:34:41 | Yardanico | "Works with valgrind and clang's address sanitizers, compile with --gc:arc -d:useMalloc (and maybe with --debuginfo) for enabling this feature." |
18:34:43 | Yardanico | https://forum.nim-lang.org/t/5734 |
18:34:53 | zacharycarter | the docs say - ```use an alternative runtime that uses destructors and that uses a shared heap via -d:useMalloc |
18:35:36 | zacharycarter | interestingly with useMalloc the error seems to not reoccur |
18:35:48 | Yardanico | well that means that everything's fine :P |
18:36:03 | zacharycarter | lol |
18:36:31 | zacharycarter | https://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:56 | Yardanico | xd |
18:37:00 | FromDiscord_ | <Technicae Circuit> > <Yardanico> because nim is statically typed ? |
18:37:00 | FromDiscord_ | <Technicae Circuit> @gitterirc golang is statically typed and it accepts multiple types in arrays and maps (tables basically) |
18:37:13 | Yardanico | can you show an example? via a paste service please |
18:37:17 | zacharycarter | does it? |
18:37:22 | FromDiscord_ | <Technicae Circuit> Mhm |
18:37:31 | zacharycarter | pretty sure hashmaps in go are heterogenous |
18:37:31 | FromDiscord_ | <Technicae Circuit> Sure |
18:37:52 | FromDiscord_ | <Technicae Circuit> Let me get the code |
18:37:56 | zacharycarter | err not heterogeneous |
18:37:58 | dom96 | Go allows interface {} probably |
18:38:05 | dom96 | and you can do the same in Nim |
18:38:09 | dom96 | Just use RootObject |
18:38:16 | dom96 | I think I said this to someone already |
18:38:19 | FromDiscord_ | <Technicae Circuit> How does RootObject work? |
18:38:29 | leorize | don't use RootObj for a hash map |
18:38:50 | leorize | that's like, requiring your objects to be as big as RootObj (which is empty itself)? |
18:39:04 | Yardanico | lol |
18:39:07 | PMunch | RootObject basically adds some hidden runtime type information to the object |
18:39:19 | Yardanico | do tables understand it? |
18:39:24 | skrylar[m] | yup `interface {}` is basically a void pointer |
18:39:42 | leorize | Yardanico: if you use `ref`, then yes |
18:39:50 | dom96 | while RootObject is likely to work, I wouldn't recommend it |
18:41:00 | FromDiscord_ | <Technicae Circuit> How would the recommended way to be able to use all types be then? |
18:41:14 | leorize | don't |
18:41:18 | dom96 | You don't ever need all types |
18:41:19 | rayman22201 | Varriount I think you can do closure.rawEnv to get the environment ptr |
18:41:32 | dom96 | Explain your use case and we can suggest something concrete |
18:42:14 | FromDiscord_ | <Technicae Circuit> I need to be able to use multiple types for discord's API |
18:42:25 | Yardanico | object variants :P |
18:42:30 | FromDiscord_ | <Technicae Circuit> So i can send an integer with a steing in the same map |
18:42:30 | leorize | certainly |
18:42:39 | leorize | yea object variants |
18:42:39 | FromDiscord_ | <Technicae Circuit> How does that work? :P |
18:42:45 | leorize | look it up :P |
18:42:47 | leorize | it's in the manual |
18:43:07 | dom96 | You can likely get away with just using JsonNode |
18:43:16 | FromDiscord_ | <Technicae Circuit> Oki |
18:43:19 | dom96 | maybe Discord's API even uses JSON |
18:43:32 | leorize | !repo discord |
18:43:34 | disbot | https://github.com/Krognol/discordnim -- 9discordnim: 11Discord library for nim 15 52⭐ 10🍴 7& 6 more... |
18:43:41 | leorize | ^ you can consult that too |
18:43:44 | Yardanico | it does |
18:43:46 | Yardanico | over websockets |
18:44:02 | dom96 | of course it does, so there is no excuse not to use JsonNode anyway |
18:44:43 | Yardanico | and 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:42 | FromGitter | <Bennyelg> ```CC: stdlib_json.nim ⏎ CC: dal.nim`````` [https://gitter.im/nim-lang/Nim?at=5ea486bee5ed621d4dde24ee] |
18:52:05 | Yardanico | you don't need to care about these warnings unless you use threads |
18:52:16 | FromDiscord_ | <codic> yeah but that doesn't export to python lol |
18:52:47 | Yardanico | ? |
18:53:00 | FromGitter | <Bennyelg> Buf if i'll want my server to run threads probably I need to apply something ? |
18:53:31 | zacharycarter | so if I don't want to use the implicit result var I just use {.noinit.} ? |
18:53:37 | FromGitter | <Bennyelg> single threaded server is poor i guess |
18:53:49 | Yardanico | if it's async - not really |
18:54:02 | Yardanico | also if you use jester you won't need to worry since it uses httpbeast on supported OSes which is multithreade |
18:54:03 | Yardanico | d |
18:54:08 | FromGitter | <Bennyelg> Yea well, dbs are sync :| |
18:54:34 | dom96 | benchmark your code before enabling threads |
18:54:35 | FromGitter | <Bennyelg> I must learn more on this area |
18:54:50 | FromGitter | <Bennyelg> how to @dom96 |
18:56:00 | Yardanico | wrk2 |
18:56:04 | leorize | zacharycarter: you will always use the implicit result var :) |
18:56:23 | Yardanico | zacharycarter: if you pass noinit that implicit "result" var just won't be initialized at all |
18:56:23 | zacharycarter | so how I can I create and return a threadvar in a proc? |
18:56:54 | leorize | what's your use case? |
18:57:15 | enthus1ast | leorize i got it working https://forum.nim-lang.org/t/6254 |
18:57:28 | enthus1ast | thank you for hinting me |
18:57:37 | zacharycarter | I guess this works? https://play.nim-lang.org/#ix=2jwZ |
18:57:38 | leorize | np :) |
18:59:09 | leorize | zacharycarter: lol no |
18:59:26 | leorize | though I'm not sure what you mean by "creating a thread var" |
18:59:44 | leorize | threadvar in procs are {.global.} |
18:59:46 | zacharycarter | I want to create something on the thread local heap |
18:59:59 | zacharycarter | like in thread local storage |
19:00:06 | * | tane joined #nim |
19:00:38 | leorize | I'm still not sure what you're trying to do |
19:00:47 | zacharycarter | normally I'd use `pthread_setspecific` |
19:00:52 | zacharycarter | in C |
19:01:02 | leorize | well make a template for this one :P |
19:01:21 | leorize | native threadvars are declared |
19:01:39 | leorize | not a thread-specific hash map |
19:02:06 | zacharycarter | okay |
19:03:04 | skrylar[m] | isn't a thread specific hash map exactly how pthreads does it |
19:09:05 | zacharycarter | so I could just use a global table threadvar then I guess? |
19:11:20 | * | luis_ joined #nim |
19:16:53 | zacharycarter | oh nevermind I think I get how threadvar works now |
19:17:45 | FromDiscord_ | <Technicae Circuit> Is there a way to make a function with arguments if you don't know the type? |
19:18:02 | FromDiscord_ | <Technicae Circuit> Doubt it but it'd be nice |
19:18:25 | Yardanico | well there's "auto" or you can just use generics but pls don't |
19:18:54 | Yardanico | I mean I don't think "make a function with arguments if you don't know the type" is a good thing |
19:20:19 | FromDiscord_ | <Technicae Circuit> How do I use auto? |
19:20:35 | FromDiscord_ | <Technicae Circuit> And i kinda have to for a python module that I'm testing in Nim |
19:20:45 | Yardanico | you don't have to |
19:20:50 | Yardanico | "proc a(myarg: auto)" |
19:21:38 | FromDiscord_ | <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:46 | FromDiscord_ | <Technicae Circuit> Apparently auto is invalid |
19:24:53 | Yardanico | well what are you trying to do? |
19:25:01 | Yardanico | we can't help without code |
19:26:12 | * | luis_ quit (Client Quit) |
19:26:17 | FromDiscord_ | <Technicae Circuit> Let me paste it in playground |
19:26:41 | * | luis_ joined #nim |
19:27:50 | FromDiscord_ | <Rika> auto only works when the type is inferrable in compile time no? |
19:27:56 | Yardanico | yes of course |
19:28:03 | FromDiscord_ | <Rika> same thing with generics |
19:28:06 | FromDiscord_ | <Recruit_main707> thats what i thought |
19:28:06 | Yardanico | yep |
19:28:09 | FromDiscord_ | <Rika> so that might be techni's issue |
19:29:59 | * | Jesin joined #nim |
19:30:03 | FromDiscord_ | <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:03 | FromDiscord_ | <Recruit_main707> https://play.nim-lang.org/#ix=2jxg |
19:30:03 | FromDiscord_ | <Recruit_main707> youd rather get this into an actual editor to see the errors without compiling/checking |
19:30:34 | Yardanico | well the error exactly tells you what's wrong |
19:30:44 | Yardanico | you have two func GetVal*[T] with same definition |
19:31:01 | FromDiscord_ | <Recruit_main707> there are 35 errors though :P |
19:33:51 | Yardanico | well the errors related to "Get" are very clear too |
19:34:07 | Yardanico | compiler doesn't know which T you're talking about because you're only using it as return type |
19:34:14 | Yardanico | you'll need to explicitly specify it like [:type] too |
19:34:18 | Yardanico | for each .get call |
19:34:29 | FromDiscord_ | <Recruit_main707> when i do i get other error |
19:34:43 | FromDiscord_ | <Rika> which is |
19:34:51 | FromDiscord_ | <Recruit_main707> cannot instantiate: 'Get[voffset]'; got 1 type(s) but expected 2 |
19:34:51 | FromDiscord_ | <Recruit_main707> in expression 'Get[voffset][voffset](t, t.Pos)': identifier expected, but found 'Get[voffset]' |
19:35:06 | FromDiscord_ | <Recruit_main707> (for this code: `t.Get[:voffset](t.Pos)`) |
19:35:40 | Yardanico | ah well |
19:35:45 | Yardanico | you can fix Get definition pretty easily |
19:35:47 | Yardanico | you used generics wrong |
19:35:50 | Yardanico | "func Get*[T: Offsets](t: Vtable, off: T): T =" |
19:36:50 | FromDiscord_ | <Recruit_main707> that would work for that example, but Get should also work with ints and etc |
19:37:09 | Yardanico | well I really don't understand what are you trying to do with all this code |
19:37:30 | * | madpata joined #nim |
19:37:34 | FromDiscord_ | <Recruit_main707> ill get you the original code |
19:37:56 | Yardanico | also you have to remember |
19:38:03 | Yardanico | you can't do overloading on return type in Nim |
19:38:06 | skrylar[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:33 | FromDiscord_ | <Recruit_main707> Yardanico: i already have only one GetVal function, thats fixed :) |
19:38:39 | Yardanico | well show the code |
19:39:04 | Yardanico | but did you really look into skflatbuffers? |
19:39:21 | FromDiscord_ | <Recruit_main707> skflatbuffer uses Streams |
19:39:24 | Yardanico | so? |
19:39:48 | FromDiscord_ | <Recruit_main707> dont really want to use them |
19:40:01 | skrylar[m] | i think the suggestion is you yoink the rest of the code that already does what you're doing :b |
19:40:06 | Yardanico | yes |
19:40:11 | FromDiscord_ | <Recruit_main707> https://github.com/google/flatbuffers/blob/master/go/encode.go all this gets and writes, but as generics |
19:40:11 | Yardanico | you can easily remove streams from skflatbuffers |
19:40:25 | FromDiscord_ | <Rika> streams are useful as hell though |
19:40:47 | FromDiscord_ | <Rika> and you can make a string stream easily anyway so i dont see the issue with having them |
19:41:01 | Yardanico | @Recruit as I said there's no return type overloading in Nim |
19:41:08 | leorize | streams are super useful |
19:41:13 | skrylar[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:24 | Yardanico | so if you have func Get[T](data: seq[byte]): T = you'll always have to specify what T you're referring to |
19:42:00 | FromDiscord_ | <Recruit_main707> ye, i know |
19:42:14 | FromDiscord_ | <Recruit_main707> but the places i do it it errors with that other thing |
19:42:20 | leorize | the way I prefer is Get(data: seq[byte], T: typedesc): T |
19:42:28 | Yardanico | oh yeah |
19:42:53 | FromDiscord_ | <Recruit_main707> Get(data: seq[byte], off: offsets, T: typedesc): T rather? |
19:43:14 | Yardanico | Get(T: typedesc, data: seq[byte], off: offsets): T |
19:43:22 | Yardanico | so you'll have the type as first argument, just for easier reading :P |
19:43:47 | leorize | data should be the first argument imo |
19:43:52 | FromDiscord_ | <Recruit_main707> ok, i thought of this, but it didnt seem very nim-ish |
19:43:57 | Yardanico | why? |
19:44:08 | FromDiscord_ | <Recruit_main707> having generics |
19:44:10 | * | zacharycarter quit (Ping timeout: 246 seconds) |
19:44:22 | FromDiscord_ | <Rika> generics wont work with what you want |
19:44:23 | Yardanico | "streams" stdlib module has procs like readInt, readUint, etc |
19:45:01 | Yardanico | it uses generics only with arguments with that generic type |
19:45:03 | FromDiscord_ | <Rika> Yardanico, do you think readXXX() is better over read(typ: typedesc) ? |
19:45:12 | Yardanico | I would actually prefer readXXX() ngl |
19:45:14 | FromDiscord_ | <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:36 | FromDiscord_ | <Recruit_main707> so that hopefully i can adapt flatc to support nim |
19:45:37 | Yardanico | you can always create read(typ: typedesc) and then create procs like readUint which just call the original one |
19:45:38 | FromDiscord_ | <Rika> why? |
19:45:45 | FromDiscord_ | <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:47 | FromDiscord_ | <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:55 | FromDiscord_ | <Elegant Beef> Complains about a nil |
19:48:06 | * | Vladar quit (Quit: Leaving) |
19:48:10 | skrylar[m] | read(x: var T) :) |
19:48:26 | Yardanico | @Elegant Beef what is PPcuchar ? |
19:48:33 | Yardanico | and how does it complain |
19:48:43 | skrylar[m] | pointer to a pointer to c characters |
19:49:25 | Yardanico | you can just not have it as "nil" and it'll be initialized to zeroes which would mean the same in this case |
19:51:48 | skrylar[m] | wondering how derpy literate nim would be |
19:52:08 | Yardanico | wdym |
19:52:13 | * | zacharycarter joined #nim |
19:52:44 | FromDiscord_ | <Rika> why *is* there no generic hash proc for objects? |
19:52:45 | skrylar[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:58 | skrylar[m] | theres slightly more to literate tools than that, but not much |
19:53:46 | FromDiscord_ | <Elegant Beef> I mean all the values from my understanding will be intialized by XGetWindowProperty |
19:54:05 | * | hax-scramper joined #nim |
20:00:15 | Yardanico | well but what's the error |
20:00:38 | FromDiscord_ | <Elegant Beef> Attempt to read from nil |
20:01:55 | Yardanico | can you post *full* error? with code too :P |
20:02:31 | FromDiscord_ | <Elegant Beef> https://hatebin.com/lzsoisjsum |
20:02:33 | FromDiscord_ | <Elegant Beef> That is the full error |
20:02:45 | FromDiscord_ | <Elegant Beef> That line causes a attempt to read from nil error |
20:03:42 | Yardanico | what's on line 694 |
20:04:18 | Yardanico | and is the source itself open? |
20:04:28 | FromDiscord_ | <Elegant Beef> XGetWindowProperty |
20:04:37 | FromDiscord_ | <Elegant Beef> I posted the full code of that function |
20:05:23 | Yardanico | but I mean the full code of your project so I can test :P |
20:05:25 | FromDiscord_ | <Elegant Beef> I ensure that activeTWindow cannot be niil |
20:05:36 | FromDiscord_ | <Elegant Beef> I mean i dont have the nimble setup yet |
20:05:37 | FromDiscord_ | <Elegant Beef> but |
20:05:37 | FromDiscord_ | <Elegant Beef> https://github.com/beef331/goodwm |
20:06:09 | FromDiscord_ | <Technicae Circuit> I'm back |
20:06:11 | FromDiscord_ | <Technicae Circuit> https://play.nim-lang.org/#ix=2jxf |
20:06:18 | FromDiscord_ | <Elegant Beef> Need imgui and xlib iirc |
20:06:20 | FromDiscord_ | <Technicae Circuit> That's the code I'm struggling with |
20:06:35 | * | zacharycarter quit (Ping timeout: 246 seconds) |
20:08:46 | FromDiscord_ | <Rika> @Technicae Circuit client's type cant be inferred with the known data |
20:09:13 | Yardanico | did you check https://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184? |
20:09:15 | Yardanico | https://github.com/yglukhov/nimpy/blob/master/tests/tpyfromnim.nim#L184 |
20:09:20 | FromDiscord_ | <Technicae Circuit> Okay, but if i do `ref PyObject` i get the the following error |
20:09:27 | FromDiscord_ | <Technicae Circuit> Lemme see |
20:12:58 | FromDiscord_ | <Technicae Circuit> Nothing there that helps me |
20:13:07 | Yardanico | and what is "coroutine"? |
20:14:02 | FromDiscord_ | <Technicae Circuit> A coroutine is an asyncronous function |
20:14:08 | Yardanico | i mean in python |
20:14:10 | Yardanico | how is it defined |
20:14:19 | FromDiscord_ | <Technicae Circuit> In older Python functions async def doesn't exist |
20:14:45 | Yardanico | I know |
20:14:49 | FromDiscord_ | <Technicae Circuit> So the alternative is `func_name = types.coroutine(func_name)` |
20:14:56 | FromDiscord_ | <Technicae Circuit> O |
20:15:27 | FromDiscord_ | <Technicae Circuit> It's defined like `let coroutine = pyImport("types").coroutine` |
20:15:51 | FromDiscord_ | <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:51 | disbot | no footnotes for `/data/data/com.termux/files/home/hata.nim(14,`. 🙁 |
20:16:30 | FromDiscord_ | <Technicae Circuit> What? |
20:17:05 | FromDiscord_ | <Technicae Circuit> Disbot shouldn't respond to that :p |
20:17:13 | Yardanico | it should |
20:17:13 | leorize | well disbot don't care :P |
20:17:28 | disruptek | disbot: don't gaf. |
20:17:30 | disbot | on it. 👍 |
20:17:43 | Yardanico | try https://play.nim-lang.org/#ix=2ija @Technicae |
20:17:48 | Yardanico | but really use nim discord libs instead |
20:18:04 | skrylar[m] | huh. doesn't work too bad actually |
20:18:31 | skrylar[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:07 | FromDiscord_ | <Technicae Circuit> O |
20:20:17 | FromDiscord_ | <Technicae Circuit> Oki |
20:20:52 | FromDiscord_ | <Technicae Circuit> > <Yardanico> try https://play.nim-lang.org/#ix=2ija @Technicae |
20:20:52 | FromDiscord_ | <Technicae Circuit> Uh |
20:20:56 | FromDiscord_ | <Technicae Circuit> Wrong link? |
20:21:25 | Yardanico | no, seems like playground lagged or something like that |
20:21:31 | Yardanico | https://play.nim-lang.org/#ix=2jxI |
20:21:32 | FromDiscord_ | <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:35 | FromDiscord_ | <Technicae Circuit> Oki |
20:23:07 | Yardanico | also I wouldn't really be so sure that async from Python side will work properly with nimpy |
20:24:43 | FromDiscord_ | <Technicae Circuit> I've gotten `Traceback (most recent call last) |
20:24:43 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/hata.nim(9) hata |
20:24:43 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1198) callMethodAux |
20:24:43 | FromDiscord_ | <Technicae Circuit> SIGSEGV: Illegal storage access. (Attempt to read from nil?)` |
20:24:47 | FromDiscord_ | <Technicae Circuit> Yeah i know :p |
20:25:06 | * | luis_ quit (Remote host closed the connection) |
20:25:11 | Yardanico | well then I don't know, I don't really use nimpy or python |
20:25:45 | FromDiscord_ | <Technicae Circuit> Damn |
20:25:49 | FromDiscord_ | <Technicae Circuit> Okay, thanks anyway |
20:25:54 | Yardanico | i 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:31 | Yardanico | but I really recommend you to just use a pure-nim discord lib |
20:27:22 | FromDiscord_ | <codic> but none exist that work, lol |
20:27:28 | Yardanico | wdym |
20:27:35 | FromDiscord_ | <codic> Discord.nim doesn't work |
20:27:48 | FromDiscord_ | <Technicae Circuit> I think it's the library side |
20:27:50 | Yardanico | and the other one? |
20:27:55 | FromDiscord_ | <codic> Which other one? |
20:28:03 | Yardanico | https://github.com/krisppurg/dimscord |
20:28:15 | FromDiscord_ | <codic> i didn't even know that exists, lol |
20:28:22 | FromDiscord_ | <codic> Oh that's maintained, great! |
20:28:22 | FromDiscord_ | <Technicae Circuit> It's quite complicated :p |
20:28:33 | FromDiscord_ | <codic> Seems pretty simple |
20:28:42 | FromDiscord_ | <Technicae Circuit> Not to me ;-; |
20:28:45 | FromDiscord_ | <codic> What seems complicated about it? |
20:29:33 | Yardanico | it's much less complicated than using nimpy to call into python |
20:29:44 | FromDiscord_ | <Technicae Circuit> True |
20:29:51 | FromDiscord_ | <Technicae Circuit> But I'll probably write my own kib |
20:29:53 | FromDiscord_ | <Technicae Circuit> Lib* |
20:29:55 | FromDiscord_ | <codic> It seems very simple to me |
20:30:05 | FromDiscord_ | <codic> Simpler than every async based library I've seen so far |
20:30:20 | FromDiscord_ | <codic> (not in nim, just in general) |
20:30:28 | FromDiscord_ | <Rika> most async libraries in nim have looked simpler than any non-nim async library ive seen |
20:30:52 | madpata | checkout lface.gif in dimscord's example folder. Not very professional |
20:31:27 | FromDiscord_ | <codic> lolwat |
20:31:29 | FromDiscord_ | <codic> https://github.com/krisppurg/dimscord/blob/master/examples/lface.gif |
20:31:33 | FromDiscord_ | <Rika> hm? |
20:31:41 | FromDiscord_ | <codic> Yeah... sadly, that doesn't help me :P |
20:33:18 | * | zacharycarter joined #nim |
20:33:30 | FromDiscord_ | <codic> I wish it had much better designed examples than what it currently has |
20:33:38 | FromDiscord_ | <codic> > The docs will be out soon or later. |
20:33:41 | FromDiscord_ | <codic> Welp, no docs |
20:33:57 | Yardanico | it's not so hard to check source code |
20:34:05 | FromDiscord_ | <codic> true |
20:34:20 | FromDiscord_ | <codic> I wonder when voice support will come |
20:34:23 | FromDiscord_ | <codic> > will be added on later |
20:35:41 | FromDiscord_ | <Rika> ugh, im still heavily irked by the lack of a generic `hash(object): Hash` proc in `hashes` |
20:35:50 | FromDiscord_ | <Rika> is there a reason this doesnt exist? |
20:36:58 | FromDiscord_ | <patasuss> you mean a hash function that could hash anything you give it? |
20:37:40 | FromDiscord_ | <codic> how can i have a `varargs` supporting all types? `varargs[`$`]`? |
20:37:43 | * | zacharycarter quit (Ping timeout: 246 seconds) |
20:37:49 | FromDiscord_ | <Rika> yes patasuss |
20:38:15 | leorize | Rika: because no one really need one |
20:38:31 | FromDiscord_ | <Rika> it wouldnt hurt to have one would it? |
20:38:46 | leorize | yes it would :) |
20:39:10 | leorize | to this day the generic `$` for objects is still considered one of the harmful inventions |
20:39:27 | FromDiscord_ | <codic> but is that right? |
20:39:27 | FromDiscord_ | <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:07 | FromDiscord_ | <codic> WAIT, so could I even just use ````thing: `$` ``` for any sort of type? Or would i do `[T](thing:T)` (generics)? |
20:40:20 | FromDiscord_ | <Rika> we're not talking to you codic |
20:40:49 | FromDiscord_ | <codic> I know, just thought of it because leorize said |
20:40:49 | FromDiscord_ | <codic> > <leorize> to this day the generic $ for objects is still considered one of the harmful inventions |
20:41:04 | FromDiscord_ | <Rika> you misunderstood leorize then |
20:41:11 | Yardanico | well with [T](thing: T) you will be able to accept any type, yes |
20:41:18 | FromDiscord_ | <Rika> leorize, why is it harmful? i fail to see |
20:41:26 | Yardanico | but you'll need to check inside the proc for different types with "when" statements |
20:41:41 | Yardanico | which is the same to just writing the overloaded procs for different types |
20:41:41 | FromDiscord_ | <codic> So generics, gotcha. So can I do `[T](thing: varargs[T])`? |
20:41:46 | Yardanico | not sure |
20:41:50 | * | xcm joined #nim |
20:41:55 | FromDiscord_ | <codic> Yup I know I'd have to check inside proc |
20:41:56 | FromDiscord_ | <Rika> you can, but you can only still accept one type then |
20:42:01 | FromDiscord_ | <codic> Alright, I'd try myself |
20:42:02 | FromDiscord_ | <codic> Oh |
20:42:09 | FromDiscord_ | <codic> So using a $ is the only way for varargs? |
20:42:19 | FromDiscord_ | <Rika> using a $ will convert them all into strings |
20:42:27 | FromDiscord_ | <patasuss> $ has nothing to do with generics or varargs |
20:42:30 | Yardanico | yes, so in the end you'll only deal with one type |
20:42:32 | FromDiscord_ | <Rika> if you think that's useful, then sure |
20:42:34 | Yardanico | coz $ returns a string |
20:42:37 | FromDiscord_ | <codic> o |
20:42:40 | FromDiscord_ | <codic> welp |
20:43:00 | FromDiscord_ | <Recruit_main707> about generics dont gtting value assigned by return type, will that be a thing? |
20:43:06 | Yardanico | not really |
20:43:10 | FromDiscord_ | <Recruit_main707> it would be so cool |
20:43:18 | FromDiscord_ | <Rika> i dont understand your question |
20:43:32 | Yardanico | see https://forum.nim-lang.org/t/3025 |
20:44:30 | leorize | return type overloading is evil |
20:44:37 | leorize | and no sane prog land has never done it |
20:44:39 | Yardanico | @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:42 | leorize | lang* |
20:45:12 | leorize | Rika: it causes trouble with generic binding, and even more trouble to people who like to import modules partially |
20:45:14 | FromDiscord_ | <Recruit_main707> no sane lang has this metaprogramming either |
20:45:31 | Yardanico | depends on what you mean by "metaprogramming" |
20:45:39 | leorize | well lisp have it, even more than us |
20:45:41 | Yardanico | and yeah, I don't think we need return type overloading, you already have "var" types |
20:45:49 | FromDiscord_ | <Rika> lisp is super insane tho 😛 |
20:45:55 | * | silvernode quit (Ping timeout: 244 seconds) |
20:45:55 | leorize | it's not about var type tbh |
20:46:14 | FromDiscord_ | <Rika> Yardanico: damn, i see, that looks evil |
20:46:15 | madpata | will things like this ever be possible? https://play.nim-lang.org/#ix=2jxQ |
20:46:16 | Yardanico | @Rika not really |
20:46:34 | leorize | it's about how `foo()` means different thing in different context with no visible way to distinguish them |
20:46:35 | madpata | oh wait, didn't read the forum post |
20:46:47 | FromDiscord_ | <Rika> madpata, you can just discard since none() is default 😛 |
20:47:23 | madpata | damn, never thought about it |
20:47:33 | madpata | but thanks |
20:47:38 | leorize | if you wanna use none, it's none(T) |
20:47:53 | FromDiscord_ | <Rika> madpata, https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/options.nim#L124 LOL |
20:48:02 | FromDiscord_ | <Rika> none() is literally a discard LOL |
20:48:14 | Yardanico | that is an implementation detail |
20:48:34 | PMunch | You can also just call "return" or even "return result". The default value for Option[T] is none(T) |
20:48:51 | madpata | yeah, never looked into it. was just a bad habit of mine I guess |
20:48:58 | FromDiscord_ | <Rika> i said that PMunch |
20:49:01 | FromDiscord_ | <Rika> smhhhh T_T |
20:49:58 | PMunch | You said you could "discard" which is also true |
20:50:11 | PMunch | I was just offering up some more ways of doing it :) |
20:50:33 | FromDiscord_ | <Rika> i seem to have recalled sending a message i never actually sent |
20:50:40 | madpata | but maybe I'll stick to "return none[T]()" because it's a bit more explicit about that something gets returned |
20:50:44 | FromDiscord_ | <Rika> my memory is as reliable as discord... |
20:51:06 | PMunch | madpata, to anyone familiar with Nim you know that it has default return values |
20:51:10 | PMunch | So it shouldn't be an issue |
20:51:31 | PMunch | But 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:26 | madpata | I'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:04 | leorize | instead of typing `return smt`, you can do: `proc foo(): Option[int] = none int` |
20:57:24 | FromDiscord_ | <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:59 | Yardanico | "creature = array2d" should be "creature: array2d" |
20:58:11 | FromDiscord_ | <Ahri Fox> thank you |
20:58:23 | PMunch | madpata, you get used to it, and it's actually quite a nice feature once you know how to wield it |
20:58:29 | Yardanico | ah I see what you're trying to do |
20:59:15 | PMunch | And `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:17 | madpata | PMunch I'll try my best to change my habit |
20:59:31 | Yardanico | do you really need to return something from "runCode"? |
20:59:39 | PMunch | I mean there's nothing wrong with being explicit about returns in Nim |
20:59:54 | madpata | yeah result is great, already been using that. just have been returning them explicitly :p |
20:59:59 | FromDiscord_ | <Ahri Fox> yes, to return the altered array (err... nothing is altered yet, havent wrote it yet) |
21:00:03 | FromDiscord_ | <Rika> how do i check if a type complies with a concept on compile time? |
21:00:43 | Yardanico | then something like https://play.nim-lang.org/#ix=2jy0 @Ahri |
21:00:47 | PMunch | madpata 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:04 | FromDiscord_ | <Ahri Fox> thank you |
21:01:58 | Yardanico | also you can always do randomize() to randomize by a different value each time |
21:02:11 | Yardanico | without arguments I mean, to have a different seed each time |
21:02:45 | FromDiscord_ | <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:42 | Yardanico | ah ok |
21:04:57 | PMunch | Rika, you could to a when compiles statement.. |
21:05:03 | PMunch | Bit of a hack though.. |
21:05:12 | FromDiscord_ | <Rika> eeh... |
21:08:01 | madpata | PMunch, nice article. Have been using inline if and stuff. Very nice. |
21:08:20 | Yardanico | madpata: also don't forget you can have case expressions too :) |
21:08:34 | Yardanico | if you cover all cases of course |
21:08:36 | PMunch | Thanks, yeah I was surprised myself when I started researching that article about how deep it goes |
21:08:51 | PMunch | It was prompted by someone asking for a default value for things that could throw |
21:09:20 | PMunch | So I tried `var x = try: parseFloat("hello") except: 0.0` and it worked :) |
21:09:43 | madpata | Another question: Would there be any reason to not allow thngs like this? https://play.nim-lang.org/#ix=2jy2 |
21:09:46 | Yardanico | I 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:46 | PMunch | Yardanico, that's also mentioned in the article :) |
21:09:52 | * | zacharycarter joined #nim |
21:09:56 | madpata | PMunch I love nim for those small productivity things |
21:10:09 | Yardanico | madpata: Foo[int](val: 1) |
21:10:17 | Yardanico | also "return" is not needed here :) |
21:10:36 | PMunch | Yardanico, 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:40 | madpata | Yardanico I know what the fix would be. I just wondered why the [int9 is needed |
21:11:50 | madpata | just seems like sth the compiler could infer/assume |
21:11:51 | PMunch | You could also do it like this: https://play.nim-lang.org/#ix=2jy4 |
21:12:07 | madpata | oh damn, nice. |
21:12:13 | PMunch | Well "1" can be int, uint, int64, uint8, etc |
21:13:07 | madpata | just make number suffixes required /s |
21:13:13 | FromDiscord_ | <Rika> lol |
21:13:31 | FromDiscord_ | <Recruit_main707> No |
21:14:18 | PMunch | Hmm, 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:10 | FromDiscord_ | <Recruit_main707> That seems like it should work |
21:15:28 | madpata | but sadly doesn't |
21:15:53 | FromDiscord_ | <Recruit_main707> What happens if you don’t fill the generic? |
21:16:19 | FromDiscord_ | <Recruit_main707> (Don’t specify [int]) |
21:16:46 | madpata | throws an error. Missing generic argument |
21:18:05 | FromDiscord_ | <Recruit_main707> And Foo[int](val:... ? |
21:18:29 | FromDiscord_ | <Technicae Circuit> How would i not include the stdlib in Nim? |
21:19:20 | FromDiscord_ | <Recruit_main707> You guys are trying hard, respect, but I don’t think that’s possible |
21:19:20 | madpata | Technicae Circuit --os:standalone maybe? |
21:19:31 | FromDiscord_ | <Technicae Circuit> Thanks |
21:19:49 | FromDiscord_ | <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:21 | Yardanico | there's also --os:any |
21:20:30 | Yardanico | and what do you mean by "not include the stdlib"? |
21:20:33 | Yardanico | you mean C stdlib or wat? |
21:20:42 | madpata | probably means the system module |
21:20:44 | Yardanico | nim "system" module is ALWAYS included in your files |
21:20:49 | Yardanico | imported* :) |
21:20:52 | * | letto_ joined #nim |
21:21:05 | Yardanico | but 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:20 | FromDiscord_ | <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:47 | leorize | dead code elimination is on by default |
21:31:52 | leorize | if 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:38 | enthus1ast | does one know how to use the macros.quote do with other quoting chars than ``? No char i use seem to work. |
21:35:44 | enthus1ast | i want do do []=(`entity`.world.`storeName`, `entity.id`, `componentObj`) |
21:35:52 | enthus1ast | to do |
21:38:00 | FromDiscord_ | <Technicae Circuit> Can someone explain what ```Traceback (most recent call last) |
21:38:00 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1026) testPy_wrapper |
21:38:01 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1015) noinline |
21:38:01 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/hata_cmds.nim(7) test |
21:38:01 | FromDiscord_ | <Technicae Circuit> /data/data/com.termux/files/home/.nimble/pkgs/nimpy-0.1.0/nimpy.nim(1223) getAttr |
21:38:01 | FromDiscord_ | <Technicae Circuit> SIGSEGV: Illegal storage access. (Attempt to read from nil?)``` means? |
21:38:08 | FromDiscord_ | <Technicae Circuit> Oop- |
21:38:21 | FromDiscord_ | <Technicae Circuit> I forgot to use playground 😅 |
21:38:29 | liblq-dev | it means that you tried to read/write to a nil value. |
21:38:57 | liblq-dev | eg. a null pointer, or an uninitialized ref object |
21:39:26 | Yardanico | so 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:38 | Yardanico | it works if it's "object" but not when it's "ref object" |
21:39:39 | FromDiscord_ | <Technicae Circuit> How would i fix that then? |
21:39:45 | FromDiscord_ | <Technicae Circuit> Hm |
21:39:58 | enthus1ast | Yardanico nope ref will not work |
21:40:22 | Yardanico | enthus1ast: strange, I thought it would work, isn't it easy to initialize a "ref object" in json.to macro? |
21:40:28 | Yardanico | just add a "new" call before assigning stuff |
21:41:11 | enthus1ast | i tried to patch json for one of my game projects but the macro stuff there blew my mind |
21:41:51 | enthus1ast | also the serializer and deserializer is limited |
21:41:59 | Yardanico | I know, it's for discord api lib |
21:42:05 | Yardanico | there's A LOT of optional fields |
21:42:54 | dom96 | You don't need to define them all up front |
21:43:02 | dom96 | also, they more than likely shouldn't be refs |
21:43:12 | Yardanico | @dom96 well I know, it's just that this lib used them as "ref object" :) |
21:43:28 | dom96 | yes, and that's a bug |
21:43:35 | dom96 | should get a better error message at least |
21:43:58 | Yardanico | yeah it crashed at runtime because of assertion in options.nim so I was a bit confused for a few mins :P |
21:44:54 | enthus1ast | dom96 do you maybe know how i could use `[]=` in macro.quote ? |
21:45:30 | dom96 | nope |
21:45:46 | * | zacharycarter joined #nim |
21:46:51 | enthus1ast | mh ok; there is a parameter to change the quoting chars, but nothing i type in there seems to be allowed? dont kno |
21:46:52 | enthus1ast | w |
21:47:45 | * | liblq-dev quit (Ping timeout: 240 seconds) |
21:47:58 | FromGitter | <dumjyl> The custom quote op acts like a prefix operator, not something that surrounds like backticks. |
21:49:06 | PMunch | enthus1ast, yeah I've asked about that before |
21:49:09 | FromDiscord_ | <sealegs> Yardanico, its fixed on the devel branch |
21:49:15 | Yardanico | not for Embed though |
21:49:20 | PMunch | Seems like no one knows how to pass that parameter.. |
21:49:38 | Yardanico | all "EmbedThumbnail" etc should be just "object" to |
21:49:39 | Yardanico | o |
21:49:41 | enthus1ast | maybe |
21:49:44 | Yardanico | also I've found a few other bugs |
21:50:01 | enthus1ast | there should be an equivalent for every []= and friends in the stdlib |
21:50:09 | FromDiscord_ | <sealegs> For embed, all fields are options as the discord dics say |
21:50:18 | FromDiscord_ | <Yardanico> no, you didn't understand me |
21:50:26 | * | zacharycarter quit (Ping timeout: 260 seconds) |
21:50:33 | FromDiscord_ | <Yardanico> the types should be "EmbedThumbnail = object" and so on for all types which are used in other fields as Option[Type] |
21:50:45 | FromDiscord_ | <Yardanico> you did this to types like User but not for Embed subfields |
21:50:47 | * | liblq-dev joined #nim |
21:51:35 | FromDiscord_ | <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:39 | PMunch | enthus1ast, you an do this: https://play.nim-lang.org/#ix=2jyd |
21:52:10 | PMunch | can* |
21:52:18 | FromDiscord_ | <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:25 | FromDiscord_ | <Yardanico> so I had to add two checks for the existence of these keys |
21:52:55 | FromDiscord_ | <sealegs> huh for some reason its workinf for me |
21:53:00 | enthus1ast | ah i see PMunch nice workaround |
21:53:03 | enthus1ast | thank you |
21:53:11 | FromDiscord_ | <sealegs> sorry for the typos btw |
21:53:13 | FromDiscord_ | <Yardanico> I ran it in this Nim server so there's quite a lot of people with different presence updates and stuff |
21:53:26 | FromDiscord_ | <Yardanico> I was porting https://github.com/Yardanico/ircord to your lib |
21:53:44 | FromDiscord_ | <sealegs> Ohhhh wait, I know why |
21:54:21 | FromDiscord_ | <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:26 | PMunch | enthus1ast, I could've sworn that I found another workaround when I was creating macroutils |
21:54:34 | PMunch | But I can't figure out what that was |
21:54:35 | FromDiscord_ | <Yardanico> it's easy to change, I did that for message_create and message_update and it just worked |
21:55:01 | FromDiscord_ | <sealegs> I see. |
21:55:31 | FromDiscord_ | <sealegs> If a guild reaches a lot of members the library doesn't handle uncached members. |
21:55:58 | FromDiscord_ | <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:58 | FromDiscord_ | <Yardanico> after removing it I could handle message_update events |
21:56:25 | FromDiscord_ | <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:38 | FromDiscord_ | <Yardanico> but I removed the return |
21:57:16 | FromDiscord_ | <sealegs> Okay |
21:57:32 | Yardanico | I'll try making a PR with some of these changes so you can easier understand what I meant |
21:57:34 | Yardanico | to "devel" branch |
21:58:00 | FromDiscord_ | <sealegs> Thanks, really appeciate it. |
21:59:03 | FromDiscord_ | <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:57 | PMunch | Ahri Fox: https://play.nim-lang.org/#ix=2jyj |
22:01:27 | PMunch | Your array3d type is an array of your creatureArray tuple |
22:02:05 | PMunch | Tuples can be accessed by [], but only when the value is known at compile-time |
22:02:33 | PMunch | So that .code could be replaced by [1] |
22:02:44 | PMunch | That's why the error might be a bit confusing |
22:02:53 | PMunch | @Ahri Fox ^ |
22:03:44 | FromDiscord_ | <Ahri Fox> oh alright, thanks! |
22:04:15 | PMunch | Oh well, I'm off |
22:04:17 | PMunch | Have 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:06 | FromDiscord_ | <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:46 | FromDiscord_ | <codic> :O |
22:26:02 | * | liblq-dev quit (Quit: WeeChat 2.7.1) |
22:32:26 | dom96 | Generic: love it. |
22:33:15 | FromDiscord_ | <Recruit_main707> go out there and hit your work partners and bosses with the nim or nothin' |
22:35:08 | FromDiscord_ | <sealegs> Nice image |
22:36:51 | FromDiscord_ | <Ahri Fox> why cant creature.vars[whatever] by assigned to? tuples are mutable right https://play.nim-lang.org/#ix=2jyW |
22:37:49 | Yardanico | because you need to pass it as "var T" if you want it to be mutable in the procedure |
22:37:58 | Yardanico | https://play.nim-lang.org/#ix=2jzo |
22:38:34 | * | someunknownuser joined #nim |
22:39:11 | FromDiscord_ | <Ahri Fox> oh adding a var, i guess that makes sense |
22:39:30 | FromDiscord_ | <Ahri Fox> sorry for asking so much |
22:40:36 | Yardanico | it's okay |
22:40:46 | Yardanico | But I'd suggest you to read https://narimiran.github.io/nim-basics/ |
22:46:30 | FromDiscord_ | <Rika> TUPLES ARE MUTABLE?! |
22:47:13 | Yardanico | ehm of course lol? |
22:47:17 | Yardanico | if you declare them as "var" |
22:47:19 | Yardanico | and pass them as "var" |
22:48:06 | FromDiscord_ | <Rika> . -. |
22:48:32 | FromDiscord_ | <Rika> my disappointment is immeasurable and my day is ruined |
22:48:59 | Yardanico | well I got that reference |
22:50:25 | FromDiscord_ | <Recruit_main707> lol Rika |
22:51:35 | FromDiscord_ | <Rika> Man and here i was, thinking "no way tuples can be mutable" then Mr "var" comes along and says "lol no" |
22:51:40 | skrylar[m] | welp. greedy wrap done. now for the uh, less fun ones. |
22:51:42 | FromDiscord_ | <Recruit_main707> That’s why we have a let |
22:52:09 | skrylar[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:11 | skrylar[m] | but it says ARRR U NO DO |
22:53:10 | skrylar[m] | oh well it beats an army of match statements in v/rust to deal with errors from every function call |
22:53:33 | FromDiscord_ | <Rika> What |
22:53:37 | FromDiscord_ | <Rika> I don't understand your issue |
22:54:29 | skrylar[m] | was trying to shadow a `let` with another `let` in the same block and it wouldn't let me do it |
22:54:33 | skrylar[m] | elixir lets you do it |
22:56:31 | * | zacharycarter joined #nim |
22:56:50 | FromDiscord_ | <Rika> That just violates the point of a let tho no? |
22:57:15 | skrylar[m] | noh. it doesn't change the original value, it changes the binding |
22:57:47 | skrylar[m] | let a = 5 #a1 is now 5 |
22:57:47 | skrylar[m] | let a = a + 5 #a1 is still 5 but any code from this line down gets a2 |
22:58:54 | FromDiscord_ | <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:13 | FromDiscord_ | <Venator> is there any info about this lock level stuff? I was only able to find one github issue when searching |
23:00:41 | FromDiscord_ | <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:43 | skrylar[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:44 | FromDiscord_ | <Technicae Circuit> ~~Imagine if Nim could make haxe code~~ |
23:35:51 | zacharycarter | Why not just use Haxe? |
23:35:51 | * | rockcavera quit (Remote host closed the connection) |
23:36:53 | FromDiscord_ | <Technicae Circuit> ~~Because Nim is superior!~~ |
23:37:02 | FromDiscord_ | <Technicae Circuit> And i wasn't saying it should |
23:37:08 | FromDiscord_ | <Technicae Circuit> I'm just saying imagine |
23:37:25 | FromDiscord_ | <Technicae Circuit> If Nim could though that could be OP |
23:37:47 | FromDiscord_ | <Technicae Circuit> Not only would it be able to make C, C++, ObjC and JS |
23:38:00 | FromDiscord_ | <Technicae Circuit> But it would have access to anything Haxe could |
23:38:14 | FromDiscord_ | <Technicae Circuit> But i prefer Nim how it is now |
23:38:17 | zacharycarter | I don't really get the appeal |
23:38:31 | FromDiscord_ | <Technicae Circuit> Wdym? |
23:38:40 | FromDiscord_ | <Technicae Circuit> Appeal of Haxe? |
23:38:43 | zacharycarter | I don't understand why you'd want to generate Haxe from Nim |
23:38:49 | zedeus | well, you can do the opposite https://github.com/RapidFingers/Craxe |
23:38:52 | FromDiscord_ | <Technicae Circuit> I don't either |
23:38:54 | zacharycarter | if it can already compile to C/C++ |
23:38:59 | FromDiscord_ | <Technicae Circuit> Oo cool |
23:39:29 | zacharycarter | seems kind of pointless - why not just compile Haxe straight to C/C++? |
23:39:43 | zacharycarter | none of this makes much sense to me |
23:40:08 | FromDiscord_ | <Technicae Circuit> Yeah |
23:40:16 | FromDiscord_ | <Technicae Circuit> Neither to me :p |
23:40:34 | * | Guest96344 quit (Ping timeout: 265 seconds) |
23:41:15 | skrylar[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:41 | zacharycarter | I think if you like Java and you don't want to deal with C/C++ then Haxe might be useful |
23:42:05 | skrylar[m] | well haxe also was to replace actionscript |
23:42:08 | zacharycarter | yeah well Haxe's syntax and OO rigidness induces suffering IMO |
23:42:21 | skrylar[m] | so your flash games and the server shared the same code |
23:42:36 | skrylar[m] | i don't know that it makes much sense to use the java/c#/php backends anymore |
23:43:18 | skrylar[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:59 | zacharycarter | I remember when people said that everyone would be reusing JS with NodeJS |
23:45:26 | FromDiscord_ | <Technicae Circuit> Wdym? |
23:45:51 | zacharycarter | That client and server JS apps would be sharing code |
23:46:14 | FromDiscord_ | <Technicae Circuit> They do if you use NodeJS for the server :p |
23:46:15 | skrylar[m] | dont some of them |
23:46:34 | FromDiscord_ | <Technicae Circuit> I use Python for both most of the time |
23:46:35 | * | leorize joined #nim |
23:46:46 | FromDiscord_ | <Technicae Circuit> But I'm switching to Nim slowly |
23:46:47 | zacharycarter | Sharing code != using the same language |
23:46:54 | zacharycarter | it means actually reusing code |
23:46:59 | FromDiscord_ | <Technicae Circuit> Ik |
23:47:18 | zacharycarter | you 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:53 | FromDiscord_ | <Technicae Circuit> True |
23:47:56 | skrylar[m] | i kind of liked haxe.. also they have stuff like flixel |
23:48:08 | zacharycarter | it's too much like Java for me |
23:48:22 | skrylar[m] | hmm i didn't mind its c#-ness |
23:49:34 | skrylar[m] | v is interesting a little |
23:49:38 | FromDiscord_ | <Technicae Circuit> :p |
23:49:42 | * | martinium joined #nim |
23:50:09 | zacharycarter | V is interesting in that it's making money and is essentially vaporware |
23:50:36 | skrylar[m] | i mean. you can use it to make stuff. and its tiny |
23:50:45 | skrylar[m] | Red is more vaporish than V |
23:51:52 | skrylar[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) |