00:21:46 | ForumUpdaterBot | New thread by Treeform: Is there a way for case objects to have cases share fields?, see https://forum.nim-lang.org/t/7011 |
00:26:23 | FromGitter | <jrfondren> not that much of a pain to reduce actually: https://github.com/nim-lang/Nim/issues/15778 |
00:26:25 | disbot | β₯ Viewtype codegen error turns a single proc call into two ; snippet at 12https://play.nim-lang.org/#ix=2Crw |
00:28:45 | sealmove | is there a way to resolve ambiguous call? if 2 procs match, specify which one will be used (set priority) |
00:29:26 | FromDiscord | <ElegantBeef> named parameters is one way |
00:29:47 | FromDiscord | <ElegantBeef> you can also use a qualified call of `moduleName.procName` |
00:31:29 | sealmove | maybe there is a better solution to my problem. to avoid X-Y problem: what I am trying to do is create a more lenient `==`. For example be able to compare a seq[int] with a seq[uint32] |
00:32:52 | sealmove | so I defined a 'proc `==`*[T: SomeInteger, U: SomeInteger](a: seq[T], b: seq[U]): bool', but when T and U is the same type, it conficts with system modules's. |
00:33:11 | sealmove | and I can't know beforehands if T is same as U. |
00:36:08 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Cry |
00:36:09 | FromGitter | <jrfondren> the module using this can import system except `==` |
00:36:10 | FromDiscord | <ElegantBeef> Ehh? |
00:36:37 | FromGitter | <jrfondren> ElegantBeef: try it with the == in its own module |
00:36:37 | sealmove | jrfondren oh that might just work |
00:37:01 | sealmove | ElegantBeef thanks, I'll try it |
00:37:06 | FromDiscord | <ElegantBeef> Ah yes the importing of it would make it the same as system |
00:37:31 | FromDiscord | <ElegantBeef> Could always use something like `~=` be it uglier |
00:39:13 | sealmove | lol ElegantBeef, I was thinking of using exactly `~=` |
00:40:02 | sealmove | yeah the name conflict is not a problem if I use your type inspection idea (when T is Y) |
00:40:05 | FromDiscord | <ElegantBeef> Well it's not too silly since a `seq[byte]` isnt really equal to a `seq[int]` |
00:40:14 | sealmove | yes I like it |
00:40:36 | sealmove | i want to avoid using same symbol anyways, just didn't think of inspecting type with the `is` operator |
00:40:47 | FromDiscord | <ElegantBeef> Ah |
00:41:04 | FromDiscord | <ElegantBeef> Me actually suggesting a proper solution, that's the first π |
00:46:12 | FromDiscord | <nikki> @ElegantBeef nah i think you've brought up some good stuff here before 8) |
00:52:56 | sealmove | ended up with this https://play.nim-lang.org/#ix=2Crz |
00:54:12 | FromDiscord | <ElegantBeef> Why are you using auto? |
00:54:35 | sealmove | which can work recursively now that I think of it: https://play.nim-lang.org/#ix=2CrA |
00:55:05 | sealmove | well, I am using it in a test suite for testing equality against anything |
00:55:39 | FromDiscord | <ElegantBeef> Doesnt this just work? https://play.nim-lang.org/#ix=2CrC |
00:55:49 | FromDiscord | <ElegantBeef> Ah shit that length is an issue |
00:55:51 | FromDiscord | <ElegantBeef> Shit run! |
00:56:18 | FromDiscord | <ElegantBeef> It'll fail on tables and arrays though |
00:56:39 | sealmove | hmm |
00:56:39 | FromDiscord | <ElegantBeef> The auto is useless it can just be `[T, U]` afaik |
00:56:55 | sealmove | ah right yeah of course |
00:57:04 | sealmove | thx for the suggestion |
00:57:44 | * | Zectbumo joined #nim |
00:58:34 | sealmove | the language I am testing doesn't have arrays and tables so I think I'm ok :> |
00:58:43 | FromDiscord | <ElegantBeef> ok |
01:12:59 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
01:19:05 | * | mbomba quit (Ping timeout: 258 seconds) |
01:30:41 | sealmove | any ideas for symbols for a custom division proc? |
01:30:58 | sealmove | i thought `//` but it's used by rationals module |
01:42:49 | * | abm quit (Read error: Connection reset by peer) |
01:43:50 | * | TomDotTom quit (Ping timeout: 264 seconds) |
01:50:46 | * | hnOsmium0001 quit (Read error: Connection reset by peer) |
01:51:39 | * | hnOsmium0001 joined #nim |
01:52:47 | * | whaletechno quit (Quit: ha det bra) |
01:57:48 | FromDiscord | <tinygiant> When using `parsecfg`, is there an easy way to loop a specific section within a cfg? If I know the section name, can I get (or check) all the values within only that section when the instance is loaded via `loadConfig`, of do I need to `open` the file and loop every line until I find what I'm looking for? |
01:59:49 | sealmove | you have a `Config = OrderedTableRef[string, OrderedTableRef[string, string]]` |
02:00:56 | sealmove | if i am not mistaken the keys of the outer OrderedTable correspond to sections. |
02:01:07 | sealmove | so you can just do `for s in myConfig.keys`? |
02:02:17 | sealmove | and if you want to get all values in a section then `for k, v in myConfig[mySection]` |
02:02:48 | FromDiscord | <tinygiant> sealmove, thanks for the data, sounds promising, I'll do some looking into that. This will be my first foray into config files and tables, so ... much to learn. In you example, is `myConfig` the name of the OrderedTableRef? |
02:03:02 | sealmove | just lookup Nim's table semantics ;) |
02:03:07 | FromDiscord | <tinygiant> Wilco. |
02:03:48 | sealmove | yes, myConfig would be what `loadConfig` returns to you |
02:04:11 | sealmove | and `mySection` would be a string |
02:06:23 | FromDiscord | <tinygiant> Ok, confusion resolved, for some reason I completely missed this: `Config = OrderedTableRef[string, OrderedTableRef[string, string]]`, thinking it was you pointing me to creating a table from that data, when in fact, it is the definition of the `Config` type. That resolves a lot of problems. Thanks for helping me realize how slow I am tonight! |
02:06:52 | sealmove | happy to help |
02:16:14 | * | apahl quit (Ping timeout: 264 seconds) |
02:17:46 | * | apahl joined #nim |
02:29:33 | * | Prestige quit (Quit: Prestige) |
02:32:49 | * | Prestige joined #nim |
02:34:45 | * | jwm224 quit (Ping timeout: 260 seconds) |
02:40:33 | * | waleee-cl joined #nim |
02:42:47 | * | Zectbumo quit (Remote host closed the connection) |
02:50:59 | FromGitter | <gogolxdong> @shashlick β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f9b7f937cac87158f75acd9] |
02:51:18 | FromDiscord | <nikki> is using vcc as the main / default compiler well-supported? / how does one say to default to vcc when installing nim with choosenim? like if i wanted to use it for the compiler itself and everything. if that makes sense |
02:52:02 | FromDiscord | <ElegantBeef> I could be wrong, but i believe you'd just modify the nim.cfg file wherever that is π |
03:17:48 | * | muffindrake quit (Ping timeout: 268 seconds) |
03:19:27 | * | muffindrake joined #nim |
03:23:34 | * | unihernandez22 joined #nim |
03:29:52 | * | Zectbumo joined #nim |
03:31:39 | * | vicfred joined #nim |
03:38:40 | * | Zectbumo quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:33 | * | supakeen joined #nim |
04:15:50 | leorize[m]1 | @nikki you can set that in the config but afaik Nim CI does not test vcc so ymmv |
04:17:51 | FromDiscord | <nikki> ah i see. i may just keep using mingw since it should be fine. main thing is i want to use msvc in a particular project but i'm already just using nim compleOnly + cmake for that haha |
04:21:17 | * | mbomba joined #nim |
04:39:09 | FromDiscord | <tinygiant> If I can retrieve an existing JArray (`let jarray = json[key].getElems`, which correctly returns `@["elem1","elem2"]`, how can I add an element to this array? `.getElems` returns a `seq[JsonNode]`, where I'm trying to add a `JsonNode` with `.add`. This line throws an error: `jarray.add(%value)`, but this line works fine when I'm starting with an empty array (`newJArray`). Thanks! |
04:43:23 | FromDiscord | <ElegantBeef> Uhh https://play.nim-lang.org/#ix=2Csd |
04:45:49 | FromDiscord | <ElegantBeef> Oh you're using `let` that makes it immutable |
04:49:01 | FromDiscord | <tinygiant> Hrm. So I was trying to retrieve the value (an array), then modify and put back in, when the right answer was to modify in place. Ok, I got that concept and it worked in my code. Changing `let` to `var` didn't fix my earlier attempt, but that's a good catch. A mistake I've made quite often as I learn this new language. |
04:50:07 | FromDiscord | <ElegantBeef> Well jsonnodes are reference objects so you can do this https://play.nim-lang.org/#ix=2Cse |
04:52:24 | FromDiscord | <ElegantBeef> Just to show how you'd do it with `getElems` https://play.nim-lang.org/#ix=2Csf |
04:52:42 | FromDiscord | <ElegantBeef> I think i covered all bases π |
04:55:11 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2Csg |
04:56:01 | * | mbomba quit (Quit: WeeChat 2.9) |
04:56:14 | FromDiscord | <ElegantBeef> Just need to learn how to wrangle the types π |
04:58:52 | FromDiscord | <tinygiant> Yeah, I'd say that's been a weakness as I work through some of my battles. So it seems the `.add` works, but is there an easy way to remove one of the elements? Didn't see a method for that in json.nim. Iterate through the arrays .mitems? |
04:59:23 | sealmove | there is delete() |
04:59:36 | sealmove | which works for any seq type |
04:59:51 | FromDiscord | <ElegantBeef> Well wont for a jarray |
05:00:05 | FromDiscord | <ElegantBeef> But yea delete will work if working with sequences |
05:00:51 | FromDiscord | <tinygiant> Since `getElems` returns `seq[JsonNode]`, delete will work on it. Good to know. My mind isn't crossing module borders yet. |
05:01:12 | FromDiscord | <ElegantBeef> Worth noting that for loop is actually redundant(Didnt think to check) `data["arr"] = % arDat` works π |
05:01:24 | sealmove | JArray is just an alias for seq[JsonNode] |
05:01:34 | FromDiscord | <ElegantBeef> No it's not |
05:01:44 | sealmove | no yeah my bad |
05:01:51 | FromDiscord | <ElegantBeef> It's an object variat |
05:01:51 | sealmove | it's an enum value |
05:01:54 | FromDiscord | <ElegantBeef> (edit) "variat" => "varinat" |
05:01:58 | FromDiscord | <ElegantBeef> variant even π |
05:02:21 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/json.html#JsonNodeObj just for completions sake |
05:02:52 | sealmove | i even used it today lol i am stupid |
05:02:58 | sealmove | or just tired |
05:04:01 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2Csl |
05:04:32 | FromDiscord | <ElegantBeef> Oh i was going off the example where you use get elms add it to the seq then add it to the json node π |
05:04:42 | FromDiscord | <ElegantBeef> This un https://play.nim-lang.org/#ix=2Csm |
05:05:15 | FromDiscord | <tinygiant> Ah, ok. Yeah, there's a whole bunch of version of this in my cranium now. I hope to eventually end up at a point where I can take the input seq[strings] and add only the ones that aren't already in the JArray. Baby steps. |
05:05:44 | FromDiscord | <ElegantBeef> Same, probably added a bit of confusion with my endless variations |
05:06:11 | FromDiscord | <ElegantBeef> Message me in a few minutes and i'll create new variation to compound any confusion π |
05:06:17 | FromDiscord | <tinygiant> Maybe. I can learn from reading, but seeing all the variations helps cement it. |
05:19:46 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
05:25:20 | * | vicfred quit (Quit: Leaving) |
05:44:12 | * | unihernandez22 quit (Quit: Leaving) |
05:50:04 | * | narimiran joined #nim |
05:51:41 | bung | could nimlsp support nim file outline? |
05:56:27 | Prestige | bung: technically it can support anything in the lsp specification https://microsoft.github.io/language-server-protocol/specifications/specification-current/ |
05:56:58 | Prestige | but nimlsp just uses nimsuggest, so I think the support would have to be there first. Not sure on that |
06:01:14 | bung | I haven't seen a extension that support nim outline , let me check nimsuggest first, if not I might use regex searching procs |
06:02:19 | Prestige | building a plugin or something? |
06:02:43 | Prestige | I think regex would be easy to implement for it, if it's not supported |
06:08:42 | bung | it has outline command , I may create a PR for nimlsp |
06:09:34 | Prestige | is that part of the lsp specification tho? |
06:10:39 | leorize[m]1 | disruptek: is your CPS macro an AST-AST transformation that doesn't rely on backend features? |
06:12:10 | bung | Prestige dont know , let me check, just thought it is basic IDE feature |
06:12:32 | Prestige | hm well document symbols is one |
06:12:40 | Prestige | and nimlsp hasn't implemented it |
06:13:54 | bung | it's textDocument/documentSymbol |
06:14:07 | bung | yeah |
06:16:39 | bung | my project grows and serveral files about 1k lines, so I actually need this feature now |
06:21:55 | Prestige | you using vim? |
06:25:57 | bung | I use vscode |
06:26:27 | Prestige | ah, can't help you there |
06:35:34 | bung | I'll create PR of this for nimlsp |
06:55:28 | * | solitudesf joined #nim |
07:12:24 | * | mwbrown quit (Ping timeout: 240 seconds) |
07:19:32 | * | mwbrown joined #nim |
07:42:31 | * | rockcavera is now known as Guest14700 |
07:42:32 | * | tiorock joined #nim |
07:42:32 | * | Guest14700 quit (Killed (tolkien.freenode.net (Nickname regained by services))) |
07:42:32 | * | tiorock is now known as rockcavera |
07:53:43 | bung | does the nimsuggest outline command provide proc args info ? |
07:59:35 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
07:59:43 | FromDiscord | <lqdev> nope |
08:06:39 | bung | oh, I noticed it has no template in results |
08:08:51 | * | oculux quit (Quit: blah) |
08:09:26 | * | oculux joined #nim |
08:09:36 | * | oculux quit (Client Quit) |
08:10:09 | * | oculux joined #nim |
08:18:21 | * | oculux quit (Quit: blah) |
08:22:06 | * | oculux joined #nim |
08:32:29 | bung | I've create a PR for this https://github.com/PMunch/nimlsp/pull/58 |
08:32:29 | disbot | β₯ textDocument/documentSymbol support |
08:43:23 | Prestige | Oh nice bung |
08:44:06 | bung | :) |
08:49:31 | ForumUpdaterBot | New thread by ElAfalw: Get all procs in given module, see https://forum.nim-lang.org/t/7012 |
08:58:14 | * | letto quit (Remote host closed the connection) |
09:00:05 | * | solitudesf1 quit (Quit: Idle for 30+ days) |
09:02:07 | * | letto joined #nim |
09:03:11 | * | letto quit (Client Quit) |
09:05:43 | * | JustASlacker joined #nim |
09:07:02 | * | letto joined #nim |
09:10:15 | FromGitter | <gogolxdong> @shashlick β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f9bd8772a60f731f7247b4f] |
09:29:56 | * | letto quit (Quit: Konversation terminated!) |
09:31:00 | Araq | since it keeps coming up: any good solutions for the problem that people want their favorite helper procs in the stdlib but if we add anything we would be drowning in helpers? |
09:31:58 | FromDiscord | <haxscramper> Redirect everything to fusion? Isn't that what it supposed to be for anyway |
09:34:07 | * | letto joined #nim |
09:34:12 | Araq | it's hardly a solution, then we have same problem in fusion |
09:34:39 | Araq | at least it doesn't have the precious 'std/' then |
09:39:47 | FromDiscord | <mratsim> "moduletraits" |
09:40:14 | FromDiscord | <lqdev> std/coolstuf |
09:40:16 | FromDiscord | <lqdev> (edit) "std/coolstuf" => "std/coolstuff" |
09:40:29 | FromDiscord | <mratsim> The talk by deech last year was about listing imported proc, and there is also a RFC of feature request about that iirc |
09:45:56 | Yardanico | why not make a community-maintained package akin to nim-stew? |
09:45:59 | Yardanico | for all those "helper" procs |
09:47:19 | Araq | maybe but then people want to use these helpers in the compiler too |
09:47:30 | Araq | and then it must be available for bootstrapping |
09:57:22 | bung | oranize some people vote for that , take it into or not |
10:02:33 | * | xet7 quit (Remote host closed the connection) |
10:03:17 | FromDiscord | <flywind> hash value differs in compile time and runtime, is it intended behaviour? |
10:03:54 | FromDiscord | <flywind> (edit) "time" => "time(nimvm)" |
10:04:03 | * | xet7 joined #nim |
10:22:52 | * | lritter joined #nim |
10:25:29 | FromDiscord | <flywind> I guess `hash` function for JS backend needs some changes. |
10:34:45 | FromGitter | <gogolxdong> There isn't tsNodeType() anywhere in nimterope nor Nim compiler, where is it from? |
10:34:54 | Yardanico | tsNodeType? |
10:35:02 | Yardanico | can you link to the line where it is called? |
10:35:06 | Yardanico | and what project? |
10:35:24 | * | PMunch joined #nim |
10:35:34 | Yardanico | ah found it |
10:35:42 | Araq | PMunch, /socketstreams.nim(144, 14) Error: type mismatch: got <proc (s: Stream){.gcsafe, locks: <unknown>.}> but expected 'proc (s: Stream){.nimcall, gcsafe.}' |
10:35:42 | Araq | .tag effects differ |
10:35:42 | Araq | .tag effects differ |
10:35:45 | FromGitter | <gogolxdong> https://github.com/nimterop/nimterop/blob/master/nimterop/toastlib/tshelp.nim#L46 |
10:36:04 | PMunch | Yeah I know, can't figure it out.. |
10:36:20 | Yardanico | it's from treesitter |
10:36:37 | Araq | PMunch, can you reproduce it? |
10:37:03 | PMunch | Locally? |
10:37:45 | FromGitter | <gogolxdong> error comes from $node, before .tsNodeType() |
10:38:02 | Yardanico | well I'm not sure what you're asking |
10:38:05 | Yardanico | tsNodeType is from treesitter |
10:38:17 | Yardanico | I think it's generated by https://github.com/nimterop/nimterop/blob/master/nimterop/treesitter/tsgen.nim |
10:38:40 | Yardanico | ah lol |
10:38:43 | Yardanico | https://github.com/nimterop/nimterop/blob/master/nimterop/treesitter/api.nim#L152 |
10:38:48 | Yardanico | case insensitivity right ;) |
10:41:36 | FromGitter | <gogolxdong> errors on `$` for enum type definition when using nimterop to translate C project. |
10:42:05 | Yardanico | well you might want to ask shashlick and describe the issue for him precisely :) |
10:43:27 | Araq | also try c2nim |
10:45:31 | PMunch | Araq, yeah I'm able to reproduce locally |
10:59:14 | FromDiscord | <scott> sent a code paste, see https://play.nim-lang.org/#ix=2Cty |
10:59:43 | PMunch | How did you trigger that? |
11:00:25 | FromDiscord | <scott> i don't have a minimal reproduction of it. just trying to compile a small project |
11:00:41 | FromDiscord | <scott> it's a bug? |
11:01:16 | PMunch | Yeah, it's a bug in the compiler. Those are really quite hard to find nowadays.. |
11:01:22 | PMunch | What Nim version? |
11:02:40 | FromDiscord | <scott> 1.4.0, --threads:on |
11:02:57 | FromDiscord | <scott> I'm good at breaking compilers lol |
11:04:42 | PMunch | Haha, evidently |
11:05:14 | PMunch | I'm not too versed in the compiler error messages, so I can't really help without a minimal example.. |
11:06:01 | FromDiscord | <scott> well here is the whole example, I'll try to whittle out parts of it. https://github.com/dscottboggs/drives/blob/master/src/drivespkg/menu.nim |
11:09:58 | PMunch | Hmm, I just get this error when I try to compile that: https://github.com/dscottboggs/drives.git |
11:10:04 | PMunch | Oops: drives/src/drivespkg/find_drives.nim(41, 23) Error: undeclared identifier: 'rex' |
11:10:39 | FromDiscord | <scott> the project depends on `regex` sorry I forgot to put that in the thing |
11:11:02 | FromDiscord | <scott> this project is not anywhere near done sorry it's a mess |
11:15:29 | FromDiscord | <scott> sent a code paste, see https://play.nim-lang.org/#ix=2CtE |
11:16:07 | FromGitter | <gogolxdong> `c2nImport("c:/FFmpeg/fftools/ffplay.c", recurse=true,flags="--skipcomments --concat",nimFile="c:/ffplay/ffplaytest.nim")` |
11:18:51 | FromGitter | <gogolxdong> skipcomments doesn't skip comments in this context, it does in a smaller test. |
11:22:14 | * | apahl quit (Ping timeout: 264 seconds) |
11:23:00 | * | apahl joined #nim |
11:25:39 | PMunch | @scott, why have you tagged eventListener with nimcall? |
11:27:09 | * | abm joined #nim |
11:27:46 | PMunch | Oh and by the way, the "rex" thing was just my installed regex library was out of date |
11:32:53 | FromDiscord | <scott> the compiler said that `createThread` required that argument to have that pragma |
11:33:03 | FromDiscord | <scott> I was actually just about to ask what that means |
11:34:46 | PMunch | https://nim-lang.org/docs/manual.html#types-procedural-type |
11:34:51 | PMunch | It's the default for Nim |
11:35:03 | PMunch | Pretty much just the same as fastcall |
11:35:26 | PMunch | But without forcing it for compilers that don't support it |
11:36:28 | FromDiscord | <scott> so...why does that make it illegal to capture some var? |
11:38:30 | PMunch | Not a clue.. |
11:39:27 | FromDiscord | <flywind> `uint64` doesn't work in VM with JS backend? |
11:39:55 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2CtJ |
11:40:10 | FromDiscord | <flywind> Gave: 2025677871β΅-1598805830 |
11:40:39 | PMunch | Ah, @scott, your issue was declaring the channel as `var` in the tuple |
11:40:41 | FromDiscord | <lqdev> @scott because it's not a closure |
11:40:44 | PMunch | http://ix.io/2CtK <- this works |
11:41:09 | * | superbia joined #nim |
11:41:14 | PMunch | Or rather, it compiles, whether it works or not I have no idea :P |
11:41:30 | superbia | is anybody streaming atm? |
11:41:43 | PMunch | superbia, no, any reason we should? |
11:41:59 | superbia | I don't want to ask stupid questions on stream :P |
11:42:08 | PMunch | Oh, you said streaming :P |
11:42:13 | PMunch | I thought you said screaming :P |
11:42:25 | superbia | so somebody IS streaming ? |
11:42:33 | PMunch | Not AFAIK |
11:42:46 | superbia | ok, perfect, I can talk freely now |
11:43:06 | FromDiscord | <scott> Oh, I see, you have to make the whole tuple var. Well, I was hoping to leave menu immutable to the thread but whatever |
11:43:18 | superbia | well first quick question |
11:43:22 | PMunch | Haha, if someone was streaming they would probably only react to related questions |
11:43:24 | superbia | PMunch: in your code you new return? why ? |
11:43:30 | PMunch | scott, why would you want the channel to be a var? |
11:43:31 | superbia | new result* |
11:43:43 | PMunch | I think you might misunderstand the mutability thing here.. |
11:43:47 | FromDiscord | <scott> wait, no, `data` isn't var, how is this compiling? I thought `send()` requires var |
11:44:37 | PMunch | superbia, because I'm creating a ref object. `new` will allocate that kind of object for me |
11:45:03 | PMunch | If it was just object I wouldn't need it, and if it was ref object and I didn't do it I would get null pointer exceptions if I tried to access the fields |
11:45:15 | PMunch | @scott, no the channel itself doesn't have to be var |
11:45:29 | FromDiscord | <Rika> send only needs a var channel |
11:45:32 | FromDiscord | <Rika> what? |
11:45:37 | FromDiscord | <scott> https://nim-lang.org/docs/channels.html all take a `var Channel[T]` |
11:45:43 | superbia | PMunch: ok makes sense |
11:45:43 | PMunch | Oh.. |
11:46:05 | PMunch | Hmm, typically you need to pass channels with `ptr` to a thread if I'm not mistaken |
11:46:06 | FromDiscord | <Rika> because `eventStream` is var, |
11:46:09 | PMunch | Oherwise it will send a copy |
11:46:11 | FromDiscord | <Rika> though `data[1]` isnt |
11:46:39 | FromDiscord | <Rika> unless you already made the tuple var |
11:47:09 | FromDiscord | <Rika> in which case, i think doing `data[1]` makes a copy... |
11:47:42 | PMunch | No passing it to a thread will always make a copy IIRC |
11:48:12 | PMunch | Have a look at this: https://nim-lang.org/docs/channels.html#example-passing-channels-safely |
11:48:13 | FromDiscord | <scott> can I just ask how to properly use a channel to communicate between two threads where one is created with `createThread`? |
11:48:45 | PMunch | (be sure to read the text in the beginning first) |
11:49:10 | FromDiscord | <scott> yeah I see |
11:50:01 | PMunch | I this case I'd just set the channel as a global |
11:50:18 | PMunch | It's by far the easiest |
11:52:19 | FromDiscord | <scott> yup that compiles thanks |
11:53:00 | PMunch | To be fair though, you use the channel in a `while true` loop that only quits when the program ends as far as I can tell. So it should be safe to just pass a pointer to your local variable. It won't be GCed |
11:55:23 | FromDiscord | <scott> fair enough |
11:55:36 | FromDiscord | <scott> thanks for the help |
11:56:05 | PMunch | No problem, working with threads in Nim can be a bit tricky |
11:56:25 | PMunch | Mostly because not a lot of people do it, so the documentation and libraries are a bit lacking |
12:04:32 | Zevv | sealmove: what was with precedence? |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:32 | * | supakeen joined #nim |
12:11:21 | sealmove | https://play.nim-lang.org/#ix=2Cu5 instead of https://play.nim-lang.org/#ix=2Cu6 |
12:13:53 | FromDiscord | <shashlick> @gogolxdong just got on - please open an issue - and again, use nimterop on h files, not c |
12:19:34 | PMunch | @scott, created an issue for you: https://github.com/nim-lang/Nim/issues/15793 |
12:19:34 | disbot | β₯ Illegal type in tuple passed to Thread generic crashes the compiler |
12:19:49 | PMunch | Well, not so much for you, but from your issue |
12:22:12 | Zevv | sealmove: aah right |
12:22:16 | Zevv | nice job |
12:22:31 | Zevv | dude who can ever understand that kind of stuff |
12:26:27 | sealmove | the one who uses them I guess :P |
12:26:42 | FromDiscord | <mratsim> I'm innocent |
12:26:44 | * | TomDotTom joined #nim |
12:27:00 | * | mathsaey quit (Remote host closed the connection) |
12:28:07 | FromDiscord | <Rika> doubt |
12:30:57 | FromDiscord | <scott> Thank you very much PMunch |
12:31:00 | * | superbia quit (Quit: WeeChat 2.9) |
12:31:19 | PMunch | No problem |
12:44:21 | PMunch | Hmm, did the unused imports error become more (a bit too) aggressive? |
12:44:48 | PMunch | I get a bunch of errors saying cef_dynlib is unused: https://github.com/jangko/nimCEF/blob/devel/cef/cef_import.nim |
12:45:13 | PMunch | Even though that's where CEF_LIB_NAME comes from, and removing the import throws an error that it is not defined.. |
12:51:58 | FromDiscord | <flywind> !eval proc hello(result: int): auto = discard; hello(12) |
12:52:00 | NimBot | Compile failed: /usercode/in.nim(1, 1) Error: redefinition of 'result'; previous declaration here: /usercode/in.nim(1, 12) |
13:02:34 | PMunch | Haha, ouch |
13:02:39 | PMunch | macros.nim(586, 33) Error: type mismatch: got <cstring, cint, ptr cef_string_utf16> |
13:02:48 | PMunch | By the way, what are up with these error messages? |
13:02:54 | PMunch | Completely useless.. |
13:04:58 | Araq | guys, esp. Yardanico reducing this program https://github.com/nim-lang/Nim/issues/15753 would be most helpful |
13:05:00 | disbot | β₯ Program SIGSEGV when using '--gc:orc' ; snippet at 12https://play.nim-lang.org/#ix=2Cul |
13:13:11 | * | natrys joined #nim |
13:21:00 | * | JustASlacker quit (Remote host closed the connection) |
13:30:53 | FromDiscord | <tomck> Hello - i'm writing a networked application, and have a nimble package with 2 binaries - 'client' and 'server' |
13:31:08 | FromDiscord | <tomck> is there any way to specify nimble dependencies depending on the binary? |
13:31:32 | FromDiscord | <tomck> e.g. I want to require some graphics rendering dependencies if you're building the client, but if you're building the server those aren't needed |
13:32:06 | FromDiscord | <tomck> I'm currently running with `nimble run client` and `nimble run server`, i have `client` and `server` listed in nimble's `bin` array |
13:34:45 | FromDiscord | <krisppurg> What do you call `-d:somethingDefinable`, do you call it a defined variable or a defined word? |
13:35:33 | FromDiscord | <tomck> afaik it's just a 'define', i don't think it's a variable |
13:36:19 | FromDiscord | <tomck> unless nim specifically calls it a 'word' somewhere, i'd get 'word' confused with 'machine word', i.e. https://en.wikipedia.org/wiki/Word_(computer_architecture) |
13:36:46 | FromDiscord | <krisppurg> I want to make a section for my library docs for example:β΅Definable words:β΅β΅- `-d:discordCompress`, `-d:discordv8`, `-d:dimscordDebug` etc |
13:36:59 | FromDiscord | <krisppurg> (edit) "I want to make" => "sent" | "section for my library docs for example:β΅Definable words:β΅β΅- `-d:discordCompress`, `-d:discordv8`, `-d:dimscordDebug` etc" => "long message, see http://ix.io/2Cut" |
13:37:14 | FromDiscord | <tomck> Yeah just call it 'defines' or 'options' |
13:37:31 | FromDiscord | <krisppurg> alright |
13:51:08 | * | mmohammadi9812 quit (Quit: Quit) |
14:04:09 | PMunch | @tomck, I don't think you can declare dependencies like that. What you probably want is two separate .nimble files |
14:06:27 | FromDiscord | <tomck> alright thanks |
14:06:32 | FromDiscord | <tomck> can i have 2 nimble files in the same dir? |
14:06:51 | FromDiscord | <tomck> i don't want to have to fuck around with 3 packages, one for server, one for client, one for shared definitions |
14:07:10 | Araq | not the same dir, but in the same git repo |
14:07:34 | FromDiscord | <tomck> ok so i probably end up with 3 pkgs? |
14:07:50 | FromDiscord | <tomck> i'll see how it goes with the graphics dependency in the server binary |
14:09:54 | FromDiscord | <tomck> I'm using 'netty' to send reliable data over UDP, but it only lets me send strings through it's api - https://github.com/treeform/nettyβ΅β΅Is this normal? does nim treat strings as just a generic owned storage of bytes? Or should i edit this? I'm assuming a `string` is always allocated? |
14:10:24 | FromDiscord | <tomck> so if i can serialise on the stack b/c i know the size of everything beforehand, this api will force me to allocate & copy, right? |
14:11:17 | FromDiscord | <Rika> would be better if it had a proc for openarray i guess |
14:11:50 | FromDiscord | <tomck> can i add arbitrary bytes into a string? or will there be some utf8 encoding going on? |
14:12:06 | FromGitter | <jrfondren> Nim strings can have arbitrary data on them. UTF8 is required by operations rather than the type, so that's not a problem |
14:14:23 | FromDiscord | <tomck> so how would i go about appending a 4-byte int to a string? |
14:14:50 | FromDiscord | <tomck> `cast[array[uint8,4]](123123)` to get it to a byte array, then...? |
14:14:56 | FromDiscord | <tomck> concat with `&`? |
14:17:10 | * | mmohammadi9812 joined #nim |
14:19:02 | FromGitter | <jrfondren> https://play.nim-lang.org/#ix=2CuH - you can pipe that to |od -c to see the bytes |
14:19:15 | FromGitter | <jrfondren> you probably want to switch the endianness though |
14:19:54 | FromGitter | <jrfondren> std/endians has swapEndianXX procs that you can use for that |
14:20:01 | FromDiscord | <tomck> interesting, so you can go from int -> uint8[4], but not from int -> uint8[4]? |
14:20:15 | FromDiscord | <tomck> or does the `&` proc for `string` only work with `ptr array[uint8, n]`? |
14:23:13 | FromGitter | <jrfondren> do you mean, "you can go from ptr int -> ptr array[4, char] but not int -> array[4, char]" ? maybe you can do the latter, but to me a bare int might be in a register and not really make sense to 'cast' to bytes, but an int in memory always can be. |
14:24:05 | PMunch | Hmm, did typed macros use to output their input by default? |
14:24:07 | FromGitter | <jrfondren> casting ptrs makes more sense to me, and I've done a lot of that in the last few days and this has worked fine. f.e. to go the other way around I might `cast [ptr UncheckedArray[T]](buffer[0].addr)[0]` |
14:24:58 | FromGitter | <jrfondren> i.e., dereference from address of the 0th element of a string as if it were a ptr to arrays of some T |
14:25:25 | FromDiscord | <tomck> makes sense, thanks |
14:28:33 | PMunch | Appears so.. |
14:32:06 | * | jxy joined #nim |
14:34:27 | FromGitter | <jrfondren> come to think of it `cast[ptr T](s[0].addr)[]` is an easier way to do that... UncheckedArrays still work for 'rithmetic |
14:37:27 | * | mathsaey joined #nim |
14:39:32 | * | mmohammadi9812 quit (Ping timeout: 272 seconds) |
14:48:57 | * | mathsaey quit (Quit: mathsaey) |
14:49:16 | * | mathsaey joined #nim |
14:50:58 | FromDiscord | <tomck> Hmmm is there no way to convert to network / host endian? |
14:51:05 | FromDiscord | <tomck> i see only big/little and swap endian functions in std/endian# |
14:51:06 | FromDiscord | <tomck> (edit) "std/endian#" => "std/endians" |
14:52:24 | * | mmohammadi9812 joined #nim |
14:52:34 | FromDiscord | <tomck> or do i use cpuEndian and manually do it? |
14:53:00 | FromGitter | <jrfondren> network is bigendian; I test cpuEndian and conditionally call swapEndianXX |
14:53:52 | FromGitter | <jrfondren> it might be more convenient for you to pull htonl/htons from C FFI |
14:57:37 | PMunch | Decided to stream again after having made and eaten dinner |
14:57:41 | PMunch | Just a heads up |
14:57:54 | PMunch | Will probably be in about 1-2 hours |
15:00:30 | FromDiscord | <Idefau> nice |
15:01:57 | * | Q-Master joined #nim |
15:05:32 | * | mathsaey_ joined #nim |
15:07:25 | * | mathsaey quit (Ping timeout: 240 seconds) |
15:13:09 | * | waleee-cl joined #nim |
15:13:39 | * | mathsaey joined #nim |
15:16:48 | * | mathsaey_ quit (Ping timeout: 256 seconds) |
15:21:06 | FromDiscord | <tomck> hmm, so i have an openArray[byte] |
15:21:32 | FromDiscord | <tomck> i want to get a pointer into that array, so i'm trying `arr[0].addr`, but it's complaining about the openArray[byte] not having an address |
15:21:54 | FromDiscord | <tomck> if i make it `var openArray[byte]`, it's complaining about `openArray[byte]` being an invalid type for a `var` |
15:21:58 | FromDiscord | <tomck> so i just use `unsafeAddr`? |
15:22:37 | FromDiscord | <Clyybber> yep |
15:23:31 | FromDiscord | <tomck> alright cool - will usnafeAddr always be fine for an openarray? |
15:23:53 | FromDiscord | <Clyybber> yeah |
15:23:57 | FromDiscord | <tomck> brill |
15:24:01 | FromDiscord | <Clyybber> in the future arr[0].addr might work too |
15:24:06 | FromDiscord | <Clyybber> but for now just use unsafeAddr |
15:27:28 | * | vicfred joined #nim |
15:30:32 | * | mathsaey quit (Quit: mathsaey) |
15:47:40 | * | NimBot joined #nim |
15:48:03 | FromDiscord | <tomck> Hmm, how to convert an openArray[byte] to a string? |
15:49:25 | FromDiscord | <tomck> doesn't ened to be \0 terminated |
15:49:56 | FromGitter | <jrfondren> ah, that problem came up for me too, I don't know if there's an easy way. I ended up doing newString() and inserting bytes in a loop |
15:50:05 | FromDiscord | <tomck> yeesh |
15:50:40 | FromGitter | <jrfondren> I'm not an expert, and I haven't asked yet. There might be a ready proc lying around somewhere. |
15:50:41 | FromDiscord | <tomck> is `string` defined to us? or is it opaque, only the compiler knows? |
15:50:48 | FromGitter | <jrfondren> it's going to require copying anyway |
15:50:52 | FromDiscord | <tomck> as in, can i create the `string` container myself? |
15:51:08 | FromDiscord | <tomck> yes, but i'd rather do it with a pre-allocated buffer & a memcpy rather than looping over bytes |
15:51:09 | FromGitter | <jrfondren> "only the compiler knows", but Araq's said that it's always going to be laid out the same as seq[char] |
15:51:22 | FromDiscord | <tomck> is char == byte? |
15:51:23 | FromGitter | <jrfondren> ah well you can certainly do that still |
15:51:27 | FromGitter | <jrfondren> with newString() and then copyMem |
15:51:50 | FromDiscord | <tomck> ah i see, didn't realise you could initialise it with some capacity |
15:53:08 | FromGitter | <jrfondren> yes, char == byte == uint8. There's not even performance implications to it, like D's autodecoding. AIUI which you go with is more of a question of how many free type conversions your code will have in the end, to use procs that require one type or the other |
15:53:20 | * | rokups joined #nim |
15:54:25 | * | mathsaey joined #nim |
15:54:36 | FromGitter | <jrfondren> I remember that people using different types made crypto work a little bit annoying, not sure how that shaked out. |
15:56:42 | * | hnOsmium0001 joined #nim |
15:57:32 | FromGitter | <jrfondren> and this just came up, which might be useful for you: https://github.com/treeform/flatty/blob/master/src/flatty/binny.nim |
15:58:15 | FromGitter | <jrfondren> ... that completely assumes a little endian arch though. |
16:01:42 | * | tane joined #nim |
16:31:25 | * | rockcavera quit (Remote host closed the connection) |
16:37:34 | ForumUpdaterBot | New thread by Freeflow: Nim update failure, see https://forum.nim-lang.org/t/7013 |
16:50:42 | * | superbia joined #nim |
16:51:39 | * | superbia quit (Client Quit) |
16:55:15 | * | superbia joined #nim |
17:05:28 | * | rusua joined #nim |
17:07:39 | * | vicfred quit (Quit: Leaving) |
17:10:39 | PMunch | Okay, I'm back and ready |
17:10:41 | PMunch | Stream is up |
17:11:06 | FromDiscord | <Recruit_main707> link? |
17:11:06 | PMunch | ~PMunch is streaming at https://twitch.tw/pmunche |
17:11:07 | disbot | PMunch: 11a metaprogramming aficionado and long time Nim user who can be found at peterme.net |
17:11:07 | disbot | PMunch: 11streaming at https://twitch.tw/pmunche |
17:11:28 | FromDiscord | <Recruit_main707> twitch.tw? |
17:11:33 | PMunch | Crap |
17:11:37 | PMunch | ~PMunch is streaming at https://twitch.tv/pmunche |
17:11:37 | disbot | PMunch: 11a metaprogramming aficionado and long time Nim user who can be found at peterme.net |
17:11:37 | disbot | PMunch: 11streaming at https://twitch.tv/pmunche |
17:15:37 | * | vicfred joined #nim |
17:29:05 | * | superbia quit (Quit: WeeChat 2.9) |
17:30:56 | Zevv | dude the beard |
17:32:31 | FromDiscord | <lqdev> it's cool |
17:32:53 | * | Jesin quit (Quit: Leaving) |
17:32:55 | Zevv | such much |
17:35:26 | * | Kaivo quit (Ping timeout: 258 seconds) |
17:35:57 | FromDiscord | <AmjadHD> Hello, are there any sublime text users here interested in improving the user experience with nim in this editor ?β΅For now the only plugin that provides syntax highlighting is the the apparently unmaintained Nimlime https://packagecontrol.io/packages/NimLime |
17:37:43 | * | Kaivo joined #nim |
17:38:15 | FromDiscord | <AmjadHD> It uses the old tmLanguage format and does not follow scope naming guidelines https://www.sublimetext.com/docs/scope_naming.html |
17:38:51 | FromDiscord | <AmjadHD> In many places. |
17:40:53 | supakeen | Nice setup PMunch :) |
17:41:44 | Yardanico | @AmjadHD you can also use nimlsp with sublimetext for autocompletion and stuff, but syntax definition is an issue |
17:44:16 | FromDiscord | <AmjadHD> I'm aware of lsp, and one of the reasons i'm not satisfied with Nimlime is that it tries to fill lsp's role. |
17:45:04 | Yardanico | well, nimlime is mostly unmaintained IIRC |
17:46:52 | FromDiscord | <AmjadHD> Well I don't understand why there isn't any initiative of a decent Nim syntax for sublime text. |
17:47:22 | FromDiscord | <Idefau> because there is an initiative for lsp that works with most editors |
17:47:40 | FromDiscord | <AmjadHD> No I mean syntax. |
17:47:47 | disruptek | leorize[m]1: yes. |
17:48:33 | Zevv | PMunch: you shoud integrate with some ioselector |
17:48:47 | Zevv | or add a sleep for a few ms, but you should be ashame of yourself if you do that |
17:49:17 | * | rockcavera joined #nim |
17:49:23 | Yardanico | @AmjadHD because not enough people use sublimetext with nim in the first place :) |
17:49:29 | Yardanico | and sublimetext is losing popularity in general |
17:49:48 | Yardanico | and RAM usage isn't that *much* smaller than with VSCode really, sublimetext is like at least ~300mb ram |
17:50:04 | FromGitter | <yglukhov> disruptek: hey, trying to wrap my head around atoz/s3 + digitalocean. is it possible? |
17:50:18 | disruptek | of course. |
17:50:43 | disruptek | isn't DO just a host? |
17:50:56 | FromGitter | <yglukhov> yep. how can i change it? |
17:51:13 | disruptek | i think i don't understand. |
17:51:22 | disruptek | you want to speak s3 protocol to DO? |
17:51:33 | disruptek | they have an open-s3 type deal? |
17:51:36 | FromGitter | <yglukhov> how do i specify the host? it seems to be hardcoded as far as i understand |
17:51:57 | FromGitter | <yglukhov> oh, no, DO has s3 buckets |
17:51:57 | disruptek | ahh. you can hack individual calls if you want. |
17:52:14 | FromDiscord | <AmjadHD> All editor are losing popularity to vscode, but that doesn't justify abandoning them |
17:52:16 | FromDiscord | <dom96> PMunch: you should rename your stream, it's "test stream" right now π |
17:52:45 | FromDiscord | <dom96> AmjadHD: if you care about Sublime then by all means make Nim work well with it π |
17:52:47 | disruptek | yglukhov: you need to look at the openapi docs; that's where i demo hacking the api frameworks. |
17:53:03 | disruptek | you can override individual hosts, create your own api interface, whatever. |
17:53:17 | FromGitter | <yglukhov> thanks, will do |
17:53:44 | disruptek | lemme know if you still have questions after you see that stuff. i just got power back so i don't even have a web-browser yet. π |
17:54:06 | FromGitter | <yglukhov> alright :) |
18:01:08 | FromDiscord | <dom96> yglukhov: what you working on? π |
18:04:32 | * | haxscramper joined #nim |
18:05:31 | FromDiscord | <AmjadHD> @dom96 I don't know how that's why I came here to ask if there are any sublime users.β΅It's just I find it weird that the one can simply neglect all the users of one of the top text editors just like that. |
18:07:06 | FromDiscord | <reilly> What's the most convenient way of getting the last `n` characters of a string? |
18:07:21 | disruptek | s[^10 .. ^1] |
18:07:38 | FromDiscord | <reilly> Where 10 is n? |
18:07:43 | disruptek | what else? |
18:08:00 | FromDiscord | <reilly> Fair. |
18:09:30 | FromDiscord | <nikki> @AmjadHD no one is neglecting sublime users on purpose or something. this isn't some kind of antagonistic situation. people are just working on the things they're interested in, and using the things they want to. it's all open source. and you're welcome to help too π
|
18:10:02 | disruptek | hey, that's not fair. |
18:10:09 | FromDiscord | <nikki> your first question was whether there are other sublime users here in this chat rn; and it seems like no |
18:10:11 | disruptek | i am definitely antagonizing. |
18:10:42 | FromDiscord | <nikki> maybe in some sublime community, you could find people that would be interested in helping you support nim? or if you put some effort into it it may inspire others |
18:11:03 | FromDiscord | <nikki> oh word disruptek. well. carry on then π |
18:11:03 | FromDiscord | <Idefau> i am antagonizing non-emacs users |
18:11:38 | disruptek | rude. |
18:11:47 | disruptek | if you don't use neovim, you're dead to me. |
18:11:50 | FromDiscord | <nikki> disruptek do u use ed |
18:12:05 | FromDiscord | <Idefau> ed - the standard editor |
18:12:07 | FromDiscord | <nikki> i'm vim8 all the way |
18:12:07 | disruptek | why would i ever need to edit anything? whatever i type is perfect. |
18:12:19 | FromDiscord | <nikki> yeah could just use cat |
18:12:24 | FromDiscord | <nikki> or echo |
18:12:25 | FromDiscord | <Idefau> just use echo |
18:13:07 | FromDiscord | <Idefau> just cat /dev/tty > code.nim |
18:13:32 | FromDiscord | <nikki> could also use a heredoc |
18:16:24 | FromGitter | <yglukhov> dom96: it's just a game. nothing too interesting ;) |
18:17:27 | FromDiscord | <nikki> yglukhov: the nimsl lib was cool. do you end up using it much? |
18:18:39 | FromDiscord | <dom96> yglukhov: all you need is DO ;P |
18:18:54 | FromDiscord | <Idefau> Destroy gO? |
18:19:04 | FromDiscord | <Idefau> i agree |
18:19:59 | haxscramper | If I compiler tests for fusion pattern matching on nim 1.0.10 it just dies with codegen error. If I do this on 1.2.0+ it all works as expected. Diff between two generated files is approximately 30k lines, while c source *itself* is about the same size. I did a quick comparison is not just in something like names - 1.0.0 is missing several fields for objects too. This is basically the reason why code fails: I have something like `type A |
18:20:00 | haxscramper | = object hidden: float` and `func public(a: A): string = $a.hidden`. 1.0.10 just fails with `error: ... has no member named βhiddenβ`. And the `nimln_` points exactly int the `public` function, so I'm probably looking in the right place. |
18:20:00 | haxscramper | |
18:20:00 | haxscramper | So the question is: what can I do to make up for this difference in codegen between 1.0.10 and 1.2.0 - it is basically so different that test suite just simply fails to compile. Everything works on 1.2.0. |
18:21:11 | disruptek | write more tests. |
18:22:06 | haxscramper | And I'm kind of stuck - nim code is right, but 1.0.0 is just so wrong on codegen level that I don't even know where to start. And I can't reproduce it standalone. Haven't tried just deleting parts of the test suite though, so I should probably try that. To at least minimize things. |
18:22:40 | FromGitter | <yglukhov> nikki: well it is being used because there's some old code using it. Not that we're writing a lot of new code using it. vulkan kinda messed it all up) |
18:22:53 | disruptek | to help, we need specific information. to provide that, you need smaller tests. |
18:23:33 | FromGitter | <yglukhov> disruptek: it seems the problem is in atozSign. it only likes aws stuff... |
18:23:38 | FromDiscord | <nikki> yglukhov: it seems like glsl -> spirv -> ... is still a thing and maybe even the normal khronos way tho right |
18:23:54 | disruptek | that makes sense. |
18:24:17 | disruptek | you can reimplement atozHook. |
18:24:33 | FromGitter | <yglukhov> oh man |
18:24:52 | FromDiscord | <nikki> yglukhov: does nimsl target any specific glsl version? like is it more about "attribute / varying" than "in / out" or does it support both. i've been working on sth. that should run in both webgl1 and opengl3 and so on haha |
18:25:06 | FromGitter | <yglukhov> disruptek: whats your vision about atoz in general? how high level should it be in the end? |
18:25:16 | disruptek | or reimpl atozSign, i guess. |
18:25:26 | disruptek | probably you need to do the hook, though. |
18:25:51 | disruptek | i needed atoz, so i wrote openapi. but i expect people to use these as the basis for their own apis. |
18:26:01 | * | Jesin joined #nim |
18:26:12 | disruptek | like, i have a more idiomatic cloud api called `nigel` that does this. |
18:27:09 | disruptek | !requires atoz |
18:27:10 | disbot | atoz: 11epiphone/erverless-nim-sample 71 total |
18:29:06 | * | bung quit (Quit: Lost terminal) |
18:29:21 | FromGitter | <yglukhov> disruptek: i don't think I can "do the hook". atozHook is a method of the Call class. and there's no way i can substitute existing impl of it. only subclass. but then i have to recreate all the callable instances |
18:30:11 | disruptek | fair point. |
18:30:11 | FromGitter | <yglukhov> i guess i'll use a different sdk for now... |
18:30:27 | disruptek | you can just write your own s3 generator using the one from atoz as an example. |
18:30:57 | FromGitter | <yglukhov> eemm... it kinda seems too much of a hassle at this point) |
18:31:02 | disruptek | okay. |
18:31:47 | haxscramper | Nim <= 1.0.10 cannot properly handle identically-named types, defined in different scopes - https://play.nim-lang.org/#ix=2CvV . So if I have `block: type A = object` multiple times, it will only work for first type. And second will have codegen errors on fields. |
18:32:10 | disruptek | sounds like you know what the problem is and how to solve it. |
18:32:10 | FromGitter | <yglukhov> but hey, i'll be glad to test it once it's fixed ;) |
18:32:26 | disruptek | it's fixed. |
18:32:56 | FromGitter | <yglukhov> okay :) |
18:34:16 | disruptek | it hasn't changed appreciably in over a year. maybe get yourself a cloud provider with better support. |
18:34:41 | FromGitter | <yglukhov> right. with aws domain names :) |
18:35:00 | disruptek | now you're talkin'. π |
18:38:13 | FromGitter | <yglukhov> nikki: i don't really remember at this point. i believe it's just one version, that works "everywhere". |
18:38:38 | FromGitter | <yglukhov> only attribute / varying |
18:41:20 | FromDiscord | <nikki> ah i see. i thiiiink that version doesn't work on macos anymore π but may be wrong |
18:41:46 | FromDiscord | <nikki> may not be hard to change the codegen for those parts if i end up using it tho |
18:42:15 | FromGitter | <yglukhov> it does work on macos. and ios too. tested every day :) |
18:45:54 | FromDiscord | <nikki> oh nice! how do you do the gl context setup in the tests π€ in the repo test i only see tests for string comparison without running on gpu / or for cpu emulation |
18:46:56 | FromGitter | <yglukhov> it is being tested manually :) it's part of the project i'm working on |
18:51:27 | * | rokups quit (Quit: Connection closed for inactivity) |
18:53:17 | * | Kaivo quit (Ping timeout: 268 seconds) |
18:55:10 | * | Kaivo joined #nim |
18:57:54 | ForumUpdaterBot | New thread by AmjadBHD: Sublime Text user experience, see https://forum.nim-lang.org/t/7014 |
19:03:26 | leorize[m]1 | haxscramper: try to see if the fix is in a newer nim, then request a backport for it to 1.0.x |
19:06:15 | leorize[m]1 | disruptek: how are you supposed to use the cps macro? |
19:06:58 | leorize[m]1 | I'm gonna test this thing on JS for you :P I need closure iterators and we don't have them here |
19:25:20 | disruptek | how are you supposed to use it? |
19:26:27 | Zevv | yeah, how are we supposed to use that, disruptek?! |
19:27:12 | disruptek | this is zevv's department. |
19:27:28 | Zevv | well, currently we are not using it |
19:27:32 | Zevv | because it is broookeeen |
19:27:42 | disruptek | 0.0.13 works. |
19:27:47 | Zevv | but it sucks |
19:27:59 | disruptek | js won't know the difference. |
19:28:59 | Zevv | and anyway, stash/* is broken on 0.0.13 |
19:29:10 | Zevv | and those were all I cared about |
19:29:43 | disruptek | huh. |
19:30:22 | disruptek | leorize[m]1: whining at clyybber won't help, but it will show you are ONE OF US. |
19:30:24 | Zevv | ah unreachable code after return is an ERROR these days |
19:30:42 | Zevv | yes. whining at clyybber will not help. we tried that |
19:33:56 | Yardanico | Zevv: it's not |
19:34:04 | Yardanico | in fact it's the opposite |
19:34:13 | Yardanico | unreachable code was an error, but it's a warning now |
19:34:34 | Yardanico | see https://github.com/nim-lang/RFCs/issues/240 |
19:34:35 | disbot | β₯ Make "unreachable statement" error a warning ; snippet at 12https://play.nim-lang.org/#ix=2q6i |
19:35:26 | Yardanico | https://play.nim-lang.org/#ix=2Cwc |
19:35:29 | FromDiscord | <reilly> I don't know how to async. I have two async procs that I want to run in tandem. How can I do this? |
19:35:30 | Zevv | Yardanico: yeah you're right, I'm on the wrong machine |
19:35:37 | Yardanico | /usercode/in.nim(3, 8) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode] |
19:35:49 | Zevv | 0.0.13 indeed kind of works |
19:35:49 | Yardanico | @reilly wdym by "tandem" |
19:35:56 | Zevv | but we want typed. we want typed. |
19:35:57 | Yardanico | async is mostly relevant for IO-related stuff |
19:36:21 | * | rockcavera quit (Remote host closed the connection) |
19:36:29 | Yardanico | you can just use asyncCheck proc1(); asyncCheck proc2() but this might not do what you want |
19:36:39 | disruptek | asyncCheck is for chumps. |
19:36:42 | disruptek | never use it. |
19:36:51 | Zevv | use cps instead |
19:36:54 | Zevv | the typed version |
19:36:56 | Zevv | oh no wait |
19:36:58 | Zevv | that's broken |
19:37:01 | disruptek | leorize[m]1: how does "kinda works" sound to you? |
19:37:17 | Zevv | it also "kinda works" in js, is that better? |
19:37:17 | disruptek | Zevv: maybe the problem is that araq doesn't care. |
19:37:48 | FromDiscord | <reilly> These two procedures should both run forever. I've tried just doing it with threads, but either Nim doesn't like that, or I'm doing something wrong, so I'm trying async instead. |
19:38:06 | Yardanico | async won't help you if you're not doing IO |
19:38:14 | Yardanico | please provide more context |
19:38:22 | Zevv | disruptek: yeah that's funny, he really doesn't, does he |
19:38:56 | leorize[m]1 | disruptek: I'll let you know once I try it |
19:38:58 | Zevv | I read somewhere in the 0.14 notes a new async is underway anyway, so I guess cps is no longer needed |
19:39:19 | disruptek | i can't wait for 0.14. |
19:39:28 | FromDiscord | <reilly> This is IO. To oversimplify a bit, one procedure waits to receive requests and the other sends them. |
19:40:07 | Yardanico | well, then then you can use async provided you use async versions of receiving/sending procedures |
19:40:22 | Yardanico | e.g. AsyncHttpClient instead of HttpClient |
19:40:28 | Yardanico | add {.async.} pragma, "await" where needed, etc |
19:40:41 | disruptek | you're blowin' my mind right now. |
19:43:00 | FromDiscord | <reilly> I'm using what are, as far as I can tell, pre-made event loops. I need to run both of them simultaneously. |
19:43:25 | disruptek | fucking nuts. |
19:43:31 | Zevv | reilly: maybe you don't need async |
19:43:50 | disruptek | Zevv: did you not hear? |
19:44:16 | disruptek | pre-made event loops running simultaneously. |
19:44:41 | FromDiscord | <nikki> https://www.reddit.com/r/nim/comments/jgtogh/how_to_do_type_inference_on_proc_return/ga6wyqx/ <-- huh is there any reason typedesc params should be 'slower' than passing types explicitly as `foo[T1, T2]` π€ i don't see why but this comment mentions it and i'm new to this stuff so jw |
19:45:12 | Yardanico | typedesc can't be "slow" really |
19:45:16 | Yardanico | they don't exist at runtime anyway |
19:45:31 | FromDiscord | <nikki> yeah i don't understand what the comment is getting at about typedesc then haha |
19:46:43 | Yardanico | i think they haven't run the program like 10-30 times to average the times |
19:46:44 | FromDiscord | <ElegantBeef> Do they mean faster to type? |
19:46:49 | Yardanico | no |
19:46:52 | Yardanico | they explicitly mention runtime |
19:46:59 | Yardanico | I mean runtime timings |
19:47:07 | FromDiscord | <ElegantBeef> Ah yea didnt see the comments |
19:47:30 | FromDiscord | <nikki> i'm currently just using it as a way to prevent needing to do `obj.foo[:Type](arg)` and instead do `obj.foo(Type, arg)` |
19:48:48 | disruptek | yuck. |
19:50:51 | FromDiscord | <nikki> it's not for u disruptek, it's for me >:) |
19:51:41 | disruptek | sorry; it's just a reaction to seeing beef in the chat. |
19:51:57 | FromDiscord | <nikki> are you vegan? |
19:52:03 | disruptek | no. |
19:52:27 | Zevv | there's beef in gelatine, right? |
19:52:29 | FromDiscord | <Rika> now say yuck a second time |
19:52:45 | FromDiscord | <nikki> Zevv: idk maybe we should ask beef |
19:56:59 | FromDiscord | <ElegantBeef> Gelatine is typically scrapings off of the skin and remnants of the full animal |
19:57:04 | FromDiscord | <Daniel> 0/ new user here π |
19:57:06 | FromDiscord | <ElegantBeef> Disruptek dont act like you dont like me |
19:57:08 | FromDiscord | <ElegantBeef> Yellow |
19:57:15 | FromDiscord | <ElegantBeef> Welcome to the greatest language no one uses π |
19:57:43 | FromDiscord | <Daniel> Thanksβ΅Why no one uses it? |
19:58:24 | FromDiscord | <ElegantBeef> It's just a joke due to the relatively low usage numbers compared to the very popular langauges |
20:00:00 | FromDiscord | <Daniel> Sounds good. I started by reading this guide http://ssalewski.de/nimprogramming.html#_statements |
20:00:18 | FromDiscord | <Daniel> I am using notepad++, but it doesnt support nim...or does it? |
20:00:30 | Yardanico | it supports nim highlighting |
20:00:41 | Yardanico | also there's https://narimiran.github.io/nim-basics/ which is quite similar to salewski's work |
20:00:43 | Yardanico | they're both good |
20:00:45 | Prestige | wow, really? |
20:01:01 | Yardanico | Prestige: why wouldn't it? |
20:01:17 | Yardanico | but it's listed as "nimrod" iirc |
20:01:23 | Yardanico | i haven't used it in ages |
20:01:24 | FromDiscord | <Daniel> alright, so which one is more preferred salewski's or narimiran? |
20:01:30 | Prestige | notepad++ supporting nim syntax? I just didn't expect anything of that program lol |
20:01:34 | Yardanico | @Daniel you can read both :) |
20:01:40 | Yardanico | Prestige: notepad != notepad++ |
20:01:53 | Yardanico | notepad++ is an open source program, not related to MS's notepad |
20:02:01 | Prestige | Yeah Ik |
20:02:04 | FromDiscord | <Daniel> yes, i could read everything on internet, but thats waste of time....which one is more preffered? |
20:02:12 | Yardanico | there's no "more preferred" |
20:02:15 | FromDiscord | <nikki> i followed the "nim in action" book for the past couple weeks and it was great |
20:02:28 | Prestige | still don't expect anything of it, didn't think ppl actually used it |
20:02:31 | FromDiscord | <ElegantBeef> The most perferred method is the one that you do π |
20:02:52 | FromDiscord | <nikki> yeah whatever you find fun and makes you happy about coding π |
20:03:15 | FromDiscord | <Daniel> well, lets put it like this...i dont want to read about topics such as: What is an Operating System?β΅What is Computer Programming?β΅What is a Computer Program? |
20:03:40 | FromDiscord | <nikki> i think you are best equipped to glance over a read and find out if it's the one for you |
20:03:44 | FromDiscord | <Daniel> since i already know this, as i am using operating system, i am using computer...etc |
20:03:56 | Yardanico | well salewski's book covers CS topics more |
20:04:01 | Yardanico | "nim basics" is just an intro to nim |
20:04:09 | Yardanico | I mean more than nim basics |
20:04:21 | Yardanico | really just check https://nim-lang.org/learn.html |
20:04:38 | FromDiscord | <nikki> i have liked nim in action + nim manual itself (it's more spec'y / rigorous but i like that stuff) + reading the various articles like the one on destructors on the main website |
20:04:53 | FromDiscord | <nikki> eg. https://nim-lang.org/docs/destructors.html |
20:05:01 | FromDiscord | <nikki> lots of really solid info around |
20:05:29 | FromDiscord | <nikki> also, cloning the nim repo itself and using lsp and navigating around it |
20:05:39 | FromDiscord | <nikki> plus, reading the generated C output of things you make |
20:05:58 | FromDiscord | <nikki> these are ideas; again only you are equipped with the personal context that makes any of these ideas the one for you |
20:06:21 | FromDiscord | <reilly> I haven't had any luck trying to do it with threads. If my thread's proc isn't annotated with `{.async.}`, the `startSession()` event loop suddenly becomes an undeclared identifier. If I do make it `{.async.}`, now thread's proc is an undeclared identifier. |
20:06:45 | FromDiscord | <nikki> @reilly i believe threads and async are separate things (they can interact, but they aren't about the same system) |
20:07:03 | FromDiscord | <nikki> async afaict is actually for single threaded asynchronous mostly i/o things (or event dispatch on that thread for other reasons like timers) |
20:07:18 | FromDiscord | <nikki> and the container type is `Future[T]`. which is diff from `FlowVar[T]` for the thready things |
20:07:25 | FromDiscord | <nikki> still kind of a nim noob tho so may be off |
20:07:33 | FromDiscord | <reilly> Well there has to be some way of running two different async things at the same time. |
20:07:54 | FromDiscord | <Daniel> i mean, i posted some similar post on forum here https://forum.nim-lang.org/t/6964#43615β΅Stefan_Salewski first responded, but by page 20, to me it seems to wide and general |
20:08:04 | FromDiscord | <nikki> yes what that means is that, they are simultaneously blocked on something they are waiting on, so the appearance of the execution counter across them is simultaneous |
20:08:05 | Yardanico | if they're not "async" on the nim side, you can't really call it asynchronously from nim |
20:08:09 | Yardanico | well, not without threads |
20:08:10 | FromDiscord | <nikki> eg. JS has async but is single threaded |
20:08:18 | Yardanico | and please show more context |
20:08:20 | Yardanico | what event loops |
20:08:54 | Yardanico | are they declared in nim code? or not? |
20:09:00 | Yardanico | how are they declared (async, normal procs, etc) |
20:09:30 | FromDiscord | <reilly> I am using an AsyncHttpServer and a dimscord.DiscordClient. |
20:09:48 | Yardanico | then I don't see the problem :) |
20:09:49 | FromDiscord | <nikki> @Daniel cool. people (including myself) have already recommended some resources above. let us know what you think of those |
20:09:58 | Yardanico | you can easily run both of them asynchronously |
20:10:05 | FromDiscord | <Daniel> will, tnx for the info |
20:10:07 | Yardanico | in ircord for example I run both the discord and IRC clients |
20:10:11 | Yardanico | and also do some http(s) requests |
20:10:12 | FromDiscord | <Daniel> (edit) "will," => "will do," |
20:10:13 | FromDiscord | <nikki> highly rec "nim in action" the book |
20:10:20 | FromDiscord | <Daniel> will google it |
20:10:27 | FromDiscord | <nikki> there's some out of date stuff; but there's an errata somewhere about 'em |
20:10:57 | FromDiscord | <reilly> Okay, but how? That's what I asked at the beginning. |
20:11:48 | Yardanico | instead of await discord.run() you would do asyncCheck discord.run() |
20:11:48 | Yardanico | etc |
20:12:05 | Yardanico | "await" blocks the current procedure till the async proc returns something or fails |
20:12:26 | Yardanico | asyncCheck doesn't "block" the current procedure so you can call more async stuff |
20:12:30 | Yardanico | and then just runForever() |
20:12:53 | Yardanico | e.g. check https://github.com/Yardanico/ircord/blob/master/src/ircord.nim#L502 |
20:13:10 | Yardanico | most of the code at the bottom |
20:14:11 | Yardanico | dimscord has startSession |
20:14:33 | Yardanico | so you either asyncCheck it or asyncCheck the proc that awaits the proc that calls startSession |
20:17:15 | disruptek | don't use asyncCheck. |
20:17:52 | Yardanico | do use asyncCheck where it's useful |
20:18:21 | Yardanico | it's just a helper to set a callback which raises the error if future has raised an exception |
20:18:26 | Yardanico | nothing out of ordinary |
20:19:22 | disruptek | some lessons cannot be taught. |
20:19:29 | disruptek | for the others, there's disruptek. |
20:21:05 | FromDiscord | <Daniel> Are these bots able talk to each other in infinite loop? |
20:21:18 | FromDiscord | <ElegantBeef> These arent bots |
20:21:24 | FromDiscord | <ElegantBeef> Those are people talking over a bridge |
20:21:40 | Yardanico | @Daniel funny joke :) |
20:22:10 | FromDiscord | <ElegantBeef> They may have the personality of robots but sadly they arent |
20:22:15 | Yardanico | but it's far from the first time that we hear it |
20:22:25 | FromDiscord | <Daniel> I assumed it was bot, since it has this tag https://media.discordapp.net/attachments/371759389889003532/771831392031342662/unknown.png |
20:22:37 | Yardanico | yes, but there's no way to remove it |
20:22:41 | Yardanico | that's just how discord webhooks work |
20:22:43 | Yardanico | !repo ircord |
20:22:44 | disbot | https://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 11β 1π΄ |
20:23:01 | Yardanico | you clearly see "IRC" though :) |
20:23:07 | FromDiscord | <Daniel> oh i see, thank you for the explanation, quite interesting |
20:23:09 | FromDiscord | <ElegantBeef> You're currently chatting to Gitter, IRC, Matrix, and discord |
20:23:22 | disruptek | https://github.com/Yardanico/ircord/issues/3 |
20:23:22 | disbot | β₯ support direct messaging |
20:23:28 | Yardanico | i know |
20:23:29 | FromDiscord | <Daniel> That's actually awesome, everything is interconnected. |
20:23:50 | FromDiscord | <ElegantBeef> Increases our community size, and allows us to shittalk people we would've never met otherwise, like that disruptek guy |
20:23:55 | disruptek | like STDs. i fucked magic johnson once and i didn't even get AIDS. |
20:24:13 | FromDiscord | <ElegantBeef> Not what they meant by interconnected |
20:24:26 | disruptek | well, never mind then. |
20:27:21 | FromDiscord | <Daniel> alright the book "nim in action" seems to be from 3 years ago....i guess maybe tiny bit is out of date after 3years |
20:27:29 | Yardanico | not really |
20:27:35 | Yardanico | not much have changed in the core language |
20:27:41 | Yardanico | actually almost nothing |
20:27:58 | Yardanico | that's the whole errata, and most of it is about warnings |
20:27:59 | Yardanico | https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html |
20:29:46 | FromDiscord | <Daniel> Thank you for the errata, helps π |
20:29:58 | Yardanico | it's not mine :) |
20:33:19 | FromDiscord | <Daniel> it may not be yours, but you provided the link to it, which helps, thank you |
20:42:01 | FromDiscord | <nikki> @Daniel having followed the entire book in the past 2 weeks, i can confirm that it's basically entirely up to date and accurate and a good experience |
20:42:09 | ForumUpdaterBot | New thread by Niminem: Neural Networks From Scratch in Nim, see https://forum.nim-lang.org/t/7015 |
20:42:24 | FromDiscord | <nikki> i think the main snag i hit was the to utc time thing which i found through the errata |
20:42:58 | FromDiscord | <nikki> don't worry about all that too much, just dive in and have fun π |
20:51:07 | * | astronavt joined #nim |
20:56:40 | * | superbia joined #nim |
20:56:53 | * | superbia quit (Client Quit) |
21:00:32 | FromDiscord | <Daniel> already in it π |
21:00:57 | FromDiscord | <Daniel> thank you for the guidance |
21:03:13 | * | kwilczynski quit (Ping timeout: 272 seconds) |
21:03:32 | * | fowl quit (Ping timeout: 260 seconds) |
21:03:54 | * | rusua quit (Read error: Connection reset by peer) |
21:04:05 | FromDiscord | <reilly> After poking around for a bit, I've gotten something that works, but barely. I think this would be infinitely better if I could use a separate thread. |
21:04:20 | * | kwilczynski joined #nim |
21:04:23 | * | rusua joined #nim |
21:04:43 | FromDiscord | <reilly> It's worth adding that I've switched to using only the event loop for Dimscord, the other turned out to be unnecessary. |
21:06:04 | * | fowl joined #nim |
21:06:51 | FromDiscord | <reilly> From trying before, Nim doesn't seem to like it if you try and run an async proc as a new thread. |
21:08:43 | FromDiscord | <dom96> @Daniel you can always ping the author (me) if you run into any problems π |
21:10:09 | PMunch | Zevv, any suggestions for ioselector integration? |
21:11:35 | FromDiscord | <dom96> PMunch: maybe I can help? |
21:11:51 | PMunch | Maybe, did you watch the stream? |
21:12:16 | FromDiscord | <dom96> only a small bit |
21:14:01 | * | mbomba joined #nim |
21:21:23 | PMunch | Basically in the start I implemented a timeout thing for my notifications |
21:21:46 | PMunch | But I realised that XNextEvent would block, so I couldn't check the time without an XEvent |
21:22:28 | PMunch | So I switched to check XPending and added a small sleep(100) at the end of the loop to avoid 100% CPU utilisation |
21:23:29 | FromDiscord | <reilly> I have an `{.async.}` proc. The only error Nimsuggest is giving me is that, when attempting to `createThread()` with this proc, said proc is an undeclared identifier. It definitely isn't. What can I do about this? |
21:23:39 | * | narimiran quit (Ping timeout: 260 seconds) |
21:29:52 | FromDiscord | <reilly> https://play.nim-lang.org/#ix=2CwL |
21:31:14 | * | astronavt quit (Quit: Leaving) |
21:33:56 | * | natrys quit (Quit: natrys) |
21:40:30 | FromDiscord | <krisppurg> hey guys soβ΅on `from helpers import libVer` whenever I mention libVer it gets an error |
21:40:42 | disruptek | don't do that. |
21:40:59 | FromDiscord | <krisppurg> how come? |
21:41:18 | disruptek | it's crashing my compilation and i couldn't figure out why. |
22:01:33 | FromDiscord | <lqdev> @krisppurg what error... |
22:02:11 | FromDiscord | <krisppurg> undeclared identifier: 'libVer' |
22:02:20 | FromDiscord | <lqdev> that's odd |
22:02:24 | FromDiscord | <lqdev> are you sure libVer is exported? |
22:16:01 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=2CwV |
22:16:38 | FromDiscord | <enthus1ast> it does work in the if and elif case but not in else |
22:19:23 | * | ehmry quit (Read error: Connection reset by peer) |
22:19:34 | * | rusua quit (Quit: Connection closed for inactivity) |
22:20:55 | FromDiscord | <Rika> Well it shouldn't work for any of them |
22:21:07 | FromDiscord | <Rika> If you remove the else, does it compile |
22:21:12 | FromDiscord | <enthus1ast> yes |
22:21:22 | FromDiscord | <Rika> It shouldn't AFAIK |
22:21:49 | * | ehmry joined #nim |
22:23:17 | FromDiscord | <enthus1ast> mh yeah makes kinda sense BUT ( π ) it makes my code ugly, π¦ |
22:23:24 | FromDiscord | <ache of head> Lmao |
22:23:54 | * | lritter quit (Quit: Leaving) |
22:24:06 | FromDiscord | <enthus1ast> i'll try to assign it in the object constructor |
22:28:14 | * | solitudesf quit (Ping timeout: 264 seconds) |
22:30:14 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=2CwY |
22:30:25 | FromDiscord | <enthus1ast> thank you @Rika |
22:32:07 | FromDiscord | <dom96> @PMunch how does this event loop work? Is there an FD you could await on? |
22:32:21 | PMunch | Oh yeah, already implemented it :P |
22:32:41 | FromDiscord | <dom96> @reilly you can't `createThread` on an async proc, it needs to be marked with {.thread.} |
22:33:09 | FromDiscord | <dom96> PMunch: then you shouldn't need `sleep`, you should be blocking your thread on the async dispatch `poll` |
22:34:00 | PMunch | Oh yeah, I do now |
22:34:11 | PMunch | I implemented the selector logic since your last message :P |
22:35:56 | FromDiscord | <dom96> lol |
22:40:59 | FromDiscord | <reilly> @dom96 that code must be inside of an `{.async.}` proc. Marking it as both `{.async, thread.}` still leaves it as an undeclared identifier. |
22:43:53 | FromDiscord | <dom96> Weird that you get an undeclared identifier, but what is your high level goal here? |
22:43:57 | FromDiscord | <dom96> Why are you using threads? |
22:45:28 | FromDiscord | <reilly> Because having everything run asynchronously on a single thread is too slow. |
22:45:50 | FromDiscord | <dom96> what's "everything"? |
22:47:36 | FromDiscord | <reilly> My main thread is handling a terminal-based GUI, and the second thread is a Discord bot. |
22:51:34 | FromDiscord | <reilly> I've already tried running everything on one thread asynchronously, and as far as I could tell the Discord part was being seriously inhibited from functioning properly. |
22:52:12 | FromDiscord | <dom96> That shouldn't be the case, but if you really want another thread you should run the async loop there. To do that you don't need {.async, thread.} |
22:52:49 | FromDiscord | <dom96> Just waitFor your main async proc in the {.thread.} |
23:04:16 | * | vicfred_ joined #nim |
23:04:50 | FromDiscord | <reilly> Not making the proc async makes setting event procs impossible and makes the `startSession()` proc an undeclared routine. See https://play.nim-lang.org/#ix=2Cx7 |
23:04:51 | PMunch | Hmm, anyone got an icon idea for notifishower? |
23:07:21 | * | vicfred quit (Ping timeout: 268 seconds) |
23:08:29 | FromDiscord | <reilly> Obligatory @dom96 since he seems to be the only one helping me out. |
23:11:28 | * | haxscramper quit (Remote host closed the connection) |
23:14:50 | Prestige | PMunch: what about a notification itself? |
23:15:11 | PMunch | What do you mean? |
23:15:36 | Prestige | The icon could resemble a notification window with text |
23:16:00 | PMunch | Well, the problem is that notifishower is designed to be as flexible as absolutely possible |
23:16:26 | PMunch | So there is really nothing that would resemble any of its notifications |
23:16:39 | Axiomatic | An exhausted courier from the Pony Express collapsing while handing the observer a letter, horse keeled over dead in the background. |
23:18:42 | PMunch | Haha, that might be slightly too hard |
23:19:09 | Axiomatic | Yeah, a little busy for an icon I guess |
23:19:24 | PMunch | For context this is the logo for notificatcher: https://github.com/PMunch/notificatcher/blob/master/notificatcher.png |
23:22:40 | Axiomatic | Hmm, very clean. Ok. picture this: silver platter, top lifted to reveal a letter on the platter on offer. |
23:23:36 | PMunch | Ooh, that's not a bad idea |
23:23:39 | FromDiscord | <Clyybber> @reilly You mean removing {.async.} from the proc that contains "waitFor bot.startSession()" ? |
23:23:55 | FromDiscord | <dom96> @reilly you sure {.thread.} is to blame here? |
23:24:01 | * | mbomba quit (Ping timeout: 260 seconds) |
23:24:10 | * | abm quit (Quit: Leaving) |
23:24:27 | FromDiscord | <reilly> It's not {.thread.} that's the issue, it's the lack of {.async.}. |
23:24:30 | PMunch | Sure beats this: https://uploads.peterme.net/2020-10-31-002351_130x195_scrot.png :P |
23:24:52 | FromDiscord | <dom96> @reilly huh, nothing in that case needs {.async.} |
23:24:57 | FromDiscord | <dom96> (edit) "case" => "code" |
23:25:09 | FromDiscord | <reilly> Nimsuggest disagrees. |
23:25:18 | FromDiscord | <dom96> compile your code instead of relying on nimsuggest |
23:25:30 | Axiomatic | Haha, that's.... suggestive. Invites too many, unclean thoughts. Distracting. |
23:25:48 | PMunch | Haha :P |
23:26:27 | PMunch | I mean I'm open to change the name of the program as well |
23:26:46 | PMunch | If that meant getting a better icon and a name that doesn't sound like a shower.. |
23:27:30 | Axiomatic | Notifishower is better than Notifiexposer. There's worse names. |
23:27:43 | PMunch | Haha |
23:27:46 | PMunch | Notifipresent |
23:27:58 | PMunch | Could have the notification looking like a present |
23:30:36 | Axiomatic | A letter making it past snow, rain, heat (sun) and gloom of night (moon). |
23:30:57 | Axiomatic | It does what the postal service no longer can. TM |
23:31:14 | FromDiscord | <Clyybber> PMunch: perhaps notifair |
23:31:22 | PMunch | notifair? |
23:32:08 | FromDiscord | <Clyybber> since it shows your notifications |
23:32:18 | FromDiscord | <Clyybber> so its like a fair for notifications |
23:32:41 | FromDiscord | <reilly> I've done some tweaks now, but I can't be sure if they're really going to do anything for me since I'm having memory safety issues. Calling `startSession()` is not thread-safe, despite being completely unrelated to anything outside of the proc. |
23:33:47 | PMunch | Clyybber, ah that kind of fair |
23:33:55 | FromDiscord | <reilly> Er, well, I guess that's not exactly true. It looks like it's because it works with global memory in the Dimscord module, not something I can really do anything about. |
23:34:02 | FromDiscord | <Clyybber> notiflash |
23:34:03 | PMunch | I thought you meant like: Look at these fair icons |
23:34:32 | FromDiscord | <Clyybber> :D |
23:34:51 | FromDiscord | <Clyybber> notiflount |
23:34:57 | Axiomatic | Notifish (notify shell)/fish icon and Notificatcher/fish net. |
23:35:12 | PMunch | But why fish? |
23:35:25 | Axiomatic | Notifi-sh sh for shell |
23:35:29 | FromDiscord | <reilly> This would probably work if I could have the bot on the main thread instead, but afaik you can only echo on the main thread, so my terminal-based GUI would have to go. |
23:35:32 | PMunch | Notificatcher catcher notifications, and has the icon of a dreamcatcher, such a nice combo |
23:35:59 | PMunch | Hmm, well it doesn't have to be in the shell.. |
23:36:07 | Axiomatic | Yeah, it's hard to beat. |
23:36:21 | PMunch | @reilly, I think you can echo from any thread |
23:36:25 | PMunch | You just risk interlacing |
23:36:48 | FromDiscord | <reilly> I think I might have gotten the wrong impression from Nim in Action, then... |
23:38:08 | FromDiscord | <Clyybber> PMunch: I kinda like the shower idea tbh |
23:38:27 | FromDiscord | <Clyybber> its so contrarian to notificatcher in the sense that it doesn't make any sense |
23:38:45 | PMunch | Haha, that's kinda why I started making it :P |
23:39:29 | FromDiscord | <Clyybber> its catchy |
23:39:52 | FromDiscord | <lqdev> please don't change the name |
23:39:58 | FromDiscord | <lqdev> it's great |
23:40:04 | PMunch | Notifishower? |
23:40:09 | FromDiscord | <lqdev> yeah |
23:40:10 | FromDiscord | <Clyybber> yeah |
23:40:17 | FromDiscord | <Clyybber> just go with the shower idea all way through |
23:40:32 | FromDiscord | <reilly> I've switched which half is on the second thread, but neither works for the same reason: some necessary function call accesses global memory in the module itself. |
23:43:07 | FromDiscord | <Clyybber> @reilly So afaict your issue is that the dimscord API is not thread safe? |
23:43:16 | FromDiscord | <reilly> It would seem so. |
23:43:35 | FromDiscord | <reilly> Neither Dimscord nor Illwill are thread-safe. |
23:43:39 | FromDiscord | <Clyybber> Then just dedicate one thread to dimscord and one to illwill |
23:43:48 | FromDiscord | <reilly> That's what I'm trying to do. |
23:43:59 | FromDiscord | <Clyybber> How are you communicating between the two? |
23:44:07 | FromDiscord | <reilly> At the moment, I'm not. |
23:45:05 | mipri | if the only problem is access global memory, check out the Heap chart on https://nim-lang.org/docs/gc.html . maybe you can just --gc:boehm and call it a day. |
23:45:49 | * | xace quit (Ping timeout: 264 seconds) |
23:46:32 | * | astronavt joined #nim |
23:46:41 | FromDiscord | <reilly> That doesn't seem to have worked. |
23:47:00 | FromDiscord | <Clyybber> both threads are accessing the same global memory? |
23:47:37 | FromDiscord | <reilly> Nope! The crux of the issue seems to be that each module is trying to access some variable declared in its own global scope. |
23:48:05 | FromDiscord | <reilly> In my code, there is no shared memory between the two. |
23:48:29 | FromDiscord | <reilly> `dimscord.startSession()`, which I have to run to start the bot, is not memory safe. `illwill.display()`, which I have to run to update the screen, is not memory safe. |
23:48:55 | FromDiscord | <Clyybber> can you try with --gc:arc |
23:49:12 | FromDiscord | <Clyybber> or --gc:orc should also work |
23:49:20 | FromDiscord | <Clyybber> if you are on #devel |
23:50:32 | FromDiscord | <reilly> Both arc and orc still say that it's not gc-safe. |
23:50:47 | FromDiscord | <Clyybber> oh? So your problem is that it doesn't compile |
23:50:53 | FromDiscord | <Clyybber> I thought it was a runtime problem |
23:51:05 | FromDiscord | <reilly> Sorry, I should have made that more clear. |
23:51:40 | FromDiscord | <Clyybber> try {.gcsafe.}: bodyOfYourProc |
23:51:58 | FromDiscord | <Clyybber> gcsafe analysis is pessimistic |
23:51:59 | FromDiscord | <reilly> I currently have Illwill running in the `guiHandler()` thread proc. guiHandler is not gc-safe because it calls display. display is not safe because it accesses "gPrevTerminalBuffer," which is global. |
23:52:08 | FromDiscord | <reilly> I will try that now. |
23:52:21 | FromDiscord | <Clyybber> if you are sure only one thread accesses it it should be fine |
23:52:31 | * | xace joined #nim |
23:53:03 | FromDiscord | <reilly> I figured that would be the case, but that won't get me anywhere if Nim is forcing me to be gc-safe anyway. |
23:53:13 | FromDiscord | <dom96> you should also still be able to just tell the compiler to be quiet with --threadAnalysis:off |
23:53:23 | FromDiscord | <dom96> although I do remember hearing Araq wanting to remove that ability |
23:53:28 | FromDiscord | <reilly> The road to hell is paved with good intentions... |
23:53:59 | FromDiscord | <Clyybber> @reilly a {.gcsafe.}: ... block asserts that you are sure that its gcsafe |
23:54:18 | FromDiscord | <Clyybber> so that the compiler doesn't have to pessimistically assume you are going to access globals that you shouldn't |
23:54:50 | FromDiscord | <reilly> I had {.thread, gcsafe.} a minute ago, but I guess it has to be just {.gcsafe.}. |
23:59:47 | FromDiscord | <reilly> Lookin' good. Hopefully from here on this shouldn't be nearly as headache-inducing. |