00:02:35 | arkanoid | yeah it is sad that I have to use my nim tools only on backend. Every time I try to build a windows tool I end up fighting with the AV and it looks like I am doing something nasty just to parse an xml |
00:17:34 | FromDiscord | <treeform> I primly develop on windows. I have 0 AV problems? |
00:17:47 | FromDiscord | <treeform> I think I disable all AV is its always bad for programming. |
00:27:57 | FromDiscord | <exithead> People actually program on windows? Wild. |
00:28:57 | * | xet7 quit (Remote host closed the connection) |
00:29:41 | * | xet7 joined #nim |
00:32:50 | FromDiscord | <treeform> if you work on games as a hobby, and most of gamers use windows. Its not that bad. |
00:38:28 | FromDiscord | <theangryepicbanana> In reply to @exithead "People actually program on": I prefer using .NET and JVM languages on windows ngl lol |
00:41:21 | FromDiscord | <j$> hey trying to use ffi, when importing structs do I have to declare all the fields? |
00:45:54 | FromDiscord | <stu002> Can I confirm that on macOS the homebrew install of nim does not install testament? |
00:56:07 | fn | <ForumUpdaterBot99> New thread by Stu002: Which macOS installation method for Nim?, see https://forum.nim-lang.org/t/8240 |
00:57:28 | FromDiscord | <ElegantBeef> In reply to @j$ "hey trying to use": I dont know but i'm going to say you dont need to but for the most safe FFI it's probably the smartest |
01:02:01 | * | bkay joined #nim |
01:04:30 | * | beshr quit (Ping timeout: 255 seconds) |
01:13:41 | arkanoid | I have to serialize and deserialize GeoJSON format. I'm trying to data map it with object variant, but the "coordinates" key (see example here https://en.wikipedia.org/wiki/GeoJSON) contains seq[int] for Point type and seq[seq[int]] for LineString and Polygon type. Nim does not support object variant with attributes with different types for same name. What's an idiomatic solution for this? |
01:15:21 | FromDiscord | <treeform> In reply to @arkanoid "I have to serialize": you could name them different things |
01:15:34 | FromDiscord | <treeform> you could have Point have seq[seq[int]] as well. |
01:15:53 | arkanoid | but that's now what the standard wants |
01:16:06 | arkanoid | s/now/not |
01:17:54 | arkanoid | I think I will have to work with generics |
01:22:13 | FromDiscord | <treeform> you have have a problem that prop can be any type |
01:23:29 | FromDiscord | <treeform> and Polygon is a seq of seq of 2 int |
01:24:28 | * | vicfred_ joined #nim |
01:25:01 | arkanoid | you're right, polygon is seq[seq[seq[float]]] |
01:25:12 | arkanoid | well, any idea? |
01:25:30 | arkanoid | I'm only thinking about GeoJson[T] |
01:26:10 | FromDiscord | <treeform> I got some thing like this: |
01:26:11 | FromDiscord | <treeform> https://play.nim-lang.org/#ix=3tjw |
01:26:21 | FromDiscord | <treeform> its not a nim friendly format |
01:26:37 | FromDiscord | <treeform> its schema is loose |
01:27:04 | FromDiscord | <treeform> I kept everything that is super dynamic as JsonNode |
01:28:20 | * | vicfred quit (Ping timeout: 268 seconds) |
01:42:43 | FromDiscord | <j$> In reply to @ElegantBeef "I dont know but": yeah there are some places that so you should not have to, but it was giving me some error, so for my use case ill just wrap fields in functions and call it a day |
01:42:56 | FromDiscord | <j$> (edit) "so" => "say" |
02:01:07 | FromDiscord | <ajusa> This might be a weird question but does os.walkDir not work for file paths that have an "!" in their filename? I just tested it on my machine and that seems to be the case |
02:06:07 | arkanoid | is there a function to sanitize file names so that they can be used in paths? |
02:11:44 | FromDiscord | <ElegantBeef> You mean remove the extension? |
02:11:53 | FromDiscord | <ElegantBeef> or get the name + extension? |
02:15:10 | FromDiscord | <carmysilna> I think they mean sanitize a tainted string so it’s safe to open that file name |
02:15:37 | FromDiscord | <ElegantBeef> Tainted strings are opt in and basically 0 people use them 😄 |
02:20:26 | FromDiscord | <ElegantBeef> `splitFile` and `extractFileName` in `std/os` should help |
02:47:08 | arkanoid | I mean remove weird characters from file name, like ()!.' |
02:48:58 | FromDiscord | <ElegantBeef> You should be able to do `import std/[os, strutils];fileName.replace(invalidFileNameChars)` |
02:53:37 | FromDiscord | <ajusa> Can I import a struct from Cwithout needing to redefine it? |
02:55:01 | * | vicfred_ quit (Quit: Leaving) |
02:55:13 | * | vicfred joined #nim |
02:56:02 | fn | <Prestige99> Don't think so |
02:57:21 | FromDiscord | <ajusa> Rip, I was trying to import tcp/ip/udp header definitions, that'll be a pain |
02:57:44 | fn | <Prestige99> c2nim might be useful |
02:59:57 | FromDiscord | <ajusa> Yeah, I'll try running it (although it'll be on some pretty messy 20 year old headers). |
03:17:33 | fn | <Prestige99> I found it pretty easy to convert headers using macros in vim, if you're using anything similar |
03:26:15 | * | arkurious quit (Quit: Leaving) |
03:42:57 | FromDiscord | <Revenant> hiya, i'm trying to use NimScript as a build tool, replacing makefiles, basically, but can't figure it out how to get it to work because the documentation is quite sparse... |
03:43:12 | FromDiscord | <Revenant> i have this in `build.nims` |
03:43:14 | FromDiscord | <Bung> @haxscramper okay, get it. |
03:43:26 | FromDiscord | <Revenant> sent a code paste, see https://play.nim-lang.org/#ix=3tjS |
03:43:59 | FromDiscord | <Revenant> and this is how i'm trying to use it |
03:44:15 | FromDiscord | <Revenant> sent a code paste, see https://play.nim-lang.org/#ix=3tjT |
03:44:37 | FromDiscord | <Revenant> which doesn't actually execute the `build` task |
03:47:05 | FromDiscord | <Bung> task is defined by nimble |
03:47:54 | FromDiscord | <Revenant> no, it's defined by system |
03:48:02 | FromDiscord | <Revenant> it says it here https://nim-lang.github.io/Nim/nims.html |
03:48:21 | FromDiscord | <Revenant> "NimScript as a build tool" section |
03:48:34 | FromDiscord | <Revenant> but it doesn't show an example how to invoke the task in a nimscript file, that is my problem |
03:51:28 | FromDiscord | <Bung> hmm, havn't used it like this. |
03:52:01 | FromDiscord | <Revenant> okay, if i rename if to `config.nims`, then i can invoke `debug` with `nim debug` |
03:52:45 | FromDiscord | <Bung> so still works as a config file |
03:53:27 | FromDiscord | <Revenant> well... yeah... but the documentation is a bit misleading |
03:53:39 | FromDiscord | <Revenant> i thought you can just use tasks in any nimscript file |
03:53:43 | FromDiscord | <Bung> kinda , I agree |
03:53:51 | FromDiscord | <Revenant> but seems like just in the `config.nims` in the project root |
03:54:25 | FromDiscord | <Bung> more like config your build process |
03:55:27 | FromDiscord | <Revenant> yeah, it's all a bit confusing to be hones |
03:55:28 | FromDiscord | <Revenant> (edit) "hones" => "honest" |
03:57:20 | FromDiscord | <Bung> guess with nimble that parts does not need anymore. |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:38 | * | supakeen joined #nim |
04:12:20 | * | bkay quit (Quit: Leaving) |
04:12:34 | * | beshr joined #nim |
04:12:34 | * | beshr quit (Changing host) |
04:12:34 | * | beshr joined #nim |
04:27:03 | FromDiscord | <hamidb80> https://github.com/hamidb80/mycouch/blob/main/src/mycouch/api.nim#L57↵↵> Error: undeclared field: 'code' for type httpclient.Response [type declared in C:\Users\HamidB80\.choosenim\toolchains\nim-#devel\lib\pure\httpclient.nim(227, 3)] |
04:27:10 | FromDiscord | <hamidb80> i'm going crazy |
04:28:20 | FromDiscord | <hamidb80> https://media.discordapp.net/attachments/371759389889003532/866174522456670208/unknown.png |
04:28:35 | FromDiscord | <hamidb80> the language server detect it |
04:28:39 | FromDiscord | <ElegantBeef> does `code(res).int` work? |
04:29:06 | FromDiscord | <hamidb80> In reply to @ElegantBeef "does `code(res).int` work?": nope |
04:29:15 | FromDiscord | <hamidb80> In reply to @hamidb80 "the language server detect": but the compiler not |
04:32:02 | FromDiscord | <Hi02Hi> In reply to @Revenant "well... yeah... but the": as far as i can tell, nimscript tasks act on files with `file.nims` or with directories with `config.nims` |
04:33:30 | FromDiscord | <Revenant> In reply to @Hi02Hi "as far as i": this doesn't make much sense... |
04:35:58 | FromDiscord | <Hi02Hi> In reply to @Revenant "this doesn't make much": which part doesnt make sense? if you mean `file.nims`, then i mean if the project is in `main.nim`, then the nimscript file would be `main.nims` |
04:36:52 | FromDiscord | <Revenant> well, my original goal was to use NimScript as a substitute for makefiles |
04:37:31 | FromDiscord | <Revenant> maybe there are not even any Nim files involved |
04:37:43 | FromDiscord | <hamidb80> In reply to @ElegantBeef "does `code(res).int` work?": removing the argument type fixes the problem |
04:37:47 | FromDiscord | <Revenant> maybe i just want to write a "makefile" in NimScript for a C++ project, or whatever |
04:38:43 | FromDiscord | <Rika> wdym? |
04:38:47 | FromDiscord | <Rika> i mean to hamid |
04:38:52 | FromDiscord | <Hi02Hi> so ig use `config.nims` and use a bunch of `import os ... exec("build command")` |
04:39:07 | FromDiscord | <ElegantBeef> I just tested it hamidb and it worked |
04:39:14 | FromDiscord | <Hi02Hi> or is `import os` not needed |
04:39:24 | FromDiscord | <Rika> exec needs os |
04:39:26 | FromDiscord | <Rika> i believe |
04:39:26 | FromDiscord | <hamidb80> https://media.discordapp.net/attachments/371759389889003532/866177317009227786/unknown.png |
04:39:42 | FromDiscord | <Rika> what was the type before |
04:39:48 | FromDiscord | <hamidb80> Response |
04:39:53 | FromDiscord | <Rika> strange |
04:39:56 | FromDiscord | <ElegantBeef> Oh you're not exporting the frigging type |
04:40:00 | FromDiscord | <Revenant> my problem with using `config.nims` is that while it works, if i do `exec "nim ..."` from there, then the script gets executed a SECOND time when i exec the nim compiler from the script |
04:40:01 | FromDiscord | <ElegantBeef> (edit) "type" => "module" |
04:40:02 | FromDiscord | <Revenant> which sucks |
04:40:02 | FromDiscord | <Rika> what? |
04:40:13 | FromDiscord | <Revenant> how can i reliably parse extra command line params then? |
04:40:13 | FromDiscord | <Rika> beef what are you spouting |
04:40:18 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Oh you're not exporting": ?! |
04:41:09 | FromDiscord | <ElegantBeef> I dont know how that macro works that those procs are declared in |
04:41:27 | FromDiscord | <hamidb80> addTestCov? |
04:41:30 | FromDiscord | <ElegantBeef> But i just assumed it was due to not exporting `httpclient` since it was a template |
04:41:30 | FromDiscord | <ElegantBeef> Yes |
04:41:44 | FromDiscord | <hamidb80> it just adds `cov` pragma to the procs |
04:42:05 | FromDiscord | <ElegantBeef> Well oddly enough `export httpclient` resolves the issue 😄 |
04:43:08 | FromDiscord | <hamidb80> it works fine when i compile api.nim individually |
04:43:32 | FromDiscord | <hamidb80> but `nimble test` somehow break it |
04:43:57 | FromDiscord | <hamidb80> (edit) "break" => "breaks" |
04:44:50 | FromDiscord | <hamidb80> and something more strange: |
04:45:11 | FromDiscord | <hamidb80> i didn't import macroutils in `tests/tapi.nim` |
04:46:05 | FromDiscord | <hamidb80> but it somehow injected |
04:46:10 | FromDiscord | <hamidb80> and the last line: https://github.com/hamidb80/mycouch/blob/main/tests/tapi.nim#L67 |
04:46:14 | FromDiscord | <hamidb80> doesn't work |
04:47:32 | FromDiscord | <hamidb80> In reply to @ElegantBeef "Pmunch emits some converters": . |
04:47:49 | FromDiscord | <hamidb80> (edit) "but it somehow ... injected" added "goy" |
04:47:55 | FromDiscord | <hamidb80> (edit) "goy" => "got" |
04:47:58 | FromDiscord | <Rika> In reply to @ElegantBeef "Well oddly enough `export": ah, this was a file being imported? |
04:48:04 | FromDiscord | <ElegantBeef> Yea |
04:48:10 | FromDiscord | <Rika> yeah that means code needs to be exposed to the importing module as well |
04:48:17 | FromDiscord | <Rika> so you need to export httpclient |
04:48:19 | FromDiscord | <ElegantBeef> I'm trying to find the logic in this code |
04:48:37 | FromDiscord | <Rika> you need to find the logic in your head first 😛 |
04:48:47 | FromDiscord | <ElegantBeef> I mean i fixed the error |
04:49:02 | FromDiscord | <Rika> i dont actually know where you're looking at |
04:49:09 | FromDiscord | <ElegantBeef> https://github.com/hamidb80/mycouch/blob/main/src/mycouch/api.nim |
04:49:23 | FromDiscord | <ElegantBeef> guess i should've grabbed line 56 |
04:49:52 | FromDiscord | <ElegantBeef> This is the first time i've seen someone use `using` |
04:50:12 | FromDiscord | <Rika> i use using, not often but ive used it |
04:51:36 | FromDiscord | <hamidb80> it's because i'm too lazy to write argument types |
04:51:52 | FromDiscord | <ElegantBeef> I know why people use it 😄 |
04:52:36 | FromDiscord | <ElegantBeef> Ok so seems like this is a templates issue(bug?) |
04:53:00 | FromDiscord | <Rika> why? |
04:53:34 | FromDiscord | <hamidb80> removing type fixes the issue |
04:53:37 | FromDiscord | <ElegantBeef> I really should open this up in a properly setup editor to expand on it |
04:53:48 | FromDiscord | <hamidb80> In reply to @hamidb80 "": . |
04:53:56 | FromDiscord | <Rika> In reply to @hamidb80 "removing type fixes the": oh yeah i forgot about that |
04:55:56 | FromDiscord | <hamidb80> i think every thing works fine magically |
04:56:02 | FromDiscord | <hamidb80> (edit) "i think every thing works fine magically ... " added "now" |
04:56:34 | FromDiscord | <hamidb80> (edit) "i think every thing works ... fine" added "magically " | removed "magically" |
04:58:47 | FromDiscord | <hamidb80> no |
05:00:34 | FromDiscord | <hamidb80> https://media.discordapp.net/attachments/371759389889003532/866182639126577163/2021-07-18_09-29-16.mkv |
05:03:41 | FromDiscord | <ElegantBeef> like i said replace it with `code(res)` |
05:03:53 | FromDiscord | <ElegantBeef> I mean it gets another compiler error unrelated |
05:04:32 | FromDiscord | <hamidb80> gives me same error |
05:04:37 | FromDiscord | <ElegantBeef> you didnt replace it in both spots |
05:04:45 | FromDiscord | <ElegantBeef> you use `res.code` twice |
05:05:21 | FromDiscord | <hamidb80> wow |
05:05:35 | FromDiscord | <hamidb80> fixes https://media.discordapp.net/attachments/371759389889003532/866183895871258624/unknown.png |
05:05:38 | FromDiscord | <hamidb80> the issue |
05:05:47 | FromDiscord | <ElegantBeef> Templates have some issues with the MCS when importing which can result in having to use C style calls |
05:07:17 | FromDiscord | <ElegantBeef> you can do `mixin code` in the first line to have it seem to work |
05:07:23 | FromDiscord | <ElegantBeef> But i dont know much about mixin/bind |
05:07:53 | FromDiscord | <ElegantBeef> Ah kinda makes sense what it does |
05:09:52 | FromDiscord | <hamidb80> works with mixin |
05:10:04 | FromDiscord | <hamidb80> https://media.discordapp.net/attachments/371759389889003532/866185022247272448/unknown.png |
05:11:11 | FromDiscord | <ElegantBeef> Almost like i tested it before hand 😄 |
05:16:16 | FromDiscord | <hamidb80> do you know what are these errors? my code compiles but they exist https://media.discordapp.net/attachments/371759389889003532/866186588240085008/unknown.png |
05:17:06 | FromDiscord | <hamidb80> seems they dont give much information |
05:17:26 | FromDiscord | <ElegantBeef> It's something with your macros |
05:31:33 | FromDiscord | <hamidb80> it complains about `cov` ident https://media.discordapp.net/attachments/371759389889003532/866190433629765653/unknown.png |
05:36:44 | FromDiscord | <hamidb80> how can I tell to the compiler which `cov` i mean |
05:37:05 | FromDiscord | <hamidb80> `bindSym` seems not useful |
06:24:43 | FromDiscord | <Bung> there's something need improve, one that template/generic should be hint message, need to be configurable. |
06:33:09 | FromDiscord | <hamidb80> beef |
06:33:15 | FromDiscord | <hamidb80> i got confused |
06:34:32 | FromDiscord | <hamidb80> this code in separated file compiles successfully https://media.discordapp.net/attachments/371759389889003532/866206282201169940/unknown.png |
06:43:01 | * | max22- joined #nim |
06:43:18 | * | max22- quit (Remote host closed the connection) |
06:43:41 | * | max22- joined #nim |
06:45:18 | FromDiscord | <hamidb80> oh |
06:45:25 | FromDiscord | <hamidb80> static argument |
06:45:46 | FromDiscord | <hamidb80> i found a crazy bug |
06:50:21 | FromDiscord | <hamidb80> https://github.com/hamidb80/mycouch/blob/main/src/mycouch/api.nim#L759 |
06:50:50 | FromDiscord | <hamidb80> if i remove static argument here everything gonna be ok |
06:52:12 | FromDiscord | <hamidb80> https://github.com/hamidb80/mycouch/blob/main/src/mycouch/api.nim#L763 |
07:37:01 | fn | <ForumUpdaterBot99> New post on r/nim by WrongJudgment6: Nim on the Attack: Process Injection Using Nim and the Windows API, see https://reddit.com/r/nim/comments/omm010/nim_on_the_attack_process_injection_using_nim_and/ |
08:16:32 | FromDiscord | <hamidb80> he compiled nim for windows in linux? |
08:17:15 | FromDiscord | <hamidb80> -d:mingw |
08:17:43 | FromDiscord | <ElegantBeef> yea you can cross compile windows binaries from linux depending on the dependancies you have |
08:18:23 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/nimc.html#crossminuscompilation |
08:25:54 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I'm guessing no quick way to iterate over a string backwards? |
08:26:36 | FromDiscord | <hamidb80> ? |
08:27:07 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tkC |
08:28:59 | FromDiscord | <@bracketmaster-5a708063d73408ce4> !eval var s = "hello"; for c in countdown(s.len - 1, 0)\: echo c |
08:29:01 | NimBot | Compile failed: /usercode/in.nim(1, 59) Error: expected: ':', but got: '[EOF]' |
08:29:15 | FromDiscord | <@bracketmaster-5a708063d73408ce4> !eval var s = "hello"; for c in countdown(s.len - 1, 0)\: echo c; |
08:29:16 | NimBot | Compile failed: /usercode/in.nim(1, 60) Error: expected: ':', but got: ';' |
08:29:26 | FromDiscord | <hamidb80> 😄 |
08:29:44 | FromDiscord | <@bracketmaster-5a708063d73408ce4> which is not "olleh" |
08:29:45 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3tkD |
08:30:20 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=3tkE |
08:30:24 | FromDiscord | <hamidb80> s[c] |
08:30:51 | FromDiscord | <@bracketmaster-5a708063d73408ce4> yeah yeah, I know - but a little less elegant than string.reverse |
08:30:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> which doesn't exist |
08:31:07 | FromDiscord | <hamidb80> algorighm.reverse |
08:31:36 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=3tkE |
08:32:09 | FromDiscord | <hamidb80> sorry |
08:32:12 | FromDiscord | <hamidb80> wait a minute |
08:32:59 | FromDiscord | <@bracketmaster-5a708063d73408ce4> wrong link? |
08:33:58 | FromDiscord | <hamidb80> https://play.nim-lang.org/#ix=3tkL |
08:34:25 | FromDiscord | <hamidb80> algorithm.reversed return seq[char] by default |
08:35:20 | FromDiscord | <hamidb80> you can convert it to string in many ways |
08:35:21 | FromDiscord | <hamidb80> https://stackoverflow.com/questions/32094567/converting-a-seqchar-to-string |
08:35:30 | FromDiscord | <@bracketmaster-5a708063d73408ce4> thanks |
08:35:32 | FromDiscord | <@bracketmaster-5a708063d73408ce4> that works |
09:03:35 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3tkT |
09:03:42 | FromDiscord | <ElegantBeef> Ideally you just make an iterator for 0 cost |
09:05:15 | FromDiscord | <ElegantBeef> always realizes the time of the message too late |
09:50:48 | FromDiscord | <Kermithos> Is there a way to get the ascii char from an int? for example I have the number 97 and want to convert it to 'a' |
09:57:14 | fn | <ForumUpdaterBot99> New thread by Rtrn: Base method when returning an iterator, see https://forum.nim-lang.org/t/8241 |
10:10:57 | FromDiscord | <haxscramper> `char(97)`↵(@Kermithos) |
10:11:37 | FromDiscord | <Kermithos> In reply to @haxscramper "`char(97)` (<@739886115623927889>)": perfect, thanks |
10:48:25 | * | max22- quit (Ping timeout: 246 seconds) |
11:23:29 | * | lucerne quit (Quit: Bye) |
11:25:03 | * | greyrat_ joined #nim |
11:25:24 | * | lucerne joined #nim |
11:26:34 | * | greyrat quit (Ping timeout: 240 seconds) |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:36 | * | supakeen joined #nim |
12:27:10 | * | arkurious joined #nim |
12:34:44 | FromDiscord | <haxscramper> @Bung @ElegantBeef https://github.com/haxscramper/hnimast/blob/master/tests/tNimscriptInterop.nim↵↵This is still more or less proof-of-concept, but it is able to handle variant objects, private fields, private fields in generic objects, nested variants with variant fields inside |
12:35:22 | FromDiscord | <haxscramper> Regular serialization approach `fromVm(target: T, source: PNode)` |
12:36:06 | FromDiscord | <haxscramper> `iterateFields()` from hnimast yields fields in exactly the same order as they are placed in the PNode representation in the VM, so I just copy data using index |
12:36:38 | FromDiscord | <haxscramper> This is how `VmVariant` looks in the Vm https://media.discordapp.net/attachments/371759389889003532/866297410330427412/unknown.png |
12:37:04 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3tlG |
12:37:27 | FromDiscord | <haxscramper> Round-trip preserves all data `(beforeKind: '\x00', privateField: 0.0, tableField: (test: "Non-default argument passed to private field", genr: ""), kind: vmkSecond, field2: "Set value in the VM side", afterKind: '\x00') ` |
12:39:03 | FromDiscord | <haxscramper> You can also implement custom (de) serialization hooks and so on |
12:40:01 | FromDiscord | <haxscramper> I removed dependency on nimble, but devel breaks hmisc, most likely due to this enum "fix" |
12:40:24 | FromDiscord | <haxscramper> But in the example I can use std libraries just fine (tables), so |
12:41:18 | * | max22- joined #nim |
12:43:38 | FromDiscord | <haxscramper> So you can use this example as a reference if you already have object unparsing implemented, though hnimast is probably the best you can get for that sort of thing, unless you want to spend as much time as I did |
12:44:18 | FromDiscord | <haxscramper> In reply to @haxscramper "I removed dependency on": I had distinct enum typedef and on devel I can't convert it to the underlying enum |
12:54:26 | FromDiscord | <haxscramper> Is it normal I'm getting insane number of strange type mismatch errors when switching to devel? |
12:54:38 | FromDiscord | <haxscramper> ``type mismatch: got <uint8> but expected one of: proc echo(x: varargs[typed, `$`]) `` |
12:55:05 | FromDiscord | <haxscramper> Also had to fix like 5+ pefectly normal procs that suddely failed to compile |
12:55:30 | FromDiscord | <haxscramper> Most of them were `Type1 | Type2` and I had to separate them into two procedures |
12:56:36 | * | max22- quit (Ping timeout: 256 seconds) |
13:00:30 | FromDiscord | <haxscramper> `rror: ambiguous call; both pragmas.newNPragma(names: varargs[NimNode]) and pragmas.newNPragma(names: varargs[string]) match for: (string)` |
13:00:41 | FromDiscord | <haxscramper> And I had no implicit converters of course |
13:05:05 | FromDiscord | <haxscramper> Idk, maybe I just somehow managed to write all of the code incorrectly or something |
13:08:17 | FromDiscord | <haxscramper> In reply to @haxscramper "I had distinct enum": That one I at least figured out - now, for some reason you have to go through .int when converting distinct enum to the base type as well, which makes zero sense but anyway |
13:09:15 | FromDiscord | <haxscramper> But overall it seems like you are out of luck with hnimast on devel, @ElegantBeef , since I largely get completely random compilation errors for code that worked perfectly fine earlier |
13:19:24 | FromDiscord | <haxscramper> Also whatever fusion is installed by nimble & CI also fails with idk-why errors https://github.com/haxscramper/hmisc/runs/3097352353?check_suite_focus=true#step:5:24 |
13:26:48 | FromDiscord | <haxscramper> Fusion is still tagged as 1.0, and package version in manifest has been the same for the last 15 months |
13:40:42 | FromDiscord | <generic linux user> really bit git banner |
13:40:52 | FromDiscord | <generic linux user> covers all of my scren😐 |
13:53:45 | * | max22- joined #nim |
14:10:13 | * | huria4 joined #nim |
14:12:30 | * | huria4 quit (Quit: Leaving) |
14:23:46 | FromDiscord | <dom96> yeah, these embeds are annoying |
14:23:49 | FromDiscord | <dom96> deleted it |
14:33:45 | FromDiscord | <generic linux user> whyyy |
14:33:53 | FromDiscord | <generic linux user> just <> eh |
14:47:24 | FromDiscord | <jfmonty2> it appears that arrays indexed by enums are not bounds-checked? As in, if you cast an invalid value to the enum and use that to index the array, you can get a segfault. |
14:47:48 | FromDiscord | <jfmonty2> I'm guessing the official answer to this is "if you're casting types like that then you're taking your life into your own hands, the compiler can't help you"? |
14:48:09 | FromDiscord | <Rika> pretty much |
14:48:51 | FromDiscord | <Rika> i guess it would help if there was a runtime check for enum validity |
14:49:07 | FromDiscord | <deech> I'm using the `compile` pragma to build an object file, eg. `{.compile: "blah.cxx".}` but how do I pass the resulting `blah.cxx.o` to the linker? It ends up the the `~/.cache/nim/...` folder and simply doing `{.passL: "blah.cxx.o".}` doesn't find it. |
14:49:19 | FromDiscord | <jfmonty2> I mean there is, if you're using the regular conversions, but if you cast then all that goes out the window of course |
14:49:30 | FromDiscord | <Rika> well then there is the answer |
14:49:39 | FromDiscord | <jfmonty2> understandable but I will admit I was surprised since I was still intuitively expecting bounds checking to happen |
14:50:06 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-link-pragma @deech |
14:50:13 | FromDiscord | <Rika> would this help |
14:52:26 | FromDiscord | <carmysilna> In reply to @ElegantBeef "Tainted strings are opt": Oh, that’s funny. It was one of the features that drew me to Nim |
14:55:28 | FromDiscord | <Rika> its being rethought i believe |
14:55:34 | FromDiscord | <Rika> effects system is the modern equivalent |
14:55:51 | FromDiscord | <deech> @Rika Same issue. The object file is in the `cache` directly but `g++` can't find it. |
14:56:05 | FromDiscord | <carmysilna> The effects system is pretty cool as well. |
14:56:37 | FromDiscord | <deech> I'll ask in internals as well. |
14:56:41 | FromDiscord | <Rika> no clue then |
14:56:50 | FromDiscord | <haxscramper> If it was possible to enforce conversion via procedure and forbid .string this could make sense, otherwise tainted mode does not enforce it enough |
14:57:33 | FromDiscord | <Rika> yes but how would taintedstring -> string work? |
14:57:47 | FromDiscord | <Rika> are we restricting people regards which procs they can use now or something |
14:58:21 | FromDiscord | <Rika> are we adding a pragma `io` or an effect `parseeffect` or whatever that marks the proc for handling io |
14:58:36 | FromDiscord | <Rika> (i guess ioeffect already handles io) |
14:58:50 | FromDiscord | <Rika> i guess an effect isnt the way to go either |
14:58:57 | FromDiscord | <Rika> since that bubbles up |
14:59:48 | FromDiscord | <haxscramper> Isn't it what tainted mode was for?↵(@Rika) |
15:00:07 | FromDiscord | <haxscramper> To make everyone write converters and validate data |
15:00:35 | FromDiscord | <carmysilna> Well, there’s also “parse, don’t validate” to consider |
15:00:36 | FromDiscord | <Rika> i meant more "restricting" as in "people cannot make procs that handle stuff, it must go through stdlib stuff to convert" or so |
15:00:43 | FromDiscord | <Rika> (ofc stupid idea) |
15:02:28 | FromDiscord | <carmysilna> Maybe all io functions in the stdlib could also accept Twitter strings as input and it would be assumed that they would be properly sanitized |
15:04:10 | FromDiscord | <Rika> twitter strings? |
15:04:53 | FromDiscord | <carmysilna> Sorry, autocorrect. Tainted strings |
15:05:43 | FromDiscord | <Rika> that doesnt seem sensible; i dont understand exactly |
15:06:51 | FromDiscord | <carmysilna> So readFile accepts TaintedString as wells as string, and properly sanitizes the tainted string so that it is safe to open as a file name |
15:07:59 | FromDiscord | <Rika> hmm |
15:08:13 | FromDiscord | <Rika> that sounds complex |
15:08:21 | FromDiscord | <Rika> every proc that takes in a string needs to have a counterpart then |
15:08:40 | FromDiscord | <konsumlamm> In reply to @carmysilna "Oh, that’s funny. It": it's deprecsted in devel now |
15:08:47 | FromDiscord | <haxscramper> No, `readFile` path has very little to do with tained strings |
15:08:47 | FromDiscord | <konsumlamm> (edit) "deprecsted" => "depreca5ed" |
15:08:54 | FromDiscord | <konsumlamm> (edit) "depreca5ed" => "deprecated" |
15:08:54 | FromDiscord | <haxscramper> It has everything to do with `AbsFile = distinct string` |
15:09:06 | FromDiscord | <haxscramper> What it returns can be tainted string |
15:09:26 | FromDiscord | <haxscramper> Data from the outside world is 'tainted' and should be validated |
15:11:12 | FromDiscord | <haxscramper> That is also true, more or less. Handling absolutely everything via simple `string` - absolute/relative directory/file/link paths, environment variable names etc. is not the best idea↵(@Rika) |
15:11:20 | FromDiscord | <haxscramper> at least because of the overloading |
15:11:42 | FromDiscord | <haxscramper> Otherwise we end up with `removeFile`, `removeDir` as if we didn't have static typing |
15:12:27 | FromDiscord | <haxscramper> Well, remove procs might benefit from being explicit, so `exists()` or `.ext()` is a better |
15:12:33 | FromDiscord | <haxscramper> example |
15:18:04 | FromDiscord | <carmysilna> In reply to @konsumlamm "it's deprecated in devel": Oh, okay, good to know |
15:27:51 | * | Guest30 joined #nim |
15:28:09 | * | Guest30 quit (Client Quit) |
15:51:54 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:04:07 | * | stkrdknmibalz joined #nim |
17:03:50 | FromDiscord | <tandy> im trying to import a file from a parent dir, \`import ../types\` but i'm having trouble getting it to work.. |
17:07:29 | FromDiscord | <haxscramper> What is the error, or how does it fail? |
17:07:29 | FromDiscord | <tandy> oh nvm, the other file was importing the file i was trying to import from |
17:29:58 | FromDiscord | <tandy> is it possible to import like this \`import ../[types, utils]\`? |
17:34:50 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3tmR |
17:35:17 | FromDiscord | <Ayy Lmao> I can't seem to capture `window` inside `windowProc` because it needs to be `stdcall` |
17:37:44 | FromDiscord | <Ayy Lmao> I basically just want to define my own draw procedure on a per window basis. |
17:39:33 | FromDiscord | <demotomohiro> Only closure proc can capture, other proc cannot. |
17:39:58 | FromDiscord | <haxscramper> IIRC you have to do `import ".."/[types, utill]` |
17:40:19 | FromDiscord | <Ayy Lmao> So am I basically forced to keep a table of all HWND : Window pairs and look up the Window in `windowProc` ? |
17:40:52 | FromDiscord | <haxscramper> If the code is does not have to be threadsave you can use `{.global.}` for captures |
17:41:08 | FromDiscord | <haxscramper> Copy captured variable to global, and make callback have `nimcall` or `stdcall` |
17:41:13 | FromDiscord | <haxscramper> But this is a hack |
17:41:40 | FromDiscord | <Ayy Lmao> In reply to @haxscramper "If the code is": Ideally I would like to stay away from something like that |
17:42:04 | FromDiscord | <haxscramper> Then you need to have lookup table somewhere else |
17:42:37 | FromDiscord | <Ayy Lmao> Alright, I figured that might be the case. It seems I was on the right track |
17:42:47 | FromDiscord | <haxscramper> Or you can store pair window + proc somehoa |
17:43:55 | FromDiscord | <Ayy Lmao> `windowProc` only gets a `HWND` passed in so that's all I have to go by to determine which window it is. I still need to look up the `Window` by its `HWND` |
17:48:35 | FromDiscord | <demotomohiro> Im usually use look up table like `Table[SomeId, ref Data]` when I use callback function in C library. Easy to detect use of id after freeing data. |
17:49:40 | FromDiscord | <demotomohiro> As long as id is never reused. |
17:50:22 | FromDiscord | <Ayy Lmao> In reply to @demotomohiro "Im usually use look": I will give it a try and see if I can get it working |
17:55:53 | FromDiscord | <demotomohiro> It seems this API can set pointer to user data on hWnd.↵https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptrw |
17:58:11 | FromDiscord | <Ayy Lmao> In reply to @demotomohiro "It seems this API": Unfortunately I am limited as to what I can use from the win api. I am making an extension for Reaper which ports a small subset of the win api over to OSX/Linux. So if I want cross platform compatibility I have to stay within those constraints. |
17:59:10 | FromDiscord | <Ayy Lmao> They do seem to have `SetWindowLong` supported though |
18:16:50 | FromDiscord | <Ayy Lmao> Using `Window` as a `ref object` and creating a lookup table seems to work. |
19:16:22 | FromDiscord | <Stuffe> It seems you can't make a const out of a ref object or an object with a ref in it. The only work around I can think of for having a self referential const object is using a seq in the type, any other ideas? |
19:21:27 | FromDiscord | <haxscramper> `ref` is const is not supported yet https://github.com/nim-lang/Nim/pull/15528 |
19:22:03 | FromDiscord | <haxscramper> And I don't think there are any workarounds, at least if you need `ref` |
19:31:20 | FromDiscord | <ache of head> sent a code paste, see https://play.nim-lang.org/#ix=3tn7 |
19:31:51 | FromDiscord | <ache of head> and in general use expressions like this? |
19:32:54 | FromDiscord | <ache of head> the reason i'm asking this and not doing if something: echo a else: echo b is because i want to conditionally include something in a longer stdout.write |
19:33:24 | FromDiscord | <konsumlamm> In reply to @c1m5j "is there a way": if you would have tried that, you would have seen that it indeed works |
19:34:07 | FromDiscord | <ache of head> i tried it and it doesn't work 🤔 |
19:34:28 | FromDiscord | <ache of head> i wouldn't have asked if hadn't checked 😛 |
19:35:23 | FromDiscord | <ache of head> i get a "expression is of type string and has to be used or discarded" error |
19:39:48 | FromDiscord | <konsumlamm> huh |
19:39:59 | FromDiscord | <konsumlamm> do `a` and `b` have the same typem |
19:40:03 | FromDiscord | <konsumlamm> (edit) "typem" => "type?" |
19:40:54 | FromDiscord | <ache of head> sent a code paste, see https://play.nim-lang.org/#ix=3tna |
19:41:24 | FromDiscord | <ache of head> hmm |
19:41:28 | FromDiscord | <ache of head> i added an else clause and it worked |
19:41:30 | FromDiscord | <ache of head> interesting |
19:43:16 | FromDiscord | <ynfle (ynfle)> If not ,there is no type |
19:43:26 | FromDiscord | <konsumlamm> In reply to @c1m5j "well, even something like": why would it? there is no value for the else case |
19:44:10 | FromDiscord | <ache of head> so an else clause is required? |
19:44:36 | FromDiscord | <ynfle (ynfle)> Yes |
19:44:38 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Is there any way to make this work?↵↵var str = "hello"↵var xyz \: array[str.len, int] |
19:44:41 | FromDiscord | <ynfle (ynfle)> For an expression at least |
19:44:54 | FromDiscord | <ynfle (ynfle)> @BracketMaster What's the issue |
19:45:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I need to statically create an array with the length of a certain string |
19:45:23 | FromDiscord | <ynfle (ynfle)> It needs to be const |
19:45:34 | FromDiscord | <Bung> @haxscramper interesting! how you pass around ref types and returns between them. |
19:45:42 | FromDiscord | <ynfle (ynfle)> Else, the compiler doesn't know the length |
20:17:25 | FromDiscord | <haxscramper> In reply to @Bung "<@!608382355454951435> interesting! how you": Will test this tomorrow |
20:18:20 | FromDiscord | <ynfle (ynfle)> Do default parameters get reevaluated at every call? |
20:18:51 | * | krux02 joined #nim |
20:22:27 | FromDiscord | <haxscramper> Yes, use expandMacros to see how they are substituted |
20:23:48 | FromDiscord | <ynfle (ynfle)> Expand macros? I didn't know it was a macro |
20:24:08 | FromDiscord | <haxscramper> It is not a macro |
20:24:27 | FromDiscord | <haxscramper> expand macros shows ast after all expansions and substitutions |
20:24:32 | FromDiscord | <haxscramper> Not only macros |
20:24:57 | FromDiscord | <ynfle (ynfle)> Oh |
20:24:59 | FromDiscord | <ynfle (ynfle)> Interesting |
20:25:11 | FromDiscord | <ynfle (ynfle)> `proc t(x = now()) = echo x` |
20:25:30 | FromDiscord | <ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3tnj |
20:25:32 | FromDiscord | <ynfle (ynfle)> `t(now())` |
20:30:35 | krux02 | actually expandMacros is a macro |
20:30:37 | krux02 | I wrote it |
20:36:03 | FromDiscord | <hamidb80> hey krux |
20:45:10 | FromDiscord | <Schelz> hi, guys in not so experienced with nim but im with python, can someone please give me some websites where i can learn nim ? |
20:46:57 | FromDiscord | <carmysilna> In reply to @Schelz "hi, guys in not": https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
20:47:11 | FromDiscord | <Schelz> thx |
20:48:17 | FromDiscord | <Lefl> Hey, I'm using a library that implements a function `id(n: Node)` now the problem is I have an object that has a property `id: int`. How do I access the property? nim thinks I want to call the proc and raises an error |
20:50:50 | nixfreak_nim[m] | what am I doing wrong that .toCss isn't recognized ? https://play.nim-lang.org/#ix=3tnl |
20:51:26 | nixfreak_nim[m] | Error: undeclared field: 'toCss' for type system.string |
20:59:08 | nixfreak_nim[m] | Ok, nm I just reinstalled karax again and it seemed to work |
21:03:17 | FromDiscord | <ElegantBeef> @Lefl what library? |
21:03:35 | FromDiscord | <Lefl> Eh I meant module |
21:03:45 | FromDiscord | <Lefl> the `dom` one in the standard library |
21:04:44 | * | kayabaNerve joined #nim |
21:05:35 | FromDiscord | <Lefl> Oh maybe I'm stupid |
21:07:18 | FromDiscord | <ElegantBeef> There is no id field that i see for node |
21:11:52 | FromDiscord | <Lefl> Well I forgot to import the Object from my own module |
21:33:46 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3tnB↵↵For some reason, mysice is of type seq[NimNode] instead of string? |
21:33:49 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Macros are werid |
21:37:52 | FromDiscord | <ElegantBeef> It's not a `static` so it's taken as a Nimnode cause it can be an symbol or a literal |
21:38:58 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3tnC using static |
22:24:21 | * | beshr quit (Remote host closed the connection) |
22:34:47 | FromDiscord | <@bracketmaster-5a708063d73408ce4> thanks |
22:49:49 | FromDiscord | <demotomohiro> This news is related to Nim because Nim calls gcc in default and gcc calls `as` and `ld` in binutils.↵https://news.ycombinator.com/item?id=27875405 |
22:51:56 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Anything in particular about binutils I'm supposed to notice on that thread? |
22:52:21 | FromDiscord | <@bracketmaster-5a708063d73408ce4> It's a nice release note I guess |
22:57:21 | fn | <ForumUpdaterBot99> New thread by Fire: New Nim Discussion Site, see https://forum.nim-lang.org/t/8242 |
23:26:13 | * | max22- quit (Remote host closed the connection) |
23:31:29 | FromDiscord | <ajusa> What's the recommended way to interface with a C style array? `cstring`, `UncheckedArray`, `openarray`? |