<< 09-10-2023 >>

00:17:15*Mister_Magister quit (Quit: bye)
01:13:13FromDiscord<graveflo> sent a long message, see http://ix.io/4Ix7
01:14:09FromDiscord<graveflo> (edit) "http://ix.io/4Ix7" => "http://ix.io/4Ix8"
01:16:46FromDiscord<Elegantbeef> Uncertain what you're describing
01:18:52FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixa
01:19:28FromDiscord<Elegantbeef> Cant say I ever really care about the ordinal value
01:19:34FromDiscord<Elegantbeef> Except for C interop of course
01:19:44FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixb
01:21:26FromDiscord<graveflo> I'll give an example of what I am doing right now. The bit field is being used as a filter and I want to know if an object matches the filter. Each object should only be one of the enum values but of course the filter can select any of them. There's no real point in using a bit field if you aren't thinking of the bits as flags tbh.
01:22:47FromDiscord<Elegantbeef> Foo does not have 2 different values in different circumstances
01:23:30FromDiscord<Elegantbeef> Foo in `set[Whatever]` is in index `0`
01:23:41FromDiscord<Elegantbeef> `ord(Foo)` is `0`
01:24:38FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixc
01:24:50FromDiscord<graveflo> lol whoops
01:24:52FromDiscord<graveflo> not that
01:25:12FromDiscord<Elegantbeef> Enums are ordinals though so defaulting to what you want is an odd behaviour
01:25:50FromDiscord<graveflo> I know that but there should be an enum that is designed to have ^2 values so that the base names match their singleton values
01:26:09FromDiscord<graveflo> it's just weird
01:26:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ixe
01:26:53FromDiscord<graveflo> oh that's a good idea
01:27:03FromDiscord<Elegantbeef> I have them occasionally
01:28:41FromDiscord<Elegantbeef> It does of course mean that there is a possible errory state that you do `export Whatever` and then use `system.ord`
01:29:13FromDiscord<Elegantbeef> So perhaps there might need to be a `type MyEnum {.someMacro.} = enum`
01:29:23FromDiscord<graveflo> good point. I really try to avoid using `export`
01:29:58FromDiscord<graveflo> unless its a package toplevel or something but at that rate you should know better then to do that or at least write tests
01:30:11FromDiscord<Elegantbeef> Then you'll never hit that and be happy 😄
01:30:12FromDiscord<Elegantbeef> I use `export` mainly on modules
01:30:26FromDiscord<Elegantbeef> You also might want to implement `low` and `high` for your `typedesc`
01:30:37FromDiscord<Elegantbeef> Actually never mind
01:47:48FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Ixi
01:50:21FromDiscord<sOkam! 🫐> I'm blind-guessing you are probably used to see enum values used as flags as `1,2,4,8,16,32,64,128`, etc↵Its rare that you find code out there that uses the 1000% more readable `1 << N` version 🤷‍♂️
01:50:31FromDiscord<sOkam! 🫐> (edit) "that you" => "to"
02:19:13FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixp
02:19:48FromDiscord<Elegantbeef> Actually `One` in the above example will be 1\`
02:19:52FromDiscord<Elegantbeef> `Foo` starts the enum
02:19:57FromDiscord<graveflo> oh right
02:20:01FromDiscord<graveflo> gaah see
05:04:46*LuxuryMode joined #nim
05:44:26FromDiscord<sOkam! 🫐> In reply to @graveflo "nah that's all good": that's the thing, it only has one associated value↵its showing up as a different value because you are making a set
05:44:49FromDiscord<sOkam! 🫐> the way enum sets work is whats confusing you, not quite the enum value itself
05:45:26FromDiscord<sOkam! 🫐> that's why i mentioned that you probably have seen them used in the unreadable way (the way almost every codebase in existence uses them) and therefore that's the confusion
05:58:51*advesperacit joined #nim
06:42:05*azimut quit (Ping timeout: 252 seconds)
06:44:18FromDiscord<Phil> sent a long message, see http://ix.io/4Iyb
06:53:04FromDiscord<Elegantbeef> You are correct, did you override the `sink`, `copy`, and `dup`?
06:53:53*azimut joined #nim
06:54:04FromDiscord<Elegantbeef> I guess just `sink` `dup` and maybe `wasMoved`
07:05:29*om3ga quit (Ping timeout: 258 seconds)
07:27:13*xet7 quit (Remote host closed the connection)
07:44:25*LuxuryMode quit (Quit: Connection closed for inactivity)
07:57:18*xet7 joined #nim
08:01:28FromDiscord<Phil> Hmm I don't think I did `sink`, only `destroy` and `copy`
08:13:45*azimut quit (Ping timeout: 252 seconds)
08:17:43*Mister_Magister joined #nim
08:31:51*derpydoo quit (Read error: Connection reset by peer)
08:37:34*PMunch joined #nim
09:56:35Amun-RaSink & Destroy, great song
10:18:43*junaid_ joined #nim
10:46:03*junaid_ quit (Remote host closed the connection)
11:50:27FromDiscord<frobnicate> How do I use a proc in my nimble file?
11:50:35FromDiscord<frobnicate> Or what's the alternative?
11:51:38FromDiscord<Chronos [She/Her]> In reply to @frobnicate "How do I use": Wdym? It's just Nimscript, is it not?
11:52:02FromDiscord<frobnicate> Well I couldn't get my proc to work in a task. It kept complaining about missing identifier
11:52:31FromDiscord<Chronos [She/Her]> Did you export the proc? Calling it with all the correct arguments, etc?
11:52:38FromDiscord<Chronos [She/Her]> Did you import the proc?
11:52:43FromDiscord<frobnicate> I made the proc in the nimble file itself
11:52:52FromDiscord<frobnicate> That's not allowed?
11:52:59FromDiscord<Chronos [She/Her]> Ah, very odd then, maybe tasks are treated as separate scripts? Not sure
11:53:09FromDiscord<Chronos [She/Her]> You can import Nim code in Nimble files
11:57:42FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4Izo
11:58:02FromDiscord<kcvinker5420> What is mean by `using a semicolon` ?
12:00:15*om3ga joined #nim
12:04:35*om3ga quit (Ping timeout: 240 seconds)
12:08:30FromDiscord<nnsee> In reply to @kcvinker5420 "What is mean by": both `w` and `h` are explicitly set to `0` because they are separated by a comma in the signature and `w` has no type description
12:08:42FromDiscord<nnsee> instead of a comma between `w` and `h`, you could use a semicolon
12:09:29FromDiscord<kcvinker5420> In reply to @nnsee "instead of a comma": Oh, now I got it. Thanks a lot. The warning message is somewhat confusing.
12:19:39*derpydoo joined #nim
12:53:13FromDiscord<kcvinker5420> I just switched to Nim version 2.0. Tried to compile my program. It shows that successfully compiled, but I can't run it. If I run the program, it's just starting and doing nothing. I can see it in `Process Explorer`. It is a win32 gui program. I wrote some echo lines in Wndproc function and they are not printing. It seems the exe is not a valid windows exe.
12:54:53FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IzG
12:55:21PMunchIf it's a console application I don't think it can start a UI can it?
12:55:33PMunchOr wait, maybe it can, but it also run a terminal..
12:56:13FromDiscord<kcvinker5420> In reply to @PMunch "If it's a console": Intentionally added the `console` part. Beause, I just want to see the echo statements prints the text
12:56:25PMunchKinda hard to know what the problem is without seeing your code but I haven't heard about anything like this for Windows specific to 2.0
12:57:14FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IzI
13:01:52FromDiscord<kcvinker5420> How to set the target processor target os in compiler command. I mean what is the values for `--os` and `--cpu` ?
13:04:52PMunchWhat about that hint? It just lists the compilation options
13:05:12PMunchBy default you're compiling for the machine and architecture you're on, so I wouldn't mess with those
13:13:12FromDiscord<kcvinker5420> Oh, I see. I was thinking about to make sure the right os and right cpu arc
13:14:44FromDiscord<kcvinker5420> Okay, I can go back to version 1.6. But what's equivalent for `Path` in 1.6 ?
13:17:58PMunchPath?
13:24:30FromDiscord<odexine> There pretty much isn’t
13:24:38FromDiscord<odexine> Use strings or your own distinct
13:29:43FromDiscord<sOkam! 🫐> In reply to @kcvinker5420 "Okay, I can go": none, you need to backport it manually
13:33:18*PMunch quit (Quit: Leaving)
14:15:57*advesperacit quit ()
14:21:17FromDiscord<kcvinker5420> In reply to @PMunch "Path?": Sorry for the delay in my reply. Yes, I mean Path type in version 2.0
14:21:45FromDiscord<kcvinker5420> @sOkam! 🫐 & @odexine Thanks.
14:27:04FromDiscord<kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IAG
14:27:30FromDiscord<kcvinker5420> `orc` & `arc` has no effect
14:28:23FromDiscord<kcvinker5420> So I am sure there is something related to memory management
14:43:50FromDiscord<Chronos [She/Her]> What if you change it to `--app:gui`?
14:43:56FromDiscord<Chronos [She/Her]> Does anything else happen maybe?
14:49:33FromDiscord<kcvinker5420> In reply to @chronos.vitaqua "Does anything else happen": Let me try that
14:50:04FromDiscord<Chronos [She/Her]> 👍
14:50:36FromDiscord<kcvinker5420> @Chronos [She/Her] OMG! It just worked
14:50:55FromDiscord<Chronos [She/Her]> Hm, I don't know how Windows worked so that was a complete gamble aha
14:51:14FromDiscord<kcvinker5420> Ha ha, but it leaves a problem
14:51:17*azimut joined #nim
14:51:22FromDiscord<Chronos [She/Her]> No console?
14:51:36FromDiscord<kcvinker5420> Yes, we need it when developing
14:51:57FromDiscord<kcvinker5420> But I think IDE will catch the stdouts
14:52:28FromDiscord<Chronos [She/Her]> Fair, it should hopefully
14:52:43FromDiscord<Chronos [She/Her]> Otherwise, you could log to a file perhaps?
14:53:07FromDiscord<kcvinker5420> In reply to @chronos.vitaqua "Otherwise, you could log": Yeah.
14:53:25FromDiscord<kcvinker5420> Any how, `--mm:orc` is still not working
14:53:35FromDiscord<Chronos [She/Her]> Not the greatest thing ever, but maybe someone with more Windows + Nim logic would understand
14:53:58FromDiscord<kcvinker5420> In reply to @chronos.vitaqua "Not the greatest thing": Yeah
14:54:09FromDiscord<Chronos [She/Her]> In reply to @kcvinker5420 "Any how, `--mm:orc` is": Seems like a memory management bug then, if you can make a minimal reproducible example, you could ask in #internals and also make a GitHub issue
14:54:28FromDiscord<Chronos [She/Her]> Though, you could see if Nim devel has the same issue and/or if `-d:useMalloc` fixes it
14:55:00FromDiscord<Chronos [She/Her]> The latter would be valuable information to have, since it could be Nim's allocator at fault but not sure, since refc works according to you so
14:55:29FromDiscord<kcvinker5420> In reply to @chronos.vitaqua "Though, you could see": Yeah, I see the `-d:useMalloc` docs. Lets just try
14:57:14FromDiscord<kcvinker5420> @Chronos [She/Her] `-d:useMalloc` worked with default mm, but program started without all controls.
14:57:57FromDiscord<Chronos [She/Her]> Hm
14:58:16FromDiscord<Chronos [She/Her]> Very off behaviour, you should document this in a GitHub issue and report it
14:58:29FromDiscord<kcvinker5420> Yeah
15:15:31arkanoidany1 experienced with winim? I'm getting "winim64.res is not a valid Win32 resource file"
15:17:22*dolololadidi joined #nim
15:18:49dolololadidican't I see the C that nim generates on the try online thing?
15:24:09dolololadidiwow using C++ libs is really really cool
15:24:16dolololadidiit's made very simple!
15:29:50*dolololadidi quit (Quit: Client closed)
15:37:38FromDiscord<nervecenter> yeah it's super nice, all you really need is a function signature
15:38:02FromDiscord<nervecenter> I usually add a proc to wrap that signature in a more Nim-ish function that does all the converting necessary
16:05:28NimEventerNew thread by kcvinu: GUI program is not working when using app:console in version 2.0, see https://forum.nim-lang.org/t/10539
16:22:28FromDiscord<wick3dr0se> Is there a way to pass array indicies that are out of bounds safely? For example, I am passing args[0] and args[1] to myCustomProc() but args[1] is empty so it errors out when trying to handle the absence of args[1] within myCustomProc. I'd like to be able to check it's empty within that and hide the out of bounds errors if possible
16:32:10FromDiscord<Chronos [She/Her]> In reply to @wick3dr0se "Is there a way": By checking the length of the array
16:32:12FromDiscord<jviega> Some code would be helpful to understand what you're talking about. The common thing to do here though would be: `if args.len() < 2:`
16:32:18FromDiscord<Chronos [She/Her]> ^^
16:33:41FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4IBl
16:33:55FromDiscord<wick3dr0se> Obv has a lot of bounds issues
16:34:37FromDiscord<wick3dr0se> Ill just have to pass args directly ig
16:34:39FromDiscord<jviega> Yes, the answer is test the length of args before requesting indexes that might be out of bounds.
16:34:48FromDiscord<wick3dr0se> Too many to check tho
16:34:59FromDiscord<wick3dr0se> I'll just send the entire sequence to each setCmd call ig
16:35:39FromDiscord<jviega> That doesn't much make sense but okay.
16:35:53FromDiscord<demotomohiro> Overload `setCmd(args: seq[string])` that checks args len and call `setCmd(args[0], args[1])`.
16:36:22FromDiscord<wick3dr0se> Genuis
16:37:00FromDiscord<wick3dr0se> (edit) "Genuis" => "Genius"
16:46:59FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBq
16:51:37FromDiscord<demotomohiro> In reply to @user2m "Hey guys how do": https://nim-lang.org/docs/manual.html#statements-and-expressions-tuple-unpacking
16:57:34FromDiscord<luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IBu
16:58:00FromDiscord<luxurymode> also seems backwards to me anyways, wouldn't we want expressions to be callable without `()` and not statements...
17:00:08FromDiscord<user2m> In reply to @demotomohiro "https://nim-lang.org/docs/manual.html#statements-an": yes but I don't know ahead of time how many variables will be returned
17:02:27FromDiscord<luxurymode> if you don't know how many variables then how would you be doing `let (x,y,z)` as in your pseudocode? Does Nim have a way to denote a "and everything else" without binding?
17:03:43FromDiscord<user2m> becaause `myproc` would take varargs like so `proc myproc(args:varargs[int])`
17:05:12FromDiscord<luxurymode> yeah but you then want to unpack and unpack and bind each to a variable. How can you do that if you don't know the size of the tuple?
17:05:22FromDiscord<luxurymode> (edit) removed "unpack and"
17:07:11FromDiscord<user2m> yeah I'm thinking I'm going to have to use a seq like so
17:07:20FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBA
17:07:24FromDiscord<user2m> but I don't know how to unpack a seq
17:08:42FromDiscord<luxurymode> you can't. seq and tuple work fundamentally differently. You either have a fixed/known size in which case you use a tuple and can unpack. Otherwise you use a seq and have to loop
17:09:22FromDiscord<inventormatt> there is this library from 5 years that might work https://github.com/technicallyagd/unpack
17:10:01FromDiscord<luxurymode> I would venture to say that unless there's some really exceptional use case here, you are reaching for the wrong thing.
17:13:34FromDiscord<user2m> I think this'll work
17:13:46FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBF
17:18:28FromDiscord<luxurymode> I'm lost. You said: ↵↵> but I don't know ahead of time how many variables will be returned
17:18:38FromDiscord<luxurymode> `myproc(1,2,3,4,5)` won't work
17:18:41FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBI
17:18:51FromDiscord<luxurymode> bc you've already declared `var returned: tuple[a,b,c: int]`
17:18:53FromDiscord<user2m> In reply to @luxurymode "I'm lost. You said:": maybe I didnt explain myself well
17:19:02FromDiscord<luxurymode> I think not 😆
17:19:39FromDiscord<luxurymode> Oh I guess you're trying to just discard anything beyond the size of your target tuple
17:19:40FromDiscord<luxurymode> ?
17:19:41FromDiscord<user2m> In reply to @inventormatt "there is this library": yup this was the first module I tried! very cool. my use case involves the JS backend tho and it gave me some weird issues not sure why
17:20:42FromDiscord<inventormatt> it is a few years old so it might need an update or two
17:21:29FromDiscord<froglerr> how would i add a wait in my nim code?
17:22:08FromDiscord<nervecenter> In reply to @froglerr "how would i add": https://nim-lang.org/docs/os.html#sleep%2Cint
17:22:14FromDiscord<froglerr> thanks
17:22:32FromDiscord<user2m> In reply to @luxurymode "Oh I guess you're": Im just trying to create a short hand for document.getElementById lol the "gebi" proc takes a varargs[string] and returns a seq[Option[Element]] and I wanted to grab each element by name rather than by using indexes
17:31:29FromDiscord<froglerr> sent a code paste, see https://play.nim-lang.org/#ix=4IBO
17:41:33FromDiscord<Shiba> iam getting this everytime i try to run a nim program https://media.discordapp.net/attachments/371759389889003532/1160995482596806736/Capture.PNG?ex=6536b04d&is=65243b4d&hm=99ef72f8e8b306cb1a1ab74337bd00e4be14d04dfd34bb4bb92a7e76d0d8d1a3&
17:41:56FromDiscord<Shiba> anyone know how to fix this?
17:43:24FromDiscord<Shiba> is this a bug
17:48:59FromDiscord<michaelb.eth> In reply to @Shiba "iam getting this everytime": any Nim program, even if it consists only of `echo "hello"`?
17:49:24FromDiscord<Shiba> yea
17:49:34FromDiscord<Shiba> eversince i updated to 2.0
17:52:54FromDiscord<michaelb.eth> hmm, sounds like an issue with where/how it was installed
17:53:13FromDiscord<michaelb.eth> I haven't run into anything like that, but I don't work with Nim on Windows too frequently
17:55:06FromDiscord<Shiba> me neither i always been a linux fan
17:55:14FromDiscord<Shiba> till i had to install windows lately
17:57:16FromDiscord<michaelb.eth> I did last week, but to install I used choosenim in an MSYS2 shell, so much nicer than cmd.exe or PowerShell, I recommend giving it a try if you need to dev on Windows
17:57:47*junaid_ joined #nim
17:57:56FromDiscord<Shiba> i use gitbash all the time
17:58:08FromDiscord<michaelb.eth> it's a half-neutered MSYS2, but sure
17:58:24FromDiscord<michaelb.eth> gitbash, I mean
18:00:18FromDiscord<michaelb.eth> MSYS2, using its CLANG64 environment esp. if you're doing multithreaded you'll get better (sometimes much better) performing executables
18:01:24FromDiscord<michaelb.eth> up-to-date installer is linked from the home page, easy to give it a spin: https://www.msys2.org/
18:04:43FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4IC1
18:07:34FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4IC2
18:11:54FromDiscord<Shiba> its aint gonna work supper >win8 nd iam on 7
18:12:00FromDiscord<Shiba> (edit) "supper" => "support"
18:12:51FromDiscord<michaelb.eth> it might, though they dropped official support for < 8 awhile ago, I was building with it and/or running EXEs built with it on Win 7 a couple oof years ago
18:13:07FromDiscord<michaelb.eth> (edit) "oof" => "of"
18:21:41FromDiscord<michaelb.eth> even if you had to use an older build of the installer, many of the packages might work just fine
18:22:32FromDiscord<luxurymode> In reply to @luxurymode "hmm so docs say:": Apologies for the double ping, but this may have gotten buried and I'd love some guidance on this.
18:43:55FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax
18:47:26FromDiscord<demotomohiro> It says↵> Routines can be invoked without the () if the call is syntactically a statement. ↵But it doesn't say when routines is called without the (), it is a statement.
18:53:50FromDiscord<Shiba> how can u compare a cahr to another
18:53:51FromDiscord<Shiba> one
18:54:00FromDiscord<Shiba> wihtouth gettin an erro of mismatch
18:54:13FromDiscord<Shiba> (edit) "cahr" => "char"
18:54:24FromDiscord<Shiba> (edit) "wihtouth" => "wihtouh" | "erro" => "error"
18:54:31FromDiscord<Shiba> (edit) "wihtouh gettin an ... error" added "mismatch" | removed "of mismatch"
18:55:22FromDiscord<Chronos [She/Her]> Are you actually comparing two characters?
18:55:42FromDiscord<Chronos [She/Her]> If you're getting a type mistmatch, it means you're not comparing the same type (nor is there an overload)
18:55:52FromDiscord<Chronos [She/Her]> Can't compare a string to a character for example
18:56:18FromDiscord<Chronos [She/Her]> (Also, `'a'` is different from `"a"`, the former is a character, the latter is a string)
18:58:02FromDiscord<demotomohiro> In reply to @Shiba "how can u compare": You can convert char to other int types like `mychar.int`.
18:58:02FromDiscord<Shiba> ok got it
18:58:59FromDiscord<demotomohiro> If you want to compare char with string, `mystr[i] == mychar`.
19:00:12NimEventerNew thread by ASVI: Webidl2nim - webidl to Nim bindings generator, see https://forum.nim-lang.org/t/10540
19:24:19*junaid_ quit (Remote host closed the connection)
19:27:21FromDiscord<michaelb.eth> In reply to @Shiba "how can u compare": if you're iterating/looping over a string you're working with bytes; it happens that a char is the same size as a byte, but the point is that strings in Nim are UTF8, and UTF8 a "character" can be 1 to 4 bytes
19:28:08FromDiscord<michaelb.eth> so, while it depends on what you're doing, you should probably be using facilities in Nim `std/unicode`
19:28:57FromDiscord<michaelb.eth> (edit) "a char" => "`char`" | "a byte," => "`byte`," | "strings" => "`string`s" | "is the same size as`byte`,but the point is that`string`sin Nim are UTF8, and ... UTF8" added "in"
19:34:17FromDiscord<michaelb.eth> https://nim-lang.org/docs/unicode.html#toRunes%2Cstring
20:01:03FromDiscord<.aingel.> does nim have to build each import every time you build a project too?
20:01:08FromDiscord<.aingel.> Like each nimble import?
20:01:16FromDiscord<.aingel.> I thought it caches it or something
20:02:16FromDiscord<nervecenter> Yes Nim caches any C compile that hasn't changed
20:02:22FromDiscord<nervecenter> And by extension GCC will cache as well
20:02:39FromDiscord<.aingel.> What about c++
20:03:11FromDiscord<nervecenter> Pretty sure clang caches unchanged sources as well
20:03:40FromDiscord<.aingel.> So I made a nimble package which wraps a c/cpp lib, but every time I run some other prog which imports it, I see clang building that code
20:04:35FromDiscord<nervecenter> huh
20:05:02FromDiscord<.aingel.> Well.. so in my nimble package, I have it compiling some c code, I run a shell command for it to hit clang for something
20:05:05*LuxuryMode joined #nim
20:05:10FromDiscord<.aingel.> Is there a way to cache that
20:05:39FromDiscord<nervecenter> You could precompile it as a static lib
20:05:55FromDiscord<.aingel.> I want that, but i want it to be like platform independent
20:06:01FromDiscord<.aingel.> Or at least work on mac and linux
20:06:32FromDiscord<nervecenter> Easiest way to be platform independent is to set up a compilation configuration on each target for each target
20:06:38FromDiscord<nervecenter> I've had bad luck trying to cross compile
20:07:01FromDiscord<.aingel.> What does cross compile mean in this context?
20:07:12FromDiscord<.aingel.> In reply to @nervecenter "Easiest way to be": That's what I thought I was doing or planned on doing
20:07:19FromDiscord<nervecenter> Compiling on one platform for another, ie compiling a Windows binary on Linux
20:07:27FromDiscord<.aingel.> I thought you were referring to pre building it and shipping the built lib with nimble
20:07:57FromDiscord<nervecenter> No, I mean compiling the library you are wrapping as a static lib and linking it in your Nim compilation so it becomes a static part of your binary
20:08:17FromDiscord<.aingel.> In reply to @nervecenter "No, I mean compiling": Yeah that is exactly what I am doing currently
20:08:21FromDiscord<nervecenter> okay
20:08:24FromDiscord<.aingel.> It's just that code runs every time
20:08:37FromDiscord<.aingel.> But now that I think about it clang is probably not rebuilding it
20:08:44FromDiscord<.aingel.> The command is just running but not building it
20:09:09FromDiscord<nervecenter> You should only have the compile it once, once you have your .a file all you need is a --passL: flag
20:09:31FromDiscord<nervecenter> Like `--passl:libs/mylib.a`
20:09:36FromDiscord<.aingel.> Do I have to manually detect if it has been built already
20:09:50FromDiscord<.aingel.> Or is there like some one time build step I can do for a nimble package
20:10:21FromDiscord<nervecenter> You can compile the c or c++ library on its own with its own makefiles and build instructions, look for how to compile to a static lib, then your build folder should end up with a .a file inside
20:11:36FromDiscord<.aingel.> No I know how to do that
20:11:38FromDiscord<nervecenter> Unless your goal is to actually call the c++ source files and have clang compile them with your project
20:11:39FromDiscord<.aingel.> It's already building
20:11:56FromDiscord<.aingel.> It just builds on every run of importing the lib
20:12:06FromDiscord<.aingel.> Cause the build step is in the nimble lib
20:12:18FromDiscord<.aingel.> Is there some sort of build static lib on nimble install?
20:12:23FromDiscord<.aingel.> Does that make sense?
20:12:25FromDiscord<nervecenter> Maybe I shouldn't be helping you then because I don't use nimble
20:12:27FromDiscord<nervecenter> I use makefiles
20:12:52FromDiscord<.aingel.> Oh so you are just talking about a build step in make
20:13:05FromDiscord<nervecenter> Nah I'm talking about something you do ocne and basically never again
20:13:12FromDiscord<nervecenter> (edit) "ocne" => "once"
20:13:19FromDiscord<nervecenter> Only when the library gets important updates
20:13:30FromDiscord<nervecenter> once the .a file is in your source dir, you're just linking against it, that's it
20:13:32FromDiscord<.aingel.> But how do you ship your project then
20:13:49FromDiscord<nervecenter> As a compiled binary? I'm not sure what you're asking
20:14:08FromDiscord<.aingel.> Sorta
20:14:16FromDiscord<.aingel.> Well.. so I want to ship this as a library
20:14:22FromDiscord<.aingel.> But I can't just build the .a on mac
20:14:31FromDiscord<.aingel.> I have to build it on linux and idk well
20:14:39FromDiscord<.aingel.> U know diff architectures
20:14:47FromDiscord<Phil> ... anyone bored who'd be curious about what it feels like to wrap a GTK widget 😛 ?
20:15:24FromDiscord<nervecenter> In reply to @.aingel. "U know diff architectures": I can't really help you if the goal is to compile to apple silicon, you should probably ask in #internals
20:17:20FromDiscord<demotomohiro> In reply to @isofruit "... anyone bored who'd": https://github.com/StefanSalewski/gintro
20:20:31FromDiscord<Phil> In reply to @demotomohiro "https://github.com/StefanSalewski/gintro": Was more trying more people for adding widgets to owlkettle 😄 .↵Gintro somewhat lost me on the doc front due to (imo) lack of structure, which is why I went for owlkettle in the first place.
20:21:13FromDiscord<Phil> Which I'd honestly call a good choice looking back given how many loc their listview example takes up
20:27:37*azimut quit (Quit: ZNC - https://znc.in)
20:27:58*azimut joined #nim
20:43:50FromDiscord<sOkam! 🫐> In reply to @.aingel. "So I made a": is this with the setup we configured the other day?
20:44:02FromDiscord<sOkam! 🫐> because if yes, the caching is per-project specific
20:44:32FromDiscord<sOkam! 🫐> so if you build different projects, they each have their own cache
20:47:49FromDiscord<Chronos [She/Her]> I'm debating on using Msgpack or Protobuf for my binary format for my app's API tbh
20:48:28FromDiscord<Chronos [She/Her]> I'm leaning towards Protobuf because I can share more of the logic with JSON easily (and for langs like Python, it's literally possible to use it as a drop in replacement)
20:51:37FromDiscord<System64 ~ Flandre Scarlet> Does Nim supports such a notation? https://media.discordapp.net/attachments/371759389889003532/1161043312812245042/image.png?ex=6536dcd8&is=652467d8&hm=feebd0e7cc51a474113665b22cab37a7a1ecc19f90a10eb3cef25b4425c76a56&
20:51:57FromDiscord<Elegantbeef> No it only has binary operators
20:52:12FromDiscord<Elegantbeef> `y in 0..<height` is the nim way
20:53:42FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4ICS
20:54:24FromDiscord<Elegantbeef> `px in 0..<height and y in 0..<height`
20:55:39FromDiscord<System64 ~ Flandre Scarlet> Oh alright!
20:55:53FromDiscord<System64 ~ Flandre Scarlet> I confused with a for loop
20:57:56FromDiscord<andrew766> I'll teach anyone how to trade and earn $10k-$20k within 72 hours from the crypto market but you will pay me 10% of your profit when you receive it. Note only interested people should apply, drop a message let's get started by asking (HOW) +447456068417
20:59:07*om3ga joined #nim
21:03:22FromDiscord<ezquerra> In reply to @Elegantbeef "`y in 0..<height` is": Is that as efficient as the python a < b < c notation? Does it get translated to the two comparisons with the minimum and maximin values of the range?
21:03:50*om3ga quit (Ping timeout: 258 seconds)
21:05:22FromDiscord<demotomohiro> How about to try that operator on:https://godbolt.org
21:08:26FromDiscord<.aingel.> How do I execute a path relative to the position of the executable?
21:08:37FromDiscord<System64 ~ Flandre Scarlet> Damn! it even supports Nim!
21:09:20FromDiscord<Chronos [She/Her]> In reply to @.aingel. "How do I execute": `GetAppDir()` maybe...?
21:09:43FromDiscord<Chronos [She/Her]> https://nim-lang.org/docs/os.html#getAppDir
21:09:49FromDiscord<Chronos [She/Her]> (edit) "`GetAppDir()`" => "`getAppDir()`"
21:09:51FromDiscord<.aingel.> In reply to @chronos.vitaqua "`getAppDir()` maybe...?": Right, what about getCurrentDir?
21:10:22FromDiscord<_goel_> A few years have passed... and still nimsuggest hasn't been replaced with anthing better? How come?
21:10:24FromDiscord<.aingel.> I think appdir might be better
21:10:32FromDiscord<.aingel.> In reply to @_goel_ "A few years have": No IC I think
21:10:42FromDiscord<Chronos [She/Her]> Current working dir != App dir
21:10:53FromDiscord<sOkam! 🫐> In reply to @_goel_ "A few years have": probably because its difficult and tedious coding that nobody wants to do
21:11:10FromDiscord<Chronos [She/Her]> The app dir will always be the location of the binary while the current dir may be `/home/user` or similar
21:11:13FromDiscord<sOkam! 🫐> In reply to @.aingel. "Right, what about getCurrentDir?": getCurrentDir is where the app was launched -from-
21:11:40FromDiscord<Chronos [She/Her]> It is insane to be able to help ppl with Nim :p
21:11:51FromDiscord<System64 ~ Flandre Scarlet> No bitshift?? https://media.discordapp.net/attachments/371759389889003532/1161048403858444459/image.png?ex=6536e196&is=65246c96&hm=9a6e7047a3042a709e1272896cb620c5e9522faa607688167a982d4aab9c8dc2&
21:13:06FromDiscord<Elegantbeef> Nah nothing is as inefficient as python↵(@ezquerra)
21:13:22FromDiscord<demotomohiro> In reply to @sys64 "No bitshift??": Nim detects overflow in default. Try -d:danger to see simpler assembly code.
21:14:46FromDiscord<Elegantbeef> Yes the joke response is that if you want to see performance, profile
21:14:48FromDiscord<System64 ~ Flandre Scarlet> Oh we have shift now↵Seems -d:danger is waaaaay faster
21:14:53FromDiscord<Elegantbeef> Never trust the view of some random on the internet
21:15:48FromDiscord<ezquerra> In reply to @Elegantbeef "Nah nothing is as": OK, let me rephrase. Is it the same as doing two comparisons in C? 😅
21:16:43FromDiscord<Elegantbeef> Of course
21:16:43FromDiscord<Elegantbeef> But profile or look at the asm to be certain
21:16:44FromDiscord<Elegantbeef> It does have to first create a `Slice[T]` so that is mild overhead
21:33:58FromDiscord<Chronos [She/Her]> When storing user data in a DB, is it better to have two separate objects? One for sensitive data and one for non-sensitive data?
21:40:20FromDiscord<ezquerra> OK, thanks
22:04:42FromDiscord<lanky.lemur> Is there a significant performance impact from using templates?↵↵I have some simple code to generate primes using the sieve of Eratosthenes. When I have that code in a template, it takes about 25% longer to run than the same code in a proc
22:05:15FromDiscord<Elegantbeef> templates are code substitution they should not impact speed of code much if at all
22:05:26FromDiscord<Elegantbeef> I have a feeling you are duplicating work with your template not realising it
22:10:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ID2
22:13:46FromDiscord<lanky.lemur> sent a code paste, see https://play.nim-lang.org/#ix=4ID4
22:17:37FromDiscord<Elegantbeef> Use `monotimes` instead firstly
22:22:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ID5
22:23:05FromDiscord<Elegantbeef> Secondly they're within margin of error
22:23:16FromDiscord<lanky.lemur> But they're consistently different
22:23:46FromDiscord<lanky.lemur> And the order I run them doesn't matter
22:24:22FromDiscord<lanky.lemur> Using monotimes, I get:↵proc: 257.441 ms↵template: 306.629 ms
22:24:32FromDiscord<Elegantbeef> Code ran at top level is not as optimised as code in a proc
22:24:34FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/v1AnE
22:24:40FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Xj86O
22:30:05FromDiscord<lanky.lemur> Okay, you're absolutely right. When I create a wrapper proc to test both, I get basically the same performance
22:30:58FromDiscord<Elegantbeef> Yep orc/arc do have a mild issue that top level code does not get as optimised as code in a proc, but it does not matter that much
22:31:24FromDiscord<Elegantbeef> Actually all the MMs have it
22:31:29FromDiscord<Elegantbeef> Arc/Orc have improved the optimisation a bit, but there's still the mild cost