<< 30-11-2021 >>

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:42NimEventerNew thread by Icedquinn: Rhombus (a REBOL/Red/Ren parser), see https://forum.nim-lang.org/t/8666
02:52:40FromDiscord<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:50arkanoiddidn't even know iface was a thing. Nice!
03:06:58arkanoidamazing how many things nim can do
03:28:24FromDiscord<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:27FromDiscord<Yardanico> if someone is willing to report an issue to nim's tracker, the minimal repro is this
03:45:35FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Gxs
03:46:42FromDiscord<Yardanico> you can fix it by just having one varargs argument and then getting first and second argument
03:48:08FromDiscord<Yardanico> ah, it's been reported already
03:48:08FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/19015
03:49:44FromDiscord<Yardanico> there's a workaround that can be used for now, but of course it's quite ugly
03:50:07FromDiscord<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:47FromDiscord<ajusa> In reply to @Yardanico "https://github.com/nim-lang/Nim/issues/19015": Thanks for finding and updating the issues!
04:32:00FromDiscord<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:24FromDiscord<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:31FromDiscord<pyautogui> Thanks!
04:35:59FromDiscord<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:56FromDiscord<Yardanico> there's a description in https://github.com/status-im/nim-stint/blob/master/stint/private/datatypes.nim#L23
05:12:47FromDiscord<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:05FromDiscord<Yardanico> In reply to @sOkam! "Is it possible to": take a look at https://nim-lang.org/docs/osproc.html
05:15:23FromDiscord<impbox [ftsf]> `execCmd` is probably what you want
05:15:33FromDiscord<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:48FromDiscord<Yardanico> as impbox said
05:16:14FromDiscord<impbox [ftsf]> though depends what you want to do with the output of the script
05:17:40FromDiscord<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:54FromDiscord<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:12FromDiscord<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:12NimEventerNew 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:13NimEventerNew Nimble package! bluesoftcosmos - Bluesoft Cosmos extractor, see https://gitlab.com/lurlo/bluesoftcosmos
07:14:41FromDiscord<gogolxdong (liuxiaodong)> How to debug this
07:14:47FromDiscord<gogolxdong (liuxiaodong)> sent a code paste, see https://play.nim-lang.org/#ix=3GxY
07:15:02FromDiscord<Elegantbeef> Build a debug compiler
07:16:51FromDiscord<gogolxdong (liuxiaodong)> Is there any compile option can trace stack
07:20:15FromDiscord<Elegantbeef> You need a debug compiler
07:25:33FromDiscord<gogolxdong (liuxiaodong)> what's that?
07:26:25FromDiscord<Elegantbeef> You clone the Nim repo follow the compile steps then you should be able to do `./koch temp c yourFile.nim`
07:31:57FromDiscord<gogolxdong (liuxiaodong)> this error is from nimskull compiled project
07:33:23FromDiscord<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:18FromDiscord<Elegantbeef> What's the project?
07:35:27FromDiscord<Elegantbeef> I can debug it for you if needed
07:35:58FromDiscord<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:51FromDiscord<Elegantbeef> So in the case of nimskull you do the same thing as Nim, but pretend it's different
07:40:20FromDiscord<Paszxy> is the nimble website down?
07:41:54supakeenDoesn't work here either, it's a 502.
08:06:47*mahlon quit (Read error: Connection reset by peer)
08:08:04FromDiscord<Yardanico> @federico3 ^
08:21:28*mahlon joined #nim
08:22:52FromDiscord<steschuser (steschuser)> sent a code paste, see https://play.nim-lang.org/#ix=3Gym
08:23:22FromDiscord<Elegantbeef> There is `cstringarray`
08:24:25FromDiscord<steschuser (steschuser)> uhhh
08:24:30FromDiscord<steschuser (steschuser)> that sounds good
08:24:43FromDiscord<Elegantbeef> Well that's what you want anyway
08:25:10FromDiscord<pmunch> You could also try Futhark 🙃
08:25:27FromDiscord<steschuser (steschuser)> Indeed it is! Thank you ❤️
08:25:27FromDiscord<Elegantbeef> That could work aswell
08:25:43FromDiscord<steschuser (steschuser)> futhark?
08:26:57FromDiscord<steschuser (steschuser)> oh I see
08:27:03FromDiscord<steschuser (steschuser)> still in Alpha
08:27:15FromDiscord<steschuser (steschuser)> I'll pass for now \:)
08:28:02FromDiscord<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:21FromDiscord<steschuser (steschuser)> yeah
09:07:33*mahlon joined #nim
09:22:27FromDiscord<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:22FromDiscord<Elegantbeef> This is just an event counter basically?
09:29:40FromDiscord<Stuffe> no this is for preallocating a bunch of objects statically
09:31:01FromDiscord<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:33FromDiscord<Elegantbeef> Ah yes a generic is easy
09:32:16FromDiscord<Elegantbeef> Making an example
09:32:23FromDiscord<Stuffe> ok thank you, was about to ask 🙂
09:33:08FromDiscord<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:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GyE
09:37:06FromDiscord<Elegantbeef> There's a nice simple impl to build from
09:37:29FromDiscord<Stuffe> ok ill try
09:43:12FromDiscord<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:15FromDiscord<Zoom> Eh, do we have something for an empty iterator? Declaring a bool flag feels wrong.
10:37:42FromDiscord<Rika> What would an empty iterator do?
10:37:59FromDiscord<Zoom> I mean I'd like to check if it is
10:38:42FromDiscord<Elegantbeef> there is `finished` but if it's a closure it you need to run it once afaik
10:48:43FromDiscord<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:34FromDiscord<Zoom> Not exactly a bug, more of an unhelpful error
10:53:13FromDiscord<Zoom> That's the shortest internal error I've seen yet! `for _ in []: discard`
11:06:24*PMunch joined #nim
11:55:34arkanoidHow would you obfuscate a string constant inside your binary?
12:01:22FromDiscord<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:48m33mt33nanyone knows why uncompressed size of nim source code is > 900MB??
12:08:19m33mt33n???
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:48PMunchm33mt33n, 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:17PMunchAnd the includes the built binaries
12:27:03PMunchOh wait, the "source tarball" is in fact pretty massive
12:28:16PMunchIt is apparently the bundled C code which is used to bootstrap the compiler
12:29:51PMunchApparently built for all sorts of different targets
12:30:18PMunchAt least that is what it looks like from diffing a random file between two of the folders
12:31:58PMunchAh yes, looking at build.sh it seems like they are different versions for different targets
12:34:25PMunchHmm, 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:01Amun-Rathat could be the size of the whole repo
13:39:24Amun-Ranope, 138MB
13:40:04PMunchAmun-Ra, no it's just the Nim compiler built to C code for a bunch of different platforms
13:40:17Amun-Raah
13:40:52PMunchThat takes 1.2GB according to my archiving utility
14:04:27*arkurious joined #nim
14:22:23arkanoidYardanico: this goes sigsegv when doing "import mymdule" on python side. If I comment strenc it works. Do you have any idea?
14:22:26arkanoidhttps://play.nim-lang.org/#ix=3GzN
14:22:50FromDiscord<Yardanico> well, not really
14:23:23FromDiscord<Yardanico> strenc is really fragile, it's just a poc
14:23:46arkanoidsure it is, in fact I'd like to use it for just a couple if strings, not the whole project
14:23:51FromDiscord<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:12FromDiscord<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:47FromDiscord<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:58arkanoidyes, 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:19FromDiscord<Rika> strenc isnt really encryption though
14:29:24FromDiscord<Rika> the key is still on the binary
14:29:36FromDiscord<Rika> its as encryption as base64 is
14:29:51arkanoidyes yes I know, I just want to hide from kids
14:30:06arkanoidand also play around this, just because of nim
14:30:27arkanoidI yet have to find a proper use of compile time magic
14:30:31FromDiscord<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:58FromDiscord<Rika> yeah but it's still on the binary innit?
14:31:18FromDiscord<Yardanico> yes, in strenc case, but xor encryption itself is different from base-n
14:31:24FromDiscord<Rika> yes in that case
14:31:24FromDiscord<Yardanico> base-n is just an encoding
14:31:30FromDiscord<Rika> i mean only in strencs case
14:31:36FromDiscord<Rika> anywhere else yes its encryption
14:32:16FromDiscord<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:59arkanoidsure I'm going that direction, also pulling in nimcrypto as I've never used it before and seems solid
14:33:46FromDiscord<Yardanico> any reason why?
14:34:21arkanoidno, just out of personal interest
14:44:55arkanoidYardanico: found this https://github.com/nim-lang/Nim/issues/16620
14:45:09FromDiscord<Yardanico> yeah, i know that term-rewriting macros have a lot of issues
14:45:13FromDiscord<Yardanico> they might be even removed in the future
14:45:25FromDiscord<gogolxdong (liuxiaodong)> what's the way of doing static linking?
14:45:29arkanoidI'm unwrapping strenc into manual mode
14:46:05arkanoid--passL:"-static" in your project.nims
14:46:31arkanoidthere are multiple ways actually
14:48:14FromDiscord<gogolxdong (liuxiaodong)> like link against libmariadb.dll?
14:50:07FromDiscord<gogolxdong (liuxiaodong)> tried , but didn't link together
14:56:20FromDiscord<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:16FromDiscord<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:21FromDiscord<Yardanico> it'll be pretty efficient and easy to use
15:01:24arkanoidYardanico: 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:57FromDiscord<Yardanico> how exactly are you doing it?
15:02:07FromDiscord<Yardanico> first of all, if you have a `const` string nim will decrypt it at compile time anyway
15:02:12FromDiscord<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:07arkanoidwell, that's what's happening probably. The only changed line from your code is the signature: macro encrypt*(s: static[string]): untyped =
15:05:21FromDiscord<Yardanico> this works just fine for me:
15:05:28FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GAm
15:05:57FromDiscord<Yardanico> obviously your string has to be `var` or `let`, otherwise it'll be decrypted at compile-time
15:07:29FromDiscord<Yardanico> and yeah, you can change the macro arg to static[string], that won't hurt
15:08:40arkanoidfound 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:41FromDiscord<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:00FromDiscord<Yardanico> which is then assigned to `testStr` and few to echo, then destroyed
15:09:03FromDiscord<Yardanico> (edit) "few" => "fed"
15:10:27arkanoidyeah it works now
15:13:43*vicecea quit (Remote host closed the connection)
15:14:01arkanoidYardanico: how to hide bad languages :D -> https://play.nim-lang.org/#ix=3GAn
15:14:14*vicecea joined #nim
15:14:15FromDiscord<Yardanico> you might also consider using python obfuscators :)
15:14:21FromDiscord<Yardanico> store python itself as bytecode, etc
15:15:36arkanoidsure, it's just a playful wrapper, not really intended to be useful
15:21:09FromDiscord<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:13arkanoidPMunch: what do you mean? I'm playing wrapping python here
15:22:55arkanoidYardanico: 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:11FromDiscord<Yardanico> yes, so I do `$s` to get the string value out of it
15:23:16FromDiscord<Yardanico> but static[string] is more correct, yes
15:23:28FromDiscord<Yardanico> $s will error out for cases when you pass a runtime string to the macro
15:23:29arkanoidthanks
15:25:04arkanoidjust out of curiosity, what editor are you using here? is it vim? https://media.discordapp.net/attachments/371759389889003532/915258035079905321/unknown.png
15:25:08FromDiscord<Rika> arkanoid hes not replying to you
15:25:49arkanoidRika, k
15:26:25FromDiscord<Yardanico> In reply to @Rika "arkanoid hes not replying": wat
15:26:31FromDiscord<Yardanico> In reply to @arkanoid "just out of curiosity,": vscode :P
15:26:35FromDiscord<Yardanico> with monokai vibrant theme
15:28:31FromDiscord<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:56FromDiscord<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:09FromDiscord<Yardanico> or rewrite your logic so you don't need to check for that setting as much
15:29:12arkanoidk. 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:14arkanoiddoesn't understand that I need 4 spaces for python and for nim
15:29:55FromDiscord<Rika> sounds like your install is fucked?
15:30:06FromDiscord<Rika> nim extension forces 2, change in the settings
15:30:09FromDiscord<Rika> insert idk
15:30:22FromDiscord<Rika> restarts are prolly supposed to be handle by the plugin
15:30:31FromDiscord<Rika> canc?
15:30:34FromDiscord<Rika> cancel?
15:30:42FromDiscord<Rika> dunno how that would work
15:32:51FromDiscord<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:02arkanoidI'm using codium 1.56 from ubuntu LTS 20.04 snap store
15:33:03FromDiscord<Yardanico> In reply to @Zoom "How is using an": it is directly relevant
15:33:13FromDiscord<Rika> reading an object is fast enough
15:33:21FromDiscord<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:36FromDiscord<Yardanico> you'll only have to read it once
15:33:41FromDiscord<Yardanico> (the user-provided config)
15:33:48arkanoidRika, which vscode nim extensions should I stay on? I need the most stable/complete
15:34:17FromDiscord<Rika> saem's prolly, or koz's if you're having issues with one or the other
15:34:20FromDiscord<Rika> i dont use vscode
15:34:24FromDiscord<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:35FromDiscord<Yardanico> In reply to @Zoom "Again this is not": then what is your question? i still don't understand
15:34:36FromDiscord<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:46FromDiscord<Rika> its just a guess
15:34:57FromDiscord<Rika> i dont have any idea about caches and memory accesses at this level
15:36:41FromDiscord<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:28FromDiscord<gdquest> sent a long message, see http://ix.io/3GAx
15:52:44FromDiscord<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:13FromDiscord<Rika> Newline?
15:53:23FromDiscord<gdquest> You can see in the diff it says character 3
15:53:33FromDiscord<Rika> Didn’t realise
15:53:35FromDiscord<Yardanico> is this tool your own or it's some open-source nim library?
15:53:55FromDiscord<gdquest> In another example it says 6, but that's basically where you see `gdscript` at the start of markdown code blocks
15:53:57FromDiscord<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:48FromDiscord<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:18FromDiscord<gdquest> It's open-source, here's the code branch: <https://github.com/GDQuest/product-packager/tree/format_tutorials_rewrite/format_tutorials>
15:56:57FromDiscord<gdquest> Here's the error log as a text file https://media.discordapp.net/attachments/371759389889003532/915270185429127208/error_log.txt
15:58:58FromDiscord<Yardanico> In reply to @gdquest "Here's the error log": well, it's pretty clear with `repr` and also with your log
15:58:59FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/915270692512092180/unknown.png
15:59:20FromDiscord<Yardanico> \10 is ascii linefeed (newline)
15:59:37FromDiscord<Yardanico> expected doesn't have it, but formatted does
16:00:07FromDiscord<gdquest> A trailing newline, okay, thank you
16:00:15FromDiscord<gdquest> You call repr() on the string to get this output?
16:00:39FromDiscord<Yardanico> yes, `repr` does some stuff like converting some invisible ascii chars to their decimal representation
16:00:49FromDiscord<gdquest> Okay that's really good to know, thanks
16:00:52FromDiscord<Yardanico> `echo repr expected` and then `echo repr formatted`
16:01:05FromDiscord<Rika> Huh I was somehow right
16:01:10FromDiscord<Rika> Lucky
16:01:13FromDiscord<gdquest> Yup!
16:01:24FromDiscord<Rika> Hell of a potshot
16:02:48FromDiscord<Yardanico> In reply to @gdquest "Yup!": also `diffText` shows you not the index of the character but the line
16:02:58FromDiscord<Yardanico> "Find the difference in 2 text documents, comparing by textlines."
16:03:22FromDiscord<gdquest> I see, missed that. Thanks much for the help!
16:03:27FromDiscord<Yardanico> I've actually used https://github.com/mark-summerfield/diff myself when I needed some diffing
16:03:44FromDiscord<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:23FromDiscord<sOkam!> @gdquest on nim 😮↵poggies
17:45:51FromDiscord<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:54FromDiscord<gdquest> I'm using nim for standalone tools right now
17:57:12FromDiscord<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:42FromDiscord<gdquest> But at least for Nim I found it's a really good fit for us to develop small programsx
17:57:44FromDiscord<gdquest> (edit) "programsx" => "programs"
17:59:08FromDiscord<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:14FromDiscord<sOkam!> i see, makes sense
18:29:04*neurocyte0132889 quit (Ping timeout: 264 seconds)
18:33:59FromDiscord<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:36FromDiscord<Yardanico> huh?
18:39:13*krux02 joined #nim
20:01:57*MightyJoe quit (Ping timeout: 250 seconds)
20:49:54FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GC3
20:53:42FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GC9
20:53:51FromDiscord<Yardanico> same for strings
20:56:49FromDiscord<TryAngle> In reply to @Yardanico "This passes by a": ok thanks, how would I pass by reference then?
20:57:34FromDiscord<Yardanico> You can do `var seq[Expression]`, but when you assign it to HtmlWriter it'll still get copied
20:58:33FromDiscord<TryAngle> what do I have to write in HtmlWriter to not copy but take the reference?
20:59:02FromDiscord<Yardanico> Short answer - you can't do that safely
20:59:22FromDiscord<Yardanico> Because that would require lifetime tracking and stuff
20:59:33FromDiscord<Yardanico> Nim had view types, but they're in a very experimental state
21:00:01FromDiscord<Yardanico> you can have a reference to pass around if you either store that seq in a ref object
21:00:15FromDiscord<Yardanico> Or use ref seq[...] instead
21:02:33FromDiscord<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:52FromDiscord<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:16FromDiscord<Yardanico> Any reason you want to capture a reference like that? Usually you'd model your code in objects
21:06:40FromDiscord<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:44FromDiscord<haxscramper> You might consider writing data to stream immediately instead of storing it in the intermediate location
21:08:18FromDiscord<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:53FromDiscord<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:20FromDiscord<haxscramper> your text format is something like markdown, correct?
21:09:20FromDiscord<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:39FromDiscord<TryAngle> basically
21:10:10FromDiscord<TryAngle> but I also add like file inclusions etc.
21:10:15FromDiscord<haxscramper> and the `Expression` is a object of this format's AST/?
21:10:39FromDiscord<haxscramper> So you have `Expression` anyway, right, you just don't want to copy when you move things to html writer?
21:10:54FromDiscord<haxscramper> Also if you make the Expression a `ref object` seq copy is not that bad
21:11:03FromDiscord<TryAngle> In reply to @haxscramper "and the `Expression` is": similar I might move it to a more AST like structure later
21:11:09FromDiscord<TryAngle> In reply to @haxscramper "So you have `Expression`": yes
21:11:25FromDiscord<haxscramper> For a `100` objects you would copy `sizeof(ref) 100` which is not a lot
21:12:34FromDiscord<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:34FromDiscord<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:49FromDiscord<haxscramper> Process all data, have it in single place, then write things out
21:15:11FromDiscord<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:49FromDiscord<haxscramper> it does become a heap object,yes
21:16:24FromDiscord<haxscramper> but heap does not equate to slow
21:16:45FromDiscord<haxscramper> and of course there is a question of how fast you want to go, and whether these optimizations are needed
21:17:20FromDiscord<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:49FromDiscord<TryAngle> that's true indeed 🤔
21:22:56FromDiscord<Digitalcraftsman> sent a code paste, see https://play.nim-lang.org/#ix=3GCi
21:25:28FromDiscord<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:23FromDiscord<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:06FromDiscord<Digitalcraftsman> With requires `{.requiresinit.}` the program will not compile. My goal is to check the presence of given parameters at runtime.
21:29:11FromDiscord<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:49FromDiscord<Digitalcraftsman> (edit) removed "requires"
21:42:43*Pyautogui joined #nim
22:04:40*Pyautogui quit (Quit: Connection closed)
22:11:27FromDiscord<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:27FromDiscord<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:45FromDiscord<Elegantbeef> You have to do it the other way https://play.nim-lang.org/#ix=3GCB
22:29:59FromDiscord<Elegantbeef> You give the call for the body, not take the body from the call
22:31:54FromDiscord<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:45FromDiscord<Elegantbeef> Depending on what you're doing you may want to look at leorize's union package https://github.com/alaviss/union
22:33:16FromDiscord<Elegantbeef> @TryAngle\: `getFilePos`?
22:33:28FromDiscord<enthus1ast> @reilly\: or even json
22:34:09FromDiscord<Elegantbeef> I hate you enthus 😛
22:34:38FromDiscord<enthus1ast> ;)
22:34:38FromDiscord<enthus1ast> g8
22:34:38FromDiscord<enthus1ast> its late here; bedtime
22:34:39FromDiscord<Elegantbeef> Only in Nim is "use json for tagged unions" a common suggestion
22:34:39FromDiscord<Elegantbeef> Buh bye
22:40:25FromDiscord<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:33FromDiscord<Daniel M. Jaén> https://stackoverflow.com/questions/41397499/how-to-load-file-line-by-line-in-nim
22:53:46FromDiscord<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:30FromDiscord<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:36FromDiscord<el__maco> I wonder what it actually does
23:26:11FromDiscord<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:09FromDiscord<Elegantbeef> Well you're using tuples so... take that 😛
23:30:23FromDiscord<el__maco> I'm not supposed to use tuples?
23:30:28FromDiscord<Elegantbeef> It binds to the first tuple type, and converts the second one to that since it's the same type
23:31:07FromDiscord<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:14FromDiscord<Elegantbeef> are not distinct types\
23:31:51FromDiscord<el__maco> I was hoping the max() would return a component-wise max of the two tuples
23:32:29FromDiscord<Elegantbeef> It just does `y if y <= x: x else: y`
23:33:20FromDiscord<el__maco> I guess the mystery then is what is ``<=`` if y and x are tuples
23:33:31FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L1878
23:33:38FromDiscord<el__maco> I wonder if vec3 should be an object instead
23:33:57FromDiscord<Elegantbeef> Can be many things, tuples are generally bad for this imo
23:35:53FromDiscord<el__maco> a tuple seemed nice because you can construct using literals (a,b,c)
23:36:27FromDiscord<Elegantbeef> sure but you can always make a constructor then it's just `vec3(x, y, z)`
23:36:58FromDiscord<Elegantbeef> It's of course up to you what to do you can make your own `max`/`min` procs
23:38:07FromDiscord<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:33FromDiscord<Elegantbeef> It's using the system cmp proc and using integers dumbly
23:38:46FromDiscord<Elegantbeef> If any component is less than one it returns true otherwise false
23:38:46FromDiscord<Elegantbeef> Or vice versa
23:39:15FromDiscord<el__maco> I see. It certainly didn't do what I was hoping it to do
23:39:56FromDiscord<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:58FromDiscord<el__maco> seems to evaluate the "max" based on the first value in the tuple
23:40:13FromDiscord<Elegantbeef> Nope
23:40:55FromDiscord<Elegantbeef> You pass a anonymous tuple which `Vec3` can implicitly convert to, which is why it doesnt have `x, y, z`
23:40:58FromDiscord<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:21FromDiscord<Elegantbeef> Yes nim has `type Vec[size: static int] = array[size, float32]`
23:41:23*|smlckz| quit (Quit: WeeChat 3.2)
23:41:32FromDiscord<Elegantbeef> `static T` is a compile time value that works on all objects
23:41:49FromDiscord<Elegantbeef> Unlike rust dependant types work for most types even objects
23:42:05FromDiscord<TryAngle> and this also allows like↵type vec3[T] = distinct vec[3, T] ↵?
23:42:37FromDiscord<Elegantbeef> Indeed
23:42:43FromDiscord<TryAngle> thanks!
23:43:17FromDiscord<Elegantbeef> You could always make the base type a distinct then dont need it for all the children
23:45:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GCM
23:46:19FromDiscord<Elegantbeef> Some syntax issues 😀
23:49:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3GCN
23:50:05FromDiscord<TryAngle> thank you 👍
23:50:32FromDiscord<Elegantbeef> No problem
23:50:49FromDiscord<Elegantbeef> There are also a variety of vector libraries if you dont want to reinvent the wheel for the 300th time
23:52:11FromDiscord<TryAngle> sure I know don't worry 😂 ↵Haven't needed any algebra yet but will look if I need one
23:52:27FromDiscord<TryAngle> (edit) "yet" => "in nimyet"
23:52:30FromDiscord<TryAngle> (edit) "nimyet" => "nim yet"
23:56:57FromDiscord<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)