00:10:44 | * | krux02 quit (Remote host closed the connection) |
00:19:47 | * | rockcavera quit (Remote host closed the connection) |
00:38:09 | * | PMunch quit (Quit: leaving) |
01:52:05 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
01:52:52 | * | vicecea quit (Remote host closed the connection) |
01:53:23 | * | vicecea joined #nim |
01:55:49 | * | Lord_Nightmare joined #nim |
02:19:42 | NimEventer | New thread by Icedquinn: Rhombus (a REBOL/Red/Ren parser), see https://forum.nim-lang.org/t/8666 |
02:52:40 | FromDiscord | <ajusa> Has anyone been able to get iface working on Nim 1.6? The example in the README no longer compiles: https://github.com/yglukhov/iface |
03:06:50 | arkanoid | didn't even know iface was a thing. Nice! |
03:06:58 | arkanoid | amazing how many things nim can do |
03:28:24 | FromDiscord | <ajusa> Yeah it's super cool that something like interfaces can be implemented as a library, external to the compiler. But as you can see, it definitely doesn't help when a language update breaks a feature like interfaces 😄 |
03:45:27 | FromDiscord | <Yardanico> if someone is willing to report an issue to nim's tracker, the minimal repro is this |
03:45:35 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Gxs |
03:46:42 | FromDiscord | <Yardanico> you can fix it by just having one varargs argument and then getting first and second argument |
03:48:08 | FromDiscord | <Yardanico> ah, it's been reported already |
03:48:08 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/19015 |
03:49:44 | FromDiscord | <Yardanico> there's a workaround that can be used for now, but of course it's quite ugly |
03:50:07 | FromDiscord | <Yardanico> with `macro iface(arg1, arg2: untyped, moreArgs: varargs[untyped] = void): untyped` signature iface works just fine |
03:57:04 | * | arkurious quit (Quit: Leaving) |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
04:19:47 | FromDiscord | <ajusa> In reply to @Yardanico "https://github.com/nim-lang/Nim/issues/19015": Thanks for finding and updating the issues! |
04:32:00 | FromDiscord | <pyautogui> Would there be a performance difference if bigints was implemented using static[int] and arrays instead of seqs? 4 arithmetic operations into something like that (calling it "variableints"), wondering if it is worth it performance wise. |
04:32:24 | FromDiscord | <Yardanico> In reply to @pyautogui "Would there be a": You might want to check out https://github.com/status-im/nim-stint because it seems to do what you describe |
04:32:31 | FromDiscord | <pyautogui> Thanks! |
04:35:59 | FromDiscord | <Yardanico> In reply to @pyautogui "Thanks!": ah, seems like actually stint doesn't use arrays for that, but there is an open PR with an array backend |
04:39:56 | FromDiscord | <Yardanico> there's a description in https://github.com/status-im/nim-stint/blob/master/stint/private/datatypes.nim#L23 |
05:12:47 | FromDiscord | <sOkam!> Is it possible to execute a bash command from inside a nim app?↵Or how does one interface with linux apps/os from nim?↵_(sry if super noob Q or wrong channel)_ _ping to re_ 🙏 |
05:13:05 | FromDiscord | <Yardanico> In reply to @sOkam! "Is it possible to": take a look at https://nim-lang.org/docs/osproc.html |
05:15:23 | FromDiscord | <impbox [ftsf]> `execCmd` is probably what you want |
05:15:33 | FromDiscord | <sOkam!> In reply to @Yardanico "take a look at": thats a lot of library. can you point me a bit more to what i should be looking for? |
05:15:48 | FromDiscord | <Yardanico> as impbox said |
05:16:14 | FromDiscord | <impbox [ftsf]> though depends what you want to do with the output of the script |
05:17:40 | FromDiscord | <sOkam!> In reply to @impbox "though depends what you": simple bash scripting. just that I found a bottleneck trying to organize the file into functions, since bash doesnt allow wrapping like that. it requires sequentiality and no access write access back to global variables from local inside a function |
05:18:54 | FromDiscord | <sOkam!> or just fully pure functions, with `return` as the only way to pass back information without making a real mess of uninteligible code 😔 |
05:20:12 | FromDiscord | <sOkam!> Inputs are 3 things, but they can vary↵Outputs are files to be modified, but the modifications can be done through linux tools no probl |
05:48:12 | NimEventer | New post on r/nim by Ruri: Using Winim/CLR to execute PowerShell and get the output?, see https://reddit.com/r/nim/comments/r5g5h5/using_winimclr_to_execute_powershell_and_get_the/ |
05:50:13 | NimEventer | New Nimble package! bluesoftcosmos - Bluesoft Cosmos extractor, see https://gitlab.com/lurlo/bluesoftcosmos |
07:14:41 | FromDiscord | <gogolxdong (liuxiaodong)> How to debug this |
07:14:47 | FromDiscord | <gogolxdong (liuxiaodong)> sent a code paste, see https://play.nim-lang.org/#ix=3GxY |
07:15:02 | FromDiscord | <Elegantbeef> Build a debug compiler |
07:16:51 | FromDiscord | <gogolxdong (liuxiaodong)> Is there any compile option can trace stack |
07:20:15 | FromDiscord | <Elegantbeef> You need a debug compiler |
07:25:33 | FromDiscord | <gogolxdong (liuxiaodong)> what's that? |
07:26:25 | FromDiscord | <Elegantbeef> You clone the Nim repo follow the compile steps then you should be able to do `./koch temp c yourFile.nim` |
07:31:57 | FromDiscord | <gogolxdong (liuxiaodong)> this error is from nimskull compiled project |
07:33:23 | FromDiscord | <konsumlamm> In reply to @pyautogui "Would there be a": it's faster, but that's different from bigints, since then they can't get arbitrarily large anymore |
07:35:18 | FromDiscord | <Elegantbeef> What's the project? |
07:35:27 | FromDiscord | <Elegantbeef> I can debug it for you if needed |
07:35:58 | FromDiscord | <Elegantbeef> It's simply build Nim compiler then run the nim compiler on the code instead of just an exception you get a stack trace |
07:36:29 | * | fputs3 joined #nim |
07:38:11 | * | fputs quit (Ping timeout: 256 seconds) |
07:38:11 | * | fputs3 is now known as fputs |
07:39:51 | FromDiscord | <Elegantbeef> So in the case of nimskull you do the same thing as Nim, but pretend it's different |
07:40:20 | FromDiscord | <Paszxy> is the nimble website down? |
07:41:54 | supakeen | Doesn't work here either, it's a 502. |
08:06:47 | * | mahlon quit (Read error: Connection reset by peer) |
08:08:04 | FromDiscord | <Yardanico> @federico3 ^ |
08:21:28 | * | mahlon joined #nim |
08:22:52 | FromDiscord | <steschuser (steschuser)> sent a code paste, see https://play.nim-lang.org/#ix=3Gym |
08:23:22 | FromDiscord | <Elegantbeef> There is `cstringarray` |
08:24:25 | FromDiscord | <steschuser (steschuser)> uhhh |
08:24:30 | FromDiscord | <steschuser (steschuser)> that sounds good |
08:24:43 | FromDiscord | <Elegantbeef> Well that's what you want anyway |
08:25:10 | FromDiscord | <pmunch> You could also try Futhark 🙃 |
08:25:27 | FromDiscord | <steschuser (steschuser)> Indeed it is! Thank you ❤️ |
08:25:27 | FromDiscord | <Elegantbeef> That could work aswell |
08:25:43 | FromDiscord | <steschuser (steschuser)> futhark? |
08:26:57 | FromDiscord | <steschuser (steschuser)> oh I see |
08:27:03 | FromDiscord | <steschuser (steschuser)> still in Alpha |
08:27:15 | FromDiscord | <steschuser (steschuser)> I'll pass for now \:) |
08:28:02 | FromDiscord | <Elegantbeef> You did find pmunch's tool and not the programming language right? 😛 |
08:33:12 | * | neurocyte0132889 joined #nim |
08:33:12 | * | neurocyte0132889 quit (Changing host) |
08:33:12 | * | neurocyte0132889 joined #nim |
08:39:47 | * | mahlon quit (Ping timeout: 252 seconds) |
08:41:29 | * | xet7 quit (Remote host closed the connection) |
08:42:57 | * | xet7 joined #nim |
08:44:57 | * | mahlon joined #nim |
08:52:28 | * | mahlon quit (Ping timeout: 264 seconds) |
09:03:21 | FromDiscord | <steschuser (steschuser)> yeah |
09:07:33 | * | mahlon joined #nim |
09:22:27 | FromDiscord | <Stuffe> For what I am working on now I end up quite often defining global arrays for different types together with a high watermark integer. With the high watermark I manually keep track of how many I have used etc. I have probably 5 of these and I want to have functions for add, iteration and clear for all of them. Is there a generic way I could do this (preferably without macros if possible) |
09:25:22 | FromDiscord | <Elegantbeef> This is just an event counter basically? |
09:29:40 | FromDiscord | <Stuffe> no this is for preallocating a bunch of objects statically |
09:31:01 | FromDiscord | <Stuffe> say I have a `chair` object, i define this array of 1000 chairs and then have an integer to keep track of how many I have actually used |
09:31:33 | FromDiscord | <Elegantbeef> Ah yes a generic is easy |
09:32:16 | FromDiscord | <Elegantbeef> Making an example |
09:32:23 | FromDiscord | <Stuffe> ok thank you, was about to ask 🙂 |
09:33:08 | FromDiscord | <Stuffe> I would imagine creating an object definition with just 2 fields, the high watermark and the array, but then I don't know if/how you can initiate it with a generic array length |
09:37:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GyE |
09:37:06 | FromDiscord | <Elegantbeef> There's a nice simple impl to build from |
09:37:29 | FromDiscord | <Stuffe> ok ill try |
09:43:12 | FromDiscord | <Elegantbeef> That's badly named but meh |
10:18:06 | * | xet7 quit (Read error: Connection reset by peer) |
10:18:37 | * | xet7 joined #nim |
10:18:47 | * | xet7 quit (Read error: Connection reset by peer) |
10:19:15 | * | xet7 joined #nim |
10:34:01 | * | flynn quit (Quit: Ping timeout (120 seconds)) |
10:37:15 | FromDiscord | <Zoom> Eh, do we have something for an empty iterator? Declaring a bool flag feels wrong. |
10:37:42 | FromDiscord | <Rika> What would an empty iterator do? |
10:37:59 | FromDiscord | <Zoom> I mean I'd like to check if it is |
10:38:42 | FromDiscord | <Elegantbeef> there is `finished` but if it's a closure it you need to run it once afaik |
10:48:43 | FromDiscord | <Zoom> That's not it. The funny thing is, I wanted to paste a 4 line example and caught a bug\: https://play.nim-lang.org/#ix=3GyR |
10:49:34 | FromDiscord | <Zoom> Not exactly a bug, more of an unhelpful error |
10:53:13 | FromDiscord | <Zoom> That's the shortest internal error I've seen yet! `for _ in []: discard` |
11:06:24 | * | PMunch joined #nim |
11:55:34 | arkanoid | How would you obfuscate a string constant inside your binary? |
12:01:22 | FromDiscord | <konsumlamm> In reply to @Zoom "Not exactly a bug,": "internal error" is always a bug |
12:02:07 | * | m33mt33n joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:30 | * | supakeen joined #nim |
12:06:48 | m33mt33n | anyone knows why uncompressed size of nim source code is > 900MB?? |
12:08:19 | m33mt33n | ??? |
12:14:33 | * | m33mt33n quit (Read error: Connection reset by peer) |
12:18:22 | * | m33mt33n joined #nim |
12:20:21 | * | m33mt33n_3 joined #nim |
12:23:33 | * | m33mt33n_3 quit (Read error: Connection reset by peer) |
12:24:48 | PMunch | m33mt33n, where on earth do you get that number from? The official tarball is only 77.6MB uncompressed |
12:25:17 | * | m33mt33n quit (Ping timeout: 252 seconds) |
12:26:17 | PMunch | And the includes the built binaries |
12:27:03 | PMunch | Oh wait, the "source tarball" is in fact pretty massive |
12:28:16 | PMunch | It is apparently the bundled C code which is used to bootstrap the compiler |
12:29:51 | PMunch | Apparently built for all sorts of different targets |
12:30:18 | PMunch | At least that is what it looks like from diffing a random file between two of the folders |
12:31:58 | PMunch | Ah yes, looking at build.sh it seems like they are different versions for different targets |
12:34:25 | PMunch | Hmm, maybe someone can use Zippy and implement a pure-Nim self-decompressing version. So it can be called with the architecture in question and it will place the contents directly in c_code for the compilation to build with? |
13:05:15 | * | src joined #nim |
13:38:01 | Amun-Ra | that could be the size of the whole repo |
13:39:24 | Amun-Ra | nope, 138MB |
13:40:04 | PMunch | Amun-Ra, no it's just the Nim compiler built to C code for a bunch of different platforms |
13:40:17 | Amun-Ra | ah |
13:40:52 | PMunch | That takes 1.2GB according to my archiving utility |
14:04:27 | * | arkurious joined #nim |
14:22:23 | arkanoid | Yardanico: this goes sigsegv when doing "import mymdule" on python side. If I comment strenc it works. Do you have any idea? |
14:22:26 | arkanoid | https://play.nim-lang.org/#ix=3GzN |
14:22:50 | FromDiscord | <Yardanico> well, not really |
14:23:23 | FromDiscord | <Yardanico> strenc is really fragile, it's just a poc |
14:23:46 | arkanoid | sure it is, in fact I'd like to use it for just a couple if strings, not the whole project |
14:23:51 | FromDiscord | <Yardanico> I'm not sure why it got so much attention, because it really doesn't work well, and I don't know how to make it work well :) |
14:24:12 | FromDiscord | <Yardanico> In reply to @arkanoid "sure it is, in": I think you'd want to write some other code then, you don't need term rewriting for that |
14:24:47 | FromDiscord | <Yardanico> You can just have a template or macro that encrypts the string at compile time and decrypts at runtime, and call it explicitly |
14:26:58 | arkanoid | yes, I started from strenc because I liked the simple idea of rolling enc linked to built time. I should probably go nimcrypt, but I'm now experienced in encryption in general |
14:29:19 | FromDiscord | <Rika> strenc isnt really encryption though |
14:29:24 | FromDiscord | <Rika> the key is still on the binary |
14:29:36 | FromDiscord | <Rika> its as encryption as base64 is |
14:29:51 | arkanoid | yes yes I know, I just want to hide from kids |
14:30:06 | arkanoid | and also play around this, just because of nim |
14:30:27 | arkanoid | I yet have to find a proper use of compile time magic |
14:30:31 | FromDiscord | <Yardanico> In reply to @Rika "its as encryption as": well technically it is encryption if you didn't know the xor key :) but it can be easily bruteforced, yes |
14:30:58 | FromDiscord | <Rika> yeah but it's still on the binary innit? |
14:31:18 | FromDiscord | <Yardanico> yes, in strenc case, but xor encryption itself is different from base-n |
14:31:24 | FromDiscord | <Rika> yes in that case |
14:31:24 | FromDiscord | <Yardanico> base-n is just an encoding |
14:31:30 | FromDiscord | <Rika> i mean only in strencs case |
14:31:36 | FromDiscord | <Rika> anywhere else yes its encryption |
14:32:16 | FromDiscord | <Yardanico> In reply to @arkanoid "yes, I started from": Well, as I said you can easily create your own strenc with encryption for specific strings |
14:32:59 | arkanoid | sure I'm going that direction, also pulling in nimcrypto as I've never used it before and seems solid |
14:33:46 | FromDiscord | <Yardanico> any reason why? |
14:34:21 | arkanoid | no, just out of personal interest |
14:44:55 | arkanoid | Yardanico: found this https://github.com/nim-lang/Nim/issues/16620 |
14:45:09 | FromDiscord | <Yardanico> yeah, i know that term-rewriting macros have a lot of issues |
14:45:13 | FromDiscord | <Yardanico> they might be even removed in the future |
14:45:25 | FromDiscord | <gogolxdong (liuxiaodong)> what's the way of doing static linking? |
14:45:29 | arkanoid | I'm unwrapping strenc into manual mode |
14:46:05 | arkanoid | --passL:"-static" in your project.nims |
14:46:31 | arkanoid | there are multiple ways actually |
14:48:14 | FromDiscord | <gogolxdong (liuxiaodong)> like link against libmariadb.dll? |
14:50:07 | FromDiscord | <gogolxdong (liuxiaodong)> tried , but didn't link together |
14:56:20 | FromDiscord | <Zoom> Hey guys, any patterns you use for `--dry-run` or other options which are frequently-checked but permanent for all the running time of your program?↵I move the whole main loop into an `Impl` template with a bool parameter and instantiate a proc based on the user settings. Is there a reason I should not do it? I understand the implications of having multiple such options in a template, of course \:D |
14:59:16 | FromDiscord | <Yardanico> In reply to @Zoom "Hey guys, any patterns": not sure I understood your question, but can't you just parse user configuration into some object initially, and then just pass that object around? |
14:59:21 | FromDiscord | <Yardanico> it'll be pretty efficient and easy to use |
15:01:24 | arkanoid | Yardanico: I've converted the term rewriting macro into a simple macro and I'm encrypting the result of a staticRead. I'm compiling with --d:release and --passL:-s, but "stings mylib.so | grep contents" results in perfectly readable stuff |
15:01:57 | FromDiscord | <Yardanico> how exactly are you doing it? |
15:02:07 | FromDiscord | <Yardanico> first of all, if you have a `const` string nim will decrypt it at compile time anyway |
15:02:12 | FromDiscord | <Yardanico> and then the C compiler might also try to do a similar thing |
15:02:13 | * | nrds quit (Remote host closed the connection) |
15:03:07 | arkanoid | well, that's what's happening probably. The only changed line from your code is the signature: macro encrypt*(s: static[string]): untyped = |
15:05:21 | FromDiscord | <Yardanico> this works just fine for me: |
15:05:28 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GAm |
15:05:57 | FromDiscord | <Yardanico> obviously your string has to be `var` or `let`, otherwise it'll be decrypted at compile-time |
15:07:29 | FromDiscord | <Yardanico> and yeah, you can change the macro arg to static[string], that won't hurt |
15:08:40 | arkanoid | found my error while you were typing. I has the equivalent of "const testStr = enc("hello world!")", so compiler was running symmetric crypt function twice at compile time |
15:08:41 | FromDiscord | <Yardanico> this is when compiling with arc - the C code simply references the encoded string and the xor decryption key to it, and assings the result to the variable https://media.discordapp.net/attachments/371759389889003532/915258035079905321/unknown.png |
15:09:00 | FromDiscord | <Yardanico> which is then assigned to `testStr` and few to echo, then destroyed |
15:09:03 | FromDiscord | <Yardanico> (edit) "few" => "fed" |
15:10:27 | arkanoid | yeah it works now |
15:13:43 | * | vicecea quit (Remote host closed the connection) |
15:14:01 | arkanoid | Yardanico: how to hide bad languages :D -> https://play.nim-lang.org/#ix=3GAn |
15:14:14 | * | vicecea joined #nim |
15:14:15 | FromDiscord | <Yardanico> you might also consider using python obfuscators :) |
15:14:21 | FromDiscord | <Yardanico> store python itself as bytecode, etc |
15:15:36 | arkanoid | sure, it's just a playful wrapper, not really intended to be useful |
15:21:09 | FromDiscord | <pmunch> Still in alpha, but still better than any of the other C wrapping solutions I've tried for Nim. I use it in production at work and it works flawlessly for wrapping a large C library (Unbound DNS server) |
15:22:13 | arkanoid | PMunch: what do you mean? I'm playing wrapping python here |
15:22:55 | arkanoid | Yardanico: why static[string] is not needed here? https://play.nim-lang.org/#ix=3GAm , isn't arg "s" an ast node without it? |
15:23:11 | FromDiscord | <Yardanico> yes, so I do `$s` to get the string value out of it |
15:23:16 | FromDiscord | <Yardanico> but static[string] is more correct, yes |
15:23:28 | FromDiscord | <Yardanico> $s will error out for cases when you pass a runtime string to the macro |
15:23:29 | arkanoid | thanks |
15:25:04 | arkanoid | just out of curiosity, what editor are you using here? is it vim? https://media.discordapp.net/attachments/371759389889003532/915258035079905321/unknown.png |
15:25:08 | FromDiscord | <Rika> arkanoid hes not replying to you |
15:25:49 | arkanoid | Rika, k |
15:26:25 | FromDiscord | <Yardanico> In reply to @Rika "arkanoid hes not replying": wat |
15:26:31 | FromDiscord | <Yardanico> In reply to @arkanoid "just out of curiosity,": vscode :P |
15:26:35 | FromDiscord | <Yardanico> with monokai vibrant theme |
15:28:31 | FromDiscord | <Zoom> Wait, were you answering me? In case you were, I meant how to minimize excessive checking for some settings in a hot loop.↵(@Yardanico) |
15:28:56 | FromDiscord | <Yardanico> In reply to @Zoom "Wait, were you answering": well, as I said, you can just parse the configuration and store it in an object |
15:29:09 | FromDiscord | <Yardanico> or rewrite your logic so you don't need to check for that setting as much |
15:29:12 | arkanoid | k. I'm also using vscode, but yet I'm not sure if I'm using the full potential of it for nim. I have to restart it quite often, I have "insert" key randomly enabling (so I write over my test when typing), I have "canc" button also randomly stop working for deletion but kills vscode terminal window instead, then I have inconsistent tab spaces, for example in a project where I mix python and nim vscode |
15:29:14 | arkanoid | doesn't understand that I need 4 spaces for python and for nim |
15:29:55 | FromDiscord | <Rika> sounds like your install is fucked? |
15:30:06 | FromDiscord | <Rika> nim extension forces 2, change in the settings |
15:30:09 | FromDiscord | <Rika> insert idk |
15:30:22 | FromDiscord | <Rika> restarts are prolly supposed to be handle by the plugin |
15:30:31 | FromDiscord | <Rika> canc? |
15:30:34 | FromDiscord | <Rika> cancel? |
15:30:42 | FromDiscord | <Rika> dunno how that would work |
15:32:51 | FromDiscord | <Zoom> How is using an object relevant to my question? This is probably the proper way to store a config of course, but you need to read it anyway at some point ;)↵Anyway, at least you didn't have any objections to the way I do it, so it's fine.↵(@Yardanico) |
15:33:02 | arkanoid | I'm using codium 1.56 from ubuntu LTS 20.04 snap store |
15:33:03 | FromDiscord | <Yardanico> In reply to @Zoom "How is using an": it is directly relevant |
15:33:13 | FromDiscord | <Rika> reading an object is fast enough |
15:33:21 | FromDiscord | <Yardanico> instead of checking the argument each time you just parse the arguments that were passed to the program and store them in an object as native nim types |
15:33:36 | FromDiscord | <Yardanico> you'll only have to read it once |
15:33:41 | FromDiscord | <Yardanico> (the user-provided config) |
15:33:48 | arkanoid | Rika, which vscode nim extensions should I stay on? I need the most stable/complete |
15:34:17 | FromDiscord | <Rika> saem's prolly, or koz's if you're having issues with one or the other |
15:34:20 | FromDiscord | <Rika> i dont use vscode |
15:34:24 | FromDiscord | <Zoom> Again this is not relevant. I wasn't asking how to read the settings. Do you think I actually request arguments each time I need to check a key?↵(@Yardanico) |
15:34:35 | FromDiscord | <Yardanico> In reply to @Zoom "Again this is not": then what is your question? i still don't understand |
15:34:36 | FromDiscord | <Rika> if you have a large config object you might need to store the specific config values you need on separate variables, i assume prolly due to caches and whatever |
15:34:46 | FromDiscord | <Rika> its just a guess |
15:34:57 | FromDiscord | <Rika> i dont have any idea about caches and memory accesses at this level |
15:36:41 | FromDiscord | <Zoom> Ok, I give up as this is absolutely not important. What I suggested is just a tiny bit of an optimization which replaces a few `if bool`s to a separate routine with the checks omitted on CT. |
15:51:28 | FromDiscord | <gdquest> sent a long message, see http://ix.io/3GAx |
15:52:44 | FromDiscord | <gdquest> All tests involving code blocks fail like that, and the character indices reported by the diff algorithm are weird. Any idea of what that could be? |
15:53:13 | FromDiscord | <Rika> Newline? |
15:53:23 | FromDiscord | <gdquest> You can see in the diff it says character 3 |
15:53:33 | FromDiscord | <Rika> Didn’t realise |
15:53:35 | FromDiscord | <Yardanico> is this tool your own or it's some open-source nim library? |
15:53:55 | FromDiscord | <gdquest> In another example it says 6, but that's basically where you see `gdscript` at the start of markdown code blocks |
15:53:57 | FromDiscord | <Yardanico> also it might be better to send the error output as a file, it might have some other characters or spaces that are not visible in discord |
15:54:48 | FromDiscord | <gdquest> In reply to @Yardanico "is this tool your": It's something I'm coding right now, basically rewriting a Python program that has some issues and needed a different algorithm |
15:55:18 | FromDiscord | <gdquest> It's open-source, here's the code branch: <https://github.com/GDQuest/product-packager/tree/format_tutorials_rewrite/format_tutorials> |
15:56:57 | FromDiscord | <gdquest> Here's the error log as a text file https://media.discordapp.net/attachments/371759389889003532/915270185429127208/error_log.txt |
15:58:58 | FromDiscord | <Yardanico> In reply to @gdquest "Here's the error log": well, it's pretty clear with `repr` and also with your log |
15:58:59 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/915270692512092180/unknown.png |
15:59:20 | FromDiscord | <Yardanico> \10 is ascii linefeed (newline) |
15:59:37 | FromDiscord | <Yardanico> expected doesn't have it, but formatted does |
16:00:07 | FromDiscord | <gdquest> A trailing newline, okay, thank you |
16:00:15 | FromDiscord | <gdquest> You call repr() on the string to get this output? |
16:00:39 | FromDiscord | <Yardanico> yes, `repr` does some stuff like converting some invisible ascii chars to their decimal representation |
16:00:49 | FromDiscord | <gdquest> Okay that's really good to know, thanks |
16:00:52 | FromDiscord | <Yardanico> `echo repr expected` and then `echo repr formatted` |
16:01:05 | FromDiscord | <Rika> Huh I was somehow right |
16:01:10 | FromDiscord | <Rika> Lucky |
16:01:13 | FromDiscord | <gdquest> Yup! |
16:01:24 | FromDiscord | <Rika> Hell of a potshot |
16:02:48 | FromDiscord | <Yardanico> In reply to @gdquest "Yup!": also `diffText` shows you not the index of the character but the line |
16:02:58 | FromDiscord | <Yardanico> "Find the difference in 2 text documents, comparing by textlines." |
16:03:22 | FromDiscord | <gdquest> I see, missed that. Thanks much for the help! |
16:03:27 | FromDiscord | <Yardanico> I've actually used https://github.com/mark-summerfield/diff myself when I needed some diffing |
16:03:44 | FromDiscord | <gdquest> I have to tackle that on top of a mountain of work and I'm starting to fail to see things |
16:43:10 | * | dv^_^5 joined #nim |
16:44:30 | * | arkanoid quit (Ping timeout: 256 seconds) |
16:45:04 | * | dv^_^ quit (Ping timeout: 256 seconds) |
16:45:04 | * | nisstyre quit (Ping timeout: 256 seconds) |
16:45:05 | * | mal`` quit (Ping timeout: 256 seconds) |
16:46:31 | * | arkanoid joined #nim |
16:46:49 | * | mal`` joined #nim |
16:46:59 | * | dv^_^ joined #nim |
16:48:59 | * | dv^_^5 quit (Ping timeout: 256 seconds) |
16:58:18 | * | nisstyre joined #nim |
17:16:45 | * | rockcavera joined #nim |
17:16:45 | * | rockcavera quit (Changing host) |
17:16:45 | * | rockcavera joined #nim |
17:44:23 | FromDiscord | <sOkam!> @gdquest on nim 😮↵poggies |
17:45:51 | FromDiscord | <sOkam!> Waiting for 4.0 to nim with gdextension myself. Terrified to do so earlier↵Are you with nim on 3.x or 4.? |
17:55:54 | FromDiscord | <gdquest> I'm using nim for standalone tools right now |
17:57:12 | FromDiscord | <gdquest> I'm testing and practicing with some modern compiled languages, trying to look a bit into the modern C replacements (Zig, Odin) and other approaches like Nim and well I'll have to do some more Rust at some point |
17:57:42 | FromDiscord | <gdquest> But at least for Nim I found it's a really good fit for us to develop small programsx |
17:57:44 | FromDiscord | <gdquest> (edit) "programsx" => "programs" |
17:59:08 | FromDiscord | <gdquest> I'm using it to write a very specialized formatter and builder for my team after going with Python and using existing tools like `make`, `scons`, and some others |
18:03:14 | FromDiscord | <sOkam!> i see, makes sense |
18:29:04 | * | neurocyte0132889 quit (Ping timeout: 264 seconds) |
18:33:59 | FromDiscord | <cschardt (Christof Schardt)> [https---github.com-mark-summerfield-diff.url](https://files.gitter.im/5602f03e0fc9f982beb19f61/LfhQ/https---github.com-mark-summerfield-diff.url) |
18:36:36 | FromDiscord | <Yardanico> huh? |
18:39:13 | * | krux02 joined #nim |
20:01:57 | * | MightyJoe quit (Ping timeout: 250 seconds) |
20:49:54 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GC3 |
20:53:42 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GC9 |
20:53:51 | FromDiscord | <Yardanico> same for strings |
20:56:49 | FromDiscord | <TryAngle> In reply to @Yardanico "This passes by a": ok thanks, how would I pass by reference then? |
20:57:34 | FromDiscord | <Yardanico> You can do `var seq[Expression]`, but when you assign it to HtmlWriter it'll still get copied |
20:58:33 | FromDiscord | <TryAngle> what do I have to write in HtmlWriter to not copy but take the reference? |
20:59:02 | FromDiscord | <Yardanico> Short answer - you can't do that safely |
20:59:22 | FromDiscord | <Yardanico> Because that would require lifetime tracking and stuff |
20:59:33 | FromDiscord | <Yardanico> Nim had view types, but they're in a very experimental state |
21:00:01 | FromDiscord | <Yardanico> you can have a reference to pass around if you either store that seq in a ref object |
21:00:15 | FromDiscord | <Yardanico> Or use ref seq[...] instead |
21:02:33 | FromDiscord | <TryAngle> hmm so in HtmlWriter I also write ref before the type in the field and everywhere where I use it the [] operator after? |
21:03:52 | FromDiscord | <Yardanico> In reply to @TryAngle "hmm so in HtmlWriter": Yeah, or you can have HtmlWriter as a ref object, then you'll be able to pass a seq inside of it around without problems |
21:04:16 | FromDiscord | <Yardanico> Any reason you want to capture a reference like that? Usually you'd model your code in objects |
21:06:40 | FromDiscord | <TryAngle> In reply to @Yardanico "Any reason you want": I'm writing text format that I want to compile to HTML and I want to also learn a bit about nim by focusing a bit on performance, and want to start with avoiding duplication of huge elements. |
21:07:44 | FromDiscord | <haxscramper> You might consider writing data to stream immediately instead of storing it in the intermediate location |
21:08:18 | FromDiscord | <TryAngle> In reply to @Yardanico "Yeah, or you can": how do I pass the seq in the proc after marking it as a ref if the seq is not a ref initially? |
21:08:53 | FromDiscord | <TryAngle> In reply to @haxscramper "You might consider writing": hmm I add a lot of post processing so this doesn't sound that viable 🤔 |
21:09:20 | FromDiscord | <haxscramper> your text format is something like markdown, correct? |
21:09:20 | FromDiscord | <TryAngle> (edit) "In reply to @haxscramper "You might consider writing": hmm I add a lot of post processing so this doesn't sound that viable ... 🤔" added "(not in the html part but in the expression part" |
21:09:39 | FromDiscord | <TryAngle> basically |
21:10:10 | FromDiscord | <TryAngle> but I also add like file inclusions etc. |
21:10:15 | FromDiscord | <haxscramper> and the `Expression` is a object of this format's AST/? |
21:10:39 | FromDiscord | <haxscramper> So you have `Expression` anyway, right, you just don't want to copy when you move things to html writer? |
21:10:54 | FromDiscord | <haxscramper> Also if you make the Expression a `ref object` seq copy is not that bad |
21:11:03 | FromDiscord | <TryAngle> In reply to @haxscramper "and the `Expression` is": similar I might move it to a more AST like structure later |
21:11:09 | FromDiscord | <TryAngle> In reply to @haxscramper "So you have `Expression`": yes |
21:11:25 | FromDiscord | <haxscramper> For a `100` objects you would copy `sizeof(ref) 100` which is not a lot |
21:12:34 | FromDiscord | <haxscramper> In reply to @TryAngle "yes": So if you process the data before passing it to the writer (the preprocessing step you mentioned), and then just want to convert it out to html then you can do it directly after preprocessing step |
21:13:34 | FromDiscord | <haxscramper> For org-mode I do roughly this - https://github.com/haxscramper/haxorg/blob/master/src/haxorg/exporter/exporter_html.nim#L99-L110 |
21:13:49 | FromDiscord | <haxscramper> Process all data, have it in single place, then write things out |
21:15:11 | FromDiscord | <TryAngle> In reply to @haxscramper "Also if you make": hmmm I might have a missconception here but if I make expression a ref object doesn't it become a heap object then?↵sry this project is the first thing I ever write in Nim |
21:15:49 | FromDiscord | <haxscramper> it does become a heap object,yes |
21:16:24 | FromDiscord | <haxscramper> but heap does not equate to slow |
21:16:45 | FromDiscord | <haxscramper> and of course there is a question of how fast you want to go, and whether these optimizations are needed |
21:17:20 | FromDiscord | <haxscramper> Needlessly copying data around is probably something that need to be avoided, but switching to `ref` in order to make copying cheaper is also an option |
21:18:49 | FromDiscord | <TryAngle> that's true indeed 🤔 |
21:22:56 | FromDiscord | <Digitalcraftsman> sent a code paste, see https://play.nim-lang.org/#ix=3GCi |
21:25:28 | FromDiscord | <haxscramper> I don't really use cligen, but have you tried adding `{.requiresinit.}` annotations to the necessary fields? Alternatively, try to make them `Option[string]` and raise validation error yourself. |
21:26:23 | FromDiscord | <haxscramper> With Option you would know if the value were really omitted and not just passed empty string (if this is allowed. If not, do the validation and check for non-empty string) |
21:28:06 | FromDiscord | <Digitalcraftsman> With requires `{.requiresinit.}` the program will not compile. My goal is to check the presence of given parameters at runtime. |
21:29:11 | FromDiscord | <Digitalcraftsman> But now I realize that I've to validate the input and output fields anyway since they could be invalid even if given by the user. |
21:29:49 | FromDiscord | <Digitalcraftsman> (edit) removed "requires" |
21:42:43 | * | Pyautogui joined #nim |
22:04:40 | * | Pyautogui quit (Quit: Connection closed) |
22:11:27 | FromDiscord | <TryAngle> when iterating over a file, is there a way to also get the position of the char? |
22:14:52 | * | terminalpusher joined #nim |
22:16:36 | * | PMunch quit (Quit: leaving) |
22:26:27 | FromDiscord | <reilly> Does anybody have any idea how to get something like this working? I can't work it out for the life of me.↵https://play.nim-lang.org/#ix=3GCA↵I don't care if it uses the same method that I'm trying to use, all I care about is that I have an object that contains a single value of some arbitrary type. |
22:29:45 | FromDiscord | <Elegantbeef> You have to do it the other way https://play.nim-lang.org/#ix=3GCB |
22:29:59 | FromDiscord | <Elegantbeef> You give the call for the body, not take the body from the call |
22:31:54 | FromDiscord | <Elegantbeef> The issue you were facing is that you had a case expression that wasnt type consistent so it'd of course error |
22:32:45 | FromDiscord | <Elegantbeef> Depending on what you're doing you may want to look at leorize's union package https://github.com/alaviss/union |
22:33:16 | FromDiscord | <Elegantbeef> @TryAngle\: `getFilePos`? |
22:33:28 | FromDiscord | <enthus1ast> @reilly\: or even json |
22:34:09 | FromDiscord | <Elegantbeef> I hate you enthus 😛 |
22:34:38 | FromDiscord | <enthus1ast> ;) |
22:34:38 | FromDiscord | <enthus1ast> g8 |
22:34:38 | FromDiscord | <enthus1ast> its late here; bedtime |
22:34:39 | FromDiscord | <Elegantbeef> Only in Nim is "use json for tagged unions" a common suggestion |
22:34:39 | FromDiscord | <Elegantbeef> Buh bye |
22:40:25 | FromDiscord | <reilly> Works like a charm and makes perfect sense, thank you. |
22:45:32 | * | terminalpusher quit (Remote host closed the connection) |
22:45:54 | * | terminalpusher joined #nim |
22:47:33 | FromDiscord | <Daniel M. Jaén> https://stackoverflow.com/questions/41397499/how-to-load-file-line-by-line-in-nim |
22:53:46 | FromDiscord | <Elegantbeef> There is also filestream which also has `getPosition` |
23:03:28 | * | nrds joined #nim |
23:12:47 | * | terminalpusher quit (Remote host closed the connection) |
23:14:19 | * | src quit (Quit: Leaving) |
23:20:54 | * | oprypin quit (Quit: Bye) |
23:21:03 | * | oprypin joined #nim |
23:25:30 | FromDiscord | <el__maco> hmm today I learned the hard way that the max() function didn't do what I hoped it would do <https://play.nim-lang.org/#ix=3GCH> |
23:25:36 | FromDiscord | <el__maco> I wonder what it actually does |
23:26:11 | FromDiscord | <el__maco> it returns a vec3, the compiler is cool with it, but the value is that of the second parameter it would seem like |
23:30:09 | FromDiscord | <Elegantbeef> Well you're using tuples so... take that 😛 |
23:30:23 | FromDiscord | <el__maco> I'm not supposed to use tuples? |
23:30:28 | FromDiscord | <Elegantbeef> It binds to the first tuple type, and converts the second one to that since it's the same type |
23:31:07 | FromDiscord | <Elegantbeef> Well tuples are distinct types `vec3` is an alias to `(x: float32, y: float32, z: float32)` which is implicitly convertible to (float32, float32, float32)\` |
23:31:14 | FromDiscord | <Elegantbeef> are not distinct types\ |
23:31:51 | FromDiscord | <el__maco> I was hoping the max() would return a component-wise max of the two tuples |
23:32:29 | FromDiscord | <Elegantbeef> It just does `y if y <= x: x else: y` |
23:33:20 | FromDiscord | <el__maco> I guess the mystery then is what is ``<=`` if y and x are tuples |
23:33:31 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L1878 |
23:33:38 | FromDiscord | <el__maco> I wonder if vec3 should be an object instead |
23:33:57 | FromDiscord | <Elegantbeef> Can be many things, tuples are generally bad for this imo |
23:35:53 | FromDiscord | <el__maco> a tuple seemed nice because you can construct using literals (a,b,c) |
23:36:27 | FromDiscord | <Elegantbeef> sure but you can always make a constructor then it's just `vec3(x, y, z)` |
23:36:58 | FromDiscord | <Elegantbeef> It's of course up to you what to do you can make your own `max`/`min` procs |
23:38:07 | FromDiscord | <el__maco> yeah I solved this by making a ``proc v3max``. Though I have to say I'm looking at the generic <= for tuples and I'm still not sure what exactly is happening 😅 |
23:38:33 | FromDiscord | <Elegantbeef> It's using the system cmp proc and using integers dumbly |
23:38:46 | FromDiscord | <Elegantbeef> If any component is less than one it returns true otherwise false |
23:38:46 | FromDiscord | <Elegantbeef> Or vice versa |
23:39:15 | FromDiscord | <el__maco> I see. It certainly didn't do what I was hoping it to do |
23:39:56 | FromDiscord | <Elegantbeef> You can just do `proc max(a, b: Vec3) = (max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2]))` |
23:39:58 | FromDiscord | <el__maco> seems to evaluate the "max" based on the first value in the tuple |
23:40:13 | FromDiscord | <Elegantbeef> Nope |
23:40:55 | FromDiscord | <Elegantbeef> You pass a anonymous tuple which `Vec3` can implicitly convert to, which is why it doesnt have `x, y, z` |
23:40:58 | FromDiscord | <TryAngle> speaking of Vec3 type↵does nim have something like const generics from Rust?↵like vec[N: int, T]↵allows like Vec[3, int](4, 3, 8) |
23:41:21 | FromDiscord | <Elegantbeef> Yes nim has `type Vec[size: static int] = array[size, float32]` |
23:41:23 | * | |smlckz| quit (Quit: WeeChat 3.2) |
23:41:32 | FromDiscord | <Elegantbeef> `static T` is a compile time value that works on all objects |
23:41:49 | FromDiscord | <Elegantbeef> Unlike rust dependant types work for most types even objects |
23:42:05 | FromDiscord | <TryAngle> and this also allows like↵type vec3[T] = distinct vec[3, T] ↵? |
23:42:37 | FromDiscord | <Elegantbeef> Indeed |
23:42:43 | FromDiscord | <TryAngle> thanks! |
23:43:17 | FromDiscord | <Elegantbeef> You could always make the base type a distinct then dont need it for all the children |
23:45:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GCM |
23:46:19 | FromDiscord | <Elegantbeef> Some syntax issues 😀 |
23:49:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GCN |
23:50:05 | FromDiscord | <TryAngle> thank you 👍 |
23:50:32 | FromDiscord | <Elegantbeef> No problem |
23:50:49 | FromDiscord | <Elegantbeef> There are also a variety of vector libraries if you dont want to reinvent the wheel for the 300th time |
23:52:11 | FromDiscord | <TryAngle> sure I know don't worry 😂 ↵Haven't needed any algebra yet but will look if I need one |
23:52:27 | FromDiscord | <TryAngle> (edit) "yet" => "in nimyet" |
23:52:30 | FromDiscord | <TryAngle> (edit) "nimyet" => "nim yet" |
23:56:57 | FromDiscord | <michaelb> @dom96 with the new lock file ability in nimble, is it only the top-level lock file that's considered? |
23:58:33 | * | krux02 quit (Remote host closed the connection) |