00:02:59 | FromDiscord | <ElegantBeef> `.cfg` |
00:03:11 | FromDiscord | <ElegantBeef> I'd personally say just use a toml library π |
00:03:16 | FromDiscord | <LITeralLANGuage9> How do I export to XML or JSON? |
00:04:06 | FromDiscord | <ElegantBeef> `import json; writeFile("myJson.json", % your object)` |
00:04:11 | FromDiscord | <ElegantBeef> (edit) "your object)`" => "yourObject)`" |
00:05:21 | FromDiscord | <PizzaFox> wait does `parsecfg` not support arrays |
00:05:30 | FromDiscord | <ElegantBeef> Dont think nim's stdlib has a xml exporter |
00:05:59 | FromDiscord | <ElegantBeef> not a clue, toml can though |
00:07:49 | FromDiscord | <PizzaFox> sent a code paste, see https://play.nim-lang.org/#ix=2Q1f |
00:09:28 | * | actuallybatman joined #nim |
00:09:37 | FromDiscord | <ElegantBeef> Yea just get one of these https://nimble.directory/search?query=toml |
00:09:52 | FromDiscord | <ElegantBeef> It's a similar format but it's widely used and standardized |
00:10:55 | FromDiscord | <ElegantBeef> TomlSerialization can deserialize files directly into objects so it's pretty nifty |
00:11:59 | FromDiscord | <PizzaFox> hm |
00:12:04 | FromDiscord | <PizzaFox> will use the status im one |
00:48:16 | * | Vladar quit (Quit: Leaving) |
01:24:21 | * | krux02 quit (Remote host closed the connection) |
01:38:11 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Q1w |
01:41:03 | FromDiscord | <exelotl> I'm currently doing the latter for my own project, but at compile time instead of via nimscript... |
01:41:53 | FromDiscord | <exelotl> which is a bit dumb, means I have to recompile the project tool every time i change an asset |
01:51:41 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:52:01 | FromDiscord | <ElegantBeef> @exelotl uncertain what you mean but checkout https://github.com/JimmyCushnie/SUCC |
01:52:03 | * | njoseph joined #nim |
01:53:53 | FromDiscord | <exelotl> succ π€ |
01:59:33 | FromDiscord | <exelotl> it's pretty close I guess |
01:59:56 | FromDiscord | <exelotl> I really want to use something built in to Nim |
02:00:00 | * | abm quit (Read error: Connection reset by peer) |
02:00:26 | FromDiscord | <exelotl> that pretty much gives me json, xml, cfg or embedded nimscript |
02:00:40 | FromDiscord | <ElegantBeef> or toml π |
02:00:51 | FromDiscord | <ElegantBeef> Oh nvm you said `built in` |
02:00:57 | FromDiscord | <exelotl> yeah xD |
02:01:22 | FromDiscord | <ElegantBeef> The first three are all meh |
02:02:40 | FromDiscord | <exelotl> yep. JSON and XML are not human friendly, cfg doesn't have any concept of blocks that can be closed |
02:03:28 | FromDiscord | <ElegantBeef> Embedded nimscript is probably the best then since it also ensures values that match the source |
02:03:28 | * | Tanger quit (Quit: Leaving) |
02:03:45 | FromDiscord | <ElegantBeef> But embedding nimscript isnt really "builtin" |
02:04:29 | FromDiscord | <ElegantBeef> You need the compiler package |
02:04:30 | FromDiscord | <exelotl> oh :x |
02:04:53 | FromDiscord | <exelotl> does that not come with a standard Nim installation? |
02:05:04 | FromDiscord | <ElegantBeef> Dont think so |
02:05:14 | FromDiscord | <ElegantBeef> Could be wrong |
02:05:30 | FromDiscord | <ElegantBeef> Why are you so interested in builtin anywho? |
02:06:13 | FromDiscord | <exelotl> just want less dependencies |
02:07:26 | FromDiscord | <ElegantBeef> For serialization that dependency is pretty much par for the course |
02:08:39 | FromDiscord | <exelotl> this config file is just a list of all the graphics in the game, to be processed by a conversion tool |
02:08:49 | FromDiscord | <exelotl> I'd consider depending on toml but... it won't let me do this right? https://media.discordapp.net/attachments/371759389889003532/812506008378540082/Screenshot_from_2021-02-20_02-07-13.png |
02:09:03 | FromDiscord | <ElegantBeef> I believe it does |
02:09:31 | FromDiscord | <exelotl> I'm looking at the docs and it sounds like it would complain if I tried to make more than 1 key called sharePalette |
02:09:45 | FromDiscord | <ElegantBeef> If you made it an array i dont thinkso |
02:09:47 | FromDiscord | <ElegantBeef> (edit) "thinkso" => "think so" |
02:10:00 | FromDiscord | <ElegantBeef> Is this for the gba? |
02:10:40 | FromDiscord | <exelotl> Yeh, I'm trying to adapt my tools so they can be used in other people's projects x) |
02:11:10 | FromDiscord | <ElegantBeef> Just wondering due to how nimscript requires a minimal stdlib for the evaluation and adds around 1-2MB to the project |
02:11:42 | FromDiscord | <ElegantBeef> Yea idk make a SUCC nimplementation π |
02:12:01 | FromDiscord | <exelotl> it's not code to actually run on the GBA xD Just for the conversion tools |
02:12:08 | FromDiscord | <ElegantBeef> Ah |
02:12:20 | FromDiscord | <exelotl> (edit) "it's not code to actually run on the GBA xD Just for the ... conversion" added "asset" |
02:12:33 | FromDiscord | <exelotl> but yeah that does sound pretty heavy |
02:13:31 | FromDiscord | <ElegantBeef> Yea just checked the stdlib i ship on nimscripter's repo is 1.2MB which is like the smallest lib with 0 unrequired modules |
02:14:21 | FromDiscord | <ElegantBeef> Could always make a nim inspired format that's indent sensitive |
02:14:43 | FromDiscord | <ElegantBeef> Call it NON for Nim Object Notation π |
02:19:11 | FromDiscord | <exelotl> I also use nimscript tasks to build... so maybe I could handle the configuration at that point, and forward the results onwards to the conversion tool? |
02:20:13 | FromDiscord | <exelotl> the most frustrating thing is that nimscript doesn't any time functions at all :( |
02:20:35 | FromDiscord | <ElegantBeef> libffi cannot get here soon enough π |
02:20:52 | FromDiscord | <exelotl> ooh is that a thing? |
02:21:08 | FromDiscord | <ElegantBeef> You can build the compiler with a libffi flag which gives you C interop capaballities |
02:22:03 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q1K |
02:22:37 | FromDiscord | <ElegantBeef> I know typed means it's semantically checked but i dont know the difference π |
02:23:15 | FromDiscord | <exelotl> @Yjuq I don't understand this either x) |
02:23:19 | FromDiscord | <Yjuq> (edit) "https://play.nim-lang.org/#ix=2Q1K" => "https://play.nim-lang.org/#ix=2Q1L" |
02:23:28 | FromDiscord | <ElegantBeef> I'd like to say it doesnt matter since i've never ran into it |
02:23:41 | FromDiscord | <exelotl> yeah I'm not sure if there's even a difference |
02:23:57 | FromDiscord | <tinygiant> Finally back at it. I need to build a file parser to pull function prototypes out of plain-text program files. Can anyone point me at a project or package that may use pegs (or maybe npeg) to parse something like this so I have a good example to start/learn from? |
02:24:57 | FromDiscord | <ElegantBeef> https://github.com/zevv/aoc2020/blob/master/07/main.nim one example |
02:25:06 | FromDiscord | <ElegantBeef> I really cannot read it, but it does something π |
02:27:48 | FromDiscord | <tinygiant> @ElegantBeef That's my problem, not yours. Thanks for the pointer! |
02:41:42 | FromDiscord | <exelotl> this is getting somewhere π https://media.discordapp.net/attachments/371759389889003532/812514283497193472/Screenshot_from_2021-02-20_02-41-16.png |
02:50:33 | * | lritter quit (Ping timeout: 256 seconds) |
02:50:47 | * | asdflkj_1 joined #nim |
02:50:52 | * | lritter joined #nim |
02:51:26 | FromDiscord | <exelotl> soo it works like - The conversion tool invokes `nim e runner.nims config.nims`. The runner executes config.nim with the necessary API available, and echo's out the config in a machine-friendly format which the conversion tool can parse |
02:51:58 | FromDiscord | <exelotl> (edit) "config.nims`." => "graphics.nims`." | "config.nim" => "graphics.nims" |
02:52:01 | FromDiscord | <ElegantBeef> Nice |
02:52:12 | FromDiscord | <ElegantBeef> My silly .obj parser works π |
02:52:25 | FromDiscord | <exelotl> oh cool |
02:52:49 | FromDiscord | <ElegantBeef> Surprising that you can parse a majority that shitty format in like 41 lines of code |
02:52:53 | FromDiscord | <ElegantBeef> (edit) "Surprising that you can parse a majority ... that" added "of" |
03:15:46 | * | Tanger joined #nim |
03:30:31 | FromDiscord | <Yjuq> Uh... Could it be that I can change the whole syntax from nim if i want to with templates and macros? |
03:31:22 | FromDiscord | <Yjuq> To let it look like Go code for example. Sounds stupid - I know. And I probably don't do this, just curious |
03:33:03 | FromDiscord | <exelotl> templates and macros operate on the AST after the code has been parsed, so no you can't change Nim's syntax |
03:33:22 | FromDiscord | <exelotl> but Nim's syntax is very flexible so you can still do a lot |
03:34:12 | FromDiscord | <Yjuq> Yea... I probably can cheat a bunch of different stuff in it. But I would not get rid of the indention for example huh |
03:34:26 | FromDiscord | <ElegantBeef> Macros have to be parsable nim code, so yea you're forced into the nim style, but not implement your own unless you use strings |
03:34:51 | * | FromDiscord quit (Remote host closed the connection) |
03:35:05 | * | FromDiscord joined #nim |
03:35:40 | FromDiscord | <ElegantBeef> For instance you could make a parser which takes the code as a string and emits Nim code |
03:36:25 | FromDiscord | <Yjuq> Don't need to rofl - I have no intention of designing a programming language |
03:36:43 | FromDiscord | <ElegantBeef> Yea but it's a nice cheaty way to get a compiled language π |
03:36:47 | FromDiscord | <Yjuq> but maybe something for lua. Lua -> Nim converter or something |
03:37:14 | FromDiscord | <ElegantBeef> Dont know if you read my macro article, but it does show some of the capabillities |
03:37:32 | FromDiscord | <Yjuq> What is your macro article? |
03:37:47 | FromDiscord | <ElegantBeef> I linked it earlier but here again https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
03:38:12 | FromDiscord | <Yjuq> Ah yea, that one... I try to understand it? |
03:38:50 | FromDiscord | <Yjuq> that first example can be done with simple templates as well |
03:38:58 | FromDiscord | <ElegantBeef> Yea, but i was just showing macros |
03:39:12 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q20 |
03:40:07 | FromDiscord | <Yjuq> Why did you set the `value` as `untyped`? |
03:40:19 | FromDiscord | <ElegantBeef> Cause i dont care if it's semantically checked |
03:40:33 | FromDiscord | <ElegantBeef> Regardless it'll complain in the end |
03:41:09 | FromDiscord | <ElegantBeef> I only used typed values in macros when i need introspection since they allow you to look up values |
03:41:26 | FromDiscord | <ElegantBeef> For most cases just identifiers/literals is enough |
03:43:03 | FromDiscord | <Yjuq> And I thought I already understood the difference between `typed` and `untyped` - I'm lost again |
03:43:09 | FromDiscord | <Yjuq> x) |
03:44:02 | FromDiscord | <ElegantBeef> Typed values in macros allow you to get their instantiation and extract information |
03:44:54 | FromDiscord | <ElegantBeef> In that last example the `T` is a typed value which is why i can use `getImpl` and iterate over the reclist |
03:45:26 | FromDiscord | <ElegantBeef> `typed` means they're semantically checked and are symbols with origins, untyped means they're just valid nim code with 0 logic attached |
03:45:47 | FromDiscord | <ElegantBeef> So since it's a symbol you can actually look at things like it's fields and use that for whatever you wish |
03:46:34 | FromDiscord | <ElegantBeef> Here is another example of using a typed value `https://github.com/nim-lang/Nim/blob/devel/lib/std/setutils.nim#L39` |
03:46:39 | FromDiscord | <ElegantBeef> I'm dumb |
03:46:43 | FromDiscord | <ElegantBeef> (edit) "`https://github.com/nim-lang/Nim/blob/devel/lib/std/setutils.nim#L39`" => "https://github.com/nim-lang/Nim/blob/devel/lib/std/setutils.nim#L39" |
03:47:16 | FromDiscord | <ElegantBeef> because it's typed i'm capable of extracting all the enum values, if it wasnt typed i'd just get `ident "T"` |
03:47:26 | FromDiscord | <ElegantBeef> Also exelotl it's in devel now π |
03:49:10 | FromDiscord | <ElegantBeef> Hopefully that's helpful and not as redundant as sounds to me |
03:50:12 | FromDiscord | <Yjuq> I'm just completely lost in this topic. x) |
03:50:50 | FromDiscord | <ElegantBeef> Well ask questions and i'll attempt to provide a map |
03:51:25 | FromDiscord | <ElegantBeef> I came from C# so yea i understand being completely confused/scared of macros |
03:52:01 | FromDiscord | <Yjuq> Nah, the standard stuff is pretty straight forward. But manipulating the AST is what confuses me |
03:52:12 | FromDiscord | <Yjuq> I still didn't understand how things are structured there |
03:52:38 | FromDiscord | <ElegantBeef> Ah, play around with `macros.dumptree` and valid nim code |
03:52:55 | FromDiscord | <ElegantBeef> You'll get pretty familiar with it |
03:55:31 | FromDiscord | <Yjuq> https://discord.com/channels/371759389889003530/371759389889003532/812385368161910824β΅It's about this one here - He forget to put the into it. And as soon I do that the macro doesn't work. I try to fix it that's why i'm so engaged with macros atm x) |
03:56:01 | FromDiscord | <Yjuq> line 20: `func Example() {.mylib.}` should be `func Example() {.mylib.}` |
03:56:30 | FromDiscord | <ElegantBeef> line 15 should be `("prefix_" & toLowerAscii(procdef[0].baseName))` |
03:56:58 | FromDiscord | <Yjuq> Where does the [4] come from by the way? |
03:57:19 | FromDiscord | <ElegantBeef> when you use `name` it turns into `nnkPostfix(nnkIdent(name), nnkident()` |
03:57:24 | FromDiscord | <Yjuq> Is the index 4 all pragma definitions for func declarations? |
03:58:37 | FromDiscord | <ElegantBeef> Yes |
03:59:16 | FromDiscord | <ElegantBeef> Easy to see now https://media.discordapp.net/attachments/371759389889003532/812533802903142410/unknown.png |
04:01:35 | FromDiscord | <Yjuq> this stuff is black magic |
04:01:40 | FromDiscord | <Yjuq> x) |
04:02:09 | FromDiscord | <ElegantBeef> Well Nim's got parts of it to reduce that magic |
04:03:11 | FromDiscord | <ElegantBeef> `lispRepr`, `repr`, `dumpTree`, `treeRepr` and the like |
04:05:36 | * | vicfred quit (Quit: Leaving) |
04:06:17 | FromDiscord | <ElegantBeef> `dumpTree` and `treeRepr` imo are the most important, here is an example usage for your previous issue https://play.nim-lang.org/#ix=2Q26 |
04:06:35 | FromDiscord | <ElegantBeef> But i do kinda feel like i'm not helping any and just repeating myself π |
04:08:42 | FromDiscord | <Yjuq> I'm sorry - I'm kinda slow with learning ^.^ |
04:08:45 | * | asdflkj_1 quit (Ping timeout: 240 seconds) |
04:09:09 | FromDiscord | <Yjuq> I never mastered one programming language - I just jump between them for my needs |
04:09:33 | FromDiscord | <Yjuq> The only exception would be assembler i guess |
04:10:18 | * | vicfred joined #nim |
04:11:16 | FromDiscord | <ElegantBeef> The big take away is that the AST is static empty is just in place of "nil" |
04:11:55 | FromDiscord | <ElegantBeef> (edit) "static" => "static," |
04:12:50 | FromDiscord | <ElegantBeef> Like regardless of what you do a proper `proc`'s `[0]` will always be either `postfix` if it's exported or `ident` if it's not |
04:20:40 | * | wasted_youth2 quit (Quit: Leaving) |
04:23:49 | * | Jjp137 quit (Quit: Leaving) |
04:24:48 | FromDiscord | <Yjuq> can i give this pragma macro some parameter to make it more generic? |
04:24:59 | FromDiscord | <Yjuq> I tried to add a "prefix" parameter |
04:25:39 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q28 |
04:25:40 | FromDiscord | <Yjuq> something like this |
04:25:52 | FromDiscord | <Yjuq> ah wait |
04:27:11 | FromDiscord | <Yjuq> nvm i dont get it rofl |
04:27:18 | FromDiscord | <ElegantBeef> You're on the right path |
04:30:22 | FromDiscord | <ElegantBeef> the issue is that using the pragma method it does `myLib(funcDef): prefix` |
04:30:29 | FromDiscord | <ElegantBeef> Pragmas are evaluated as above |
04:30:59 | FromDiscord | <ElegantBeef> so if you do `func example{.myLib: a.}` prefix is `func example` and funcDef is `a` |
04:31:12 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Q2b |
04:31:27 | FromDiscord | <ElegantBeef> That was just a gotcha due to how pragmas are evaluated, you were right |
04:33:03 | FromDiscord | <Yjuq> Okey... I guess I only need a default value now if I don't add something in right? |
04:33:04 | FromDiscord | <Yjuq> sigh |
04:33:16 | FromDiscord | <Yjuq> or switch the parameter |
04:33:19 | FromDiscord | <Yjuq> this could work |
04:33:36 | FromDiscord | <ElegantBeef> Or make two macros that call an internal proc that returns a nim node |
04:34:51 | FromDiscord | <Yjuq> surprised pikachu face |
04:36:00 | FromDiscord | <Yjuq> I appreciate the help - that are some nice things you told me here. |
04:36:09 | FromDiscord | <ElegantBeef> Example of that two macro solution https://play.nim-lang.org/#ix=2Q2d |
04:36:39 | FromDiscord | <ElegantBeef> Dont know if there is a better way for default values for macros seems they require this type of logic, but i could be wrong |
04:37:38 | FromDiscord | <Yjuq> I would just check in the macro if one of them where nil and just swap the parameter x) |
04:37:44 | FromDiscord | <Yjuq> This was my first though |
04:37:49 | FromDiscord | <Yjuq> (edit) "though" => "thought" |
04:37:50 | * | spiderstew quit (Ping timeout: 264 seconds) |
04:37:51 | * | Jjp137 joined #nim |
04:38:06 | * | spiderstew joined #nim |
04:45:05 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q2f |
04:45:47 | FromDiscord | <Yjuq> (edit) "https://play.nim-lang.org/#ix=2Q2f" => "https://play.nim-lang.org/#ix=2Q2g" |
04:45:59 | FromDiscord | <Yjuq> (edit) "https://play.nim-lang.org/#ix=2Q2g" => "https://play.nim-lang.org/#ix=2Q2h" |
04:51:01 | FromDiscord | <Yjuq> Uh, can you have in a pragma more than one argument? Something like: `{.example: a, b}` ? | probably not right? since the comma is used to separate different pragmas. |
04:51:32 | FromDiscord | <ElegantBeef> I dont believe so, you could use a string and split it at a `comma` |
04:51:46 | FromDiscord | <ElegantBeef> Havent passed many arguements through pragma macros |
04:52:15 | FromDiscord | <Yjuq> Would be better I guess. If I like to generalize that more I need at least the header file as well |
04:52:18 | FromDiscord | <Yjuq> rofl |
05:35:42 | FromDiscord | <Seedofarson> Yo |
05:35:55 | FromDiscord | <Seedofarson> Iβm going to start learning more real nim tommorow |
05:36:06 | FromDiscord | <Seedofarson> I really like the langauge \:) |
05:47:30 | FromDiscord | <apollo> noice |
06:02:01 | * | a_chou joined #nim |
06:04:10 | * | a_chou quit (Client Quit) |
06:28:09 | * | narimiran joined #nim |
06:36:28 | * | muffindrake joined #nim |
06:40:31 | FromDiscord | <hamidb80> i'm stuckβ΅β΅whenever i enter `nimble test`, it forces `--noNimblePath` flag to nim compiler |
06:42:44 | FromDiscord | <hamidb80> i tried `nimble test --NimblePath:~/.nimble/` but it didn't word |
06:42:49 | FromDiscord | <hamidb80> (edit) "word" => "work" |
07:00:48 | * | vsantana quit (Ping timeout: 272 seconds) |
07:13:30 | FromDiscord | <ElegantBeef> Why do you need the nimble path in testing?@hamidb80 |
07:26:44 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Why do you need": i use a third-party package called `ws` (websocket) |
07:29:20 | FromDiscord | <hamidb80> the problem is that i use the package `ws` in my codeβ΅β΅if i want to test the nim file that imported `ws` module, nimble says `cannot open file: ws` |
07:29:31 | FromDiscord | <ElegantBeef> Yea i figured that |
07:32:21 | ForumUpdaterBot | New thread by Treeform: Check out my new lib Spacy: Spatial data structures for Nim., see https://forum.nim-lang.org/t/7536 |
07:32:31 | FromDiscord | <ElegantBeef> Did you add `ws` to your nimble required list? |
07:35:26 | FromDiscord | <treeform> In reply to @hamidb80 "i use a third-party": You need to add `ws` to your nimble require list, because during `nimble test` it ignores normal installed packages and only allows imports of packages on the require list (or their require lists). |
07:35:43 | FromDiscord | <ElegantBeef> It's completely sandboxed for good reason |
07:35:43 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q2K |
07:35:52 | FromDiscord | <treeform> ... and thank you for using `ws`! |
07:36:00 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Did you add `ws`": no it's global |
07:36:11 | FromDiscord | <ElegantBeef> Like we said it needs to be required by nimble |
07:36:17 | * | krux02 joined #nim |
07:37:12 | FromDiscord | <ElegantBeef> No problem yjuq, though weird to see `lib` and `Lib` not very conventional π |
07:37:41 | FromDiscord | <Yjuq> Well - The only difference is the invoked callback |
07:38:09 | FromDiscord | <Yjuq> could name it "LIB" instead but it doesn't make a difference at all |
07:38:20 | FromDiscord | <Yjuq> since you can still write "LIB" in the pragma definition |
07:38:34 | FromDiscord | <ElegantBeef> Well Nim is case insensitive after the first letter π |
07:38:40 | FromDiscord | <Yjuq> yes, exactly |
07:39:54 | FromDiscord | <ElegantBeef> Treeform has returned to the "package-y" naming scheme! π |
07:40:17 | FromDiscord | <treeform> just to make you happy |
07:40:35 | FromDiscord | <ElegantBeef> Aw i didnt know you cared |
07:42:07 | FromDiscord | <Yjuq> So, if I see this right nim doesn't have "real member methods" for object in context of OOP right? You can attach the OOP syntax `.doSomething()` to everything as long the first parameter matches the type? |
07:42:26 | FromDiscord | <ElegantBeef> We do have dynamic dispatch but yes "member methods" |
07:42:29 | FromDiscord | <ElegantBeef> (edit) "We do have dynamic dispatch but yes ... "member" added "no" |
07:42:56 | FromDiscord | <ElegantBeef> You can use a method the same way as a proc `a(b)` or `b.a` |
07:43:29 | FromDiscord | <Yjuq> It's kind of funny. This allows you to attack this stuff to literals. |
07:43:32 | FromDiscord | <ElegantBeef> `method` being the overrideable dynamically dispatched "proc" |
07:43:41 | FromDiscord | <treeform> even `a(b)` or `b.a` or even just `a b` |
07:44:02 | FromDiscord | <Yjuq> Is there a way to make namespaces? |
07:44:05 | FromDiscord | <treeform> I have yest to use a `method` I don't think OOP fits into nim. |
07:44:07 | FromDiscord | <ElegantBeef> It makes the language feel great to use, cause everything but `iterators` can be used in any method that makes it feel great |
07:44:25 | FromDiscord | <ElegantBeef> No we just use modules and selective exports |
07:44:48 | FromDiscord | <treeform> In reply to @Yjuq "Is there a way": yeah `namesspace.function(args)` but then you can't use the other forms. |
07:44:58 | FromDiscord | <ElegantBeef> Well that's qualified imports |
07:45:21 | FromDiscord | <treeform> I guess you are right, they feel like namespaces... |
07:45:52 | FromDiscord | <Yjuq> I guess you can kinda do this with a typedef that you just use as first parameter for every proc / func in your module? |
07:45:53 | FromDiscord | <Yjuq> rofl |
07:46:04 | FromDiscord | <Yjuq> would be strange |
07:46:14 | FromDiscord | <Solitude> In reply to @Yjuq "I guess you can": i've seen at least one person do that |
07:46:25 | FromDiscord | <ElegantBeef> you can use qualified imports `from strutils import nil` which enforces `strutils.procName` |
07:46:48 | FromDiscord | <ElegantBeef> But it breaks the ufcs, so it's garbage |
07:46:56 | FromDiscord | <ElegantBeef> Sorry, i mean mcs π |
07:47:32 | FromDiscord | <ElegantBeef> A lot of people coming from python use qualified imports, and it makes me sad |
07:48:24 | FromDiscord | <ElegantBeef> Such a fantastic feature of a language being throw aside cause of what they're used to |
07:48:37 | * | vicfred quit (Quit: Leaving) |
07:48:41 | FromDiscord | <treeform> yeah its kind justified in python because everything so dynamic... its easy to get one thing as the other thing and be confused. |
07:48:41 | FromDiscord | <Yjuq> In the end code must be readable |
07:49:52 | FromDiscord | <ElegantBeef> I dont see how c style function calling achieves readabillity, but to each their own |
07:50:39 | FromDiscord | <ElegantBeef> To go with my shitty example `3.14.floor.int.mod(2)` vs. `mod((int)floor(3.14), 2)` |
07:51:01 | FromDiscord | <Yjuq> i honestly prefer the second one more |
07:51:09 | FromDiscord | <ElegantBeef> I can barely read the second one |
07:51:19 | FromDiscord | <Yjuq> I'm just used to that |
07:51:23 | FromDiscord | <treeform> I prefer the 1st one |
07:51:36 | FromDiscord | <treeform> I was used to the second one, but after I got used to the first 1 i prefer it now. |
07:51:39 | FromDiscord | <ElegantBeef> It removes a ton of noise, which i just like |
07:51:46 | FromDiscord | <treeform> its linear |
07:52:23 | FromDiscord | <ElegantBeef> Not to say you can't abuse parts of the mcs and make it unreadable |
07:54:41 | FromDiscord | <Yjuq> Dunno - I think this is not really a practical example. But there are surely cases where I would prefer the first one |
07:54:52 | FromDiscord | <Yjuq> Maybe more a mix of both in the right situations |
07:55:32 | FromDiscord | <ElegantBeef> `isX` i think is a perfect example where `a.isNil` is just more linear and sensible to `isNil(a)` |
07:56:39 | FromDiscord | <ElegantBeef> Ooh also `contains` if a type has a `contains` proc you can do `a in b` instead of `b.contains(a)` |
07:57:04 | FromDiscord | <treeform> here is an example of from my code: `textureAtlas.image.width.GLsizei` vs what you would do in C? `(GLsizei)width(textureAtlas->image)` |
07:57:50 | FromDiscord | <ElegantBeef> no fair you have auto dereference π |
08:10:55 | FromDiscord | <Yjuq> sent a code paste, see https://paste.rs/IZu |
08:12:04 | FromDiscord | <ElegantBeef> There is a way to capture values passed into the compiler |
08:12:13 | FromDiscord | <ElegantBeef> I have to look for it, since i never remember how |
08:12:20 | FromDiscord | <Yjuq> I know about the compiler |
08:12:29 | FromDiscord | <Yjuq> but I kinda want just declare it in the source code |
08:12:37 | FromDiscord | <ElegantBeef> Then idk what you're talking about |
08:12:40 | FromDiscord | <Yjuq> It was `defined` by the way |
08:13:00 | FromDiscord | <Yjuq> file a contains the code above. I import this file into file b. |
08:13:19 | FromDiscord | <Yjuq> can i declare it in file b so that this doesn't trigger? |
08:13:23 | FromDiscord | <ElegantBeef> ok so then put the export marker on `path` and import it |
08:13:32 | FromDiscord | <ElegantBeef> Oh |
08:13:46 | FromDiscord | <ElegantBeef> Why couldnt you declare it in file b? |
08:14:00 | FromDiscord | <Yjuq> I want to declare it in file b |
08:14:04 | FromDiscord | <Yjuq> but it still triggers |
08:14:06 | FromDiscord | <Yjuq> xD |
08:14:38 | FromDiscord | <ElegantBeef> Did you export it in file b? |
08:14:54 | FromDiscord | <Yjuq> ... Uh |
08:15:10 | FromDiscord | <Yjuq> yes |
08:15:15 | FromDiscord | <Yjuq> but still doesnt work xD |
08:15:19 | FromDiscord | <Yjuq> okey, one moment |
08:16:05 | FromDiscord | <Yjuq> sent a code paste, see https://paste.rs/nHK |
08:16:08 | FromDiscord | <Yjuq> dunno |
08:16:12 | FromDiscord | <Yjuq> something like this |
08:16:14 | FromDiscord | <ElegantBeef> Possibly if not try `declaredInScope` |
08:16:52 | FromDiscord | <ElegantBeef> the example for `declared` shows it taking `strutils.toUpper` so it seems it's looking for module symbols |
08:17:12 | * | krux02 quit (Remote host closed the connection) |
08:18:18 | FromDiscord | <Yjuq> I could use include probably |
08:18:31 | FromDiscord | <Yjuq> but don't know if this is a good idea |
08:19:13 | FromDiscord | <ElegantBeef> also btw you said it was `defined` but that doesnt capture the value it just returns a bool, there is a way to get a value from the compilers cli from the `--define:thingy=100` |
08:20:39 | FromDiscord | <Yjuq> does this have something to do with what i'm asking? :o - I actually don't want to pass this on the compiler via cli |
08:21:05 | FromDiscord | <ElegantBeef> Well it was about what you said previously, and now i'm searching for it cause i cannot remember the name of it myself |
08:21:27 | FromDiscord | <ElegantBeef> So nope not one bit π |
08:22:51 | FromDiscord | <ElegantBeef> Ah i found it it's a pragma, there i can rest easy! https://docs.unity3d.com/Manual/CustomPackages.html |
08:22:58 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compileminustime-define-pragmas |
08:23:20 | FromDiscord | <ElegantBeef> Still unrelated but posting for my own sanity |
08:28:54 | FromDiscord | <Yjuq> fine... i do it over the cli <.< SIGH |
08:29:11 | FromDiscord | <ElegantBeef> I wasnt saying to do that |
08:29:42 | FromDiscord | <Yjuq> Yea, but I can't find a solution for such a trivial thing. I mean, you have this stuff all over c / c++ with the pre processor |
08:30:11 | FromDiscord | <Yjuq> okey, but you kinda use `include` there to be fair |
08:30:26 | FromDiscord | <ElegantBeef> Wait. you're importing a from b |
08:30:29 | FromDiscord | <Yjuq> (edit) "`include`" => "`#include`" |
08:30:38 | FromDiscord | <Yjuq> yes |
08:30:44 | FromDiscord | <Yjuq> i'm importing a from b |
08:31:03 | FromDiscord | <Yjuq> wait |
08:31:07 | * | haxscramper joined #nim |
08:31:09 | FromDiscord | <Yjuq> do i just need to switch both |
08:31:12 | FromDiscord | <Yjuq> wait |
08:31:20 | FromDiscord | <ElegantBeef> A should import b and it might work |
08:31:54 | FromDiscord | <ElegantBeef> Yea it does work |
08:32:20 | FromDiscord | <Yjuq> Nono,... it is required that b imports a |
08:32:45 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q2Z |
08:32:47 | FromDiscord | <Yjuq> I was thinking about switching it like this |
08:32:51 | FromDiscord | <Yjuq> but still no profit |
08:33:10 | FromDiscord | <ElegantBeef> You have to include a for that |
08:33:20 | FromDiscord | <Yjuq> yea, that's what i'm scared of |
08:33:48 | FromDiscord | <Yjuq> if you have 2 same procedure names you are screwed with include |
08:33:58 | FromDiscord | <Yjuq> in c / c++ you have namespaces |
08:34:02 | FromDiscord | <ElegantBeef> Only if all parameter names match |
08:34:35 | FromDiscord | <ElegantBeef> Though you can have recursive imports |
08:34:37 | FromDiscord | <ElegantBeef> and in this case it's fine |
08:34:55 | FromDiscord | <Yjuq> but i have x dependencies on a |
08:35:04 | FromDiscord | <Yjuq> and i can't list them all in a |
08:35:06 | FromDiscord | <Yjuq> x) |
08:35:37 | FromDiscord | <ElegantBeef> Depending on what you end up with this does work https://media.discordapp.net/attachments/371759389889003532/812603347873693736/unknown.png |
08:36:15 | FromDiscord | <Yjuq> Sure, but then everytime I use this module in a different project i need to change the import there |
08:36:28 | FromDiscord | <Yjuq> I was hoping I could just declare it outside of it |
08:37:40 | FromDiscord | <Yjuq> I could solve this with a runtime check but why do i should put unnecessary overhead in the release binary? |
08:37:53 | * | FromDiscord quit (Remote host closed the connection) |
08:38:07 | * | FromDiscord joined #nim |
08:40:48 | FromDiscord | <ElegantBeef> You could abuse `macrocache` here adding a path to a cache variable, which then you fetch in the sub module |
08:41:21 | FromDiscord | <ElegantBeef> so in your main module it'd be something like `setPath("./lib/mylib")` |
08:41:45 | FromDiscord | <ElegantBeef> I guess it'd be "something" in this case |
08:43:26 | FromDiscord | <ElegantBeef> Though i think i misunderstand how that works |
08:43:33 | FromDiscord | <ElegantBeef> I probably should just shutup again |
08:44:20 | FromDiscord | <Yjuq> Sorry, I'm a hypocrite if it's about how I structure my projects :D |
08:45:03 | FromDiscord | <Yjuq> I have very specific needs and no programming language could actually deliver what I wanted from it. But nim is pretty close to it so far I see |
08:59:23 | * | synthmeat quit (Quit: WeeChat 3.0.1) |
09:00:35 | * | synthmeat joined #nim |
09:00:44 | * | synthmeat quit (Client Quit) |
09:01:34 | * | synthmeat joined #nim |
09:07:36 | * | kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in) |
09:07:56 | * | kitech1 joined #nim |
09:16:31 | ForumUpdaterBot | New thread by Hugogranstrom: Any way to avoid nested case statements for proc taking two variant objects?, see https://forum.nim-lang.org/t/7537 |
10:06:42 | * | Vladar joined #nim |
10:18:26 | * | jjido joined #nim |
10:22:27 | * | natrys joined #nim |
10:38:57 | * | teasea quit (Quit: teasea) |
10:39:24 | * | teasea joined #nim |
11:04:42 | * | NimBot joined #nim |
11:12:35 | * | wasted_youth2 joined #nim |
11:30:49 | FromDiscord | <whisperdev> What is the best way for long running tasks to run them in parallel? Communication between threads is not required just orchestration (pause,cancel,re-start). |
11:42:34 | * | idf left #nim ("ERC (IRC client for Emacs 27.1)") |
11:53:29 | FromDiscord | <Rika> do they need to be in parallel |
11:54:47 | FromDiscord | <Rika> anyway theres threadpool and (3rd party) weave i guess, if mratsim were here he'd be able to explain better |
12:08:15 | FromDiscord | <mratsim> long running services should run on createThread |
12:09:47 | FromDiscord | <mratsim> a threadpool or Weave makes sense for small tasks that are fired and then finished. |
12:10:08 | FromDiscord | <mratsim> in that case the overhead of thread creatin is high |
12:10:34 | FromDiscord | <mratsim> but if you want say a logging service that is up throughout the lifetime of your application, create a dedicated thread for it |
12:11:13 | * | Vladar quit (Quit: Leaving) |
12:15:08 | FromDiscord | <KnorrFG> I have a nim program that works just fine on linux, but on windows the following line does not return: ` let file = "antenna.jpg".open()` it does not crash, it does not throw an exception, it simply does not return. Does anyone have an Idea what could cause this? |
12:15:44 | FromDiscord | <mratsim> It took some vacation maybe |
12:16:22 | FromDiscord | <mratsim> is your file already opened somewhere? Because Windows require to lock files for access. |
12:16:57 | FromDiscord | <KnorrFG> not as far as im aware, but ill quickly reboot to rule out the possibility |
12:20:12 | FromDiscord | <KnorrFG> nope, that was not the reason |
12:26:13 | FromDiscord | <Rika> I feel like something went wrong with your C compiler to cause this |
12:26:17 | FromDiscord | <Rika> But thatβs just a hunch |
12:31:06 | FromDiscord | <KnorrFG> any idea how i could investigate this? |
12:33:19 | FromDiscord | <Rika> I would say GDB but I hear itβs a pain to set up for Nim |
12:35:28 | FromDiscord | <KnorrFG> hmm. i have msvc installed on windows, ill try with mingw |
12:35:49 | FromDiscord | <Rika> Report back if it was the issue |
12:51:25 | FromDiscord | <KnorrFG> i installed mingw added the bin folder to my path and compiled my program with `nimble build --cc:gcc` |
12:51:58 | FromDiscord | <KnorrFG> which now results in a compilation failure because of mutliple `NIM_STATIC_ASSERT`s |
12:52:40 | FromDiscord | <KnorrFG> Do I have to do anything else to change the compiler? Do you want me to post the error output? |
12:53:11 | ForumUpdaterBot | New thread by Kcvinu: Question about using "include", see https://forum.nim-lang.org/t/7538 |
12:55:58 | FromDiscord | <konsumlamm> ok, why on earth does `math.gamma` always return 0.0 in the vm? |
12:58:44 | FromDiscord | <flywind> It is not implemented for VM I think |
12:59:06 | * | FromDiscord quit (Remote host closed the connection) |
12:59:22 | * | FromDiscord joined #nim |
13:00:37 | FromDiscord | <konsumlamm> shouldn't it be an error then? |
13:01:01 | FromDiscord | <mratsim> In reply to @Rika "I would say GDB": gdb just needs --debugger:native |
13:02:03 | FromDiscord | <flywind> yeah, may de due to the hack of vmops, easy to fix them. |
13:02:20 | FromDiscord | <konsumlamm> i'll open an issue |
13:03:32 | FromDiscord | <mratsim> you're the first user of the Gamma function I met :p |
13:05:10 | FromDiscord | <konsumlamm> i actually just went over the math tests again and tested if gamma works at compile time |
13:05:39 | FromDiscord | <konsumlamm> for erf and erfc it just complains that it can't importc at compile time |
13:05:39 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/blob/a1a18cfe66c94a634525f28775f170ad01c84344/lib/pure/math.nim#L36 |
13:05:47 | FromDiscord | <flywind> why using echo? |
13:06:20 | FromDiscord | <konsumlamm> because i didn't think adding an assert makes much sense there |
13:12:32 | FromDiscord | <konsumlamm> does something classify as a regression if it didn't compile in previous version and compiles now, but is buggy? |
13:23:55 | FromDiscord | <konsumlamm> https://github.com/nim-lang/Nim/issues/17118 |
13:27:22 | FromDiscord | <Solitude> how does it even compile for you, errors for me on pretty recent devel. |
13:28:01 | FromDiscord | <konsumlamm> Β―\_(γ)_/Β― |
13:30:16 | FromDiscord | <Solitude> errors with fresh devel, you sure its not something in your global config? |
13:30:32 | FromDiscord | <konsumlamm> hmm, errors with latest devel for me too |
13:30:44 | FromDiscord | <konsumlamm> so it must have been fixed in the last 24 hours or so? |
13:30:54 | FromDiscord | <konsumlamm> cuz the devel i used was fromy esterday |
13:30:54 | FromDiscord | <flywind> it doesn't error for me with devel on windows |
13:31:01 | FromDiscord | <konsumlamm> (edit) "fromy esterday" => "from yesterday" |
13:31:09 | FromDiscord | <flywind> Compiled at 2021-02-16 |
13:31:17 | FromDiscord | <konsumlamm> wait, i'm running the wrong program |
13:31:31 | FromDiscord | <Solitude> In reply to @flywind "it doesn't error for": what does it do? |
13:31:44 | FromDiscord | <konsumlamm> compiles and returns what i described in the issue with latest devel for me |
13:31:54 | FromDiscord | <IndianGoldSmith> Hi all, what's the correct syntax for "=destroy" ? |
13:31:55 | FromDiscord | <flywind> sent a code paste, see https://play.nim-lang.org/#ix=2Q4g |
13:32:06 | FromDiscord | <flywind> prints 0 with 2021-02-16 devel on windows |
13:32:24 | FromDiscord | <IndianGoldSmith> proc `=destroy`[Person]( p : var Person) is not working |
13:32:46 | FromDiscord | <Solitude> remove [Person] |
13:32:51 | FromDiscord | <konsumlamm> `[Person]` makes Person a generic parameter |
13:32:56 | FromDiscord | <IndianGoldSmith> Okay |
13:33:28 | FromDiscord | <IndianGoldSmith> Error - signature for '=destroy' must be proc[T: object](x: var T) |
13:34:12 | FromDiscord | <Solitude> is Person an object or ref object? |
13:34:17 | FromDiscord | <IndianGoldSmith> ref |
13:34:29 | FromDiscord | <Solitude> destructors take non ref objects |
13:34:31 | FromDiscord | <Solitude> as you can see |
13:34:38 | FromDiscord | <IndianGoldSmith> Oh i see. |
13:34:49 | FromDiscord | <IndianGoldSmith> Then how do we destroy ref objects |
13:34:54 | FromDiscord | <Solitude> make PersonObj for destructor and Person = ref Person |
13:34:58 | FromDiscord | <Solitude> (edit) "Person" => "PersonObj" |
13:35:18 | FromDiscord | <IndianGoldSmith> Sorry, i don't get you |
13:36:07 | FromDiscord | <konsumlamm> sent a code paste, see https://paste.rs/cgv |
13:36:08 | FromDiscord | <IndianGoldSmith> @konsumlamm Thanks. ow got it |
13:36:13 | FromDiscord | <konsumlamm> and then define the destructor for `PersonObj` |
13:36:46 | FromDiscord | <IndianGoldSmith> @konsumlamm Okay. Let me check |
13:36:47 | FromDiscord | <Solitude> or you could do whacky things like typeof Person()[] |
13:37:05 | FromDiscord | <IndianGoldSmith> @Solitude Oh ! |
13:47:09 | FromDiscord | <IndianGoldSmith> @konsumlamm How do i explicitly call the destructor ? |
13:48:59 | FromDiscord | <konsumlamm> \`=destroy\`(test) |
13:49:07 | FromDiscord | <konsumlamm> but why would you want that? |
13:50:18 | FromDiscord | <IndianGoldSmith> I am subclassing some windows controls like buttons and labels. So when the user closes a window, i need to destroy my button class and remove subclass hook. |
13:50:56 | FromDiscord | <IndianGoldSmith> After all, i need complete control over my classes |
13:53:45 | FromDiscord | <IndianGoldSmith> typeβ΅ Person = ref PersonObjβ΅ PersonObj = object |
13:54:11 | FromDiscord | <IndianGoldSmith> (edit) "typeβ΅ Person = ref PersonObjβ΅ PersonObj = object ... " added "β΅In this example, destructor only works for non-ref objects." |
13:56:16 | FromDiscord | <hamidb80> seems like karax has problems with windows... https://media.discordapp.net/attachments/371759389889003532/812684046509277224/unknown.png |
13:59:09 | FromDiscord | <dom96> that looks like a Nim problem |
13:59:28 | * | jjido quit (Quit: Connection closed for inactivity) |
14:00:42 | FromDiscord | <hamidb80> In reply to @dom96 "that looks like a": should i open an issue? |
14:01:22 | FromDiscord | <hamidb80> it tries to build `karax` but it cant https://media.discordapp.net/attachments/371759389889003532/812685327315632158/unknown.png |
14:03:50 | FromDiscord | <KnorrFG> In reply to @Rika "Report back if it": after installing the latest nim for windows, and letting it install the mingw it wants via the finish.exe I can compile again, but the problem that open() does not return persists |
14:19:11 | FromDiscord | <Rika> Whereβs the document listing compatible modules for JS again? |
14:23:25 | FromDiscord | <flywind> nowhere, or you can see tests |
14:23:42 | FromDiscord | <flywind> maybe see wiki |
14:24:21 | FromDiscord | <Rika> I distinctly remember a non comprehensive list |
14:24:33 | FromDiscord | <flywind> I recorded some modules which support JS backend before(but not complete) |
14:24:34 | FromDiscord | <flywind> https://github.com/xflywind/Nim/issues/1 |
14:24:55 | FromDiscord | <Rika> Unicode doesnβt support JS right now? |
14:24:56 | FromDiscord | <flywind> > see tests/js/tstdlib_imports.nim which is the module that should be kept up to date to at least list the things that can be imported (a weaker but useful notion) |
14:25:10 | FromDiscord | <hamidb80> In reply to @flywind "https://github.com/xflywind/Nim/issues/1": what about `diff` module? |
14:25:46 | * | muffindrake quit (Quit: muffindrake) |
14:26:46 | FromDiscord | <Rika> Oh wow TIL reserved mem |
14:26:50 | FromDiscord | <flywind> see https://github.com/nim-lang/Nim/wiki/Standard-library-and-the-JavaScript-backend |
14:27:13 | FromDiscord | <Rika> Thatβs the list I remember |
14:27:14 | FromDiscord | <Rika> Thanks |
14:27:24 | * | kitech1 quit (Quit: ZNC 1.7.5 - https://znc.in) |
14:27:41 | * | kitech1 joined #nim |
14:28:23 | FromDiscord | <flywind> np |
14:31:20 | ForumUpdaterBot | New thread by KnorrFG: Open() does not return, see https://forum.nim-lang.org/t/7539 |
14:34:08 | FromDiscord | <flywind> @konsumlamm I find the reason, `func gamma(x: float64): float64 {.importc: "tgamma", header: "<math.h>".} =` |
14:34:43 | FromDiscord | <konsumlamm> ye, i saw your comment |
14:35:34 | FromDiscord | <konsumlamm> seems to be a bug in `importc` handling for VM |
14:35:38 | FromDiscord | <flywind> introduced by this PR https://github.com/nim-lang/Nim/commit/afa87f223cdb9fd10e8b6f70aad51c44da7303a7 |
14:35:45 | FromDiscord | <brainproxy> anyone had problems in GitHub Actions where a Nim program with threads:on will hang on linux/mac? |
14:35:47 | FromDiscord | <konsumlamm> i know, i made that PR |
14:36:10 | FromDiscord | <konsumlamm> though that's not the expected behaviour, is it? |
14:36:43 | FromDiscord | <konsumlamm> In reply to @brainproxy "anyone had problems in": does your program run normally on linux/mac? |
14:37:25 | FromDiscord | <flywind> Yeah, the proper fix is to register vmops. |
14:37:27 | * | Vladar joined #nim |
14:37:53 | FromDiscord | <brainproxy> In reply to @konsumlamm "does your program run": yes, though can hit some problems with ulimit because some file descriptors aren't getting cleaned up (I think it's the fault of some code I borrowed); however, when that happens there is an exception `Too many open files` and I don't see that in GitHub Actions logs |
14:40:37 | FromDiscord | <brainproxy> it's possible, though, that I'm swallowing an exception somewhere in such a way that the program can't make further progress and I've not hit that scenario locally, but in GHA it manifests more readily because the program is running more slowly in resource constrained environment. |
14:54:17 | * | vicfred joined #nim |
15:05:38 | * | tane joined #nim |
15:12:43 | FromDiscord | <Rika> zevv: do you know if npeg is JS compatible? wanted to ask before i commit a few hours of my time making a parser... |
15:58:14 | * | D_ quit (Ping timeout: 264 seconds) |
15:58:45 | * | a_chou joined #nim |
16:18:02 | * | theelous3 joined #nim |
16:36:33 | * | vegai1 joined #nim |
17:02:57 | FromDiscord | <queersorceress> is the `nimssl` package supposed to be a complete interface for openssl? i see lots of C headers but not the nim interfaces for them. |
17:12:34 | FromDiscord | <mratsim> Those are autogenerated on Install, there is a doc generated as well but I've complained to @shashlick many times that not seeing the Nim APi in the repo is misleading. |
17:13:21 | FromDiscord | <mratsim> basically everything exported by OpenSSL is available |
17:14:06 | FromDiscord | <mratsim> @queersorceress ^ |
17:14:59 | FromDiscord | <queersorceress> then how do i access the x509 apis? |
17:16:53 | FromDiscord | <mratsim> basically you find the name of the proc in OpenSSL and you get the same name in Nim: https://www.openssl.org/docs/man1.0.2/man3/d2i_X509.html |
17:17:33 | FromDiscord | <queersorceress> right, but what is the import? is it just `import nimssl/crypt`? |
17:17:38 | FromDiscord | <queersorceress> (edit) "nimssl/crypt`?" => "nimssl/crypto`?" |
17:18:00 | FromDiscord | <Rika> is it not the same file nimssl? |
17:19:03 | FromDiscord | <queersorceress> that's what i don't get, there are basically no nim files in nimssl package, how does that work |
17:19:04 | FromDiscord | <mratsim> I think it's nimssl/ssl |
17:19:15 | FromDiscord | <mratsim> They are generated on install. |
17:19:40 | FromDiscord | <mratsim> on install, nimssl downloads OpenSSL, scans the header and generates the .nim files. |
17:19:53 | FromDiscord | <mratsim> so you will see them on your local install but not on GIthub |
17:22:18 | FromDiscord | <queersorceress> sent a code paste, see https://play.nim-lang.org/#ix=2Q6a |
17:24:33 | FromDiscord | <mratsim> https://github.com/genotrance/nimssl/blob/master/nimssl/ssl.nim#L60-L73 |
17:26:04 | FromDiscord | <queersorceress> and it isn't part of my install of the package locally |
17:26:59 | FromDiscord | <queersorceress> and building from latest isn't working |
17:30:34 | * | a_chou quit (Remote host closed the connection) |
17:32:50 | * | Tanger quit (Remote host closed the connection) |
17:34:21 | FromDiscord | <mratsim> mmmh, better ping @genotrance / @shashlick if he is available |
17:35:52 | FromDiscord | <queersorceress> reinstalling from head doesn't work either, i'm running into an error on trying to build nimterop because of building treesitter. |
17:40:44 | * | al1ranger joined #nim |
17:49:30 | FromDiscord | <hamidb80> Who are the core members of nim foundation? |
17:54:32 | FromDiscord | <konsumlamm> there is a nim foundation? |
17:57:00 | FromDiscord | <hamidb80> In reply to @konsumlamm "there is a nim": No, nim programming language, my bad |
17:57:43 | FromDiscord | <konsumlamm> https://github.com/orgs/nim-lang/people |
17:57:46 | FromDiscord | <konsumlamm> these i guess? |
17:58:07 | FromDiscord | <hamidb80> In reply to @konsumlamm "these i guess?": Yes. Tnx |
18:04:04 | FromDiscord | <queersorceress> hmmm, okay well i was able to work out how to properly do this using the gnutls library instead of the openssl wrappers. |
18:05:10 | FromDiscord | <mratsim> ugh, hopefully your app isn't security sensitive because I would flee anything GNU for crypto |
18:05:21 | * | Jesin quit (Quit: Leaving) |
18:05:53 | FromDiscord | <queersorceress> no, the purpose for this is just parsing a certificate file and extracting information about the expiry time. |
18:06:24 | FromDiscord | <mratsim> sounds good then |
18:06:25 | FromDiscord | <queersorceress> then it creates an ics file i can put into my calendar so i know when to update my ssl certs for my website |
18:06:51 | leorize[m] | isn't it better to perform automatic updates nowadays? |
18:07:12 | * | Jesin joined #nim |
18:07:31 | * | Jesin quit (Remote host closed the connection) |
18:08:13 | FromDiscord | <queersorceress> oh, for sure, but it's just for my own use. there is obviously a cron job setup to do that for me, but this is to keep it on my radar. |
18:08:39 | * | Jesin joined #nim |
18:16:07 | * | smlckz[m] joined #nim |
18:29:31 | * | teasea quit (Quit: teasea) |
18:31:34 | * | teasea joined #nim |
18:35:33 | * | al1ranger quit (Quit: Leaving) |
18:38:25 | * | Jesin quit (Quit: Leaving) |
18:38:47 | Prestige | Is the only way to create a thread for a proc with multiple params, to pack the params in a tuple? |
18:39:02 | liblq-dev | yes |
18:39:10 | Prestige | okay, ty |
18:39:45 | liblq-dev | tbh it kinda sucks that nim doesn't have proc parameter unpacking like rust does. gives some nice ergonomics |
18:40:14 | Prestige | Yeah, would be cool to see that added |
18:40:17 | * | Jesin joined #nim |
18:43:03 | FromDiscord | <Rika> proc parameter unpacking is? |
18:43:46 | liblq-dev | `proc ((a, b): (int, int))` |
18:46:24 | FromDiscord | <hamidb80> sent a long message, see http://ix.io/2Q6M |
18:47:55 | FromDiscord | <hamidb80> files/folders: examples package.nimble readme.md src tests |
18:48:19 | FromDiscord | <hamidb80> (edit) "examples" => "`examples/`" | "package.nimble" => "`package.nimble`" | "readme.md" => "`readme.md` `src/`" | "src tests" => "`tests/`" |
18:48:56 | FromDiscord | <hamidb80> is there any flag to specify local nimble config file path? |
18:51:03 | FromDiscord | <queersorceress> you mean a config file for use when building the package? |
18:51:59 | FromDiscord | <hamidb80> In reply to @queersorceress "you mean a config": yes |
18:53:04 | FromDiscord | <hamidb80> i wish there was a article about getting start with nimble |
18:53:09 | FromDiscord | <hamidb80> (edit) "a" => "an" |
18:53:29 | FromDiscord | <queersorceress> placing a `nim.cfg` file in your `srcDir` will apply to all binaries built, if you have multiple binaries then you should make `x.cfg` files where `x` is the name of the nim file that the binary is built from. so if you have a binary built from `foo.nim` and `baz.nim` then you can make `foo.nim.cfg` and `baz.nim.cfg` and those would only apply to building that particular binary target. |
18:54:16 | FromDiscord | <queersorceress> and that can be either `.nim.cfg` or `.nims` depending on the style of config file you want to use. |
18:54:57 | FromDiscord | <queersorceress> i believe this is covered in the nimble readme, if not then a PR should be made to include this information, because you are correct it is important. |
18:55:16 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q6N |
18:56:06 | FromDiscord | <Yjuq> (edit) "https://play.nim-lang.org/#ix=2Q6N" => "https://play.nim-lang.org/#ix=2Q6O" |
18:56:35 | FromDiscord | <queersorceress> that seems counter to what the code is supposed to do. |
18:56:51 | FromDiscord | <queersorceress> unless you are trying to emulate a pre-processor. |
18:57:27 | FromDiscord | <Yjuq> In reply to @queersorceress "unless you are trying": yea... kind of - you can do that in c++ / c with `#define` |
18:58:15 | FromDiscord | <queersorceress> or, you want to be using the `include` keyword instead of the `import` keyword. |
18:59:04 | FromDiscord | <Yjuq> I was thinking about include but this could get some issues if I have 2 procs in different files with the same name for example. In C / C++ you have namespaces for that |
18:59:15 | FromDiscord | <Yjuq> But nim seems to lack this kind of construct |
18:59:32 | FromDiscord | <queersorceress> @Yjuq you do understand the difference between a C preprocessor and regular nim code, right? i can understand wanting the ability to access preprocessors as a language feature but you do realize that you shouldn't expect them to behave even remotely the same in this case. |
19:00:14 | FromDiscord | <Yjuq> I understand the difference - I'm just looking for a solution |
19:00:30 | FromDiscord | <Yjuq> One would be using CLI Parameter to declare the path |
19:00:38 | FromDiscord | <Yjuq> But I try to avoid it |
19:00:45 | FromDiscord | <Yjuq> If I can't find something else |
19:00:55 | FromDiscord | <Yjuq> The other one would be a runtime check |
19:01:21 | FromDiscord | <queersorceress> so meta-programming is done in C using the preprocessor, in nim it is done using templates and macros. |
19:04:45 | FromDiscord | <queersorceress> writing code like the example you gave could be classified as unsafe, as it leaves the definition of variables left up to run-time checks vs compile-time checks. this is a language feature, as it prevents you doing things that would cause undefined behavior. |
19:06:04 | FromDiscord | <Yjuq> i really don't care if it's unsafe x) - like i said: I'm looking for a solution |
19:08:41 | FromDiscord | <queersorceress> to my knowledge you are asking the language to do something it was designed not to do so idk what to say. i'm sure one of the primary devs or compiler contributers could answer you in more detail or possibly give you a native work-around, but you can always fall back into C and do interop between the two to support what you are attempting to do. |
19:09:53 | FromDiscord | <Yjuq> does the c pre processor run over the code? Otherwise I don't see a way to do this at compile time even in c |
19:10:13 | FromDiscord | <queersorceress> i mean, many of us use nim specifically because it doesn't allow these sorts of things. |
19:13:16 | FromDiscord | <queersorceress> if it is just if something is a compile-time defined symbol, then there is `defined` in the system module. |
19:13:47 | FromDiscord | <Yjuq> I know about defined. But in this case I need to pass the paths over in the cli |
19:14:20 | FromDiscord | <Yjuq> I already have a solution for that with the CLI but I was wondering if it can be done otherwise |
19:15:36 | FromDiscord | <queersorceress> you cannot compile a check of an undefined symbol, because there would be no way for it to resolve and perform the check |
19:15:51 | FromDiscord | <queersorceress> it's logically invalid |
19:17:59 | FromDiscord | <queersorceress> it has to be defined somewhere, even if that definition exists to say "this gets defined by a compiler flag at compile-time" |
19:18:29 | FromDiscord | <XeroOl> super quick question is there a way to `echo` without a newline |
19:18:39 | FromDiscord | <ElegantBeef> `stdout.write` |
19:18:45 | FromDiscord | <XeroOl> awesome! thank you |
19:19:58 | FromDiscord | <queersorceress> the only reason that this works in C with the pre-processor is because it gets processed and evaluated/expanded prior to it being compiled |
19:21:42 | FromDiscord | <queersorceress> so the `path` would be converted into a value, not a symbol that is defined in the code. since it isn't a symbol then the compiler won't complain since it doesn't have to look-up the value |
19:23:19 | FromDiscord | <queersorceress> sent a code paste, see https://play.nim-lang.org/#ix=2Q73 |
19:23:55 | FromDiscord | <ElegantBeef> Yea that or recursive imports is what i already suggested |
19:24:26 | FromDiscord | <Yjuq> In reply to @Yjuq "I already have a": ^ |
19:26:46 | FromDiscord | <queersorceress> i get that, i was trying to explain why it isn't possible, and why it should be clear why it isn't possible based on how the language works. |
19:29:32 | FromDiscord | <Yjuq> In reply to @queersorceress "i get that, i": You could have shortcut that with the statement: It's not possible x) | I'm practical - I already understood that this normally doesn't work. I thought maybe this could be done with some kind of macro magic or something I was missing in the doc. |
19:30:01 | ForumUpdaterBot | New thread by Cdunn2001: Nim in Meson?, see https://forum.nim-lang.org/t/7540 |
19:31:36 | FromDiscord | <queersorceress> i mean, since macros allow for rewriting the AST completely, it might be possible to make custom macros to handle that sort of situation so that it can compile, but it would be pretty silly imo. |
19:32:12 | FromDiscord | <Yjuq> In reply to @Yjuq "I understand the difference": ^ |
19:33:12 | FromDiscord | <Yjuq> It really doesn't matter how silly this might look for you :o - If you know of a way I would appreciate that. Otherwise I keep looking for it |
19:34:27 | FromDiscord | <Yjuq> In reply to @Yjuq "Sorry, I'm a hypocrite": ^ |
19:34:49 | FromDiscord | <queersorceress> i'm no expert on nim macros, it may be possible but the purpose in doing so would run counter to the way the language is design, which seems like a wasteful endeavor, not an opinionated one; is what i mean. |
19:35:05 | FromDiscord | <queersorceress> (edit) "design," => "designed," |
19:37:25 | FromDiscord | <queersorceress> i've known a number of people that have been dead set on using languages in ways that were never meant to be built purely because they wanted to, and there is nothing wrong with that but for the purposes of learning to use the language, if you don't ever recognize the distinction between "can" and "should" then it's going to be very hard to properly learn anything. |
19:38:47 | * | xrinzler quit (Quit: WeeChat 3.0) |
19:39:59 | FromDiscord | <Yjuq> Yes, it's true that I'm learning the language at the moment. I mean, hopping from one to another isn't that hard. As soon it hits the API / language specific features this requires a learning curve. But learning just the plain syntax is a matter of a couple of days. |
19:40:20 | saem | :wave |
19:40:26 | saem | boo, failed at emoji |
19:40:31 | saem | morning |
19:40:38 | FromDiscord | <Yjuq> macros for example is a completly new topic for me. Nim is pretty unique with these since it can modify the AST |
19:41:03 | FromDiscord | <queersorceress> indeed, they are quite unique |
19:41:05 | Prestige | what's up today saem |
19:41:11 | FromDiscord | <hamidb80> In reply to @Prestige "Yeah, would be cool": hey Perstige, did you find answer of your last night question? |
19:41:18 | saem | gonna get mad about a bug and see if I can fix it. |
19:41:36 | Prestige | Yeah, mratsim was able to help. I didn't know channels were a thing for threads |
19:41:37 | saem | also made about full disk encryption. |
19:41:52 | Prestige | speaking of, there should probably be a mention of channels on the threads docs |
19:42:17 | Prestige | saem: for nimlsp stuff still? |
19:42:37 | saem | Prestige: nah, that was a long time ago I was playing with nimlsp |
19:42:49 | FromDiscord | <Yjuq> But I also try to evaluate if nim can fit into the kind of projects. In the worst case I fall back to assembler, but I have hope that nim can actually replace it. It's seems very promising. And I want to stay away from C / C++ ^^ |
19:42:50 | saem | I'm all sem all the time nowadays |
19:43:10 | FromDiscord | <Yjuq> I mean, C is ok. It's not like I didn't do anything in it so far, but C++ no thanks |
19:43:48 | FromDiscord | <Yjuq> (edit) "projects." => "projects i'm doing." |
19:43:56 | Prestige | Hoping I can finish up this ipc feature today, seems I have a clear path forward. Going to be neat to play with |
19:44:51 | saem | \o/ |
19:45:00 | FromDiscord | <hamidb80> what should i do instead of creating global vars to make my code `GC-SAFE`? |
19:46:13 | FromDiscord | <hamidb80> should i follow certain pattern in my codes? |
19:46:52 | Prestige | in terms of using threads? |
19:47:05 | FromDiscord | <hamidb80> In reply to @Prestige "in terms of using": async, threads ,.. |
19:48:01 | Prestige | I'm just starting to play with threads for the first time myself, not sure. Just been trying to separate concerns and using channels to send basic data between threads |
19:48:09 | Prestige | Not sure if that's the best answer |
19:48:30 | FromDiscord | <ElegantBeef> Using arc/orc you can tend to just use `{.cast(gcSafe).}:` afaik |
19:49:11 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/7475 |
19:49:37 | FromDiscord | <queersorceress> speaking of, i'm using some of the docutils code and running into problems with gc-safety with some of the methods. i know i can do a cast and capturing block but is there a more correct way to handle this? |
19:54:52 | FromDiscord | <Yjuq> is there a command to stop the compiling process? |
19:55:07 | FromDiscord | <Yjuq> or procedure or whatever |
19:56:14 | FromDiscord | <queersorceress> what, you mean like abort mid-compile? |
19:56:20 | FromDiscord | <Rika> ctrl+c? |
19:56:44 | FromDiscord | <Rika> or do you mean within the code |
19:57:08 | FromDiscord | <Rika> within the code just make an error `{.error: "msg".}` |
19:57:35 | FromDiscord | <Yjuq> In the code, was looking for something like exit |
19:57:41 | FromDiscord | <Yjuq> but it's called quit in nim |
19:57:50 | FromDiscord | <Yjuq> so, kind of found it already |
19:57:51 | FromDiscord | <Yjuq> x) |
19:58:21 | FromDiscord | <Rika> quit does not stop compile |
19:58:28 | FromDiscord | <Rika> it stops runtime |
19:58:46 | FromDiscord | <queersorceress> it would be what rika said, you would have to use something like the `defined` to conditionally evaluate and present an error to the compiler |
19:59:10 | FromDiscord | <Rika> you dont need to attach the pragma i just sent to anything |
19:59:15 | FromDiscord | <Rika> it can stand alone i believe |
19:59:26 | FromDiscord | <Yjuq> This works for me |
19:59:28 | FromDiscord | <Yjuq> sent a code paste, see https://play.nim-lang.org/#ix=2Q7b |
19:59:58 | FromDiscord | <queersorceress> it would but i'm not sure that is actually what you intend here |
20:00:19 | FromDiscord | <Rika> it works i guess |
20:00:29 | FromDiscord | <Rika> eh |
20:00:42 | FromDiscord | <queersorceress> yeah, that's basically what i just said to myself π |
20:00:54 | FromDiscord | <Yjuq> Dunno, what would be better? |
20:01:16 | FromDiscord | <queersorceress> it shouldn't be in a `static` block tbh |
20:01:21 | FromDiscord | <Rika> `when not defined(path): {.error: "path not defined".}` |
20:01:27 | FromDiscord | <queersorceress> ^ yeah, that |
20:01:41 | FromDiscord | <Yjuq> But, isn't that at runtime then? |
20:01:52 | FromDiscord | <Rika> no |
20:02:00 | FromDiscord | <Rika> whens and pragmas are not runtime |
20:02:07 | FromDiscord | <queersorceress> no, if you read the `defined` docs, it gets done at compile time |
20:02:08 | FromDiscord | <enthus1ast> is there a "c like flag" module in the standardlib? |
20:02:15 | FromDiscord | <Rika> a what? |
20:02:43 | FromDiscord | <enthus1ast> where you "or" the different values |
20:03:00 | FromDiscord | <Yjuq> I get a bunch of warnings |
20:03:04 | FromDiscord | <enthus1ast> flagA | flagB |
20:03:04 | FromDiscord | <Yjuq> x) |
20:03:10 | FromDiscord | <queersorceress> oh, bitwise |
20:03:14 | FromDiscord | <enthus1ast> yeah |
20:03:29 | FromDiscord | <queersorceress> bitops |
20:03:38 | FromDiscord | <ElegantBeef> `flaga or flagb` is in the language without anything |
20:03:44 | FromDiscord | <ElegantBeef> But the nim way is to use bitsets |
20:04:04 | FromDiscord | <ElegantBeef> Then you do `{flagA, flagB}` |
20:04:11 | FromDiscord | <queersorceress> it's part of the stdlib, `bitops`: https://nim-lang.org/docs/bitops.html |
20:04:16 | FromDiscord | <Rika> you dont need the bitops module |
20:04:23 | FromDiscord | <ElegantBeef> bitops just gives you more clear operators |
20:04:24 | FromDiscord | <Rika> `or`ing ints is equivalent |
20:04:56 | FromDiscord | <Rika> its a preference thing |
20:05:27 | FromDiscord | <enthus1ast> i would like to set flags with flags.incl(myEnumValue) then transfer them to int |
20:05:35 | FromDiscord | <enthus1ast> and back π |
20:06:04 | FromDiscord | <Yjuq> sent a code paste, see https://paste.rs/OfD |
20:06:09 | FromDiscord | <queersorceress> i think bitops would probably be the best way to do that especially if you are going to interop with C |
20:06:16 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Using arc/orc you can": "`cast` pragma only allowed in a statement context" says nim compiler |
20:07:08 | FromDiscord | <queersorceress> you can turn the particular hints off, in this case unreadablecode |
20:07:08 | FromDiscord | <Rika> i think what beef said is devel-only |
20:07:16 | FromDiscord | <Rika> unreachable |
20:07:17 | FromDiscord | <Rika> lol |
20:07:47 | FromDiscord | <Rika> @enthus1ast you can cast a set to an int just fine |
20:07:50 | FromDiscord | <queersorceress> if you using the default gc, the cast thing beef said should work on 1.4.2 |
20:08:25 | FromDiscord | <hamidb80> In reply to @queersorceress "if you using the": nope |
20:08:29 | FromDiscord | <Rika> yjuq: the code you just posted will only "quit" when you run the binary |
20:08:29 | FromDiscord | <enthus1ast> @Rika huh thought i tried this, lememe try again |
20:08:32 | FromDiscord | <hamidb80> (edit) "nope" => "nope, it doen't word" |
20:08:34 | FromDiscord | <Rika> use {.error.}, please |
20:08:37 | FromDiscord | <hamidb80> (edit) "word" => "work" |
20:08:56 | FromDiscord | <queersorceress> In reply to @hamidb80 "nope, it doen't work": yes it does |
20:09:14 | FromDiscord | <Rika> @enthus1ast i think i know your error, can you post the enum values? |
20:09:46 | FromDiscord | <queersorceress> it may give you warnings instead of errors, but it should compile. |
20:09:52 | FromDiscord | <enthus1ast> ah cool @Rika, works |
20:10:03 | FromDiscord | <enthus1ast> thanks |
20:10:08 | FromDiscord | <Rika> in nim, the enum values are equivalent to the bit that is set, not the value that is or'ed |
20:10:13 | FromDiscord | <Rika> okay |
20:10:15 | FromDiscord | <Rika> nice |
20:11:35 | FromDiscord | <hamidb80> In reply to @queersorceress "it may give you": https://media.discordapp.net/attachments/371759389889003532/812778496484835328/unknown.png |
20:11:44 | * | natrys quit (Quit: natrys) |
20:12:38 | FromDiscord | <queersorceress> because that isn't using it correctly, if you look at the snippet it is a pragma on a capture block |
20:13:05 | FromDiscord | <queersorceress> `{.cast(gcsafe).}: doThing()` |
20:13:39 | FromDiscord | <queersorceress> it isn't a pragma on the proc signature |
20:13:52 | FromDiscord | <hamidb80> In reply to @queersorceress "`{.cast(gcsafe).}: doThing()`": so how to add other pragmas? |
20:15:23 | FromDiscord | <queersorceress> sent a code paste, see https://play.nim-lang.org/#ix=2Q7g |
20:16:34 | FromDiscord | <hamidb80> i asked too many questions these days, is there anywhere that has some articles about these stuff? |
20:16:53 | FromDiscord | <Rika> welcome to a small community language |
20:17:15 | FromDiscord | <Rika> questions are not bad |
20:17:19 | FromDiscord | <queersorceress> it was an easy mistake to make, no worries |
20:17:20 | FromDiscord | <Rika> keep asking, dont worry about it |
20:18:09 | FromDiscord | <Rika> it really is unfortunate that there arent enough articls |
20:18:26 | FromDiscord | <Rika> but its hard to make as many as another language has if we got like 10% of the community size |
20:18:47 | FromDiscord | <queersorceress> i may start writing some again once i finish rebuilding my website app. |
20:20:41 | FromDiscord | <Avatarfighter> In reply to @hamidb80 "i asked too many": Welcome to the community if you're new π |
20:21:13 | FromDiscord | <Rika> avatar why do i feel like you JUST changed avatar when i think you did that days ago |
20:21:21 | FromDiscord | <Avatarfighter> well i uh |
20:21:22 | FromDiscord | <Avatarfighter> uhm |
20:21:35 | FromDiscord | <Avatarfighter> maybe i did :p |
20:21:59 | FromDiscord | <Rika> maybe i should too |
20:22:08 | FromDiscord | <Rika> i found an amazing image a few hours ago |
20:22:09 | * | Prestige laughs in irc |
20:22:14 | FromDiscord | <Avatarfighter> @ElegantBeef have you messed with async at all recently ? |
20:22:16 | FromDiscord | <apollo> laughs at you in irc |
20:22:20 | Prestige | haha |
20:22:29 | FromDiscord | <Avatarfighter> Prestige: you're just jealous of our profile pics sMh |
20:22:36 | Prestige | I can't see them :( |
20:22:41 | FromDiscord | <Avatarfighter> exactly |
20:22:43 | FromDiscord | <apollo> ouch |
20:22:48 | FromDiscord | <Avatarfighter> ;P |
20:23:00 | Prestige | let's get textual |
20:23:12 | FromDiscord | <Avatarfighter> π₯² |
20:23:40 | FromDiscord | <Avatarfighter> What's the newest devel version ? |
20:23:50 | FromDiscord | <Rika> devel is devel |
20:24:01 | FromDiscord | <Rika> theres no newest version that stays for more than a day or something |
20:24:05 | FromDiscord | <Avatarfighter> π₯² |
20:24:11 | FromDiscord | <Rika> its like asking what the newest master version is |
20:24:13 | FromDiscord | <Avatarfighter> What about the version # |
20:24:18 | FromDiscord | <Avatarfighter> well that is literally what i am asking |
20:24:19 | FromDiscord | <Rika> no clue |
20:24:39 | FromDiscord | <Rika> why? if your version is more than a day old you can basically assume its stale already |
20:24:49 | FromDiscord | <Avatarfighter> I know |
20:25:11 | FromDiscord | <Avatarfighter> I just can't remember if choosenim installs the newest devel version or if it still struggles with that |
20:25:41 | FromDiscord | <Rika> i think it uses nightlies |
20:26:55 | FromDiscord | <Avatarfighter> @ElegantBeef |
20:27:02 | FromDiscord | <Avatarfighter> Do you know the devel version by any chance ? |
20:28:06 | saem | choosenim update devel --latest or something like that should ensure you're at the latest |
20:28:42 | FromDiscord | <Avatarfighter> thanks saem, I couldn't remember how to get the latest lol |
20:28:59 | FromDiscord | <Avatarfighter> I kept doing `choosenim update devel` but no dice which wasn't making sense |
20:29:12 | FromDiscord | <Avatarfighter> because I'm pretty sure devel got updated in the time I last did that lol |
20:29:39 | saem | you're welcome |
20:29:44 | FromDiscord | <Avatarfighter> rip my chromebook too its not going to happy about this |
20:42:20 | reversem3 | @yardanico you around ? |
20:46:58 | * | sacredfrog quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:47:41 | * | sacredfrog joined #nim |
20:50:09 | reversem3 | Does anyone if the wasm-ld linker has to be installed ? |
20:53:33 | FromDiscord | <brainproxy> is there a way to get stats re: the "shared heap" used by e.g. `allocShared`, `createShared`. If not with something Nim lang provides then with gdb/lldb? (have been learning a lot about Nim but I'm still a newbie when it comes to nim/c/gdb, etc.) |
20:55:25 | FromDiscord | <brainproxy> (edit) "nim/c/gdb, etc.)" => "nim/c/gdb/etc)" |
21:06:47 | Prestige | hm using multiple threads with xlib is apparently a nightmare |
21:12:12 | Prestige | oh wait, it's just a channel issue. I guess tryRecv blocks? |
21:14:25 | FromDiscord | <brainproxy> receiving on a channel blocks the thread afaik |
21:14:35 | FromDiscord | <brainproxy> currently working on async channels π |
21:14:50 | Prestige | lol |
21:14:53 | FromDiscord | <brainproxy> (edit) |
21:15:12 | Prestige | well, time to rethink the structure of everything yet again |
21:15:27 | FromDiscord | <brainproxy> well, I can't take credit, someone else wrote the "async channels" code, but it's in a never-merged PR branch of a nice repo |
21:16:12 | FromDiscord | <brainproxy> but I'm working on a "task runner" API that builds on top of "async channels" (and not really working on the API just yet, more the "use cases" which will hopefully inform how the API is shaped) |
21:17:41 | FromDiscord | <brainproxy> (edit) removed "but" |
21:20:39 | * | haxscramper quit (Remote host closed the connection) |
21:20:59 | Prestige | Wait, why would tryRecv block if it returns a bool saying if it has dataa |
21:24:49 | Prestige | i checked if channel.peek > 0 before using tryRecv and it seems to have solved the issue. Seems odd/wrong but whatever |
21:24:52 | FromDiscord | <brainproxy> oh... my apologies, channels on the brain, I honed in on "[r]ecv", I'm actually not sure about the behavior of `tryRev` π€¦ββοΈ |
21:25:12 | Prestige | Np, I think it must be blocking? |
21:31:47 | FromDiscord | <mikebelanger> hey has anyone ever got just a `signature mismatch` for an entire error, with no stack-trace? |
21:33:19 | FromDiscord | <mikebelanger> not even like blah blah function has such and such parameters, but this function call has these arguments etc. Just `signature mismatch`. On nim 1.4, on OS X `10.13.6` |
21:34:25 | FromDiscord | <mikebelanger> sent a code paste, see https://play.nim-lang.org/#ix=2Q7J |
21:39:10 | FromDiscord | <ElegantBeef> @Avatarfighter nope i dont touch async ever really, only when i'm forced to π |
21:39:42 | FromDiscord | <ElegantBeef> Prestige isnt there a purpose build X api for multithreading |
21:40:04 | Prestige | there's xcb but I'm not using that lib, I'd have to change everything |
21:40:19 | Prestige | xlib support multithreading apparently but it's making everything lag |
21:40:30 | Prestige | probably something I'm doing incorrectly, I guess |
21:41:48 | FromDiscord | <queersorceress> what are you trying to do? |
21:42:16 | Prestige | Listen for events on one thread, and pass them via a channel to the main thread |
21:43:12 | FromDiscord | <queersorceress> so the functionality of libnotify? |
21:43:54 | FromDiscord | <queersorceress> quick search seems like there are a few packages on nimble.directory that do async event handling and callback registration. |
21:45:12 | Prestige | The problem I think might be with xlib but I'm not sure |
21:45:15 | FromDiscord | <queersorceress> i don't know why you would listen on one thread and then trigger events on the main thread vs just registering the event callback handler on the main thread as part of the run loop though. |
21:45:41 | Prestige | Because I'm implementing ipc which has to be on another thread |
21:46:39 | FromDiscord | <ElegantBeef> Does it really? Couldnt you just have a socket and poll it every tick? |
21:46:44 | FromDiscord | <queersorceress> implementing from scratch? |
21:49:12 | Prestige | XNextEvent blocks the thread so I don't know a way around it |
21:49:58 | FromDiscord | <queersorceress> yeah it would depend highly on the method of implementation. if you are doing message passing, which is what it sounds like, then yeah it will need multiple threads to do it correctly |
21:52:47 | Prestige | Yeah |
21:53:14 | Prestige | Not sure what's making it occasionally process events slower, it gets a little laggy. Maybe a locking issue |
21:54:15 | FromDiscord | <queersorceress> that would be my guess, i don't know much about the details of what you are using but the implementation of your serial queue might be doing it |
21:54:42 | FromDiscord | <brainproxy> In reply to @Prestige "Listen for events on": what I'm working on might be of interest to you, but take for granted that (1) myself and the other contributor the repo are not experts, (2) we're relying on code that is (yet) far from battle-tested, (3) you'd have to get in bed with nim-chronos which isn't compatible with the built-in asyncdispatch (can't use nim-chronos' `async` macro in same thread with the built-in equivalent):β΅οΏ½ |
21:55:35 | FromDiscord | <brainproxy> the backdrop for that work is the nim-chronos repo: https://github.com/status-im/nim-chronos |
21:56:13 | FromDiscord | <brainproxy> (edit) removed "(yet)" |
21:58:23 | FromDiscord | <QueenFuckingAdrielle> does anyone have any experience programming in nim with godot? |
21:59:42 | FromDiscord | <ElegantBeef> Some in #gamedev do π |
22:00:52 | FromDiscord | <QueenFuckingAdrielle> yea i realized that right after lol |
22:01:35 | FromDiscord | <QueenFuckingAdrielle> going through the search result rn, im thinking of making a 2d rpg for fun and thought it could be cool to check out godot finally |
22:02:11 | FromDiscord | <QueenFuckingAdrielle> im not big unity fan, godot seems like it could fit the bill |
22:03:50 | FromDiscord | <ElegantBeef> Yea godot is apparently very good for 2D, though i've toyed with Nico a fair bit for 2D pixel art games |
22:05:09 | * | narimiran quit (Ping timeout: 265 seconds) |
22:05:13 | FromDiscord | <QueenFuckingAdrielle> yea ive never really had time to dig in and really make a full game, ive mainly worked in unity, unreal, and gazebo (not a game engine) for simulation type of stuff |
22:05:59 | FromDiscord | <QueenFuckingAdrielle> unity is a great tool, but it seems like an odd place between 3d and 2d, id rather use unreal for anything 3d, and its got more than i want for a pixel game at least |
22:08:39 | FromDiscord | <ElegantBeef> https://jbeetham.itch.io/linerino this is the most complete thing i've made using nico, so i can vouch for it being good, but it's also very very different from a fully engine. You design everything yourself with the basic IO! |
22:12:18 | * | PMunch joined #nim |
22:28:19 | ForumUpdaterBot | New thread by Mantielero: Templates - how to check if a template has been used, see https://forum.nim-lang.org/t/7541 |
22:31:53 | * | D_ joined #nim |
22:38:31 | reversem3 | So I needed to download wasm-sdk and then export wasi, I can now compile c to wasm without js glue |
22:39:05 | reversem3 | Now to figure out how nim compiler uses wasm32 |
22:39:57 | reversem3 | Still getting wasm-ld error though with wasmrt |
23:32:25 | FromDiscord | <XxDiCaprioxX> Hey can someone help me resolve my issues with choosenim? |
23:32:37 | Prestige | what issues? |
23:33:01 | FromDiscord | <XxDiCaprioxX> I can't update somehow |
23:33:10 | Prestige | I need more info |
23:33:50 | FromDiscord | <XxDiCaprioxX> I have nim 1.2.4 installed via choosenim and even if I change my environment variables to use the newest version from a folder on my desktop the compiler wont stop using 1.2.4 |
23:34:46 | Prestige | Is that a choosenim issue? What env variable(s) are you setting and how are you invoking the compiler? |
23:34:55 | FromDiscord | <ElegantBeef> did you do `choosenim update stable`? |
23:35:27 | FromDiscord | <XxDiCaprioxX> I'm not 100% sure if it is the issue with choosenim but I changed the env variables you change when installing nim by hand |
23:36:00 | FromDiscord | <XxDiCaprioxX> In reply to @ElegantBeef "did you do `choosenim": yeah I dad that now, Ima compile and see if it works out |
23:37:33 | Prestige | I wonder if there's a way to deal with my problem with async instead of a thread. I think copying events and sending them through a channel is making the application lag a bit |
23:37:47 | FromDiscord | <XxDiCaprioxX> In reply to @XxDiCaprioxX "yeah I dad that": alright compiler works now |
23:40:24 | * | tane quit (Quit: Leaving) |
23:52:12 | FromDiscord | <XxDiCaprioxX> aaaaand I'm back with another question: is there a way to break out of a nestled while loop? java for example has `break label`, does nim have something similar? |
23:54:10 | PMunch | Yes |
23:54:27 | PMunch | You can do `block myName:` and then `break myName` |
23:55:14 | PMunch | Prestige, what're you trying to do? |
23:56:19 | FromDiscord | <XxDiCaprioxX> just a simple blackjack game |
23:56:34 | FromDiscord | <XxDiCaprioxX> sry me smol brain |
23:56:45 | FromDiscord | <XxDiCaprioxX> In reply to @PMunch "You can do `block": thanks |
23:57:02 | Prestige | PMunch: implementing ipc in Nimdow. Problem is, XNextEvent is blocking so I put that on another thread. I'm passing the events over a channel to the main thread for processing, but now the WM is kind of laggy. I think, since the events have to be copied, it's causing the lag. I'm not 100% sure, though |
23:57:38 | Prestige | Thinking of either using xcb or just sharing a pointer to a single event in an "unsafe" way, if possible |
23:57:59 | PMunch | @XxDiCaprioxX no worries, Nim has a lot of features and getting through them all is hard. |
23:58:26 | PMunch | Prestige, hmm that sounds wrong.. |
23:58:33 | PMunch | Xevents are pretty small IIRC |
23:58:44 | PMunch | And aren't they pointers anyways? |
23:59:36 | Prestige | If I try sharing the pointer to the events, they don't get processed for some reason. After passing the actual event through the channel, it start working |
23:59:44 | Prestige | Starts* |