00:02:20 | FromDiscord | <guttural666> In reply to @pyolyokh "a sophisticated young person": don't be mean |
00:09:41 | FromDiscord | <ringabout> Why does Nim use DataInit procs instead of consts in the codegen? |
00:12:44 | FromDiscord | <voidwalker> you know what puzzles me, why do we have like 4 NES emulator projects, and no torrent library effort ? I thought emulation was harder |
00:15:02 | FromDiscord | <arkanoid> Because it's fun?↵(@voidwalker) |
00:15:49 | FromDiscord | <pyolyokh> even if difficulty is lower, there needs to be interest |
00:43:58 | FromDiscord | <auxym> bittorrent, unfortunately, isn't as popular as it was in the heyday of supernova and TPB |
00:44:22 | FromDiscord | <auxym> though IIRC, someone on here was in the process of implementing a torrent lib in nim' |
00:47:21 | FromDiscord | <voidwalker> what do you mean, it is probably still the number 1 traffic generator on the internet. There is no actual popular replacement for it as a public filesharing protocol |
00:47:50 | FromDiscord | <voidwalker> looking at the chat history, I can only see me mentioning torrents it a few times this year, nothing else related to any torrent lib dev |
00:47:57 | FromDiscord | <Rika> popular to use not popular to program for |
00:48:35 | FromDiscord | <Rika> its popular to use yes but theres probably only a handful of torrent clients with a significant usebase |
00:48:37 | FromDiscord | <auxym> In reply to @voidwalker "looking at the chat": I was probably thinking of you 😛 |
00:48:41 | FromDiscord | <Rika> most prolly are in C++ or Python |
00:49:48 | FromDiscord | <voidwalker> yeah, there is that huge ass libtorrent in c++ that most clients use |
00:50:09 | FromDiscord | <voidwalker> has many thousands , probably tens of thousands of LOC |
00:50:15 | FromDiscord | <Rika> we meet again rakshasa |
00:50:30 | FromDiscord | <auxym> who uses torrents though? People who download linux ISOs? I get the impression that piracy isn't as big as it used to be. remember private trackers for high quality music rips? pedro's btmusic, waffle.fm, what.cd, etc. All dead. People just use netflix and spotify nowadays. |
00:50:31 | FromDiscord | <voidwalker> while the goal for me is to have a working and minialistic one in 300 lines or so |
00:50:33 | FromDiscord | <Rika> hell of a fucked up library really |
00:51:02 | FromDiscord | <Rika> In reply to @auxym "who uses torrents though?": its not |
00:51:04 | FromDiscord | <Rika> really not |
00:54:00 | FromDiscord | <voidwalker> I for one, won't stop wearing the hat, even if all digital media becomes free : P |
00:57:15 | FromDiscord | <voidwalker> there is a need for super high performance backend + web frontend torrent clients, that can handle tens of thousands of torrents. |
01:42:00 | FromDiscord | <Yepoleb> In reply to @auxym "who uses torrents though?": it's actually on the rise again because of the big studios delisting from netflix and starting tons of smaller streaming services |
01:43:19 | FromDiscord | <Yepoleb> and afaik for anime the legal options were always shit |
01:52:57 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i gen a random 16bit int in nim? |
01:57:35 | FromDiscord | <jtv> Do you want it stored as two bytes, or do you want an int that can't be larger than 1<<16-1? |
01:58:30 | FromDiscord | <Rika> `import random; randomize(); let theInt = rand(int16.low..int16.high).int16` |
01:58:37 | FromDiscord | <jtv> NO |
01:58:45 | FromDiscord | <jtv> random is insecure, use urandom |
01:58:55 | FromDiscord | <Rika> but you dont need security all the time |
01:58:58 | FromDiscord | <Rika> security is slow |
01:59:02 | FromDiscord | <jtv> False, false false |
01:59:06 | FromDiscord | <jtv> It isn't remotely slow |
01:59:09 | FromDiscord | <Elegantbeef> lol |
01:59:13 | FromDiscord | <Rika> my goodness |
01:59:18 | FromDiscord | <jtv> And you need it almost always. |
01:59:26 | FromDiscord | <Elegantbeef> You really dont |
01:59:36 | * | ltriant quit (Ping timeout: 264 seconds) |
01:59:36 | FromDiscord | <Elegantbeef> I have never needed a secure random number |
01:59:46 | FromDiscord | <jtv> The one thing I actually like about rust is that it's the only language smart enough to make it the default |
02:00:01 | FromDiscord | <jtv> Honestly, I'm a cryptographer, you ALL run algorithms I wrote. They are in hardware. |
02:00:22 | FromDiscord | <jtv> The system random number generator is more than fast enough for 10gb/sec encryption |
02:00:26 | FromDiscord | <jtv> So you're just wrong |
02:00:27 | FromDiscord | <Rika> and basically all the things you write are cryptography |
02:00:31 | FromDiscord | <jtv> There's never a reason not to use it |
02:00:34 | FromDiscord | <jtv> Nope, not even close. |
02:00:54 | FromDiscord | <Elegantbeef> Imagine ensuring a games proc gen is cryptographically secure! |
02:01:20 | FromDiscord | <jtv> Most of them are, because, guess what, the OS gives you cheap random numbers that are far more random than algorithms |
02:01:39 | FromDiscord | <Rika> but does it really matter in that case |
02:01:42 | FromDiscord | <jtv> So unless you're a statistician that needs repeatable sequences, there's no good reason not to use them |
02:02:42 | FromDiscord | <jtv> The OS gives you cheap cryptographically secure random numbers via urandom (in Linux). And the algorithms most languages use for non cryptographically strong numbers are slower. |
02:02:55 | madprops | test |
02:03:05 | FromDiscord | <Rika> but does it really matter ->>> in that case <<<- |
02:03:45 | FromDiscord | <jtv> I have owned all sorts of systems over the past 2 decades via their use of bad random numbers, who all thought it wasn't important and it was slower |
02:03:53 | FromDiscord | <jtv> Including several online poker sites |
02:03:57 | FromDiscord | <jtv> So 🤷 |
02:04:50 | FromDiscord | <Generic> well Nim uses xorshiro128 iirc |
02:05:02 | FromDiscord | <Generic> not that I'm an expert on the field of random numbers |
02:05:16 | FromDiscord | <Generic> but I know that it's hard to top it in terms of speed |
02:06:35 | FromDiscord | <Generic> because one iteration will boil down to something around a dozen ALU instructions |
02:06:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hfa |
02:06:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hfb |
02:06:57 | FromDiscord | <Elegantbeef> Now you can have your cake and eat it too |
02:07:11 | FromDiscord | <jtv> So the crypto the OS does is incredibly cheap as far as crypto goes, as it's basically all accelerated instructions. You can do about 4-5x faster w/o cryptography but completely yield on security, and you could be encrypting at 10gbit a second and not notice the difference, full stop |
02:07:19 | FromDiscord | <Rika> `import sysrand; let theInt = urandom(1).int16 + urandom(1).int16 shl 8`↵if you really really desire then here it is |
02:07:25 | FromDiscord | <jtv> So performance is NOT worth the tradeoff, full stop |
02:07:40 | FromDiscord | <Rika> forgot the [0] |
02:07:48 | FromDiscord | <Rika> `import sysrand; let theInt = urandom(1)[0].int16 + urandom(1)[0].int16 shl 8` |
02:07:49 | FromDiscord | <Rika> of course |
02:07:51 | FromDiscord | <Elegantbeef> > So performance is NOT worth the tradeoff↵Assuming you need a secure random number |
02:07:59 | FromDiscord | <Rika> it would be faster in other ways, of course with urandom(2) |
02:08:12 | FromDiscord | <Rika> In reply to @Elegantbeef "> So performance is": well apparently we all do |
02:08:14 | FromDiscord | <jtv> And again, even if you think you don't, you've got a good chance of being wrong |
02:08:26 | FromDiscord | <Rika> it seems like seeding a prng with a random byte isnt enough anymore |
02:08:29 | FromDiscord | <Elegantbeef> Tell me why a video game's proc gen needs a cryptographically secure number? |
02:08:32 | FromDiscord | <jtv> It's definitely not worth the margin of error. |
02:08:50 | FromDiscord | <albassort> oi |
02:08:56 | FromDiscord | <albassort> do you guys wanna see some horrible fucking code |
02:08:58 | FromDiscord | <albassort> wel |
02:09:00 | FromDiscord | <albassort> docs |
02:09:00 | FromDiscord | <jtv> No, Rika, most non-cryptographic PRNGs are completely breakable after just a few outputs |
02:09:10 | FromDiscord | <Generic> rng manipluation is actually a fun thing done by really advanced players |
02:09:13 | FromDiscord | <albassort> https://github.com/ROCm-Developer-Tools/HIP |
02:09:13 | FromDiscord | <Generic> in things like speedruns |
02:09:21 | FromDiscord | <Generic> or in older Pokemon games |
02:09:25 | FromDiscord | <Rika> it is yes i know about those |
02:09:36 | FromDiscord | <jtv> If playing poker, Even if I just get a fraction of the cards in a deal, it'll probably take me a few hundred cards at most to be able to figure out the whole state of the algorithm |
02:09:54 | FromDiscord | <jtv> Just as an example. |
02:10:22 | FromDiscord | <Elegantbeef> Someone is very smart |
02:10:42 | FromDiscord | <Generic> for the newer Pokemon games they use tools to read out the current rng state |
02:10:58 | FromDiscord | <Generic> to be still eable to manipulate it |
02:11:26 | FromDiscord | <albassort> its u beef |
02:11:38 | FromDiscord | <Rika> In reply to @Generic "for the newer Pokemon": well that sounds different now |
02:12:25 | FromDiscord | <Generic> it's a bit weird, but the difference to cheating is that "technically" the Pokemon caught this way are still 100% legal |
02:13:00 | FromDiscord | <jtv> Modern cryptographic PRNGs are one AES operation, which costs LESS than once cycle per byte |
02:13:14 | FromDiscord | <jtv> If that's "too expensive" you're worried about the wrong stuff. |
02:13:33 | FromDiscord | <jtv> One operation per 16 bytes output |
02:13:36 | FromDiscord | <Elegantbeef> jtv there are many applications that cryptographically secure doesnt matter |
02:13:59 | FromDiscord | <jtv> Right, and it's so cheap in comparison to non-cryptographic, you should use it by default JUST TO BE SAFE |
02:14:07 | FromDiscord | <Generic> well not every cpu has those AES instructions |
02:14:10 | FromDiscord | <Rika> beef of course but whats the difference if the performance isnt any different |
02:14:16 | FromDiscord | <jtv> Every CPU built over the last 15 years does |
02:14:18 | FromDiscord | <albassort> numba + nim |
02:14:30 | FromDiscord | <Rika> what downside would using crypto secure have |
02:14:31 | FromDiscord | <albassort> In reply to @jtv "Every CPU built over": mine was built in the last 15 years and does not |
02:14:41 | FromDiscord | <albassort> 2009 |
02:14:43 | FromDiscord | <Generic> also on ARM it's also different |
02:14:44 | FromDiscord | <Elegantbeef> Why a video game's procedural generation needs to be crytographically secure is beyond me |
02:14:44 | FromDiscord | <Elegantbeef> Why a noise generator needs to be is also confounding |
02:14:52 | FromDiscord | <Rika> well it doesnt have to |
02:15:01 | FromDiscord | <Generic> idk if they made AES obligatory with ARMv9 |
02:15:04 | FromDiscord | <jtv> No, it's not, ARM has AES instructions as well |
02:15:08 | FromDiscord | <Generic> but with ARMv8 it was still an extension |
02:15:17 | FromDiscord | <Generic> which not every cpu implemented |
02:15:29 | FromDiscord | <albassort> ++ |
02:15:42 | FromDiscord | <jtv> The OS is doing the work to gather the entropy no matter what. They bytes are just generated from the state w/ cheap as hell encryption |
02:15:55 | FromDiscord | <Elegantbeef> Based off sysrand vs. random about 10ms for a small application↵(@Rika) |
02:15:56 | FromDiscord | <huantian> one reason I've heard is that it can give people a false sense of security ↵though personally idk if I agree with that |
02:16:24 | FromDiscord | <jtv> It's almost completely ubiquitous, and 80+% of all internet traffic goes through it with nobody complaining |
02:16:37 | FromDiscord | <jtv> So you're really just being argumentative to claim the performance is even remotely important |
02:16:47 | FromDiscord | <Rika> the performance implication of a game and a website is somewhat different no |
02:17:09 | FromDiscord | <Elegantbeef> Generating a world can take a lot of calls to a random generator for noise and prop placement |
02:17:16 | FromDiscord | <jtv> Cloudflare cares quite a lot, Rika. |
02:17:28 | FromDiscord | <Rika> cloudflare runs their shit on megaservers |
02:17:30 | FromDiscord | <jtv> And they prefer everything be encrypted. Yet every byte translates to costs. |
02:17:53 | FromDiscord | <jtv> They've long been a customer of mine and friends. I get a lot of performance data through them. |
02:17:58 | FromDiscord | <jtv> You're just wrong. |
02:18:27 | FromDiscord | <Rika> no matter what i cannot agree that the performance implications of games and even websites run by google with commodity hardware are comparable |
02:18:30 | FromDiscord | <Rika> in any way |
02:18:42 | FromDiscord | <Rika> because theyre just different |
02:19:01 | FromDiscord | <jtv> Except that everyone I know at those companies would 100% disagree with you, but sure |
02:19:08 | FromDiscord | <Rika> are they gamedevs |
02:19:32 | FromDiscord | <Elegantbeef> appeal to authority in an argument, i've never! |
02:19:33 | FromDiscord | <jtv> I have plenty of friends who are game developers, and have worked w/ plenty of gaming companies. |
02:20:11 | FromDiscord | <jtv> You can't spare an average of .6 cycles per byte? How much random data do you actually need? |
02:20:29 | FromDiscord | <jtv> Compared to the amount of video you're probably pumping? Why are you unwilling to pay that price?? |
02:20:37 | FromDiscord | <jtv> It's just a daft argument. |
02:24:13 | FromDiscord | <jtv> It's all dwarfed by the cost of crossing the ring boundry anyway. |
02:24:28 | FromDiscord | <jtv> Which people do all the time without thinking about |
02:25:33 | FromDiscord | <Rika> i dont even know why i continue to argue when ive been agreeing with you halfway through the argument |
02:31:32 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4hfe |
02:31:41 | FromDiscord | <Rika> is the performance loss because of the syscall or what |
02:33:25 | * | rockcavera joined #nim |
02:34:31 | FromDiscord | <jtv> The system call is REALLY expensive in comparison. And most implementations don't use whatever native system call is there on Unix systems because it's easier from a portability perspective to just open up /dev/urandom |
02:34:42 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1047339861306265640/image.png |
02:34:44 | FromDiscord | <jtv> Which is generally less direct still |
02:34:54 | FromDiscord | <Elegantbeef> I'm going to guess it's the syscall |
02:35:05 | FromDiscord | <Elegantbeef> But that still discredits jtv's view that "it's not slower" |
02:35:16 | FromDiscord | <Elegantbeef> Cause it's demonstrably slower |
02:35:36 | FromDiscord | <Rika> it is slower but not because of the generation |
02:35:47 | FromDiscord | <jtv> You read two bytes at a time, in a language that doesn't care at all about crypto performance, and it was still plenty fast |
02:36:02 | FromDiscord | <jtv> Sure, the shitty algorithm that doesn't need to make a system call can perform fine |
02:36:17 | FromDiscord | <jtv> Trace how many system calls the average high performance game is making |
02:37:09 | FromDiscord | <jtv> That's all in the noise, and if you need THAT MUCH random data, then use a crypto library in another language that cares about performance |
02:37:12 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1047340396272955412/image.png |
02:37:32 | FromDiscord | <Elegantbeef> My argument is two points↵↵1\: sysrand is slower than random↵2\: You dont always need cryptographically secure generators |
02:37:57 | FromDiscord | <Elegantbeef> If you disagree with either of those i guess sod off |
02:38:02 | FromDiscord | <jtv> People are generally bad at security, and often need them when they don't know it. |
02:38:22 | FromDiscord | <Elegantbeef> Yes a video game that uses a seed to generate a world needs to be secure |
02:38:27 | FromDiscord | <jtv> And "good and fast" is better than "faster but garbage", even if that's all you can get out of the language |
02:38:29 | FromDiscord | <Elegantbeef> Yes a noise generator needs to be secure |
02:39:25 | * | pbotfullerton quit (Ping timeout: 260 seconds) |
02:39:33 | FromDiscord | <Elegantbeef> But now i'm instituting the sod off part of my plan |
02:39:34 | FromDiscord | <jtv> It's so in the noise for the average app, it should be the default, and if you want to shoot yourself in the foot because you think it's not the right option for you, you should be able to do that. |
02:40:10 | FromDiscord | <Rika> how would you propose to improve sysrand's performance |
02:41:17 | FromDiscord | <jtv> I haven't looked at the implementation, but frankly, you only need to read 16 bytes from the OS, then use it to key AES-CTR which you can do with some scorchingly fast assembly |
02:41:27 | FromDiscord | <Rika> In reply to @Elegantbeef "My argument is two": if you dont need cryptosecure then what difference would switching to it make once 1 becomes false if ever |
02:41:33 | FromDiscord | <jtv> That's definitely NOT what's going on in the test case |
02:41:59 | FromDiscord | <jtv> The whole point is, the average developer shouldn't ever have to worry about what kind of random number they need, or be a security expert |
02:42:15 | FromDiscord | <jtv> Why do you want to give them a tool that is going to make it easy for them to shoot themselves in the foot? |
02:42:16 | FromDiscord | <Rika> jtv: essentially sysrand is just a call to whatever the os provides so it makes a syscall every function call |
02:42:18 | FromDiscord | <jtv> You a C++ fan?? |
02:42:43 | FromDiscord | <Elegantbeef> There is no reason to in that case rika |
02:42:45 | FromDiscord | <jtv> It's quite possibly even multiple syscalls the way it's implemented |
02:43:01 | FromDiscord | <Rika> In reply to @Elegantbeef "There is no reason": there is no reason not to, either, no? |
02:43:08 | FromDiscord | <Elegantbeef> That's what i mean |
02:43:11 | FromDiscord | <jtv> Again, Nim's developers clearly haven't prioritized crypto in any way shape or form |
02:43:45 | FromDiscord | <Rika> well of course, we're magnitudes smaller tahn rust or go or whatever |
02:43:45 | FromDiscord | <Elegantbeef> Though sysrand does not allow you to seed it |
02:43:47 | FromDiscord | <Rika> we have what |
02:43:50 | FromDiscord | <Elegantbeef> So actually that's another issue |
02:43:56 | FromDiscord | <Rika> a handful or something big developers |
02:44:10 | FromDiscord | <Elegantbeef> Many procgen relies on seeding the prng to regenerate the world instead of storing the entire world |
02:44:16 | FromDiscord | <Rika> In reply to @Elegantbeef "Though sysrand does not": of course since its not an algorithm |
02:44:21 | FromDiscord | <jtv> Even so, those numbers are more than good enough to make it the default, to keep people from having to understand anything about the fact that shooting themselves in the foot is efen a possibility |
02:44:21 | FromDiscord | <Elegantbeef> Yes i know |
02:44:35 | FromDiscord | <Rika> In reply to @Elegantbeef "Many procgen relies on": this is valid |
02:44:38 | FromDiscord | <Elegantbeef> So in many cases sysrand cannot be used how game devs need it |
02:45:01 | FromDiscord | <Elegantbeef> It's not crossplatform or repeatable |
02:45:19 | FromDiscord | <jtv> Yeah, again, it's generally a good optimization to take 128 bits from the OS and use AES-CTR, which is easy to do almost anywhere in ASM and make it fast |
02:45:50 | FromDiscord | <jtv> And then buffer blocks in userland instead of going back across the ring boundry every 2 bytes for crying out loud 🙂 |
02:47:12 | FromDiscord | <Elegantbeef> Sure but the point was to show the actual speed difference between the two |
02:47:27 | FromDiscord | <Rika> yes but your point is to not switch because of the current speed |
02:47:35 | FromDiscord | <Rika> so if the speed wasnt an issue then what is your point |
02:47:51 | FromDiscord | <Elegantbeef> There is no point then |
02:47:53 | FromDiscord | <jtv> In Nim's implementation, the speed is poor compared to what it can be, but it still does not matter |
02:47:56 | FromDiscord | <Elegantbeef> As i've said multiple times |
02:47:57 | FromDiscord | <Rika> the lack of a seed makes sense, i dont know how to fix that |
02:48:00 | FromDiscord | <Rika> mayhe jtv does |
02:48:14 | FromDiscord | <Rika> In reply to @jtv "In Nim's implementation, the": it should be better |
02:48:19 | FromDiscord | <jtv> The average developer should be able to get random numbers easily, not need to be a security expert, and not shoot themselves in the foor |
02:48:21 | FromDiscord | <jtv> foot |
02:48:54 | FromDiscord | <jtv> And the relative rarity of calls to the rng even in apps that use it heavily, |
02:49:09 | FromDiscord | <Rika> ~~if you didnt know, a lot of people still get bugs with `random` because they forget to call the seeding function `randomize`~~ |
02:49:25 | FromDiscord | <jtv> That doesn't matter |
02:49:54 | FromDiscord | <Rika> yeah no im just pointing it out that with what we have rn people are already pretty footshooty |
02:51:25 | FromDiscord | <jtv> 100%, sure. The implementations most languages use leak tons of info, and even if they didn't, are never more than 64 bits worth of internal state |
02:57:18 | FromDiscord | <Elegantbeef> Anyway rika i think it's just not possible to use `/dev/urandom` as many would want with procgen projects, since one generally wants a deterministic repeatable PRNG |
02:58:21 | FromDiscord | <jtv> Yeah, that's fine, and even there I'd say increase your state space, have a seedable random implementation by default that uses AES-CTR, where the seed is the 128-bit AES key. |
02:59:13 | FromDiscord | <jtv> Especially in the math world, if you want repeatability and want the output to be devoid of bias to the degree possible, why use simplistic functions we know have plenty of bias? |
02:59:41 | FromDiscord | <Rika> `have a seedable random implementation by default that uses AES-CTR` what algorithms use this? |
03:00:32 | FromDiscord | <jtv> So if I were doing the design, you'd have to `import stupidrandom` to get the Mersenne Twister people seem to love for no good reason |
03:00:43 | FromDiscord | <jtv> What do you mean? AES-CTR is a PRNG algorithm |
03:00:50 | FromDiscord | <Rika> oh okay |
03:01:02 | FromDiscord | <Rika> in that sese, i get it |
03:01:05 | FromDiscord | <Rika> (edit) "sese," => "sense," |
03:01:06 | FromDiscord | <jtv> With a proof of security behind it that makes quite minimalist assumptions |
03:01:12 | FromDiscord | <Rika> In reply to @jtv "So if I were": lol |
03:02:01 | * | rockcavera quit (Remote host closed the connection) |
03:02:28 | * | rockcavera joined #nim |
03:02:31 | FromDiscord | <jtv> The PRP assumption... which is basically, if you only encrypt with a given key, input pair once, and the key remains private, and after each block, you show the attacker 16 bytes of actual random data, and the output, then an attacker won't do meaningfully better than random at guessing which one is from the algorithm. |
03:02:43 | FromDiscord | <Rika> i read this (of course, pinch of salt, it's SO) but wdyt? https://crypto.stackexchange.com/questions/83212/using-aes-ctr-as-a-prng |
03:02:52 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4hfh |
03:03:43 | FromDiscord | <jtv> "not considered a CSPRNG" by who? |
03:04:14 | FromDiscord | <jtv> The crypto world moves fast, and most OSes keep up with it reasonably well too |
03:04:40 | FromDiscord | <jtv> The design of the OS part is both a) provide a default CSPRNG, and b) collect and manage entropy |
03:04:55 | FromDiscord | <jtv> b) is much, much harder to reason about, and the two do get intertwined in the OS |
03:05:21 | FromDiscord | <jtv> But it's in a much better position to actually collect the entropy, and nobody is going to do much better than they do there. |
03:05:52 | FromDiscord | <Rika> i think that it is perhaps important that the prng is portably quick |
03:05:57 | FromDiscord | <jtv> But for the CSPRNG part, I believe every OS is basically using CTR mode |
03:06:15 | FromDiscord | <Rika> i assume AES-CTR is implemented in a standard way right |
03:06:45 | FromDiscord | <jtv> Yeah, it's use AES to encrypt values in a sequence. Doesn't matter if you start at 0 or randomize it |
03:07:12 | FromDiscord | <jtv> The PRP assumption mandates you not re-use key/input pairs, that is the main constraint |
03:07:45 | FromDiscord | <jtv> The birthday paradox may also apply, so you shouldn't go for more than 2^60 or so blocks before rekeying with a new seed |
03:08:00 | FromDiscord | <jtv> But in practice, that's way beyond anyone's needs |
03:08:29 | FromDiscord | <Rika> In reply to @jtv "But in practice, that's": i'd imagine, 2^60 before "needing to do another syscall" sounds unlikely |
03:09:50 | FromDiscord | <jtv> Keying AES is actually relatively expensive. Nowhere near public key crypto costs of course |
03:10:15 | FromDiscord | <jtv> actual encryption is pretty damn cheap, especially when hardware accelerated |
03:11:27 | FromDiscord | <emanresu3> is there a way to have a lambda with generics? |
03:11:35 | FromDiscord | <Rika> no, not that i know of |
03:12:11 | FromDiscord | <Rika> a lambda is a value, and a generic cannot be a value as long as it is generic, so i dont think its possible |
03:15:38 | FromDiscord | <emanresu3> I see, but maybe I can find a workaround with a genSym that creates a named proc |
03:15:56 | FromDiscord | <emanresu3> Since I'm making a macro, I could probably work with that |
03:23:31 | FromDiscord | <Yepoleb> @jtv using aes requires an external library to ship with my code. That's annoying. Unless i code it up myself which will make cryptographer angry too. |
03:24:43 | FromDiscord | <Yepoleb> LCG goes brrrr haha |
03:25:49 | FromDiscord | <jtv> Uh, you can statically compile in what you need. |
03:26:04 | FromDiscord | <jtv> Even with nim you can do that |
03:26:41 | FromDiscord | <Yepoleb> Statically compiling does not eliminate the dependency |
03:27:04 | FromDiscord | <jtv> Of course it does, that's the whole point of static compilation |
03:27:42 | FromDiscord | <Yepoleb> You just put two files into one, that hardly makes any difference |
03:28:39 | FromDiscord | <jtv> You just conflate two things into one, that hardly make any sense |
03:32:35 | FromDiscord | <Yepoleb> I'm confused |
03:33:04 | FromDiscord | <jtv> Exactly, "You just put two files into one, that hardly makes any difference" makes no sense |
03:34:26 | FromDiscord | <Yepoleb> It does not matter if the crypto library is an additional file, including it at all is the problem |
03:35:10 | FromDiscord | <Yepoleb> Because it requires work to include it in the build process and takes up space |
03:36:37 | FromDiscord | <jtv> If you're only linking in a library that does AES, I can assure you its footprint in your binary will be miniscule compared to the standard library. And code that doesn't run will be paged out all the time at no cost to you, so who cares |
03:36:52 | FromDiscord | <jtv> So no, that's not a good reason |
03:38:13 | * | arkurious quit (Quit: Leaving) |
03:39:42 | FromDiscord | <Yepoleb> Still work to implement it and make it compile |
03:40:27 | FromDiscord | <jtv> So is using anything in the standard library? |
03:40:49 | FromDiscord | <jtv> I'm sure you can find someone to give you a no-code interface if you like |
03:41:47 | FromDiscord | <Yepoleb> I can copy paste a shitty non secure rng in seconds |
03:42:16 | FromDiscord | <Rika> so your issue is that no one has implemented it |
03:42:21 | FromDiscord | <jtv> You can also use openssl in seconds |
03:42:23 | FromDiscord | <Rika> or rather in nim |
03:42:42 | FromDiscord | <jtv> Or just use urandom, it is good enough |
03:42:54 | FromDiscord | <Yepoleb> Oof so slow |
03:43:39 | FromDiscord | <Rika> here we go again... |
03:44:13 | FromDiscord | <Yepoleb> In reply to @jtv "You can also use": The openssl api is pain |
03:44:25 | FromDiscord | <jtv> As someone who has spent a lot of his career on high performance at scale, I don't bat an eyelash at the cost, nor doesn't see why any reasonable person would (otherwise you should be trying to avoid every system call). But hey, to each his own. |
03:44:35 | FromDiscord | <Yepoleb> Almost all crypto apis are pain |
03:45:00 | FromDiscord | <jtv> I don't really care what you do personally, I am saying the default is not a good one. That's it, that's my only point. |
03:45:22 | FromDiscord | <Yepoleb> In reply to @jtv "As someone who has": Nobody uses urandom for high performance |
03:46:01 | FromDiscord | <ringabout> It can be used for seed. |
03:46:02 | FromDiscord | <Rika> :Gladsuna: |
03:46:26 | FromDiscord | <ringabout> `std/random` uses `unrandom` for that. |
03:46:43 | FromDiscord | <ringabout> (edit) "`unrandom`" => "`urandom`" |
03:47:04 | FromDiscord | <Yepoleb> Yes, but then you need a crypto library to extend it in a secure way |
03:47:17 | FromDiscord | <Yepoleb> One that pleases the security enthusiasts |
03:47:44 | FromDiscord | <jtv> Yet many people do plenty of things for performances' sake that they don't need, and isn't worth the time or money. That doesn't make it right, or make it worth trading off security in the average case where it doesn't fing matter. |
03:48:07 | FromDiscord | <jtv> Why default to insecure, go find the insecure version in std/stupidrandom if you really want to use it |
03:48:49 | FromDiscord | <jtv> That's absurd. Anyone who knows anything about security hates all crypto libraries, some more than others :). And the less code, the less attack surface. |
03:49:42 | FromDiscord | <Yepoleb> In reply to @jtv "Why default to insecure,": Because i don't want my pong clone to depend on fucking openssl |
03:50:00 | FromDiscord | <Yepoleb> snake clone |
03:50:13 | FromDiscord | <Yepoleb> I'm not sure pong is random |
03:50:15 | FromDiscord | <jtv> Yeah I don't either, and there's no reason it should. The system random is more than good enough as a default. |
03:50:30 | FromDiscord | <ringabout> Does `extern` have some side effects? I have to rely on this to forward a variable C and C++ code gen => https://stackoverflow.com/questions/3714808/forward-declarations-for-variables |
03:51:45 | FromDiscord | <jtv> No |
03:52:02 | FromDiscord | <jtv> It just means other modules in your app will be able to see the symbol |
03:53:16 | FromDiscord | <ringabout> Yeah, I see. |
03:54:00 | FromDiscord | <jtv> In C, it's basically C's way of declaring to the compiler that the symbol is going to be there at link time, so don't worry about it |
03:54:42 | FromDiscord | <ringabout> I hope so, https://github.com/nim-lang/Nim/pull/20977 |
03:56:12 | FromDiscord | <jtv> If the symbol is truly defined in something you're linking to, you'll be fine 🙂 |
03:57:35 | FromDiscord | <ringabout> Yeah, the declaration and the initialization are in the same module. |
03:58:06 | FromDiscord | <jtv> There's no performance penalty even in the slightest |
03:58:22 | FromDiscord | <ringabout> I see, thank you! |
03:59:40 | FromDiscord | <jtv> Any time |
04:01:34 | FromDiscord | <Yepoleb> @jtv honestly you do have a point about making it harder to use unsafe random numbers. I just had the argument because i thought your security above all attitude was annoying. |
04:02:06 | FromDiscord | <jtv> Honestly, that's not even remotely my attitude |
04:02:35 | FromDiscord | <jtv> Meaning, I think most security people definitely care too little about anything else |
04:02:42 | FromDiscord | <jtv> So I understand 🙂 |
04:04:49 | * | derpydoo quit (Ping timeout: 260 seconds) |
04:05:56 | FromDiscord | <Yepoleb> In reply to @jtv "And again, even if": Stuff like this rubbed me the wrong way |
04:06:15 | FromDiscord | <Yepoleb> And then i had a twitter moment |
04:07:22 | FromDiscord | <jtv> I also think plenty of people overemphasize performance. Sometimes thinking about each is merited, sometimes it isn't. In this particular case, the cost/benefit analysis is in favor of keeping the average person safe, because it's no skin off the back of people who want to do something different. 99% of people are just going to go google "nim random number" or some variation, and just implement whatever is in std/random |
04:08:51 | FromDiscord | <jtv> If you care about performance, then your m.o. is going to be profiling and working on your hotspots. Even the average person there will just go w/ the default until it's the easiest way to make a difference, which won't be often. |
04:13:25 | FromDiscord | <Yepoleb> For something like procedual generation, like beef mentioned, having millions of syscalls will definitely slow things down |
04:13:49 | FromDiscord | <Yepoleb> But when you're doing that using the default rng is bad anyway |
04:15:20 | FromDiscord | <jtv> Right, and per the thread it wouldn't be too terribly hard to actually make the system random call both strong and far more performant than the system call. |
04:26:33 | * | ltriant joined #nim |
04:44:34 | * | ltriant quit (Ping timeout: 256 seconds) |
05:35:22 | * | ltriant joined #nim |
05:43:23 | * | ltriant quit (Ping timeout: 264 seconds) |
06:26:19 | * | rockcavera quit (Remote host closed the connection) |
07:28:02 | * | kenran joined #nim |
07:32:15 | * | kenran quit (Remote host closed the connection) |
07:42:35 | FromDiscord | <narimiran> With Advent of Code starting tomorrow, it's time to make our #aoc channel active again..... See you there 🙂 |
07:47:37 | * | PMunch joined #nim |
08:01:28 | NimEventer | New thread by miran: Advent of Nim 2022, see https://forum.nim-lang.org/t/9678 |
08:06:42 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=4hg0 |
08:09:08 | FromDiscord | <luteva> so I understand that the condition is there, as the code is made step-by-step (which is great for learning). but it could be dropped, right? |
08:12:53 | Amun-Ra | jtv: it's alwa a way of declaring opaque types |
08:23:28 | FromDiscord | <planetis> In reply to @luteva "Hi! I am reading": > Identifiers are nnkIdent nodes. After the name lookup pass these nodes get transferred into nnkSym nodes. |
08:23:45 | FromDiscord | <planetis> (edit) "nodes." => "nodes.↵https://nim-lang.github.io/Nim/macros.html" |
08:24:55 | FromDiscord | <planetis> you should leave both conditions |
08:25:50 | FromDiscord | <luteva> otherwise....? it could crash for some (special) input? or what would happen? |
08:29:46 | FromDiscord | <planetis> hmm, typed macros return resolved asts so you might think that's all nnkSym but they also return nodes of symbol choices according to https://nim-lang.github.io/Nim/macros.html#bindSym%2C%2CBindSymRule |
08:30:23 | FromDiscord | <planetis> in that case it might not matter? But why would it hurt to leave it as is. better ask beef |
08:31:22 | FromDiscord | <planetis> yea pass an overloaded proc name instead and see the difference |
08:33:50 | NimEventer | New Nimble package! cppany - A wrapper for C++'s std::any, see https://github.com/sls1005/cppany |
08:35:51 | * | disso_peach quit (Quit: Leaving) |
08:39:59 | * | junaid_ joined #nim |
08:40:19 | FromDiscord | <luteva> In reply to @planetis "in that case it": Thanks @planetis ! Of course it doesn't hurt. 🙂↵I just want to understand (that's why i ask "why?"). 🙂 |
09:01:31 | FromDiscord | <luteva> did i understand aright? The "quote do:" is for macros only. And with "quote do:" you can write the macro as a nim code "template" with 'parameters' that get inserted into the code you want to generate. Instead of writing the commands to generate the AST. |
09:05:53 | FromDiscord | <vindaar> yes, that's essentially correct. Note that nowadays there is also `genAsts` https://nim-lang.org/docs/genasts.html which may be a bit more convenient to work with |
09:08:20 | FromDiscord | <planetis> There is also a DSL for declaring the ast tree in fusion |
09:09:14 | FromDiscord | <planetis> Sometimes it's more convenient to use quote do/genast others buildast |
09:18:08 | FromDiscord | <planetis> In reply to @luteva "Thanks <@915614219364368394> ! Of": Running on an ident crashes https://play.nim-lang.org/#ix=4hge |
09:18:08 | FromDiscord | <luteva> nim is so great!! ❤️ |
09:22:35 | PMunch | @luteva, @vindaar, there is also superquote: https://github.com/PMunch/macroutils |
09:23:06 | FromDiscord | <aolko (aolko)> nim might be great, but it lacks sugar and community is goddamn terrible |
09:24:40 | FromDiscord | <planetis> wow there |
09:25:10 | FromDiscord | <planetis> who's terrible, you? |
09:26:18 | FromDiscord | <planetis> I mean do you enjoy defaming others who are trying their best? |
09:27:04 | FromDiscord | <planetis> and when that special snowflakes bullshit will stop |
09:27:14 | PMunch | And Nim has plenty of sugar? |
09:27:49 | PMunch | Not quite sure who pissed in their cereal, the Nim community is typically super helpul |
09:28:26 | FromDiscord | <ajusa> What is the macro library that uses string interpolation? I can't remember the name for the life of me |
09:28:39 | FromDiscord | <ajusa> The author has a few other nim repos as well iirc |
09:28:42 | PMunch | For creating macros? |
09:28:47 | FromDiscord | <ajusa> Yes |
09:29:08 | FromDiscord | <ajusa> They had an example using an enum to generate variables by looping over them |
09:30:41 | FromDiscord | <planetis> rust zealots attack without any justification, they just can't help it |
09:31:06 | PMunch | @ajusa, hmm not sure if I've heard of that one. But it sounds pretty nice |
09:31:21 | FromDiscord | <planetis> I've been harassed in the comments by just saying I like nim |
09:31:30 | PMunch | @planetis, which comments? |
09:31:32 | FromDiscord | <ajusa> I even used it once, and I opened an issue which the author fixed. |
09:31:36 | FromDiscord | <planetis> youtube |
09:31:44 | FromDiscord | <ajusa> BUT I CAN'T SEEM TO FIND IT AGAIN |
09:32:23 | PMunch | @ajusa, go to github.com/issues |
09:32:54 | PMunch | Then rewrite the filter to is:closed is:issue author:@ajusa for example |
09:33:44 | FromDiscord | <ajusa> Thanks, managed to find it: https://github.com/geekrelief/genit |
09:33:59 | FromDiscord | <ajusa> Don't think it is on nimble either, no wonder I had a tough time finding it |
09:36:13 | PMunch | Ooh, that is pretty neat |
09:36:19 | PMunch | Shame it's not on Nimble though.. |
09:39:38 | FromDiscord | <luteva> why not asking the author to add it? Or ask him/her what licence the lib uses and if it is free/open, fork it and add that one to nimble...? |
09:41:07 | FromDiscord | <aolko (aolko)> > ↵> who's terrible, you?↵> ~~nou~~, community members |
09:41:43 | FromDiscord | <Elegantbeef> You can just say my name I dont mind |
09:42:07 | FromDiscord | <aolko (aolko)> > I mean do you enjoy defaming others who are trying their best?↵no, in fact i both "hate" and pity them |
09:42:27 | PMunch | Let's not start anything here, aolko, feel free to comment in the private message I sent you :) |
09:42:55 | FromDiscord | <aolko (aolko)> i'm on the jankiest gitter client ever - the webapp |
09:43:02 | PMunch | So am I |
09:43:13 | FromDiscord | <aolko (aolko)> so i didn't receive anything so far |
09:43:40 | FromDiscord | <planetis> I am an asshole you can say it, i dont mind either |
09:43:57 | FromDiscord | <PMunch (Peter Munch-Ellingsen)> Strange, you could try to send me a message? |
09:44:03 | FromDiscord | <aolko (aolko)> trying |
09:44:36 | FromDiscord | <Elegantbeef> @luteva\: if you remove that condition and provide an type that's not supported for that macro it'll error something unhelpful |
09:45:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hgk |
09:45:35 | FromDiscord | <Elegantbeef> `/usercode/in.nim(3, 9) Error: node is not a symbol` |
09:45:40 | FromDiscord | <Elegantbeef> Is not a helpful error for the user |
09:46:13 | * | disso_peach joined #nim |
09:46:54 | FromDiscord | <luteva> uh yeah. That's it! 👍 |
09:47:26 | FromDiscord | <Elegantbeef> You can use `expectKind` from macros but it's againt not useful for the user |
09:47:43 | FromDiscord | <Elegantbeef> When i write macros i tend to use `error` cause it actually provides useful error messages |
10:09:05 | * | junaid_ quit (Remote host closed the connection) |
10:21:20 | FromDiscord | <aolko (aolko)> sent a long message, see http://ix.io/4hgr |
10:22:35 | FromDiscord | <aolko (aolko)> sent a long message, see http://ix.io/4hgs |
10:23:42 | FromDiscord | <aolko (aolko)> sent a long message, see http://ix.io/4hgt |
10:30:58 | FromDiscord | <ShalokShalom> @aolko (aolko)#0000 you might like to join nimskull, idk |
10:31:49 | FromDiscord | <aolko (aolko)> i'm not talking about joining an existing project |
10:32:05 | FromDiscord | <aolko (aolko)> after all there might be conflicts |
10:33:48 | FromDiscord | <emanresu3> Hi @ShalokShalom , thanks again for putting my pipe repo on nim-awesome |
10:34:59 | FromDiscord | <emanresu3> I recall you were interested in a composition operator for Nim, I'm just getting started with that here https://codeberg.org/emanresu3/nim-compose, it's not very usable at the moment |
10:35:36 | FromDiscord | <Rika> woah thats cool |
10:36:41 | FromDiscord | <aolko (aolko)> .🤔 |
10:42:08 | FromDiscord | <jmgomez> In reply to @emanresu3 "I recall you were": looks pretty cool. Nim is missing some partial application. Would be nice if it where in GitHub though, much easier to keep track of the progress there |
10:43:37 | FromDiscord | <Rika> In reply to @jmgomez "looks pretty cool. Nim": what's wrong with codeberg? |
10:44:25 | FromDiscord | <jmgomez> I guess it's just me, but I didnt know it even existed until now |
10:49:03 | FromDiscord | <emanresu3> Thanks, I'm trying to make it type generic, but still can't figure out how↵(@jmgomez) |
10:49:39 | FromDiscord | <emanresu3> Yeah, Github just gives me headaches sorry |
10:53:59 | * | ltriant joined #nim |
10:57:23 | PMunch | Haden't heard of Codeberg either, it's like an open-source GitHub? |
10:58:40 | PMunch | Looks suspiciously similar to GitHub :P |
11:01:11 | FromDiscord | <Yardanico> It's a Gitea instance operated by a non-profit in EU |
11:01:18 | FromDiscord | <Yardanico> Well, they run a fork of Gitea |
11:32:55 | FromDiscord | <ShalokShalom> In reply to @emanresu3 "I recall you were": Yeaaah 🥳🥳 |
11:33:35 | FromDiscord | <ShalokShalom> In reply to @Yardanico "Well, they run a": Do they? |
11:33:41 | FromDiscord | <Yardanico> yes |
11:33:43 | FromDiscord | <ShalokShalom> Interesting, didn't knew |
11:33:55 | FromDiscord | <Yardanico> https://codeberg.org/Codeberg/gitea |
11:34:11 | FromDiscord | <Yardanico> https://docs.codeberg.org/getting-started/what-is-codeberg/ |
11:35:08 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4hgF |
11:35:14 | FromDiscord | <Rika> why |
11:35:21 | FromDiscord | <ShalokShalom> Why what? |
11:35:21 | FromDiscord | <Rika> why the mirror, i mean |
11:35:49 | FromDiscord | <ShalokShalom> Ah. Because he/she does want to host on Codeberg and dont like to open a Github account. |
11:36:32 | FromDiscord | <Rika> wouldnt you need a gh to mirror |
11:36:34 | FromDiscord | <ShalokShalom> I published via nimble for him/her, and also cloned the according repo, for clearity.↵↵Some people only find packages via Github. |
11:37:14 | FromDiscord | <ShalokShalom> In reply to @Rika "wouldnt you need a": Yeah, this is what I was asking myself.↵↵If that is possible with his/her account on Codeberg and mine on Github. |
11:38:34 | FromDiscord | <ShalokShalom> I also have a Codeberg account, if that helps.↵↵https://codeberg.org/ShalokShalom |
11:43:16 | FromDiscord | <emanresu3> I really don't mind forks on github, just don't want an account there myself. If it's a mirror through your account I'm fine with it \:) |
11:44:59 | FromDiscord | <emanresu3> I'm gonna do a bit on those repos once I get my vacations this weekend, and will see if after that I get more time or someone would like to fork/maintain it |
11:45:28 | FromDiscord | <ShalokShalom> Nice |
11:45:32 | FromDiscord | <ShalokShalom> Thanks a lot |
11:45:34 | FromDiscord | <Rika> get to it shalok |
11:45:35 | FromDiscord | <Rika> smh |
11:46:51 | FromDiscord | <ShalokShalom> I am on my way 😄 |
11:47:05 | FromDiscord | <ShalokShalom> Love that you choose >> |
11:47:12 | FromDiscord | <ShalokShalom> Makes me feel at home |
11:47:24 | FromDiscord | <ShalokShalom> F# vibes |
11:48:00 | FromDiscord | <ShalokShalom> @Rika You know their https://codeberg.org/emanresu3/nim-pipexp already? |
11:49:22 | FromDiscord | <Rika> nope |
11:49:29 | FromDiscord | <Rika> what does it do |
11:49:52 | FromDiscord | <Rika> olh |
11:49:59 | FromDiscord | <Rika> thats deffo a name i misread lmao |
11:50:28 | FromDiscord | <emanresu3> Haha yeah, I saw that F# does that, I initially wanted ∘ like Julia, but having composition both ways it's cool as well↵(@ShalokShalom) |
11:51:06 | FromDiscord | <ShalokShalom> I think the PR is still pending. Maybe someone can do something about it?↵↵https://github.com/nim-lang/packages/pull/2415 |
11:51:17 | FromDiscord | <ShalokShalom> In reply to @emanresu3 "Haha yeah, I saw": Yes, totally |
11:51:41 | FromDiscord | <Phil> In reply to @Rika "thats deffo a name": TFW you see pip everywhere |
11:51:56 | FromDiscord | <luteva> suppose i would like to use limdb (https://github.com/capocasa/limdb) for storing some data and i would like to store an int (not just a string). so i have to find out the length of the data(or the type) to be stored as Blob/bytes.↵But an int can be int8/16/32/64. so how can i find out the length of the int what's the way to go? |
11:52:27 | FromDiscord | <luteva> (edit) "int" => "int?" |
11:53:26 | FromDiscord | <Phil> You could force transform from int to whatever int you want (int64?) |
11:53:32 | FromDiscord | <Phil> (edit) "You could force transform from int to whatever int you want (int64?) ... " added "before storing" |
11:53:56 | FromDiscord | <Phil> int --> int64 --> stored --> int64 (when retrieved from db) --> int |
11:53:58 | FromDiscord | <luteva> ok yes. so always choose the biggest, should work. |
11:54:26 | FromDiscord | <Phil> Are you doing embedded stuff so is memory or storage capacity potentially a problem? |
11:55:06 | FromDiscord | <luteva> is there a way to extract the compile time property/architecture to detect the correct int(8/16/...)? |
11:56:32 | FromDiscord | <Phil> In reply to @luteva "is there a way": I don't recall anything off the top of my head, but would check out the libs system and std/os |
11:56:32 | FromDiscord | <luteva> In reply to @Isofruit "Are you doing embedded": no! I will do it choosing the biggest, as you suggested. I now just want to know, how it could be done in case there are capacity problems 🙂 |
11:57:01 | FromDiscord | <Phil> (edit) "system" => ""system"" | "std/os" => ""std/os"" |
12:00:35 | FromDiscord | <Rika> In reply to @Isofruit "TFW you see pip": MFW |
12:00:58 | * | jmdaemon quit (Ping timeout: 252 seconds) |
12:06:13 | FromDiscord | <Phil> In reply to @luteva "no! I will do": Going through it, first approach I'm seeing is doing "sizeof" on a variable |
12:06:34 | FromDiscord | <Phil> or even a type |
12:07:01 | FromDiscord | <Phil> `sizeOf int` e.g. returns "8" for me, so 8 bytes, meaning my int is by default int64 |
12:08:14 | FromDiscord | <Phil> Having solved that, if you're looking for something more direct you're free to read through the rest of the system lib yourself 😛 |
12:10:29 | FromDiscord | <ringabout> Hello, @Phil do you happen to have some time to approve the CI? https://github.com/PhilippMDoerner/Snorlogue/pull/12 |
12:10:43 | FromDiscord | <Phil> Ah, right, good point! |
12:11:36 | FromDiscord | <ringabout> Thanks |
12:12:30 | FromDiscord | <Phil> Just writing up a commit message so I'll remember in 2 years why that commit was made |
12:14:06 | FromDiscord | <luteva> In reply to @Isofruit "Having solved that, if": Hi! Thanks. I also just tested the sizeOf. int64 is default on my system, too. |
12:14:07 | FromDiscord | <luteva> 🙂 |
12:14:11 | FromDiscord | <Phil> Now to figure out later why the hell my `nimble nimidocs` task straight up doesn't finish on my github docs pipeline |
12:14:34 | FromDiscord | <Phil> In reply to @luteva "Hi! Thanks. I also": I mean, it better be, we migrated off 32bit in like.... was that 2010? |
12:14:48 | FromDiscord | <Phil> How long have we been in a 64 bit world by now? |
12:14:59 | FromDiscord | <Phil> Win7 was the last 32bit version, right? |
12:15:39 | FromDiscord | <Phil> Actually, nobody answer that, I'm fairly sure once I know I'll just feel old again |
12:15:48 | FromDiscord | <luteva> 😄 |
12:16:46 | FromDiscord | <Phil> ... ringabout, how deep lies your experience on github pipelines involving compiling nimibook? |
12:17:03 | FromDiscord | <Rika> In reply to @Isofruit "I mean, it better": help why is my default int size 16bit |
12:17:06 | FromDiscord | <Rika> 😛 |
12:17:43 | FromDiscord | <Phil> I'm pretty sure I'm not old enough to have ever touched a 16bit OS |
12:17:55 | FromDiscord | <Phil> Are you on a raspberry pi or sth? |
12:19:15 | FromDiscord | <ringabout> In reply to @Isofruit "... ringabout, how deep": I don't use `nimibook` though. It runs locally. That's it. |
12:19:31 | FromDiscord | <ringabout> I checked the error message before. |
12:19:52 | FromDiscord | <Phil> In reply to @ringabout "I don't use `nimibook`": Fair... maybe I should just copy paste how norm does it.↵But they do it in a docker container which seems like a paaaaaaaiiiiin |
12:21:32 | FromDiscord | <ringabout> Perhaps it hangs because of a bug. |
12:21:38 | FromDiscord | <ringabout> (edit) "hangs" => "hanged" |
12:23:29 | FromDiscord | <ringabout> (edit) "hanged" => "hangs" |
12:25:22 | FromDiscord | <Rika> In reply to @Isofruit "Are you on a": a raspberry pi is max 32 bit |
12:25:25 | FromDiscord | <Rika> i mean, min |
12:25:44 | FromDiscord | <Rika> i dont think there are popular modern 16 bit computers |
12:26:25 | FromDiscord | <Phil> Hm, maybe in the embedded world |
12:26:29 | FromDiscord | <Phil> But the embedded world is weird anyway |
12:31:46 | FromDiscord | <Rika> embedded world usually jumps to 32 bit after 8 bit |
12:31:55 | FromDiscord | <Rika> not often does one bother with 16 anymore |
12:36:33 | FromDiscord | <ringabout> In reply to @Isofruit "Fair... maybe I should": Switched to ubuntu to build docs, it should work now => https://github.com/PhilippMDoerner/Snorlogue/actions/runs/3583313879/jobs/6028596708 |
12:37:40 | FromDiscord | <ringabout> The half CI failed because the pull request don't have the access to build docs, |
12:37:46 | FromDiscord | <Phil> The deploy step I'll likely have to fix later, but that one's on me. It does get through the doc-compilation stage though, that is a gigantic step forward as I've been stuck on that since yesterday evening |
12:37:50 | FromDiscord | <ringabout> https://github.com/PhilippMDoerner/Snorlogue/pull/13 |
12:38:08 | FromDiscord | <ringabout> (edit) "half" => "deplot" |
12:38:17 | FromDiscord | <ringabout> In reply to @ringabout "The deplot CI failed": Which is expected. |
12:39:46 | FromDiscord | <ringabout> You can report the issue to nimibook, maybe they can figure out something. |
12:41:11 | FromDiscord | <Phil> Wait a second, this step seems to be a general problem for auth↵> Error: You have to provide a GITHUB_TOKEN or GH_PAT↵But this worked before, what the heck.↵That's why I set up a token env variable |
12:41:24 | FromDiscord | <Phil> (edit) "Wait a second, this step seems to be a general problem for auth↵> Error: You have to provide a GITHUB_TOKEN or GH_PAT↵But this worked before, what the heck.↵That's why I set up a token env variable ... " added "and put that into the docs.yml" |
12:41:44 | FromDiscord | <ringabout> (edit) "You can report the ... issue" added "former" |
12:45:58 | FromDiscord | <ringabout> It is weird that the push failed at nimibook building while the pull request succeeded. |
13:18:29 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=4hhb |
13:18:54 | FromDiscord | <luteva> or does it have es special meaning? |
13:20:00 | FromDiscord | <Rika> semicolon has special meaning |
13:20:24 | FromDiscord | <Rika> lets say `proc whatever(a, b: int)` a and b are both int |
13:21:20 | FromDiscord | <Rika> `proc whatever(a; b: int)` a is not an int (it is either not valid if no `using a: sometype` or is that type if `using` is used), b is |
13:22:31 | FromDiscord | <luteva> ok so in the above example it is equivalent, as both parameters have their own type given, right? |
13:24:19 | FromDiscord | <luteva> (edit) "it is" => "using a comma would be" |
13:41:20 | FromDiscord | <pyolyokh> yep. |
13:51:17 | * | derpydoo joined #nim |
14:05:47 | FromDiscord | <sOkam!> how do you format a float to a string with max N decimals? |
14:06:11 | FromDiscord | <sOkam!> i know of $, but its getting all decimals, and don't know how to format it. plus std/strformat docs are omega confusing |
14:06:48 | * | Phytolizer joined #nim |
14:07:14 | FromDiscord | <sOkam!> aiming for the C equivalent to: `"%.3f", thevar` |
14:09:01 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4hhm |
14:10:42 | * | rockcavera joined #nim |
14:13:03 | FromDiscord | <sOkam!> ty |
14:14:40 | * | PMunch quit (Quit: Leaving) |
14:25:07 | FromDiscord | <Phil> In reply to @ringabout "It is weird that": The pain of github actions |
14:36:51 | FromDiscord | <ringabout> In reply to @Isofruit "The pain of github": finally |
14:40:54 | FromDiscord | <Phil> Wait, it built? I call hax! |
14:41:10 | FromDiscord | <Phil> Okay, now I need to figure out what the url to the nimibook docs are |
14:42:15 | FromDiscord | <Phil> Oh nice, it's literally right under "bookCompiled" |
14:42:27 | FromDiscord | <ringabout> https://philippmdoerner.github.io/Snorlogue/bookCompiled/ |
14:42:35 | FromDiscord | <Phil> I may need to rename a couple folders here and there, but sweet |
14:43:31 | FromDiscord | <Phil> One of these days I'll have docs where the lists don't get mangled in formatting https://media.discordapp.net/attachments/371759389889003532/1047523273338003546/image.png |
14:44:08 | FromDiscord | <ringabout> Good luck 😆 |
14:44:18 | FromDiscord | <Phil> In reply to @ringabout "https://philippmdoerner.github.io/Snorlogue/bookCom": Thank you very, very, very much btw. for your help here |
14:44:29 | FromDiscord | <ringabout> My pleasure |
14:50:10 | * | disso_peach quit (Ping timeout: 265 seconds) |
14:59:52 | FromDiscord | <ringabout> Why is the test action not triggered? |
15:08:18 | * | Phytolizer quit (Ping timeout: 260 seconds) |
15:21:39 | FromDiscord | <ShalokShalom> In reply to @Isofruit "Wait, it built? I": Sentence to frame it and putting it on the wall 😄 |
15:26:36 | FromDiscord | <jmgomez> Is correct to assume that poll(0) doesnt block? |
15:29:41 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How wou |
15:29:51 | FromDiscord | <@thatrandomperson5-6310e3b26da03> d i make a dns server in nim |
15:30:01 | FromDiscord | <@thatrandomperson5-6310e3b26da03> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1047534892252151920): How woul |
15:39:34 | FromDiscord | <leetnewb> Could you look through the dnsmasq source, interface with your nim code, and replace it piece by piece? |
15:53:11 | FromDiscord | <jtv> @jmgomez If the timeout field to the system poll() is 0, it will not block, correct. |
16:41:59 | FromDiscord | <Phil> In reply to @ringabout "Why is the": I'm pretty sure there is no test action, at least I didn't intentionally add any, there may be some left over from copy-pasting |
16:42:29 | FromDiscord | <ringabout> In reply to @Isofruit "I'm pretty sure there": https://github.com/PhilippMDoerner/Snorlogue/blob/main/.github/workflows/action.yml ? |
16:44:47 | FromDiscord | <Phil> In reply to @ringabout "https://github.com/PhilippMDoerner/Snorlogue/blob/m": Ahhh leftover from copy pasting. And it doesn't run because it requires pushes or prs on stable or devel, I have neither of those branches, I got main, master, github pages and whatever weird branch the github bot added |
16:45:25 | FromDiscord | <Phil> devel is for when you actually released something and need to keep a version stable somewhere 😛 |
16:45:35 | FromDiscord | <Phil> (edit) "somewhere" => "on main" |
16:45:53 | FromDiscord | <Phil> Not having it symbolizes that snorlogue is still the wild wild west |
17:10:22 | * | jmdaemon joined #nim |
17:37:37 | * | jmcantrell quit (Quit: Bridge terminating on SIGTERM) |
17:43:02 | * | jmcantrell joined #nim |
17:45:17 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4hii |
17:46:49 | FromDiscord | <jtv> (edit) "https://play.nim-lang.org/#ix=4hii" => "https://play.nim-lang.org/#ix=4hik" |
17:57:47 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
17:59:32 | FromDiscord | <ringabout> In reply to @jtv "Something really weird is": Firstly, the devel branch defaults to ORC. Using `--mm:refc` still works. Secondly, the internal representation of string in ARC/ORC is no long a pointer. You cannot cast it to `int`. |
18:01:49 | * | junaid_ joined #nim |
18:02:32 | FromDiscord | <Elegantbeef> Thirdly on refc you need to do `GcRef` to keep a GC'd reference alive |
18:02:38 | FromDiscord | <albassort> is there anyway to kill a thread? |
18:02:43 | FromDiscord | <Elegantbeef> And `GCUnref` to destroy it |
18:02:52 | FromDiscord | <albassort> actually |
18:02:55 | FromDiscord | <albassort> certainly not |
18:02:58 | FromDiscord | <albassort> hmmm |
18:03:04 | FromDiscord | <Elegantbeef> Nope there is not, atleast in the stdlib threads |
18:03:56 | FromDiscord | <ringabout> It conflicts destructors, I don't think it will be implemented in the future. |
18:04:06 | FromDiscord | <albassort> im trying to get around the httpclient deadlocking problem by timingout and then culling threads and instantiating the thead |
18:04:33 | FromDiscord | <ringabout> (edit) "It" => "Killing a Thread" | "Killing a Threadconflicts ... destructors," added "with" |
18:04:36 | FromDiscord | <Elegantbeef> Why use async properly when you can bolt 10 different features together |
18:05:03 | FromDiscord | <albassort> im already doing async |
18:05:15 | FromDiscord | <albassort> (just on threads) |
18:05:27 | FromDiscord | <jtv> That's not casting a string to an int. |
18:05:58 | FromDiscord | <albassort> ??? |
18:06:03 | FromDiscord | <jtv> It's assuming I'm only ever going to call test with a box that has an int in it |
18:06:30 | FromDiscord | <Elegantbeef> Why do you need the cast then? |
18:07:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hiu |
18:07:31 | FromDiscord | <Elegantbeef> or `getString` if you prefer |
18:07:36 | FromDiscord | <pyolyokh> that code'll let you store something int-like in an int by having T differ from box.kind |
18:09:32 | FromDiscord | <ringabout> Nim cast in ARC doesn't support arbitrary cast. |
18:09:39 | FromDiscord | <ringabout> (edit) "cast." => "casting." |
18:12:21 | FromDiscord | <pyolyokh> specifically, it doesn't like the cast[int](somestring) that's possible, even though it never happens |
18:12:36 | * | derpydoo quit (Ping timeout: 248 seconds) |
18:13:34 | FromDiscord | <Elegantbeef> To get arbitrary casting working all you really need to do is `cast[ptr T](myT.addr)[]` |
18:13:57 | FromDiscord | <Elegantbeef> but in reality what i suggested above is saner |
18:14:35 | FromDiscord | <ringabout> `casts are allowed as long as castDest.size >= src.size` |
18:14:47 | FromDiscord | <huantian> huh that's neat |
18:14:48 | FromDiscord | <ringabout> (edit) "as long as" => "when" |
18:15:08 | FromDiscord | <Elegantbeef> What is? |
18:15:52 | FromDiscord | <ringabout> In reply to @ringabout "`casts are allowed when": One condition from comments in `isCastable` |
18:16:23 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4hiy works fine with arc and refc |
18:16:36 | FromDiscord | <huantian> how safe! |
18:17:27 | FromDiscord | <jtv> Okay, that's all helpful, and I'll check it out in a second |
18:18:42 | FromDiscord | <Elegantbeef> For completion's sake this is the 'more proper' way https://play.nim-lang.org/#ix=4hiz |
18:18:53 | FromDiscord | <albassort> what about orc |
18:18:55 | FromDiscord | <albassort> :\ |
18:19:05 | FromDiscord | <Elegantbeef> Orc and Arc are the same for 99% of semantics |
18:19:18 | FromDiscord | <Elegantbeef> Orc is Arc + cycle collector |
18:19:25 | FromDiscord | <albassort> orc is like 0.01% faster sometimes |
18:19:35 | FromDiscord | <albassort> (from my testing) |
18:19:41 | FromDiscord | <albassort> (on my machine) |
18:19:42 | FromDiscord | <Elegantbeef> Margin of error i'd say |
18:19:44 | FromDiscord | <albassort> (non-scientifically) |
18:19:58 | FromDiscord | <Elegantbeef> Arc and Orc with non cyclical types are identical |
18:20:01 | FromDiscord | <huantian> In reply to @Elegantbeef "For completion's sake this": time to write a macro to create enums, fields, and procs for an arbitrary list of types! |
18:20:19 | FromDiscord | <Elegantbeef> The only difference is when you have a cyclical graph |
18:21:10 | FromDiscord | <Elegantbeef> Meh just use oop at that point huan |
18:21:35 | FromDiscord | <huantian> hehe |
18:22:36 | FromDiscord | <Elegantbeef> The nice part though is you get an interface for unpacking/packing your own types to/from the box type in the variant example |
18:22:52 | FromDiscord | <Elegantbeef> Can even pack floats in there if you really hated yourself 😄 |
18:23:32 | FromDiscord | <huantian> yeah ig if you wanted arbitrary types you could just use a generic type as well |
18:24:18 | FromDiscord | <Elegantbeef> After playing around with my toy ecs I now see tuples as varadic generics 😄 |
18:31:41 | FromDiscord | <Phil> In reply to @Elegantbeef "Why use async properly": Because potatoe's taste best when properly seasoned and used as filling in dumplings |
18:31:47 | FromDiscord | <Phil> (edit) "potatoe's" => "potato's" |
18:32:01 | FromDiscord | <Phil> I am hungry and wanted to make a joke |
18:32:12 | FromDiscord | <Phil> And now I made myself hungrier |
18:32:39 | FromDiscord | <huantian> huh I never put potatos in dumplings |
18:32:43 | FromDiscord | <huantian> is that an actual thing? |
18:32:50 | FromDiscord | <Elegantbeef> That joke makes 0 sense when your only experience is american dumplings |
18:33:02 | FromDiscord | <Phil> It is, and they were among the best dumplings I've ever eaten |
18:33:02 | FromDiscord | <Elegantbeef> Which is just bread cooked in a broth |
18:33:30 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4hiE |
18:33:43 | FromDiscord | <Elegantbeef> Other places huan make dumplings like perogies |
18:33:45 | FromDiscord | <jtv> Whoops, replied to the wrong one, I meant the cast |
18:33:49 | FromDiscord | <huantian> ah true |
18:34:21 | FromDiscord | <Elegantbeef> We generally get "Chicken and Dumplings" which is just soggy bread water 😛 |
18:35:06 | FromDiscord | <jtv> I'm effectively already keeping detailed type info around for the items in the box so to speak, but they can be complex types, so just having a single function per type isn't going to work |
18:35:55 | FromDiscord | <Elegantbeef> I mean I already provided a procedure that handles like 10 types 😄 |
18:37:48 | FromDiscord | <jtv> It's fine though, understanding why it broke is all I needed to fix the code, thanks again |
18:39:50 | FromDiscord | <hotdog> In reply to @Elegantbeef "Arc and Orc with": I read this as "cylindrical types" and was very confused for a moment |
18:41:57 | FromDiscord | <albassort> ok is there any reason why div (/) have to be of two floats and cant be of floats and integers |
18:42:12 | FromDiscord | <albassort> >:O |
18:42:25 | * | disso_peach joined #nim |
18:42:30 | FromDiscord | <jtv> Eh? It can be two ints |
18:42:35 | FromDiscord | <jtv> The types must match though |
18:42:47 | FromDiscord | <albassort> why though |
18:42:48 | FromDiscord | <jtv> So if you want to divide an int and a float, just do: float(i) |
18:42:53 | FromDiscord | <albassort> yes but why |
18:43:09 | FromDiscord | <jtv> Automatic typecasting leads to bugs |
18:43:11 | FromDiscord | <hotdog> @albassort check out https://nim-lang.org/docs/lenientops.html |
18:43:49 | FromDiscord | <huantian> yeah you dont' want to accidentally lose information when converting from int to float |
18:43:58 | FromDiscord | <albassort> thats why you size up |
18:44:24 | FromDiscord | <huantian> with cases like division ig it's better to be more explicit |
18:44:27 | FromDiscord | <albassort> because obviously binary arithmetic must be done between two equally sized integers |
18:44:34 | FromDiscord | <albassort> but |
18:44:41 | FromDiscord | <albassort> still |
18:44:55 | FromDiscord | <albassort> im pretty sure its a side affect of static |
18:45:12 | FromDiscord | <albassort> im too lazy to type now |
18:45:16 | FromDiscord | <albassort> humans are hard to talk to |
18:45:18 | FromDiscord | <albassort> 👋 |
18:46:06 | FromDiscord | <jtv> Another minor nit, how should I properly express that I actually mean to do this kind of cast, or do I just need to add the pragma to suppress the warning (which I hate to do): `Warning: target type is larger than source type` |
18:46:56 | * | pro joined #nim |
18:50:40 | * | nisstyre quit (Ping timeout: 252 seconds) |
18:51:22 | * | xet7 joined #nim |
18:51:30 | * | nisstyre joined #nim |
18:51:30 | FromDiscord | <huantian> I'd assume suppressing the warning is how you'd express that you mena to do this cast |
18:52:59 | * | junaid_ quit (Remote host closed the connection) |
19:00:25 | FromDiscord | <jtv> Casting is supposed to say "I know what I'm doing in this type conversion" already 🙂 |
19:36:28 | * | arkurious joined #nim |
19:57:27 | Amun-Ra | to explicite one? |
19:57:56 | FromDiscord | <demotomohiro> In reply to @jtv "Casting is supposed to": Do you want to cast from larger type to smaller type even if you get random bits?↵https://github.com/nim-lang/Nim/issues/19101 |
20:00:33 | FromDiscord | <demotomohiro> from smaller type to larger type. |
20:01:38 | FromDiscord | <demotomohiro> `copyMem` is safer than casting from smaller type to larger type.↵https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/bitwiseCopy.nim |
20:02:42 | * | krux02 joined #nim |
20:06:48 | FromDiscord | <Michal Maršálek> Wanted to setup Visual Studio Code as my editor for this year's Advent of Code. Which is the best extension? |
20:09:47 | Amun-Ra | iirc one is abandoned, can't remember which one |
20:10:30 | FromDiscord | <Michal Maršálek> ok, I'll install the more recently updated one |
20:12:09 | FromDiscord | <Michal Maršálek> ty |
20:15:01 | Amun-Ra | prosim |
20:20:14 | * | kenran joined #nim |
20:28:41 | * | pro quit (Quit: pro) |
20:40:21 | * | junaid_ joined #nim |
20:51:46 | FromDiscord | <auxym> nim saem is the good one |
21:04:08 | * | attah_ joined #nim |
21:04:24 | * | attah quit (Ping timeout: 264 seconds) |
21:04:54 | * | attah_ is now known as attah |
21:06:58 | FromDiscord | <jtv> @demotomohiro In the specific case I'm getting the errors on, it's a single field of a variant record in a case where the other bits would 100% be zero unless the underlying memory wasn't zero-initialized on allocation. Which would be quite surprising behavior. |
21:08:16 | FromDiscord | <jtv> And I think if the purpose of the warning is to alert them because they might be getting random bits, I'd think the error message should explain that fact, otherwise many will just tune it out. |
21:11:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hje |
21:12:51 | FromDiscord | <Elegantbeef> Level isnt an enum |
21:12:53 | FromDiscord | <Elegantbeef> It's a subrange type |
21:13:21 | FromDiscord | <Phil> It is 10pm and I did a talk, it appears I'm also more braindead than I should be allowed to write code |
21:13:23 | FromDiscord | <Phil> God damn |
21:13:49 | FromDiscord | <Elegantbeef> also `myEnum: T` expects a value not a typedesc |
21:13:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjf |
21:14:15 | FromDiscord | <Elegantbeef> You did it all by yourself! |
21:14:42 | FromDiscord | <Phil> I was playing around a lot with "does it have to be typedesc, does it not have to be?" so I accidentally copy pasted the wrong version |
21:14:54 | FromDiscord | <Phil> Which, given the kinds of mistakes I'm making atm, isn't that surprising I guess |
21:16:56 | FromDiscord | <Phil> Can I do a generic that accepts all kinds of ranges that does something similar? hmmmm |
21:17:12 | * | junaid_ quit (Remote host closed the connection) |
21:17:36 | FromDiscord | <Elegantbeef> `T: range` and `low(T)..high(T)` |
21:18:32 | FromDiscord | <Elegantbeef> Really you could do `SomeOrdinal or (enum and Ordinal)` |
21:18:46 | FromDiscord | <Elegantbeef> But have fun when you accidently do `iterateOver(int64)` |
21:18:50 | FromDiscord | <Phil> One thing after another |
21:19:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hji |
21:21:59 | FromDiscord | <Elegantbeef> Built in typeclasses are magic |
21:26:09 | FromDiscord | <Phil> In reply to @Elegantbeef "Really you could do": Chances are I'll be forced to do so |
21:27:50 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjn |
21:28:16 | FromDiscord | <Phil> I have no idea how Tainted string fits into both of em as apparently it's an enum and a range at once (?) |
21:28:48 | FromDiscord | <Elegantbeef> It's neither of them |
21:29:22 | FromDiscord | <Elegantbeef> Also tainted string jesus i havent heard that name in a long time |
21:29:30 | FromDiscord | <Phil> Then how is this an ambiguous call?↵I thought it can only be an ambiguous call if both procs overloads can be used to run sth |
21:30:07 | FromDiscord | <Phil> In reply to @Elegantbeef "Also tainted string jesus": The only reason I even know Tainted strings exist is because I looked into the systems module during lunch today, I swear none of my code ever used it directly or was even aware of it |
21:30:18 | FromDiscord | <Phil> So I have no idea where that tainted string business is even coming from |
21:30:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hjp |
21:30:53 | FromDiscord | <Elegantbeef> TaintedString is an old idea to make all strings coming from unsafe APIs to be sanitised to string first |
21:31:09 | FromDiscord | <Elegantbeef> It's been deprecated and now is an alias to `string` afaik |
21:31:47 | FromDiscord | <Phil> okay then... how the hell is it even popping up |
21:31:56 | FromDiscord | <Phil> one sec, I'll provide a bit more code |
21:34:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjq |
21:35:02 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4hjq" => "https://play.nim-lang.org/#ix=4hjr" |
21:35:33 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4hjr" => "https://play.nim-lang.org/#ix=4hjs" |
21:35:59 | FromDiscord | <Phil> So how any of this is even remotely ambiguous is beyond me |
21:36:34 | FromDiscord | <Elegantbeef> Might just be a generic bug |
21:36:45 | FromDiscord | <Phil> I have 2 generic `toFormField` covering `range` and `enum`↵I have multiple non-generic `toFormField` covering int, float, string, bool and something else I think |
21:36:50 | FromDiscord | <Elegantbeef> also `value is not Option` is sinful 😄 |
21:37:10 | FromDiscord | <Phil> is `isnot` more correct? |
21:37:19 | FromDiscord | <Elegantbeef> Correct |
21:37:31 | FromDiscord | <Phil> Works for me |
21:37:56 | FromDiscord | <Phil> Unlike ambiguity! |
21:38:24 | FromDiscord | <Elegantbeef> `value isnot A or B` works whereas `value is not A or B` does not due to operator precedence |
21:38:44 | FromDiscord | <Elegantbeef> I lie 😄 |
21:38:45 | FromDiscord | <Phil> Alright, so the workaround for my bug is one combined generic for range+enum |
21:38:48 | FromDiscord | <Elegantbeef> smoke bomb |
21:39:01 | FromDiscord | <Elegantbeef> Odd that you need it but it's not big deal |
21:39:07 | FromDiscord | <Elegantbeef> It's the same proc twice really |
21:39:20 | FromDiscord | <Elegantbeef> Unless you use holey enums like a satanist |
21:39:31 | FromDiscord | <Phil> I was actually keeping holey enums in mind |
21:39:36 | FromDiscord | <Phil> I have no idea about their uses |
21:39:47 | FromDiscord | <Phil> But I didn't want to exclude anything unless technically necessary |
21:39:53 | FromDiscord | <Phil> Which in this case it appears to be |
21:41:54 | FromDiscord | <Elegantbeef> well then do `range or (Ordinal and enum)` |
21:41:58 | FromDiscord | <Elegantbeef> and your other one can be `enum and not Ordinal` |
21:41:59 | FromDiscord | <Elegantbeef> `HoleyEnum` and `OrdinalEnum` exists in typetraits |
21:41:59 | FromDiscord | <Elegantbeef> If you want to save a few tippity taps |
21:42:38 | FromDiscord | <Phil> Nah, it's fine. I mean, these are just "default" procs, the other can override them at any time by specifying their own `toFormField` proc specifically for their enum type |
21:43:04 | FromDiscord | <Phil> If I understood call priority correctly, if they define their proc then it'll be used over whatever generic I provide, if not there's still my generic as a fallback |
21:43:23 | FromDiscord | <Elegantbeef> Correct the most specific procedure in scope of first instantiation is used |
21:43:49 | FromDiscord | <Elegantbeef> yes first instantiation is always important, but almost never an issue |
21:45:28 | FromDiscord | <Phil> Okay, now the type system or sth is just messing with me |
21:51:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjv |
21:51:55 | FromDiscord | <Phil> Wait a sec, do I need to convert to int... most likely |
21:52:41 | FromDiscord | <Phil> Nope, still breaks even with ` result.intSeqVal = value.map(val => val.int)` in Line 72 |
21:53:16 | FromDiscord | <Phil> Flipping tainted strings |
21:56:44 | * | attah quit (Ping timeout: 246 seconds) |
21:57:02 | * | attah joined #nim |
21:58:51 | FromDiscord | <Phil> Okay.... wtf? So I got it to work, but I have no understanding as to how |
22:00:35 | * | xet7 quit (Ping timeout: 260 seconds) |
22:00:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjA |
22:03:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjB |
22:05:50 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hjC |
22:06:23 | FromDiscord | <Phil> So the reason why this map call needs to be nested in the when-statement absolutely escapes me |
22:12:59 | * | xet7 joined #nim |
22:13:42 | * | kenran quit (Remote host closed the connection) |
22:22:57 | FromDiscord | <guttural666> can somebody tell me why I get and invalid type: typedesc[seq[Band]] for var error from the compiler here? https://media.discordapp.net/attachments/371759389889003532/1047638891357802606/image.png |
22:23:26 | FromDiscord | <guttural666> Band is an object |
22:25:31 | FromDiscord | <guttural666> https://nim-lang.org/docs/manual.html#templates-identifier-construction |
22:25:32 | FromDiscord | <guttural666> probably |
22:25:51 | FromDiscord | <guttural666> hm no |
22:28:35 | FromDiscord | <Rika> `data: seq[data_type]` not ` = ` |
22:30:34 | FromDiscord | <Phil> Yeh that type annotation is off |
22:31:56 | FromDiscord | <guttural666> omg |
22:32:22 | FromDiscord | <guttural666> so blind sometimes, but the compiler wasn't helpful at all either ^^ |
22:33:15 | FromDiscord | <Phil> In reply to @guttural666 "so blind sometimes, but": I mean, I mistook a range for an enum earlier if it makes you feel any better |
22:34:19 | FromDiscord | <guttural666> In reply to @Isofruit "I mean, I mistook": most of the times it's the most trivial stuff |
22:35:27 | * | krux02 quit (Remote host closed the connection) |
22:38:16 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hjL |
22:38:18 | FromDiscord | <albassort> anyway to make this prettier |
22:38:38 | FromDiscord | <guttural666> maybe another one: how does one pass a proc to a template? one argument of that proc is the same as a previously untyped argument of the template, another may be unknown and then there's an int and it returns a string, if I'm not mistaken I do have to specify the proc signature, right? https://media.discordapp.net/attachments/371759389889003532/1047642839665868891/image.png |
22:38:53 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#ix=4hjL" => "https://play.nim-lang.org/#ix=4hjM" |
22:39:13 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hjN |
22:39:34 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hjO |
22:39:48 | FromDiscord | <Elegantbeef> `unicode in 0..255 and byte(unicode) in {34u8..57u8, 63u8...126u8}` |
22:40:00 | FromDiscord | <Elegantbeef> or just `unicode in 34..57 or uncode in 63..126` |
22:40:23 | FromDiscord | <albassort> wait why'd i do == 34 |
22:40:37 | FromDiscord | <albassort> ah i meant to do 33 |
22:40:52 | FromDiscord | <albassort> whoopsie |
22:41:21 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4hjP |
22:41:37 | FromDiscord | <albassort> yea but still |
22:42:02 | FromDiscord | <albassort> email restricted characters weren't made to be conveniently tested |
22:42:29 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4hjQ |
22:43:17 | * | xet7 quit (Ping timeout: 246 seconds) |
22:43:28 | * | Lord_Nightmare quit (Excess Flood) |
22:43:45 | FromDiscord | <ahungry> How does the `ptr cint` type work? raylib/raygui wants it for the spinner() call - I've seen stuff like `var Foo = ref object` which https://nim-lang.org/docs/tut1.html briefly touches on, but when I try `var x: ptr cint` - I'm not sure what to initialize it to? literal ints fail - do I need an alloc call of some sort there? if I don't initialize it at all, the program compiles, but crashes, with a `SIGSEGV: Illegal storage access. ( |
22:44:02 | FromDiscord | <Rika> alloc yes |
22:44:10 | * | pech joined #nim |
22:44:28 | * | Lord_Nightmare joined #nim |
22:44:35 | FromDiscord | <Rika> `let aPtrCint = create(cint)` |
22:44:36 | FromDiscord | <Elegantbeef> It's likely for this you dont need a heap allocation |
22:44:45 | FromDiscord | <Rika> yeah, depends on what it does |
22:44:55 | FromDiscord | <Rika> you can just make a cint |
22:44:59 | FromDiscord | <Rika> and pass the addr |
22:45:06 | FromDiscord | <ITR> I'm trying out openai's newest gpt thingy, and it's actually managing to write nim code pretty well, lol.↵It's really fun, since instead of messing around with comments like with copilot I can literally tell it "you did this wrong" and have it fix something |
22:45:16 | FromDiscord | <ITR> have any of y'all tried it yet? |
22:45:20 | FromDiscord | <Rika> `let aCint = 1.cint; let aPtrCint = aCint.addr` |
22:45:53 | FromDiscord | <Elegantbeef> I dont use AI tools, I find writing the code once enough |
22:46:47 | * | disso_peach quit (Ping timeout: 260 seconds) |
22:47:16 | FromDiscord | <ITR> Oh hi beef, lol. I haven't used them since copilot went paid, but I find it fun just for smaller personal projects with lots of boilerplate |
22:47:53 | FromDiscord | <ITR> Like, they write pretty ugly code, but it's good enough for when I don't want to bother writing it myself |
22:50:26 | FromDiscord | <ahungry> I haven't tried it, just the dall-e stuff - just 5 years ago watching Star Trek holodeck "programming" the whole thing seemed far fetched, but once again Star Trek was spot on in predicting the future - imagine being able to create something useful by talking to your speaker in another 5 |
22:58:53 | FromDiscord | <ahungry> is there a better repl than `inim`? I notice it takes a few seconds to evaluate `1 + 1` , so I'm guessing it's running a full compile in the background - I suppose unlike lisps, nim lacks an `eval()` equivalent for runtime execution of code? |
22:59:12 | FromDiscord | <guttural666> damn, templates are fucking amazing |
22:59:28 | FromDiscord | <Elegantbeef> There is `nim secret` which uses the nim vm |
22:59:44 | FromDiscord | <Elegantbeef> you can also use `--cc:tcc` with inim to reduce compile times |
23:01:00 | FromDiscord | <Phil> In reply to @ahungry "is there a better": Note that thanks to the full compile, inim allows you to use all nim libraries.↵nim secret explicitly does not, as libraries like `std/os` can not work in just the vm |
23:01:41 | * | xet7 joined #nim |
23:01:49 | FromDiscord | <Elegantbeef> Except std/os can work in the VM due to there being OS hooks, though whether they're enabled for `nim secret` is another thing |
23:02:35 | FromDiscord | <Phil> If I start nim secret, write std/os and the first thing that greets me is dozens of errors, then it doesn't work 😛 |
23:02:46 | FromDiscord | <Phil> (edit) "std/os" => "`import std/os`" |
23:03:11 | FromDiscord | <ahungry> that's really neat, thanks everyone |
23:03:21 | FromDiscord | <Elegantbeef> Sure but std/os does work in the VM so that means it doesnt hook them |
23:09:20 | * | derpydoo joined #nim |
23:11:57 | * | neceve quit (Quit: ZNC - https://znc.in) |
23:12:11 | * | neceve joined #nim |
23:14:29 | FromDiscord | <ITR> sent a code paste, see https://play.nim-lang.org/#ix=4hjX |
23:14:53 | FromDiscord | <ITR> it has no love for the nim discord apparently, smh |
23:17:41 | * | oprypin_ quit (Quit: Bye) |
23:17:51 | * | oprypin joined #nim |
23:17:52 | FromDiscord | <ahungry> Sounds like a really long way for the AI to tell you to RTFM 😂 |
23:19:24 | FromDiscord | <Phil> In reply to @ITR "I tried asking the": TBF if your question is sufficiently complicated, then nim forums becomes your only option since the chances of your question getting drowned out in discord and thus not being seen by the folks knowledgeable enough to answer it is high |
23:20:02 | FromDiscord | <Phil> By which I mean, if you've got complicated shizz going on and you're asking outside of the active times of folks like Yard, demo and Beef, you're screwed 😛 |
23:50:35 | FromDiscord | <Anze> Hey, just looked through the web and found Nim to be an interesting coding language, but I dont see it being used a lot in production. What are Nim usecases / libraries / frameworks? Thanks |
23:50:55 | * | pch__ joined #nim |
23:52:05 | FromDiscord | <Elegantbeef> It's use cases are "technically anywhere" |
23:52:06 | * | pch__ quit (Remote host closed the connection) |
23:52:23 | * | pch__ joined #nim |
23:52:24 | FromDiscord | <Elegantbeef> https://nimble.directory/ most libraries are here |
23:53:21 | * | pech quit (Ping timeout: 246 seconds) |
23:55:50 | FromDiscord | <Horizon [She/Her]> Beef, you expose all of the wasm3 procs anyway right? |
23:56:10 | FromDiscord | <Elegantbeef> All of the ones that are supposed to be exported that i know of |
23:56:23 | FromDiscord | <Horizon [She/Her]> I think I should probably write my own macro instead of relying/trying to work on yours, since it's let me understand it better |
23:56:41 | FromDiscord | <Horizon [She/Her]> I'm scatterbrained af which is a pain |
23:56:50 | FromDiscord | <Elegantbeef> Yea i mean i still need to think about my macro more anyway |
23:57:02 | FromDiscord | <Elegantbeef> It needs to support generic interfaces somehow |