00:17:15 | * | Mister_Magister quit (Quit: bye) |
01:13:13 | FromDiscord | <graveflo> sent a long message, see http://ix.io/4Ix7 |
01:14:09 | FromDiscord | <graveflo> (edit) "http://ix.io/4Ix7" => "http://ix.io/4Ix8" |
01:16:46 | FromDiscord | <Elegantbeef> Uncertain what you're describing |
01:18:52 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixa |
01:19:28 | FromDiscord | <Elegantbeef> Cant say I ever really care about the ordinal value |
01:19:34 | FromDiscord | <Elegantbeef> Except for C interop of course |
01:19:44 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixb |
01:21:26 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> Foo does not have 2 different values in different circumstances |
01:23:30 | FromDiscord | <Elegantbeef> Foo in `set[Whatever]` is in index `0` |
01:23:41 | FromDiscord | <Elegantbeef> `ord(Foo)` is `0` |
01:24:38 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixc |
01:24:50 | FromDiscord | <graveflo> lol whoops |
01:24:52 | FromDiscord | <graveflo> not that |
01:25:12 | FromDiscord | <Elegantbeef> Enums are ordinals though so defaulting to what you want is an odd behaviour |
01:25:50 | FromDiscord | <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:09 | FromDiscord | <graveflo> it's just weird |
01:26:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ixe |
01:26:53 | FromDiscord | <graveflo> oh that's a good idea |
01:27:03 | FromDiscord | <Elegantbeef> I have them occasionally |
01:28:41 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> So perhaps there might need to be a `type MyEnum {.someMacro.} = enum` |
01:29:23 | FromDiscord | <graveflo> good point. I really try to avoid using `export` |
01:29:58 | FromDiscord | <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:11 | FromDiscord | <Elegantbeef> Then you'll never hit that and be happy 😄 |
01:30:12 | FromDiscord | <Elegantbeef> I use `export` mainly on modules |
01:30:26 | FromDiscord | <Elegantbeef> You also might want to implement `low` and `high` for your `typedesc` |
01:30:37 | FromDiscord | <Elegantbeef> Actually never mind |
01:47:48 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Ixi |
01:50:21 | FromDiscord | <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:31 | FromDiscord | <sOkam! 🫐> (edit) "that you" => "to" |
02:19:13 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4Ixp |
02:19:48 | FromDiscord | <Elegantbeef> Actually `One` in the above example will be 1\` |
02:19:52 | FromDiscord | <Elegantbeef> `Foo` starts the enum |
02:19:57 | FromDiscord | <graveflo> oh right |
02:20:01 | FromDiscord | <graveflo> gaah see |
05:04:46 | * | LuxuryMode joined #nim |
05:44:26 | FromDiscord | <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:49 | FromDiscord | <sOkam! 🫐> the way enum sets work is whats confusing you, not quite the enum value itself |
05:45:26 | FromDiscord | <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:18 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Iyb |
06:53:04 | FromDiscord | <Elegantbeef> You are correct, did you override the `sink`, `copy`, and `dup`? |
06:53:53 | * | azimut joined #nim |
06:54:04 | FromDiscord | <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:28 | FromDiscord | <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:35 | Amun-Ra | Sink & Destroy, great song |
10:18:43 | * | junaid_ joined #nim |
10:46:03 | * | junaid_ quit (Remote host closed the connection) |
11:50:27 | FromDiscord | <frobnicate> How do I use a proc in my nimble file? |
11:50:35 | FromDiscord | <frobnicate> Or what's the alternative? |
11:51:38 | FromDiscord | <Chronos [She/Her]> In reply to @frobnicate "How do I use": Wdym? It's just Nimscript, is it not? |
11:52:02 | FromDiscord | <frobnicate> Well I couldn't get my proc to work in a task. It kept complaining about missing identifier |
11:52:31 | FromDiscord | <Chronos [She/Her]> Did you export the proc? Calling it with all the correct arguments, etc? |
11:52:38 | FromDiscord | <Chronos [She/Her]> Did you import the proc? |
11:52:43 | FromDiscord | <frobnicate> I made the proc in the nimble file itself |
11:52:52 | FromDiscord | <frobnicate> That's not allowed? |
11:52:59 | FromDiscord | <Chronos [She/Her]> Ah, very odd then, maybe tasks are treated as separate scripts? Not sure |
11:53:09 | FromDiscord | <Chronos [She/Her]> You can import Nim code in Nimble files |
11:57:42 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4Izo |
11:58:02 | FromDiscord | <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:30 | FromDiscord | <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:42 | FromDiscord | <nnsee> instead of a comma between `w` and `h`, you could use a semicolon |
12:09:29 | FromDiscord | <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:13 | FromDiscord | <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:53 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IzG |
12:55:21 | PMunch | If it's a console application I don't think it can start a UI can it? |
12:55:33 | PMunch | Or wait, maybe it can, but it also run a terminal.. |
12:56:13 | FromDiscord | <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:25 | PMunch | Kinda 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:14 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IzI |
13:01:52 | FromDiscord | <kcvinker5420> How to set the target processor target os in compiler command. I mean what is the values for `--os` and `--cpu` ? |
13:04:52 | PMunch | What about that hint? It just lists the compilation options |
13:05:12 | PMunch | By default you're compiling for the machine and architecture you're on, so I wouldn't mess with those |
13:13:12 | FromDiscord | <kcvinker5420> Oh, I see. I was thinking about to make sure the right os and right cpu arc |
13:14:44 | FromDiscord | <kcvinker5420> Okay, I can go back to version 1.6. But what's equivalent for `Path` in 1.6 ? |
13:17:58 | PMunch | Path? |
13:24:30 | FromDiscord | <odexine> There pretty much isn’t |
13:24:38 | FromDiscord | <odexine> Use strings or your own distinct |
13:29:43 | FromDiscord | <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:17 | FromDiscord | <kcvinker5420> In reply to @PMunch "Path?": Sorry for the delay in my reply. Yes, I mean Path type in version 2.0 |
14:21:45 | FromDiscord | <kcvinker5420> @sOkam! 🫐 & @odexine Thanks. |
14:27:04 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4IAG |
14:27:30 | FromDiscord | <kcvinker5420> `orc` & `arc` has no effect |
14:28:23 | FromDiscord | <kcvinker5420> So I am sure there is something related to memory management |
14:43:50 | FromDiscord | <Chronos [She/Her]> What if you change it to `--app:gui`? |
14:43:56 | FromDiscord | <Chronos [She/Her]> Does anything else happen maybe? |
14:49:33 | FromDiscord | <kcvinker5420> In reply to @chronos.vitaqua "Does anything else happen": Let me try that |
14:50:04 | FromDiscord | <Chronos [She/Her]> 👍 |
14:50:36 | FromDiscord | <kcvinker5420> @Chronos [She/Her] OMG! It just worked |
14:50:55 | FromDiscord | <Chronos [She/Her]> Hm, I don't know how Windows worked so that was a complete gamble aha |
14:51:14 | FromDiscord | <kcvinker5420> Ha ha, but it leaves a problem |
14:51:17 | * | azimut joined #nim |
14:51:22 | FromDiscord | <Chronos [She/Her]> No console? |
14:51:36 | FromDiscord | <kcvinker5420> Yes, we need it when developing |
14:51:57 | FromDiscord | <kcvinker5420> But I think IDE will catch the stdouts |
14:52:28 | FromDiscord | <Chronos [She/Her]> Fair, it should hopefully |
14:52:43 | FromDiscord | <Chronos [She/Her]> Otherwise, you could log to a file perhaps? |
14:53:07 | FromDiscord | <kcvinker5420> In reply to @chronos.vitaqua "Otherwise, you could log": Yeah. |
14:53:25 | FromDiscord | <kcvinker5420> Any how, `--mm:orc` is still not working |
14:53:35 | FromDiscord | <Chronos [She/Her]> Not the greatest thing ever, but maybe someone with more Windows + Nim logic would understand |
14:53:58 | FromDiscord | <kcvinker5420> In reply to @chronos.vitaqua "Not the greatest thing": Yeah |
14:54:09 | FromDiscord | <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:28 | FromDiscord | <Chronos [She/Her]> Though, you could see if Nim devel has the same issue and/or if `-d:useMalloc` fixes it |
14:55:00 | FromDiscord | <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:29 | FromDiscord | <kcvinker5420> In reply to @chronos.vitaqua "Though, you could see": Yeah, I see the `-d:useMalloc` docs. Lets just try |
14:57:14 | FromDiscord | <kcvinker5420> @Chronos [She/Her] `-d:useMalloc` worked with default mm, but program started without all controls. |
14:57:57 | FromDiscord | <Chronos [She/Her]> Hm |
14:58:16 | FromDiscord | <Chronos [She/Her]> Very off behaviour, you should document this in a GitHub issue and report it |
14:58:29 | FromDiscord | <kcvinker5420> Yeah |
15:15:31 | arkanoid | any1 experienced with winim? I'm getting "winim64.res is not a valid Win32 resource file" |
15:17:22 | * | dolololadidi joined #nim |
15:18:49 | dolololadidi | can't I see the C that nim generates on the try online thing? |
15:24:09 | dolololadidi | wow using C++ libs is really really cool |
15:24:16 | dolololadidi | it's made very simple! |
15:29:50 | * | dolololadidi quit (Quit: Client closed) |
15:37:38 | FromDiscord | <nervecenter> yeah it's super nice, all you really need is a function signature |
15:38:02 | FromDiscord | <nervecenter> I usually add a proc to wrap that signature in a more Nim-ish function that does all the converting necessary |
16:05:28 | NimEventer | New 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:28 | FromDiscord | <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:10 | FromDiscord | <Chronos [She/Her]> In reply to @wick3dr0se "Is there a way": By checking the length of the array |
16:32:12 | FromDiscord | <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:18 | FromDiscord | <Chronos [She/Her]> ^^ |
16:33:41 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4IBl |
16:33:55 | FromDiscord | <wick3dr0se> Obv has a lot of bounds issues |
16:34:37 | FromDiscord | <wick3dr0se> Ill just have to pass args directly ig |
16:34:39 | FromDiscord | <jviega> Yes, the answer is test the length of args before requesting indexes that might be out of bounds. |
16:34:48 | FromDiscord | <wick3dr0se> Too many to check tho |
16:34:59 | FromDiscord | <wick3dr0se> I'll just send the entire sequence to each setCmd call ig |
16:35:39 | FromDiscord | <jviega> That doesn't much make sense but okay. |
16:35:53 | FromDiscord | <demotomohiro> Overload `setCmd(args: seq[string])` that checks args len and call `setCmd(args[0], args[1])`. |
16:36:22 | FromDiscord | <wick3dr0se> Genuis |
16:37:00 | FromDiscord | <wick3dr0se> (edit) "Genuis" => "Genius" |
16:46:59 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBq |
16:51:37 | FromDiscord | <demotomohiro> In reply to @user2m "Hey guys how do": https://nim-lang.org/docs/manual.html#statements-and-expressions-tuple-unpacking |
16:57:34 | FromDiscord | <luxurymode> sent a code paste, see https://play.nim-lang.org/#ix=4IBu |
16:58:00 | FromDiscord | <luxurymode> also seems backwards to me anyways, wouldn't we want expressions to be callable without `()` and not statements... |
17:00:08 | FromDiscord | <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:27 | FromDiscord | <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:43 | FromDiscord | <user2m> becaause `myproc` would take varargs like so `proc myproc(args:varargs[int])` |
17:05:12 | FromDiscord | <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:22 | FromDiscord | <luxurymode> (edit) removed "unpack and" |
17:07:11 | FromDiscord | <user2m> yeah I'm thinking I'm going to have to use a seq like so |
17:07:20 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBA |
17:07:24 | FromDiscord | <user2m> but I don't know how to unpack a seq |
17:08:42 | FromDiscord | <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:22 | FromDiscord | <inventormatt> there is this library from 5 years that might work https://github.com/technicallyagd/unpack |
17:10:01 | FromDiscord | <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:34 | FromDiscord | <user2m> I think this'll work |
17:13:46 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBF |
17:18:28 | FromDiscord | <luxurymode> I'm lost. You said: ↵↵> but I don't know ahead of time how many variables will be returned |
17:18:38 | FromDiscord | <luxurymode> `myproc(1,2,3,4,5)` won't work |
17:18:41 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4IBI |
17:18:51 | FromDiscord | <luxurymode> bc you've already declared `var returned: tuple[a,b,c: int]` |
17:18:53 | FromDiscord | <user2m> In reply to @luxurymode "I'm lost. You said:": maybe I didnt explain myself well |
17:19:02 | FromDiscord | <luxurymode> I think not 😆 |
17:19:39 | FromDiscord | <luxurymode> Oh I guess you're trying to just discard anything beyond the size of your target tuple |
17:19:40 | FromDiscord | <luxurymode> ? |
17:19:41 | FromDiscord | <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:42 | FromDiscord | <inventormatt> it is a few years old so it might need an update or two |
17:21:29 | FromDiscord | <froglerr> how would i add a wait in my nim code? |
17:22:08 | FromDiscord | <nervecenter> In reply to @froglerr "how would i add": https://nim-lang.org/docs/os.html#sleep%2Cint |
17:22:14 | FromDiscord | <froglerr> thanks |
17:22:32 | FromDiscord | <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:29 | FromDiscord | <froglerr> sent a code paste, see https://play.nim-lang.org/#ix=4IBO |
17:41:33 | FromDiscord | <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:56 | FromDiscord | <Shiba> anyone know how to fix this? |
17:43:24 | FromDiscord | <Shiba> is this a bug |
17:48:59 | FromDiscord | <michaelb.eth> In reply to @Shiba "iam getting this everytime": any Nim program, even if it consists only of `echo "hello"`? |
17:49:24 | FromDiscord | <Shiba> yea |
17:49:34 | FromDiscord | <Shiba> eversince i updated to 2.0 |
17:52:54 | FromDiscord | <michaelb.eth> hmm, sounds like an issue with where/how it was installed |
17:53:13 | FromDiscord | <michaelb.eth> I haven't run into anything like that, but I don't work with Nim on Windows too frequently |
17:55:06 | FromDiscord | <Shiba> me neither i always been a linux fan |
17:55:14 | FromDiscord | <Shiba> till i had to install windows lately |
17:57:16 | FromDiscord | <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:56 | FromDiscord | <Shiba> i use gitbash all the time |
17:58:08 | FromDiscord | <michaelb.eth> it's a half-neutered MSYS2, but sure |
17:58:24 | FromDiscord | <michaelb.eth> gitbash, I mean |
18:00:18 | FromDiscord | <michaelb.eth> MSYS2, using its CLANG64 environment esp. if you're doing multithreaded you'll get better (sometimes much better) performing executables |
18:01:24 | FromDiscord | <michaelb.eth> up-to-date installer is linked from the home page, easy to give it a spin: https://www.msys2.org/ |
18:04:43 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4IC1 |
18:07:34 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4IC2 |
18:11:54 | FromDiscord | <Shiba> its aint gonna work supper >win8 nd iam on 7 |
18:12:00 | FromDiscord | <Shiba> (edit) "supper" => "support" |
18:12:51 | FromDiscord | <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:07 | FromDiscord | <michaelb.eth> (edit) "oof" => "of" |
18:21:41 | FromDiscord | <michaelb.eth> even if you had to use an older build of the installer, many of the packages might work just fine |
18:22:32 | FromDiscord | <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:55 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
18:47:26 | FromDiscord | <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:50 | FromDiscord | <Shiba> how can u compare a cahr to another |
18:53:51 | FromDiscord | <Shiba> one |
18:54:00 | FromDiscord | <Shiba> wihtouth gettin an erro of mismatch |
18:54:13 | FromDiscord | <Shiba> (edit) "cahr" => "char" |
18:54:24 | FromDiscord | <Shiba> (edit) "wihtouth" => "wihtouh" | "erro" => "error" |
18:54:31 | FromDiscord | <Shiba> (edit) "wihtouh gettin an ... error" added "mismatch" | removed "of mismatch" |
18:55:22 | FromDiscord | <Chronos [She/Her]> Are you actually comparing two characters? |
18:55:42 | FromDiscord | <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:52 | FromDiscord | <Chronos [She/Her]> Can't compare a string to a character for example |
18:56:18 | FromDiscord | <Chronos [She/Her]> (Also, `'a'` is different from `"a"`, the former is a character, the latter is a string) |
18:58:02 | FromDiscord | <demotomohiro> In reply to @Shiba "how can u compare": You can convert char to other int types like `mychar.int`. |
18:58:02 | FromDiscord | <Shiba> ok got it |
18:58:59 | FromDiscord | <demotomohiro> If you want to compare char with string, `mystr[i] == mychar`. |
19:00:12 | NimEventer | New 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:21 | FromDiscord | <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:08 | FromDiscord | <michaelb.eth> so, while it depends on what you're doing, you should probably be using facilities in Nim `std/unicode` |
19:28:57 | FromDiscord | <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:17 | FromDiscord | <michaelb.eth> https://nim-lang.org/docs/unicode.html#toRunes%2Cstring |
20:01:03 | FromDiscord | <.aingel.> does nim have to build each import every time you build a project too? |
20:01:08 | FromDiscord | <.aingel.> Like each nimble import? |
20:01:16 | FromDiscord | <.aingel.> I thought it caches it or something |
20:02:16 | FromDiscord | <nervecenter> Yes Nim caches any C compile that hasn't changed |
20:02:22 | FromDiscord | <nervecenter> And by extension GCC will cache as well |
20:02:39 | FromDiscord | <.aingel.> What about c++ |
20:03:11 | FromDiscord | <nervecenter> Pretty sure clang caches unchanged sources as well |
20:03:40 | FromDiscord | <.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:35 | FromDiscord | <nervecenter> huh |
20:05:02 | FromDiscord | <.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:10 | FromDiscord | <.aingel.> Is there a way to cache that |
20:05:39 | FromDiscord | <nervecenter> You could precompile it as a static lib |
20:05:55 | FromDiscord | <.aingel.> I want that, but i want it to be like platform independent |
20:06:01 | FromDiscord | <.aingel.> Or at least work on mac and linux |
20:06:32 | FromDiscord | <nervecenter> Easiest way to be platform independent is to set up a compilation configuration on each target for each target |
20:06:38 | FromDiscord | <nervecenter> I've had bad luck trying to cross compile |
20:07:01 | FromDiscord | <.aingel.> What does cross compile mean in this context? |
20:07:12 | FromDiscord | <.aingel.> In reply to @nervecenter "Easiest way to be": That's what I thought I was doing or planned on doing |
20:07:19 | FromDiscord | <nervecenter> Compiling on one platform for another, ie compiling a Windows binary on Linux |
20:07:27 | FromDiscord | <.aingel.> I thought you were referring to pre building it and shipping the built lib with nimble |
20:07:57 | FromDiscord | <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:17 | FromDiscord | <.aingel.> In reply to @nervecenter "No, I mean compiling": Yeah that is exactly what I am doing currently |
20:08:21 | FromDiscord | <nervecenter> okay |
20:08:24 | FromDiscord | <.aingel.> It's just that code runs every time |
20:08:37 | FromDiscord | <.aingel.> But now that I think about it clang is probably not rebuilding it |
20:08:44 | FromDiscord | <.aingel.> The command is just running but not building it |
20:09:09 | FromDiscord | <nervecenter> You should only have the compile it once, once you have your .a file all you need is a --passL: flag |
20:09:31 | FromDiscord | <nervecenter> Like `--passl:libs/mylib.a` |
20:09:36 | FromDiscord | <.aingel.> Do I have to manually detect if it has been built already |
20:09:50 | FromDiscord | <.aingel.> Or is there like some one time build step I can do for a nimble package |
20:10:21 | FromDiscord | <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:36 | FromDiscord | <.aingel.> No I know how to do that |
20:11:38 | FromDiscord | <nervecenter> Unless your goal is to actually call the c++ source files and have clang compile them with your project |
20:11:39 | FromDiscord | <.aingel.> It's already building |
20:11:56 | FromDiscord | <.aingel.> It just builds on every run of importing the lib |
20:12:06 | FromDiscord | <.aingel.> Cause the build step is in the nimble lib |
20:12:18 | FromDiscord | <.aingel.> Is there some sort of build static lib on nimble install? |
20:12:23 | FromDiscord | <.aingel.> Does that make sense? |
20:12:25 | FromDiscord | <nervecenter> Maybe I shouldn't be helping you then because I don't use nimble |
20:12:27 | FromDiscord | <nervecenter> I use makefiles |
20:12:52 | FromDiscord | <.aingel.> Oh so you are just talking about a build step in make |
20:13:05 | FromDiscord | <nervecenter> Nah I'm talking about something you do ocne and basically never again |
20:13:12 | FromDiscord | <nervecenter> (edit) "ocne" => "once" |
20:13:19 | FromDiscord | <nervecenter> Only when the library gets important updates |
20:13:30 | FromDiscord | <nervecenter> once the .a file is in your source dir, you're just linking against it, that's it |
20:13:32 | FromDiscord | <.aingel.> But how do you ship your project then |
20:13:49 | FromDiscord | <nervecenter> As a compiled binary? I'm not sure what you're asking |
20:14:08 | FromDiscord | <.aingel.> Sorta |
20:14:16 | FromDiscord | <.aingel.> Well.. so I want to ship this as a library |
20:14:22 | FromDiscord | <.aingel.> But I can't just build the .a on mac |
20:14:31 | FromDiscord | <.aingel.> I have to build it on linux and idk well |
20:14:39 | FromDiscord | <.aingel.> U know diff architectures |
20:14:47 | FromDiscord | <Phil> ... anyone bored who'd be curious about what it feels like to wrap a GTK widget 😛 ? |
20:15:24 | FromDiscord | <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:20 | FromDiscord | <demotomohiro> In reply to @isofruit "... anyone bored who'd": https://github.com/StefanSalewski/gintro |
20:20:31 | FromDiscord | <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:13 | FromDiscord | <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:50 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "So I made a": is this with the setup we configured the other day? |
20:44:02 | FromDiscord | <sOkam! 🫐> because if yes, the caching is per-project specific |
20:44:32 | FromDiscord | <sOkam! 🫐> so if you build different projects, they each have their own cache |
20:47:49 | FromDiscord | <Chronos [She/Her]> I'm debating on using Msgpack or Protobuf for my binary format for my app's API tbh |
20:48:28 | FromDiscord | <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:37 | FromDiscord | <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:57 | FromDiscord | <Elegantbeef> No it only has binary operators |
20:52:12 | FromDiscord | <Elegantbeef> `y in 0..<height` is the nim way |
20:53:42 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4ICS |
20:54:24 | FromDiscord | <Elegantbeef> `px in 0..<height and y in 0..<height` |
20:55:39 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright! |
20:55:53 | FromDiscord | <System64 ~ Flandre Scarlet> I confused with a for loop |
20:57:56 | FromDiscord | <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:22 | FromDiscord | <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:22 | FromDiscord | <demotomohiro> How about to try that operator on:https://godbolt.org |
21:08:26 | FromDiscord | <.aingel.> How do I execute a path relative to the position of the executable? |
21:08:37 | FromDiscord | <System64 ~ Flandre Scarlet> Damn! it even supports Nim! |
21:09:20 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "How do I execute": `GetAppDir()` maybe...? |
21:09:43 | FromDiscord | <Chronos [She/Her]> https://nim-lang.org/docs/os.html#getAppDir |
21:09:49 | FromDiscord | <Chronos [She/Her]> (edit) "`GetAppDir()`" => "`getAppDir()`" |
21:09:51 | FromDiscord | <.aingel.> In reply to @chronos.vitaqua "`getAppDir()` maybe...?": Right, what about getCurrentDir? |
21:10:22 | FromDiscord | <_goel_> A few years have passed... and still nimsuggest hasn't been replaced with anthing better? How come? |
21:10:24 | FromDiscord | <.aingel.> I think appdir might be better |
21:10:32 | FromDiscord | <.aingel.> In reply to @_goel_ "A few years have": No IC I think |
21:10:42 | FromDiscord | <Chronos [She/Her]> Current working dir != App dir |
21:10:53 | FromDiscord | <sOkam! 🫐> In reply to @_goel_ "A few years have": probably because its difficult and tedious coding that nobody wants to do |
21:11:10 | FromDiscord | <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:13 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Right, what about getCurrentDir?": getCurrentDir is where the app was launched -from- |
21:11:40 | FromDiscord | <Chronos [She/Her]> It is insane to be able to help ppl with Nim :p |
21:11:51 | FromDiscord | <System64 ~ Flandre Scarlet> No bitshift?? https://media.discordapp.net/attachments/371759389889003532/1161048403858444459/image.png?ex=6536e196&is=65246c96&hm=9a6e7047a3042a709e1272896cb620c5e9522faa607688167a982d4aab9c8dc2& |
21:13:06 | FromDiscord | <Elegantbeef> Nah nothing is as inefficient as python↵(@ezquerra) |
21:13:22 | FromDiscord | <demotomohiro> In reply to @sys64 "No bitshift??": Nim detects overflow in default. Try -d:danger to see simpler assembly code. |
21:14:46 | FromDiscord | <Elegantbeef> Yes the joke response is that if you want to see performance, profile |
21:14:48 | FromDiscord | <System64 ~ Flandre Scarlet> Oh we have shift now↵Seems -d:danger is waaaaay faster |
21:14:53 | FromDiscord | <Elegantbeef> Never trust the view of some random on the internet |
21:15:48 | FromDiscord | <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:43 | FromDiscord | <Elegantbeef> Of course |
21:16:43 | FromDiscord | <Elegantbeef> But profile or look at the asm to be certain |
21:16:44 | FromDiscord | <Elegantbeef> It does have to first create a `Slice[T]` so that is mild overhead |
21:33:58 | FromDiscord | <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:20 | FromDiscord | <ezquerra> OK, thanks |
22:04:42 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> templates are code substitution they should not impact speed of code much if at all |
22:05:26 | FromDiscord | <Elegantbeef> I have a feeling you are duplicating work with your template not realising it |
22:10:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ID2 |
22:13:46 | FromDiscord | <lanky.lemur> sent a code paste, see https://play.nim-lang.org/#ix=4ID4 |
22:17:37 | FromDiscord | <Elegantbeef> Use `monotimes` instead firstly |
22:22:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ID5 |
22:23:05 | FromDiscord | <Elegantbeef> Secondly they're within margin of error |
22:23:16 | FromDiscord | <lanky.lemur> But they're consistently different |
22:23:46 | FromDiscord | <lanky.lemur> And the order I run them doesn't matter |
22:24:22 | FromDiscord | <lanky.lemur> Using monotimes, I get:↵proc: 257.441 ms↵template: 306.629 ms |
22:24:32 | FromDiscord | <Elegantbeef> Code ran at top level is not as optimised as code in a proc |
22:24:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/v1AnE |
22:24:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Xj86O |
22:30:05 | FromDiscord | <lanky.lemur> Okay, you're absolutely right. When I create a wrapper proc to test both, I get basically the same performance |
22:30:58 | FromDiscord | <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:24 | FromDiscord | <Elegantbeef> Actually all the MMs have it |
22:31:29 | FromDiscord | <Elegantbeef> Arc/Orc have improved the optimisation a bit, but there's still the mild cost |