| 00:01:54 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
| 00:02:16 | * | njoseph joined #nim |
| 00:17:41 | FromDiscord | <ElegantBeef> Hell yea pmunch due to people trying the bindings atleast for linux it's now even easier. got `nimble setup` which installs the deps and fetches the pico sdk, then you can just `nimble make` |
| 00:21:38 | * | Tlanger quit (Ping timeout: 240 seconds) |
| 00:22:19 | * | tiorock joined #nim |
| 00:22:19 | * | rockcavera is now known as Guest57290 |
| 00:22:20 | * | Guest57290 quit (Killed (card.freenode.net (Nickname regained by services))) |
| 00:22:20 | * | tiorock is now known as rockcavera |
| 00:26:59 | * | tiorock joined #nim |
| 00:26:59 | * | tiorock quit (Changing host) |
| 00:26:59 | * | tiorock joined #nim |
| 00:26:59 | * | rockcavera quit (Killed (barjavel.freenode.net (Nickname regained by services))) |
| 00:26:59 | * | tiorock is now known as rockcavera |
| 00:27:51 | * | rockcavera quit (Remote host closed the connection) |
| 00:31:15 | FromDiscord | <Sabena Sema> has the whitespace sensitive operator binding been totally removed? |
| 00:34:01 | FromDiscord | <ElegantBeef> what do you mean? |
| 00:34:23 | FromDiscord | <ElegantBeef> `10 -10` != `10 - 10` |
| 00:34:32 | FromDiscord | <Sabena Sema> there used to be a mode where like `a+b c` would do `(a+b)c` |
| 00:35:01 | FromDiscord | <Sabena Sema> each power of two number of spaces would decrease precedence by one |
| 00:35:49 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#syntax-precedence↵Base off that i think so |
| 00:40:31 | * | rockcavera joined #nim |
| 00:45:06 | * | Vladar quit (Quit: Leaving) |
| 00:47:00 | * | rockcavera quit (Read error: Connection reset by peer) |
| 00:47:45 | * | rockcavera joined #nim |
| 00:49:14 | FromDiscord | <TennisBowling> hey how can I interact with api's? I know I can use python's requests inside of nim but still |
| 00:51:03 | FromDiscord | <ElegantBeef> Well we have multiple HTTP libraries |
| 00:51:18 | FromDiscord | <ElegantBeef> You have the stdlib `httpclient` |
| 00:51:26 | FromDiscord | <ElegantBeef> Treeform has `puppy` |
| 00:52:01 | FromDiscord | <ElegantBeef> The standard library one relies on `openssl` so you need to ship that or statically link it to anywhere you go |
| 00:52:16 | FromDiscord | <ElegantBeef> "Anywhere you go" talking about platforms you compile to |
| 00:53:56 | FromDiscord | <TennisBowling> ahh okay |
| 01:02:21 | * | Tlangir joined #nim |
| 01:08:16 | FromDiscord | <Nisha's alt> In reply to @TennisBowling "hey how can I": (Gonna sound like a hypocrite but whatevs) Bad idea |
| 01:08:22 | FromDiscord | <Nisha's alt> Not necessarily bad |
| 01:08:29 | FromDiscord | <Nisha's alt> But... Dumb |
| 01:09:07 | FromDiscord | <Nisha's alt> I'd always recommend using a Nim library before even LOOKING at another lang's libraries to use in Nim |
| 01:13:10 | FromDiscord | <ElegantBeef> Lol |
| 01:13:20 | FromDiscord | <ElegantBeef> When nisha says dumb idea you know it was silly 😄 |
| 01:13:28 | FromDiscord | <ElegantBeef> Sorry couldnt help myself |
| 01:17:42 | FromDiscord | <nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2W09 |
| 01:17:56 | FromDiscord | <Hi02Hi> `for a in -11..<11:` |
| 01:29:20 | FromDiscord | <Sabena Sema> will ↵`static: sizeof(int)` give 64 if I'm compiling a 64-bit executable with a 32-bit version of the compiler? |
| 01:29:46 | FromDiscord | <ElegantBeef> I believe it emulates the destination |
| 01:33:19 | FromDiscord | <nsauzede> Is there some documentation/example on how to access program arguments ? (like argc argv) |
| 01:33:52 | FromDiscord | <ElegantBeef> You can use https://nim-lang.org/docs/parseopt.html for an easy to use abstraction |
| 01:34:06 | FromDiscord | <Sabena Sema> why were case statement macros needed for pattern matching? why not term rewriting macros? |
| 01:34:11 | FromDiscord | <ElegantBeef> or manually access them with `paramStr` and `paramCount` from OS |
| 01:34:36 | FromDiscord | <nsauzede> Thanks |
| 01:35:03 | FromDiscord | <Rika> Because term rewriting macros are kinda broken isn't it? |
| 01:35:24 | FromDiscord | <Sabena Sema> they are not really broken, they are just insanely dangerous |
| 01:35:39 | FromDiscord | <Sabena Sema> also I don't think they participate in overload resolution in quite the same way as case macros |
| 01:36:28 | FromDiscord | <Rika> The implementation is wonky I hear is what I mean from broken |
| 01:44:51 | * | rockcavera quit (Remote host closed the connection) |
| 01:52:00 | * | rockcavera joined #nim |
| 02:04:22 | FromDiscord | <nsauzede> is thee a way to convert a string to int ? |
| 02:04:35 | FromDiscord | <nsauzede> (found toInt but it's for floats) |
| 02:05:31 | FromDiscord | <nsauzede> (edit) "thee" => "there" | "therea way to convert a string to int ? ... " added "(eg: like `atoi`)" |
| 02:06:50 | rockcavera | nsauzede https://nim-lang.org/docs/strutils.html#parseInt%2Cstring |
| 02:07:06 | rockcavera | or https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint |
| 02:07:25 | rockcavera | opz |
| 02:07:51 | rockcavera | Is the string a number? |
| 02:08:43 | FromDiscord | <nsauzede> yep 🙂 it works fine |
| 02:08:50 | FromDiscord | <nsauzede> (edit) "fine" => "fine, thanks" |
| 02:09:09 | rockcavera | =) |
| 02:14:43 | * | thomasross joined #nim |
| 02:14:57 | FromDiscord | <ElegantBeef> Make sure to catch exceptions 😛 |
| 02:20:34 | * | rockcavera quit (Remote host closed the connection) |
| 02:34:51 | * | rockcavera joined #nim |
| 02:46:32 | * | thomasross quit (Ping timeout: 240 seconds) |
| 03:09:32 | * | spiderstew_ joined #nim |
| 03:11:21 | * | spiderstew quit (Ping timeout: 260 seconds) |
| 03:30:24 | * | wasted_youth2 quit (Read error: Connection reset by peer) |
| 03:57:45 | * | sknebel quit (Ping timeout: 246 seconds) |
| 03:58:39 | * | sknebel joined #nim |
| 04:12:25 | * | letto quit (Quit: Konversation terminated!) |
| 04:24:07 | * | letto joined #nim |
| 05:42:22 | * | johnnynitwits quit (Quit: Bridge terminating on SIGTERM) |
| 05:42:22 | * | threenp quit (Quit: Bridge terminating on SIGTERM) |
| 05:42:49 | * | johnnynitwits joined #nim |
| 05:42:49 | * | threenp joined #nim |
| 05:42:51 | * | johnnynitwits quit (Excess Flood) |
| 05:43:01 | * | johnnynitwits joined #nim |
| 05:50:36 | * | threenp quit (Quit: Bridge terminating on SIGTERM) |
| 05:50:36 | * | johnnynitwits quit (Quit: Bridge terminating on SIGTERM) |
| 05:51:02 | * | johnnynitwits joined #nim |
| 05:51:03 | * | threenp joined #nim |
| 05:52:42 | * | rockcavera quit (Remote host closed the connection) |
| 06:04:26 | * | narimiran joined #nim |
| 06:13:32 | * | narimiran quit (Ping timeout: 265 seconds) |
| 06:16:15 | * | narimiran joined #nim |
| 06:31:14 | FromDiscord | <TennisBowling> hello everyone, I have this for loop in python `for i in range(1,100000000):↵ a=2(i%2)-1↵ pi+=an/d↵ d+=2` and I can't seem to get it into nim |
| 06:33:38 | FromDiscord | <haxscramper> Replace range with ..< and % with mod. You might have to explicitly convert to int/float or import std/lenientopts to allow for more relaxed math operations (like mixing integer and float in multiplication etc.) |
| 06:33:58 | FromDiscord | <haxscramper> (edit) "or" => "and/or" |
| 06:34:34 | * | raboof quit (Ping timeout: 245 seconds) |
| 06:34:47 | * | notchris quit (Read error: Connection reset by peer) |
| 06:37:01 | * | notchris joined #nim |
| 06:37:25 | * | raboof joined #nim |
| 06:59:05 | * | PMunch joined #nim |
| 06:59:43 | FromDiscord | <TennisBowling> not quite sure I follow. |
| 06:59:53 | FromDiscord | <jtiai> How I should go with types where A depends on B and B depends on A? Should I declare third module where I define both? |
| 07:02:20 | FromDiscord | <Solitude> yes, mutually recursive types have to be in one type section |
| 07:23:57 | * | haxscramper joined #nim |
| 07:28:31 | FromDiscord | <haxscramper> In reply to @TennisBowling "hello everyone, I have": ``nim |
| 07:28:40 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2W0Z |
| 07:51:49 | * | Gustavo6046 quit (Ping timeout: 250 seconds) |
| 07:57:39 | FromDiscord | <Varriount> sent a code paste, see https://play.nim-lang.org/#ix=2W15 |
| 07:58:25 | FromDiscord | <Varriount> (the Python implementation has the same problem) |
| 08:02:58 | FromDiscord | <haxscramper> Yes, this can probably be improved somehow, but I don't think that it really important here |
| 08:12:26 | FromDiscord | <Sabena Sema> how does the `{.compileTime.}` variable access at runtime actually work? is it just going to be broken until IC is fully functional? |
| 08:13:15 | FromDiscord | <ElegantBeef> What's broken with it? |
| 08:13:46 | FromDiscord | <Sabena Sema> the runtime value has no relation to anything that happened at compile time |
| 08:13:50 | FromDiscord | <Sabena Sema> it's just default initialized |
| 08:14:29 | FromDiscord | <Sabena Sema> I can't really find much discussion of this, except for the RFC that wants to remove the feature |
| 08:14:39 | FromDiscord | <haxscramper> You mean something like this? https://play.nim-lang.org/#ix=2W1a |
| 08:15:31 | FromDiscord | <haxscramper> If you do `const runtest = test` it works, but I agree this is not really obvious |
| 08:15:37 | FromDiscord | <Sabena Sema> yeah, that's an example of the odd behavior |
| 08:15:45 | FromDiscord | <Sabena Sema> and you could do the const thing before the behavior change |
| 08:15:49 | FromDiscord | <haxscramper> In reply to @Sabena Sema "I can't really find": https://github.com/nim-lang/RFCs/issues/338 |
| 08:15:55 | FromDiscord | <Sabena Sema> yeah |
| 08:16:03 | FromDiscord | <haxscramper> And that's the only discussion basically that was about this |
| 08:16:12 | FromDiscord | <Sabena Sema> then again, if things worked like the manual says it would be a neat feature |
| 08:25:37 | * | Vladar joined #nim |
| 08:42:12 | * | Tlangir quit (Remote host closed the connection) |
| 09:04:07 | FromDiscord | <nsauzede> How can we allocate a byte array at runtime ? |
| 09:05:38 | FromDiscord | <ElegantBeef> What are you after exactly? |
| 09:06:12 | FromDiscord | <ElegantBeef> You can do `seq[byte]` |
| 09:06:18 | FromDiscord | <nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2W1r |
| 09:06:32 | FromDiscord | <nsauzede> so in Nim, I would like to allocate `bytes` at runtime |
| 09:06:49 | FromDiscord | <ElegantBeef> Well a sequence would work if you dont change the length |
| 09:07:01 | FromDiscord | <nsauzede> yep fixed length |
| 09:07:14 | FromDiscord | <ElegantBeef> Someone should make a `FixedSeq` 😄 |
| 09:08:05 | FromDiscord | <nsauzede> fixed as : arbitrary at runtime but doesn't change once the buffer is allocated😅 |
| 09:08:11 | FromDiscord | <ElegantBeef> Yea that's what i mean |
| 09:08:15 | FromDiscord | <nsauzede> (edit) "fixed as ... :" added "in" |
| 09:08:21 | FromDiscord | <nsauzede> oof |
| 09:08:22 | FromDiscord | <ElegantBeef> To change the size of FixedSeq you'd need to reinit it |
| 09:08:36 | FromDiscord | <ElegantBeef> But that doesnt exist in the stdlib |
| 09:09:11 | FromDiscord | <nsauzede> In C I would do `bytes = malloc(arbitrary_len);` |
| 09:09:23 | FromDiscord | <ElegantBeef> Sure but that gives you 0 safeties |
| 09:09:39 | FromDiscord | <nsauzede> so in Nim, I should do `var bytes : seq[byte]` ? |
| 09:09:52 | FromDiscord | <nsauzede> then allocate it with some helper ? |
| 09:10:01 | FromDiscord | <Rika> newSeq |
| 09:10:05 | FromDiscord | <Rika> That’s your helper |
| 09:10:24 | FromDiscord | <Rika> The number you pass is the amount of entries in the sequence |
| 09:15:36 | FromDiscord | <ElegantBeef> If you do want a FixedSeq this would be a good start https://play.nim-lang.org/#ix=2W1w |
| 09:16:53 | FromDiscord | <ElegantBeef> All of it was untested and rushed 😄 |
| 09:16:59 | * | teasea quit (Quit: teasea) |
| 09:17:48 | FromDiscord | <nsauzede> what would be the benefit over std `seq` ? perf ? |
| 09:17:56 | FromDiscord | <nsauzede> (edit) "perf" => "perf/mem usage" |
| 09:17:57 | FromDiscord | <ElegantBeef> Slightly safer |
| 09:18:02 | FromDiscord | <nsauzede> oh |
| 09:18:12 | FromDiscord | <nsauzede> (edit) "oh ... " added "-- I see" |
| 09:18:18 | FromDiscord | <ElegantBeef> You know to resize you have to do `newFixedSeq` since there is no `.add` |
| 09:18:55 | * | teasea joined #nim |
| 09:19:04 | FromDiscord | <nsauzede> for now it's not required -- I'm only evaluating Nim to see how it performs on my naive benchmark.. |
| 09:19:25 | FromDiscord | <nsauzede> ideally I'd like to beat my Rust and C impls 🙂 |
| 09:20:46 | FromDiscord | <nsauzede> can I pass the above `bytes` to `writeBuffer` directly ? |
| 09:20:54 | FromDiscord | <ElegantBeef> Probably |
| 09:22:48 | FromDiscord | <nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2W1x |
| 09:24:47 | FromDiscord | <ElegantBeef> `writeBytes` |
| 09:24:48 | FromDiscord | <haxscramper> `addr buffer, len buffer` |
| 09:25:00 | FromDiscord | <ElegantBeef> well would be `addr buffer[0]` |
| 09:27:23 | FromDiscord | <ElegantBeef> Someone should take my keyboard cause i basically finished `FixedSeq` 😄 |
| 09:29:04 | FromDiscord | <nsauzede> sent a code paste, see https://play.nim-lang.org/#ix=2W1z |
| 09:29:08 | FromDiscord | <nsauzede> Is this canoNimcal ? |
| 09:29:22 | FromDiscord | <nsauzede> (edit) "canoNimcal" => "canoNimcal" |
| 09:29:37 | FromDiscord | <ElegantBeef> no the hungarian notation isnt |
| 09:30:14 | FromDiscord | <nsauzede> I didn't get it ? |
| 09:30:32 | FromDiscord | <ElegantBeef> I'm commenting o n`fnameout` and `fout` |
| 09:30:40 | FromDiscord | <nsauzede> oh right -- thanks |
| 09:30:53 | FromDiscord | <nsauzede> should have been `fNameOut` ? |
| 09:30:58 | FromDiscord | <ElegantBeef> `fileName` 😄 |
| 09:31:01 | FromDiscord | <nsauzede> (edit) "should have been `fNameOut` ... ?" added "`fOut`" |
| 09:31:22 | FromDiscord | <ElegantBeef> `file` would work for `fOut` i guess |
| 09:31:28 | FromDiscord | <Rika> Out file |
| 09:31:39 | FromDiscord | <ElegantBeef> when i read those vars i just read them with a weird lisp |
| 09:32:15 | FromDiscord | <nsauzede> (for now it's just a bare manual transpile from other langs which explains strangeness -- but I'm willing to learn the Nim way) |
| 09:34:23 | FromDiscord | <ElegantBeef> Worth noting in that code it'll echo `"Cant write"` even if it did write |
| 09:34:36 | FromDiscord | <ElegantBeef> since it returns the number of bytes written to the file |
| 09:34:54 | * | lritter joined #nim |
| 09:34:59 | FromDiscord | <ElegantBeef> So if it only writes half the file it'll say it didnt write, but it in fact did |
| 09:35:51 | FromDiscord | <ElegantBeef> Anyone got a repo that nimble has issue resolving dependancies for? |
| 09:42:09 | Clonkk[m] | Fidget v0.7.5 used to have the issue depending on the packages you already have installed |
| 09:47:01 | FromDiscord | <ElegantBeef> I have a very dumb resolve which might "work" for that now, but it's ughly |
| 09:47:27 | FromDiscord | <nsauzede> Hey, nice ! my little (first) Nim benchmark is slightly slower than Rust but faster than my (suboptimal) C impl ! thanks for your help https://media.discordapp.net/attachments/371759389889003532/831827983467282492/unknown.png |
| 09:47:48 | FromDiscord | <nsauzede> Nim is really great ! |
| 09:47:56 | FromDiscord | <ElegantBeef> Did you do `-d:danger -d:flto --gc:arc`? |
| 09:48:04 | FromDiscord | <nsauzede> I did : |
| 09:48:20 | FromDiscord | <ElegantBeef> also possibly `--opt:speed --passC:-flto --passL:-flto` |
| 09:48:49 | FromDiscord | <nsauzede> `nim c --hints:off -d:release -d:danger --gc:arc -d:lto -o:main02.elf main02.nim` |
| 09:49:00 | FromDiscord | <ElegantBeef> Atleast i've seen one case where the opt was stuck on off |
| 09:49:12 | FromDiscord | <ElegantBeef> dont need both danger/release one or the other will work |
| 09:49:38 | FromDiscord | <nsauzede> I also tried `-march native` but that screwed my bit-exact regression |
| 09:49:54 | FromDiscord | <nsauzede> (probably messes with float computes dunno) |
| 09:50:54 | FromDiscord | <nsauzede> should I replace `-d:lto` by your two `--pass` ? or just add them ? |
| 09:51:11 | FromDiscord | <clyybber> `-d:lto` should accomplish the same |
| 09:51:58 | FromDiscord | <ElegantBeef> I'm worried about my bodged dependancy resolver in nimble cause it seems to work properly and how nimble should've worked 😄 |
| 09:52:13 | FromDiscord | <clyybber> well then :D push it :D |
| 09:52:29 | FromDiscord | <ElegantBeef> I mean i did but it's certainly not proper |
| 09:52:38 | FromDiscord | <ElegantBeef> It does properly reason about atleast `>=` deps |
| 09:53:13 | FromDiscord | <ElegantBeef> IE if you have >= 0.2.3 and another package has 0.2.5 it does correctly say that the min version allowed is the latter |
| 09:53:27 | FromDiscord | <clyybber> and nimble doesn't? |
| 09:53:41 | FromDiscord | <ElegantBeef> Well it didnt seem to properly fetch them |
| 09:54:07 | FromDiscord | <ElegantBeef> I think i bodged in a whole "collect all deps" then "remove disallowed" |
| 09:54:17 | FromDiscord | <clyybber> cool |
| 09:54:26 | FromDiscord | <ElegantBeef> Emphasis on "think" |
| 09:54:30 | FromDiscord | <clyybber> heh |
| 09:55:19 | FromDiscord | <ElegantBeef> Right now i have an infinite recursion problem and my solution is to just disallow running a procedure more than once using a global bool, so clearly i dont understand how nimble works |
| 09:57:05 | FromDiscord | <zetashift> In reply to @nsauzede "Hey, nice ! my": Very cool! Looking good too |
| 09:57:52 | FromDiscord | <ElegantBeef> atleast at first glance nimble goes through top down and fetches any packages that arent installed |
| 09:58:20 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=2W1E |
| 09:58:26 | FromDiscord | <ElegantBeef> `age in 11..17` |
| 09:58:32 | FromDiscord | <ElegantBeef> and you can do it in case |
| 09:59:00 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2W1F |
| 09:59:00 | FromDiscord | <ElegantBeef> Anywho i sleep |
| 09:59:27 | FromDiscord | <haxscramper> In reply to @ElegantBeef "atleast at first glance": Yes, it just fetches them directly while resolving dependencies |
| 10:00:09 | FromDiscord | <haxscramper> One of the main complaints in #890 is that it is not possible to even run `nimble test` without it trying to download/install something |
| 10:00:33 | FromDiscord | <haxscramper> Well, not "one of the main", but it is certainly annoying |
| 10:01:28 | FromDiscord | <zetashift> In reply to @ElegantBeef "Anywho i sleep": Good night! |
| 10:01:45 | FromDiscord | <clyybber> @Solitude any reason you used nanosleep instead of sleep? |
| 10:06:26 | FromDiscord | <Solitude> i needed sub ms precision |
| 10:08:11 | FromDiscord | <Solitude> or did i |
| 10:08:17 | FromDiscord | <clyybber> seems overkill I think |
| 10:08:31 | FromDiscord | <clyybber> I can't notice any perceptible difference when using sleep |
| 10:12:06 | FromDiscord | <Solitude> thats because default step is 30ms |
| 10:12:28 | FromDiscord | <clyybber> yeah |
| 10:12:54 | FromDiscord | <clyybber> dunno if it makes sense to support sub ms precision |
| 10:13:20 | FromDiscord | <Solitude> it doesn't, ill remove it |
| 10:13:25 | FromDiscord | <clyybber> I made a PR |
| 10:14:05 | FromDiscord | <Goel> "Switch statements are also supported, although in Nim they’re known as case"↵Why are they called Switch if their associated keyword is case? |
| 10:14:10 | FromDiscord | <clyybber> @Solitude <https://github.com/SolitudeSF/nbonsai/pull/1> |
| 10:14:37 | FromDiscord | <clyybber> In reply to @Goel ""Switch statements are also": I guess the sentence is directed at users coming from other languages |
| 10:14:50 | FromDiscord | <Solitude> In reply to @Clyybber "<@!104136074569211904> <https://github.com/Solitude": explain yourself https://media.discordapp.net/attachments/371759389889003532/831834873563971614/unknown.png |
| 10:14:57 | FromDiscord | <clyybber> oh ugh |
| 10:15:05 | FromDiscord | <clyybber> umm |
| 10:15:37 | FromDiscord | <clyybber> leftover from another thing I was trying :D |
| 10:15:57 | FromDiscord | <clyybber> I was thinking about an option to show the current seed somewhere |
| 10:16:50 | FromDiscord | <nsauzede> In reply to @zetashift "Very cool! Looking good": Thanks ! but I only followed the RTIOW book ; and I also know that there was already (at least) one other Nim impl of it -- but I wanted to write it from scratch, to discover the language |
| 10:36:05 | * | aeverr joined #nim |
| 10:36:19 | * | natrys joined #nim |
| 11:06:44 | FromDiscord | <zetashift> In reply to @nsauzede "Thanks ! but I": Yup https://nim-lang.org/blog/2020/06/30/ray-tracing-in-nim.html (there are more but this one is has a lot of extras) |
| 11:09:17 | FromDiscord | <gollark> Is there something case-insensitive like string tables, but not just strings to strings? |
| 11:13:23 | FromDiscord | <nsauzede> In reply to @zetashift "Yup https://nim-lang.org/blog/2020/06/30/ray-tracin": Exactly ; I saw this, and tried not to get tainted by its solution 😉 |
| 11:14:02 | FromDiscord | <nsauzede> I'm pretty sure its impl might be even faster than mine |
| 11:14:12 | FromDiscord | <nsauzede> but eh, one must start somewhere |
| 11:17:39 | FromDiscord | <haxscramper> In reply to @gollark "Is there something case-insensitive": You can create `distinct` type and write case-insensetive `hash`/`==` for it |
| 11:17:56 | FromDiscord | <haxscramper> The only thing I can think of |
| 11:18:15 | FromDiscord | <gollark> Hmm, that might work. |
| 11:20:17 | * | inamannerofspeak joined #nim |
| 11:23:55 | * | clyybber joined #nim |
| 11:26:13 | * | clyybber quit (Client Quit) |
| 11:26:26 | * | clyybber joined #nim |
| 11:27:21 | FromDiscord | <clyybber> the current base64 encode takes openarray[SomeInteger | char] even though it will just take the first byte of the passed in integers |
| 11:27:44 | FromDiscord | <clyybber> should probably be changed to openarray[uint8 | int8 | char] |
| 11:27:55 | FromDiscord | <clyybber> or take all the bytes of the integers passed in |
| 11:40:43 | * | antranigv left #nim ("Leaving") |
| 11:45:21 | FromDiscord | <zetashift> In reply to @nsauzede "but eh, one must": Indeed, a good reason to not immediately look up the answer |
| 12:12:08 | * | vicfred quit (Quit: Leaving) |
| 12:25:44 | * | krux02 joined #nim |
| 13:00:54 | * | rockcavera joined #nim |
| 13:27:10 | ForumUpdaterBot | New Nimble package! csv2dbsrc - create db util sources from csv, see https://github.com/z-kk/csv2dbsrc |
| 13:27:14 | * | tane joined #nim |
| 13:34:56 | * | stefantalpalaru quit (Ping timeout: 245 seconds) |
| 13:36:36 | * | bozaloshtsh quit (Ping timeout: 245 seconds) |
| 13:37:04 | * | Fish-Face quit (Ping timeout: 245 seconds) |
| 13:38:25 | * | bozaloshtsh joined #nim |
| 13:38:25 | * | bozaloshtsh quit (Changing host) |
| 13:38:25 | * | bozaloshtsh joined #nim |
| 13:40:40 | * | stefantalpalaru joined #nim |
| 13:41:09 | * | Fish-Face joined #nim |
| 13:42:49 | * | rockcavera quit (Remote host closed the connection) |
| 13:43:40 | * | narimiran quit (Ping timeout: 252 seconds) |
| 13:45:53 | * | rockcavera joined #nim |
| 13:46:41 | * | stefantalpalaru quit (Ping timeout: 240 seconds) |
| 13:50:53 | * | stefantalpalaru joined #nim |
| 13:51:11 | * | stefantalpalaru quit (Changing host) |
| 13:51:11 | * | stefantalpalaru joined #nim |
| 13:54:57 | ForumUpdaterBot | New thread by Abudden: Getting started with the Foreign Function Interface - calling library functions, see https://forum.nim-lang.org/t/7790 |
| 13:55:35 | PMunch | @ElegantBeef, how happy where you when you saw this post? https://forum.nim-lang.org/t/7789 |
| 14:00:20 | FromDiscord | <Rika> oh wow nice, was actually considering to move to the rp2040 as well for my kb lmao |
| 14:01:06 | PMunch | For a keyboard?! :S What're you going to do with the firmware that requires that much oomph? |
| 14:01:32 | PMunch | Here I am trying to keep my FW small enough that I can potentially port it to an ATtiny85 :P |
| 14:01:48 | FromDiscord | <Rika> well, i dont. its just easy to acquire |
| 14:02:06 | PMunch | But it's so overpowered! :P |
| 14:02:06 | FromDiscord | <Rika> reminder that i live in fucking whereever the fuck i am in japan |
| 14:02:17 | FromDiscord | <Rika> you think i care, im not mass producing this |
| 14:02:25 | FromDiscord | <Rika> the price difference is what |
| 14:02:29 | PMunch | Uhm, I live in the arctic.. Not exactly easy to get stuff here either |
| 14:03:04 | FromDiscord | <Rika> but you live in europe xd |
| 14:03:24 | PMunch | Barely :P |
| 14:04:28 | FromDiscord | <Rika> well you're not the one designing a pcb here, im not really up to designing a keyboard around an attiny |
| 14:04:31 | PMunch | Distance wise I live in Europe about as much as you live in China :P |
| 14:04:34 | FromDiscord | <Rika> keyboard -> pcb i mean |
| 14:05:01 | FromDiscord | <Rika> you're connected to europe |
| 14:05:47 | FromDiscord | <Rika> by using an rp2040 that's like 1 less board for me to design amongst idk 2 or 3 or so |
| 14:06:03 | PMunch | Well, I buy almost all my components and chips and stuff from China.. |
| 14:06:12 | PMunch | Local resellers are crazy expensive |
| 14:06:25 | PMunch | Even with the new tax regulations it's cheaper to just buy from AliExpress |
| 14:07:12 | FromDiscord | <Rika> me being near china doesnt mean its any cheaper if you didnt know |
| 14:08:19 | FromDiscord | <Rika> and again, if i used an attiny then id need to design an extra board |
| 14:08:30 | FromDiscord | <Rika> and i dont even think that thing can drive whatever im planning to put on this board |
| 14:08:35 | FromDiscord | <Rika> actually no it prolly can |
| 14:08:53 | PMunch | Probably get stuff faster though.. |
| 14:09:00 | FromDiscord | <Rika> maybe ill just fucking design the board damn it fuck you this is gonna take me a week or something because im fucking slow |
| 14:09:03 | PMunch | I barely remember what I've ordered by the time it arrives :P |
| 14:09:17 | PMunch | Haha, just do whatever suits you :) |
| 14:09:58 | PMunch | I mean you can use a chip on a breakout, I wasn't saying you should actually get an SMD ATtiny85 and the components to have that work |
| 14:11:04 | FromDiscord | <Rika> no, pcb |
| 14:11:06 | PMunch | Oh well, I've gotta go |
| 14:11:18 | FromDiscord | <Rika> im not doing some hacky ass wire bullshite for my keyboard xd |
| 14:11:24 | PMunch | Haha :P |
| 14:11:39 | PMunch | I guess when I have my keyboard up and working fully it would be fun to create a PCB for it |
| 14:11:59 | PMunch | With the IO expanders and mini-jacks all on the board |
| 14:12:30 | PMunch | I'm just a bit paranoid about height.. I can't stand tall keyboards. |
| 14:13:18 | PMunch | But as I said, gotta go |
| 14:13:24 | FromDiscord | <Rika> height? does the lack of a pcb make it shorter or are you planning on using massive ICs |
| 14:13:25 | FromDiscord | <Rika> okay |
| 14:13:39 | PMunch | Not shorter, slimmer |
| 14:14:07 | PMunch | My current design makes the keys rest on the desk, only stabilised by the frame |
| 14:14:13 | PMunch | There's no bottom to the board |
| 14:15:08 | * | PMunch quit (Quit: leaving) |
| 14:15:13 | FromDiscord | <Rika> you should go |
| 14:15:20 | FromDiscord | <Rika> continuing will spend more time |
| 14:28:56 | * | wasted_youth2 joined #nim |
| 14:52:05 | * | Gustavo6046 joined #nim |
| 15:18:26 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=2W3b |
| 15:49:07 | FromDiscord | <mlokis> is it possible to pass multiple blocks to template? |
| 15:51:12 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2W3r |
| 15:51:37 | FromDiscord | <mlokis> thnx |
| 15:52:33 | FromDiscord | <mlokis> ah yes satisfaction |
| 16:31:38 | * | inamannerofspeak quit (Ping timeout: 240 seconds) |
| 16:43:08 | * | NimBot joined #nim |
| 16:46:50 | FromDiscord | <mlokis> can i somehow view how template generated code looks like? |
| 16:47:41 | FromDiscord | <haxscramper> https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctyped |
| 16:51:43 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=2W3S |
| 16:53:06 | FromDiscord | <Solitude> you are assigning int to float |
| 16:53:12 | FromDiscord | <Solitude> `2 (i mod 2) - 1` is int |
| 16:54:32 | FromDiscord | <TennisBowling> okay but how can I make the `2` and `1` floats? |
| 16:54:46 | FromDiscord | <Solitude> font. make whole expression float |
| 16:54:48 | FromDiscord | <Solitude> dont |
| 16:54:57 | FromDiscord | <TennisBowling> oh |
| 16:55:21 | FromDiscord | <Solitude> now its not clear why a is float in the first place |
| 16:55:40 | FromDiscord | <TennisBowling> why not |
| 16:55:44 | FromDiscord | <TennisBowling> I need decimal |
| 16:56:02 | FromDiscord | <Solitude> yeah, whatevr |
| 16:57:32 | FromDiscord | <TennisBowling> In reply to @Solitude "font. make whole expression": how ? 🔰 |
| 16:59:50 | FromDiscord | <Solitude> float(expression) |
| 17:00:08 | FromDiscord | <Solitude> https://nim-lang.org/docs/tut1.html#basic-types-type-conversion |
| 17:04:35 | * | inamannerofspeak joined #nim |
| 17:06:08 | FromDiscord | <mlokis> i em triing to add immediate pragma to template though its not working |
| 17:06:14 | FromDiscord | <mlokis> (edit) "triing" => "trying" |
| 17:06:29 | FromDiscord | <mlokis> (edit) "immediate" => "`immediate`" |
| 17:06:37 | FromDiscord | <mlokis> i get `cannot attach a custom pragma` |
| 17:06:55 | FromDiscord | <mlokis> em i missing an import |
| 17:08:13 | * | Prestige quit (Ping timeout: 250 seconds) |
| 17:09:20 | * | inamannerofspeak quit (Ping timeout: 252 seconds) |
| 17:09:21 | * | Prestige joined #nim |
| 17:17:47 | FromDiscord | <TennisBowling> `proc float fib(): =` |
| 17:18:01 | FromDiscord | <TennisBowling> gives undeclared identifier fib |
| 17:18:26 | Prestige | don't need the : |
| 17:18:41 | FromDiscord | <Solitude> https://nim-lang.org/docs/tut1.html#procedures |
| 17:18:47 | FromDiscord | <Solitude> proc fib(): float = |
| 17:23:38 | FromDiscord | <TennisBowling> gives implementation of pi.float expected |
| 17:39:25 | FromDiscord | <haxscramper> You can show code via https://play.nim-lang.org/ |
| 17:48:05 | * | vicfred joined #nim |
| 18:18:01 | * | lritter quit (Ping timeout: 260 seconds) |
| 18:19:39 | FromDiscord | <mikip0> sent a long message, see http://ix.io/2W4o |
| 18:27:53 | FromDiscord | <ajusa> In reply to @ajusa "Will incremental compilation speed": Just tried IC on the js backend, it's five times faster! It doesn't work, but it crashes five times faster now!↵(I know IC isn't ready, just wanted to try it out though) |
| 18:29:07 | giaco__ | how to turn a string int32 the corresponding 1:1 byte-to-byte string (4 bytes long)? |
| 18:29:31 | giaco__ | please remove first "string" occurrence in my question |
| 18:35:39 | FromDiscord | <Solitude> giaco, cast int32 into char array and do whatever or copyMem into preallocated string |
| 18:41:10 | * | rockcavera quit (Remote host closed the connection) |
| 18:43:04 | FromDiscord | <haxscramper> In reply to @mikip0 "hi, newbie here, i'm": you can get type via `typeof` so you don't have to make it a template with typedesc (and `typedesc` does not necessarily imply `templte`) |
| 18:43:49 | giaco__ | Solitude: thanks |
| 18:44:07 | FromDiscord | <haxscramper> You can have rutime `Table[string, int]` if you wish, and use `$typeof(arg)` for example, if you want to make it simpler (at the expense of runtime performance) |
| 18:46:19 | FromDiscord | <haxscramper> > "map certain types to an increasing uint16 id per type at compile time and replace a macro call with the mapped uint16 for the passed type" ↵You can also try and do this using single function where you explicitly write all mappings for a select number of types |
| 18:46:49 | FromDiscord | <haxscramper> Something like that |
| 18:46:50 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2W4B |
| 18:50:48 | FromDiscord | <mikip0> sent a code paste, see https://play.nim-lang.org/#ix=2W4C |
| 18:51:25 | FromDiscord | <mikip0> the thing i'm struggling with, and am not sure how to resolve is something like this: <https://play.nim-lang.org/#ix=2W4D> |
| 18:52:53 | FromDiscord | <mikip0> the proc wants to call the macro, but i suppose by the time macros are resolved the templated proc isn't split into 1 proc per type so i can't actually do that? |
| 18:54:03 | FromDiscord | <mikip0> i can post my current code as well instead of this example, but it's a bit more cluttered so idk if anyone actually wants to read through that |
| 18:54:41 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2W4E |
| 18:56:08 | FromDiscord | <haxscramper> `const val = getIdAux()` is for transferring types between compiletime variables and runtime |
| 18:57:05 | FromDiscord | <haxscramper> And you can do it at runtime with almost the same logic https://play.nim-lang.org/#ix=2W4F |
| 18:57:18 | * | blackpawn quit (Ping timeout: 240 seconds) |
| 18:57:22 | * | blackpawn_ joined #nim |
| 18:58:35 | FromDiscord | <mikip0> ok, that's cool, so basically this `const val` part captures it at compile time in the first example right? and it's the added benefit it's actually quite simple |
| 18:59:27 | FromDiscord | <mikip0> and as you said, the runtime version is really similiar so i can probably quite easily merge them, thanks a lot @haxscramper |
| 18:59:57 | FromDiscord | <haxscramper> Though it breaks on |
| 18:59:59 | FromDiscord | <haxscramper> 1. generics |
| 19:00:08 | FromDiscord | <haxscramper> 2. similarly named types from different modules |
| 19:00:19 | FromDiscord | <haxscramper> 3. Generics x2 |
| 19:01:08 | FromDiscord | <haxscramper> In reply to @haxscramper "1. generics": Though I'm not sure how you would want to handle `seq[int]` vs `seq[string]` or if this is necessary at all |
| 19:01:25 | FromDiscord | <Goel> @haxscramper If i define `var x: int` it is int32 or int64 based on system architecture right? But what happens in the case of a x86 if that var gets overflow? Nim will automatically turn it into a int64? |
| 19:01:38 | FromDiscord | <mikip0> 2. ik, it's a limitation i have as well↵seq handling is not necessary↵1 and 3 are a shame still |
| 19:01:54 | * | narimiran joined #nim |
| 19:02:13 | FromDiscord | <haxscramper> In reply to @Goel "<@!608382355454951435> If i define": It won't be automatically turned into int64 of couse, because that means you have to change type of a variable |
| 19:02:39 | FromDiscord | <haxscramper> IIRC you would get `OverflowDefect` raised |
| 19:02:52 | FromDiscord | <haxscramper> !eval echo high(int) + 1 |
| 19:02:59 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/fatal.nim(49) sysFatal↵Error: unhandled exception: over- or underflow [OverflowDefect] |
| 19:03:38 | FromDiscord | <Goel> I see, so in this case is better to simply define them as var x: int64 if im not sure to prevent it |
| 19:05:14 | FromDiscord | <haxscramper> If you need specific integer size then use it, otherwise `int` is a good default in almost all cases. I think. |
| 19:07:48 | * | azed joined #nim |
| 19:11:37 | FromDiscord | <PsychoClay> does `continue` work in for loops? |
| 19:17:17 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2W4Q |
| 19:18:12 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2W4R |
| 19:18:45 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2W4S |
| 19:19:31 | FromDiscord | <mlokis> is size static? |
| 19:20:05 | FromDiscord | <mlokis> like you have `const size` not `var size` |
| 19:20:26 | FromDiscord | <jtiai> There is nothing yet. Just trying to setup datastructures. |
| 19:20:27 | FromDiscord | <mlokis> though error is off |
| 19:21:03 | FromDiscord | <haxscramper> In reply to @jtiai "Having some troubles with": You need to specify parameter for `Memory`, like `Memory[256]` |
| 19:21:06 | FromDiscord | <haxscramper> Like for `array` |
| 19:21:31 | FromDiscord | <jtiai> So how I can refer to array which is unknown at the time of writing. |
| 19:21:42 | FromDiscord | <haxscramper> And "not a concrete type" is related to `mem: seq[Memory]` because you didn't specify size explicitly |
| 19:21:43 | FromDiscord | <mlokis> use seq then |
| 19:21:46 | FromDiscord | <haxscramper> no |
| 19:21:57 | FromDiscord | <haxscramper> It can be done witout seq, wait a second |
| 19:22:23 | FromDiscord | <jtiai> There willbe 9878321 different "instances" of Memory,. |
| 19:22:24 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2W4T |
| 19:22:31 | FromDiscord | <haxscramper> You just need to make `Bus` generic also |
| 19:23:01 | FromDiscord | <haxscramper> Because `Memory` is a generic therefore you need to either specify concrete type or make everything generic too |
| 19:23:03 | FromDiscord | <mlokis> sent a code paste, see https://paste.rs/EAi |
| 19:23:23 | FromDiscord | <mlokis> or maybe not am not sure what he wants |
| 19:23:26 | FromDiscord | <jtiai> Out of curiosity, why bus needs to be generic? |
| 19:23:34 | FromDiscord | <haxscramper> In reply to @haxscramper "Because `Memory` is a": . |
| 19:23:48 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
| 19:24:11 | FromDiscord | <haxscramper> You either need to stop creating generics but substituting some concrete value |
| 19:24:16 | FromDiscord | <haxscramper> Or continue making generics |
| 19:24:21 | FromDiscord | <jtiai> So there is no way to have a list objects that do have arrays? |
| 19:24:23 | * | Gustavo6046 joined #nim |
| 19:24:44 | FromDiscord | <mlokis> all arrays need to have same size or use seq |
| 19:25:05 | FromDiscord | <haxscramper> If arrays have different size no. If they have the same size then they are of the same type and so you can easily store them in seq |
| 19:25:22 | FromDiscord | <jtiai> Arrays are different sizes, since they emulate some computer memory. |
| 19:25:27 | FromDiscord | <jtiai> (or device) |
| 19:25:47 | FromDiscord | <mlokis> so you need array with variable size? |
| 19:25:58 | FromDiscord | <jtiai> Several arrays with fixed sizes. |
| 19:26:11 | * | rockcavera joined #nim |
| 19:26:20 | FromDiscord | <haxscramper> with different fixed sizes? |
| 19:26:21 | FromDiscord | <jtiai> size can be different but they are known at compile time. |
| 19:26:34 | FromDiscord | <mlokis> collection cannot contain data with different sizes |
| 19:26:40 | FromDiscord | <dk> Maybe make a different field for each array size |
| 19:26:53 | FromDiscord | <jtiai> diefferent field? |
| 19:27:04 | FromDiscord | <jtiai> Err for infinite array sizes? |
| 19:27:12 | FromDiscord | <mlokis> In reply to @dk "Maybe make a different": we are getting wery memory effective now |
| 19:27:26 | FromDiscord | <dk> I thought you said you know the sizes, I misunderstand |
| 19:27:44 | FromDiscord | <jtiai> I know when building final configuration for emulated device. |
| 19:27:58 | FromDiscord | <mlokis> can you describe the behavior you want? |
| 19:28:20 | FromDiscord | <mlokis> arrays size needs to be known at compile time |
| 19:28:30 | FromDiscord | <jtiai> A emulated memory , basically an array of different bit sizes. |
| 19:28:43 | FromDiscord | <mlokis> then you need seq |
| 19:29:23 | FromDiscord | <mlokis> well all the arrays inside the seq have same size? |
| 19:29:51 | FromDiscord | <mlokis> (edit) "well" => "will" |
| 19:29:57 | FromDiscord | <jtiai> No. |
| 19:30:11 | FromDiscord | <mlokis> then its imposible to have arrays here |
| 19:30:52 | FromDiscord | <jtiai> Don't you people read? I have several times said: arrays are known at compile time. array size is known at compile time. I don't know before compilation configuration of memories. |
| 19:31:16 | giaco__ | Solitude: what do you think about the alternative solution: myint32.toHex.parseHexStr? |
| 19:32:13 | FromDiscord | <haxscramper> You want to have something like a single emulator instance with some fixed number of memory arrays (like RAM, L1 cache or whatever) and use single `Memory` type for all of them? |
| 19:32:54 | FromDiscord | <jtiai> Yes because range is quite huge. |
| 19:33:43 | FromDiscord | <haxscramper> So the emulator instance is parametrized on these sizes (which are known at compile-time) |
| 19:33:48 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=2W4W |
| 19:34:26 | FromDiscord | <jtiai> In reply to @haxscramper "So the emulator instance": Yes. There is nothing "dynamic" involved. |
| 19:34:26 | FromDiscord | <haxscramper> In reply to @haxscramper "So the emulator instance": If you want to make emulator fully parametric on all sizes you would have to pass them as generic type parameters all the way down to where they are used |
| 19:35:15 | FromDiscord | <Solitude> In reply to @giaco__ "<@104136074569211904>: what do you": awful |
| 19:35:30 | FromDiscord | <haxscramper> So create different fields for different memory elements and arrange size parameters however you need |
| 19:36:41 | FromDiscord | <jtiai> If I drop down to `seq` would it be significantly slower? |
| 19:37:32 | FromDiscord | <jtiai> Because majority of emulation revolves around reading and writing memory... |
| 19:38:02 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2W4X |
| 19:38:07 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=2W4X" => "https://paste.rs/1tG" |
| 19:38:21 | FromDiscord | <Yardanico> outside can be an array (if you don't change the length), but inside ones have to be seqs since they have different length |
| 19:38:29 | FromDiscord | <haxscramper> In reply to @jtiai "If I drop down": One more pointer indirection |
| 19:38:32 | FromDiscord | <Yardanico> or you can have padded arrays |
| 19:42:13 | FromDiscord | <mlokis> from what i understand he wants to store differently sized data structure in sequence witch makes you unable to safely index into it |
| 19:42:44 | FromDiscord | <mlokis> (edit) "you unable" => "it impossible" |
| 19:42:52 | FromDiscord | <Yardanico> i'm confused who is asking help with what |
| 19:43:27 | FromDiscord | <mlokis> am not asking for help |
| 19:46:09 | FromDiscord | <Gennadiy> sent a long message, see http://ix.io/2W53 |
| 19:47:12 | FromDiscord | <Gennadiy> (edit) "http://ix.io/2W53" => "http://ix.io/2W54" |
| 20:09:19 | * | Vladar quit (Quit: Leaving) |
| 20:10:05 | * | narimiran quit (Ping timeout: 240 seconds) |
| 20:15:33 | * | natrys quit (Quit: natrys) |
| 20:18:06 | * | stefantalpalaru quit (Ping timeout: 240 seconds) |
| 20:18:46 | FromDiscord | <sealmove> @giaco you here? |
| 20:30:37 | FromDiscord | <hamidb80> did you know that`reverse` proc is in `algorithm` module and not `sequtils` 🤔 |
| 20:31:21 | FromDiscord | <hamidb80> (edit) "🤔" => "🤔?" |
| 20:43:35 | FromDiscord | <ElegantBeef> yes |
| 20:43:59 | * | inamannerofspeak joined #nim |
| 20:48:49 | * | inamannerofspeak quit (Ping timeout: 252 seconds) |
| 20:49:19 | * | haxscramper quit (Remote host closed the connection) |
| 20:49:43 | * | haxscramper joined #nim |
| 20:49:46 | * | haxscramper quit (Remote host closed the connection) |
| 20:57:13 | * | krux02 quit (Remote host closed the connection) |
| 20:57:49 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2W5w |
| 21:00:54 | FromDiscord | <ElegantBeef> `array[1024, uint8]` |
| 21:01:15 | * | stefantalpalaru joined #nim |
| 21:03:06 | FromDiscord | <jtiai> So how do I set that to object? |
| 21:04:51 | FromDiscord | <sealmove> Just like this. `data: array[1024, uint8]` |
| 21:05:58 | FromDiscord | <jtiai> So when I do `var rom = Memory()` then I can do `rom.data: array[1024, uint8]`? |
| 21:06:38 | FromDiscord | <sealmove> `:` is mostly for declarations, not assignments |
| 21:06:44 | FromDiscord | <Solitude> no, array is preallocated with object |
| 21:06:49 | FromDiscord | <ElegantBeef> It's an array it'd already be 0'd inited |
| 21:07:03 | FromDiscord | <ElegantBeef> so it'd take up the KB and 0 it |
| 21:07:37 | FromDiscord | <jtiai> Well that's what I want but I want to tell size as a parameter, not as typed fixed static value in code. |
| 21:08:03 | FromDiscord | <Solitude> use a sequence? |
| 21:08:57 | FromDiscord | <Yardanico> In reply to @jtiai "Well that's what I": if that size is known at compile-time, you can make your Memory a generic |
| 21:09:22 | FromDiscord | <jtiai> I tried to make it generic but then I was told that everything that uses it must be generic too... |
| 21:09:55 | FromDiscord | <Yardanico> yes, because you'll be dealing with different types effectively |
| 21:10:00 | FromDiscord | <jtiai> Like bus should be generic - even it's not generic just because it uses generics... |
| 21:10:14 | FromDiscord | <Yardanico> oh, if you want to store seq[Memory] then you can't use generics |
| 21:10:34 | FromDiscord | <Yardanico> if you expect seq[Memory] to be able to contain Memory objects of different sizes |
| 21:10:39 | FromDiscord | <jtiai> Of course because there can be several pieces of memory. like "rom", "ram", video ram" |
| 21:11:03 | FromDiscord | <Yardanico> yes, but what's your actual problem? you were told to use seqs a lot of times if you need dynamic memory sizes |
| 21:11:30 | FromDiscord | <jtiai> My actual problem is to store several predefined static arrays in an array. |
| 21:11:45 | FromDiscord | <jtiai> and second array is dynamic. |
| 21:11:57 | FromDiscord | <jtiai> I don't know at compile time which memories might be enabled. |
| 21:12:10 | FromDiscord | <Yardanico> In reply to @jtiai "My actual problem is": you can't, since seqs can only hold variables of the same type |
| 21:12:20 | FromDiscord | <Yardanico> but two arrays with different sizes are different types |
| 21:12:43 | FromDiscord | <Yardanico> again, why seqs don't work for you? |
| 21:12:54 | FromDiscord | <Yardanico> seq[Memory] and Memory has a data which is a seq too |
| 21:13:17 | FromDiscord | <jtiai> Can I make data as "fixed sized" since I need to use it by index always. |
| 21:13:29 | FromDiscord | <Yardanico> In reply to @jtiai "Can I make data": yes, you can just preallocate the seq when starting the program |
| 21:13:37 | FromDiscord | <Yardanico> so then no reallocations will be needed for it |
| 21:14:23 | FromDiscord | <sealmove> GUYS, can someone tell how is something like nimpy possible O_O I just used it for the first time and I am so amazed and thrilled!!! |
| 21:14:23 | FromDiscord | <jtiai> how about `newSeq`? |
| 21:14:53 | FromDiscord | <Yardanico> In reply to @รєคɭ๓๏שє "GUYS, can someone tell": CPython C API + some Nim sugar, as usual :P |
| 21:15:11 | FromDiscord | <sealmove> OMG I AM SO HAPPY |
| 21:15:12 | FromDiscord | <Yardanico> In reply to @jtiai "how about `newSeq`?": well, that's what I'm talking about |
| 21:15:27 | FromDiscord | <sealmove> now i can write Nim forever |
| 21:15:39 | FromDiscord | <Solitude> thats the plan |
| 21:16:18 | FromDiscord | <jtiai> how about seq performance, though that probably is least of my worries with current cpu power vs machines I plan to emulate... |
| 21:16:32 | FromDiscord | <Yardanico> what about it |
| 21:16:48 | FromDiscord | <sealmove> In reply to @jtiai "how about seq performance,": well jtiai, seqs can use the stack, so it's not like you are allocating on the heap |
| 21:17:01 | FromDiscord | <Yardanico> In reply to @รєคɭ๓๏שє "well jtiai, seqs can": stack wouldn't work for his usecase anyway |
| 21:17:08 | FromDiscord | <Yardanico> and you can't allocate seqs on stack in Nim without hacks |
| 21:17:20 | FromDiscord | <sealmove> really? |
| 21:17:34 | FromDiscord | <Yardanico> yes |
| 21:17:45 | FromDiscord | <Yardanico> seqs are always on the heap, same as "ref object" types |
| 21:18:30 | FromDiscord | <Yardanico> but again, seqs are not that complicated, they won't be worse in performance than a heap allocated array in any other native language like C |
| 21:18:44 | FromDiscord | <Yardanico> since you're not reallocating them anyway, just 1 allocation on the program startup |
| 21:18:55 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2W5H |
| 21:18:56 | FromDiscord | <Yardanico> what do you want data to be? |
| 21:19:08 | FromDiscord | <Yardanico> what type should it store? |
| 21:19:15 | FromDiscord | <sealmove> seq[byte]? |
| 21:19:19 | FromDiscord | <jtiai> seq[int8] |
| 21:19:50 | FromDiscord | <Yardanico> then just do that |
| 21:19:59 | FromDiscord | <Yardanico> data: seq[int8] |
| 21:23:01 | FromDiscord | <ElegantBeef> that will be 0 len on creation of memory so you might want `Memory(data: newSeq[int8](1024))` or w/e you want the size to be |
| 21:26:35 | FromDiscord | <hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=2W5N |
| 21:26:55 | FromDiscord | <ElegantBeef> `new T` |
| 21:27:50 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2W5O |
| 21:28:08 | FromDiscord | <exelotl> you're probably best off using a `var seq` as the parameter |
| 21:28:13 | FromDiscord | <exelotl> rather than ref seq |
| 21:28:35 | FromDiscord | <ElegantBeef> True |
| 21:34:17 | FromDiscord | <jtiai> Now final issue for tonight: |
| 21:36:07 | FromDiscord | <jtiai> sent a code paste, see https://play.nim-lang.org/#ix=2W5R |
| 21:36:52 | FromDiscord | <jtiai> Of course I get recursion error. How that should be done? |
| 21:37:31 | FromDiscord | <Solitude> one of these types has to be a reference |
| 21:37:33 | FromDiscord | <ElegantBeef> `typeB = ref object` |
| 21:39:24 | FromDiscord | <jtiai> Actually both should be refs. That would make sense in this context. |
| 21:42:04 | FromDiscord | <jtiai> At least I learnt a small piece of Nim. After 10 years I will master it! |
| 21:47:56 | * | Vladar joined #nim |
| 21:52:42 | * | thomasross joined #nim |
| 21:53:00 | * | Yardanico quit (Remote host closed the connection) |
| 21:54:07 | * | Yardanico joined #nim |
| 21:58:48 | * | tane quit (Quit: Leaving) |
| 22:03:08 | * | azed quit (Quit: WeeChat 3.1) |
| 22:13:46 | FromDiscord | <sealmove> Nah, you don't need 10 years to master it. It has a lot of features but they I think the learning curve is very smooth. The features really make sense. |
| 22:16:38 | FromDiscord | <dom96> hm, it's been 12 years and I still haven't mastered it |
| 22:17:00 | FromDiscord | <sealmove> It depends what we mean by master |
| 22:17:22 | FromDiscord | <dom96> 🙂 |
| 22:20:59 | FromDiscord | <Sabena Sema> can nimpy result in amazing heap corruption? I wrote a nim program that embedded a python interpreter and was also called from C# one time and that was ..... fun |
| 22:21:22 | FromDiscord | <Sabena Sema> "inside me there are three wolves, they are all garbage collectors, and they all want to collect" |
| 22:21:28 | FromDiscord | <Yardanico> compile your extension with arc/orc and you won't have those issues |
| 22:21:37 | FromDiscord | <Sabena Sema> it was like an extremely aggressive garbage collector union action |
| 22:21:46 | FromDiscord | <Sabena Sema> this was before arc/orc existed |
| 22:21:56 | FromDiscord | <Yardanico> but now arc/orc exist |
| 22:40:19 | * | stefantalpalaru quit (Changing host) |
| 22:40:19 | * | stefantalpalaru joined #nim |
| 22:43:38 | FromDiscord | <aab> Hi guys |
| 22:43:45 | FromDiscord | <aab> why does `someFunction(none(openArray[float32))` not work |
| 22:45:30 | FromDiscord | <aab> how would I pass a none option to a function like this? `proc someFunction(optional_array: Option[openArray[float32]]): void =` |
| 22:53:27 | FromDiscord | <Yardanico> this code is invalid since openArray is not a concrete type |
| 22:53:32 | FromDiscord | <Yardanico> it is with experimental views, but they're experimental :) |
| 22:54:20 | FromDiscord | <aab> hmm so I can't really pass an optional type as an openarray? |
| 22:54:50 | FromDiscord | <Yardanico> no, you can't pass openArray with an Option |
| 22:55:58 | FromDiscord | <aab> alright then thanks! |
| 22:57:06 | * | Vladar quit (Quit: Leaving) |
| 23:18:19 | * | clyybber quit (Quit: WeeChat 3.1) |
| 23:36:41 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
| 23:37:15 | FromDiscord | <exelotl> mann I wish std/marshal worked in nimscript :( |
| 23:37:57 | FromDiscord | <exelotl> passing data from config.nims to a dedicated tool seems like a major use case |
| 23:38:43 | * | Lord_Nightmare joined #nim |