01:16:29 | FromDiscord | <heysokam> how can you convert an `array[N,cstring]` into a `cstringArray` directly? ๐ค |
01:22:21 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix= |
01:22:38 | FromDiscord | <jviega> Oh, from an array |
01:23:09 | FromDiscord | <jviega> No that works too |
01:23:25 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DuL |
01:25:31 | FromDiscord | <jviega> Hmm, I suspect you could solve w/ casting then copying, but just iterating through the array would basically be the same |
01:36:46 | FromDiscord | <Elegantbeef> make the last entry in your `array[N, cstring]` nil then you can just `cast[cstringarray]` |
01:48:34 | FromDiscord | <terrygillis> Is there a way to pass in an array to a macro to loop through it and generate new nodes based on its content? |
01:50:54 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4DuP |
01:51:46 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=4DuR |
01:53:32 | FromDiscord | <Elegantbeef> Though I do question why even use a macro |
01:55:29 | FromDiscord | <Elegantbeef> Also why not just `arr: varargs[untyped]` |
01:55:35 | FromDiscord | <Elegantbeef> If we're going down the macro route |
01:56:47 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4DuV |
01:57:04 | FromDiscord | <Elegantbeef> Of course |
01:57:42 | FromDiscord | <terrygillis> I tried `const node` to force compile time evaluation but it didn't work because `NimNode` is ref type |
01:59:58 | FromDiscord | <Elegantbeef> `const node = generateNimNode(name, arr).astAsString` |
02:00:15 | FromDiscord | <terrygillis> `let node` wouldn't run at compile time so the compiler just pass into the macro the proc `generateNimNode` as the node itself and so the output to `dir` is just literally `generateNimNode(name, arr)` |
02:00:26 | FromDiscord | <Elegantbeef> But yet again... why are you doing this |
02:00:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/yBL4x |
02:00:33 | * | azimut quit (Remote host closed the connection) |
02:00:36 | FromDiscord | <jviega> Hmm, if I'm trying to add a {.cdecl.} pragma to a sugar'd function type that has 0 or 1 args, no problem. 2 or more args, I am having a hard time figuring out where to put the {.cdecl.}? |
02:01:00 | * | azimut joined #nim |
02:02:13 | FromDiscord | <terrygillis> In reply to @Elegantbeef "But yet again... why": I want to have two macros: one spits out code for direct use and the other writes the said code to a different file. |
02:04:08 | FromDiscord | <terrygillis> or rather a string to be written to another file |
02:04:23 | FromDiscord | <Elegantbeef> Why not just have a single macro and one that does `myCode.repr`? |
02:05:33 | FromDiscord | <terrygillis> wouldn't it repeat a lot of code ๐ |
02:07:00 | FromDiscord | <terrygillis> In reply to @Elegantbeef "Also why not just": what would this do? |
02:07:23 | FromDiscord | <Elegantbeef> I do not know your usage so i figured you were doing `myMacro("bleh", ["bleh", "meh", "Steh"})` |
02:08:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/6iwki |
02:11:18 | * | azimut quit (Ping timeout: 246 seconds) |
02:15:53 | FromDiscord | <terrygillis> Well I'm now hitting the error that it says `name: string` or `name: static[string]` cannot be evaluated at comptime in the macro body despite clearing passing a const into it. |
02:20:24 | FromDiscord | <odexine> Can you show what you wrote? |
02:20:48 | FromDiscord | <terrygillis> yeah i'm condensing my code into a small snippet |
02:20:51 | FromDiscord | <Elegantbeef> The macro is only instantiated once, it does not instantiate per call |
02:23:59 | * | krux02 quit (Remote host closed the connection) |
02:27:03 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4Dv0 |
02:28:13 | FromDiscord | <terrygillis> (edit) "https://play.nim-lang.org/#ix=4Dv0" => "https://play.nim-lang.org/#ix=4Dv1" |
02:29:22 | FromDiscord | <Elegantbeef> I'm so lost |
02:30:20 | FromDiscord | <terrygillis> ok that's weird the new piece of code despite my condensing from my original does show error at the baseName but at the `varargs[untyped]/varargs[string]` part |
02:30:43 | * | rockcavera quit (Read error: Connection reset by peer) |
02:30:46 | FromDiscord | <terrygillis> which makes it unrepresentative of my original :/ |
02:31:04 | FromDiscord | <Elegantbeef> I just don't get what this is supposedly trying so solve |
02:31:40 | * | rockcavera joined #nim |
02:31:41 | * | rockcavera quit (Changing host) |
02:31:41 | * | rockcavera joined #nim |
02:33:07 | * | lucasta_ joined #nim |
02:38:55 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4Dv4 |
02:39:15 | FromDiscord | <terrygillis> (edit) "https://play.nim-lang.org/#ix=4Dv4" => "https://play.nim-lang.org/#ix=4Dv5" |
02:39:28 | FromDiscord | <Elegantbeef> Ok so firstly do not use strings, use `untyped` |
02:39:43 | FromDiscord | <Elegantbeef> So `baseName` is now `untyped` |
02:40:17 | FromDiscord | <Elegantbeef> I'd do `(A: tuple[time: int, mod: string]), (B: tuple[width: float, setting: Base])` |
02:40:47 | FromDiscord | <Elegantbeef> So now we make our type def(draw the owl) |
02:41:30 | FromDiscord | <terrygillis> oh so I should actually do all the string processing outside of the macro right? |
02:41:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/SFKfv |
02:41:45 | FromDiscord | <Elegantbeef> What strings? ๐ |
02:50:39 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4Dv7 |
02:51:19 | FromDiscord | <terrygillis> yeah that's basically what my code does except the structure of the strings in the array involves much more maneuvering |
02:51:24 | * | lucasta_ quit (Quit: Quit) |
02:51:35 | FromDiscord | <Elegantbeef> Stop using strings firstly |
02:52:08 | * | lucasta_ joined #nim |
02:54:23 | FromDiscord | <terrygillis> What would be the ideal ways to pass in this kind of structure? |
02:54:31 | FromDiscord | <terrygillis> (edit) "ways" => "way" |
02:54:32 | FromDiscord | <Elegantbeef> I told you a tuple |
02:54:34 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4Dv8 |
02:55:03 | FromDiscord | <Elegantbeef> But then again you're just remaking https://github.com/beef331/fungus or https://github.com/metagn/skinsuit/tree/master |
02:58:49 | * | lucasta_ quit (Quit: Quit) |
02:59:03 | * | lucasta_ joined #nim |
02:59:40 | FromDiscord | <terrygillis> would a tuple also work with a variable number of fields? Like: โต`(A: tuple[time: int]), (B: tuple[width: float, setting: ref Base], (C: tuple[field1: string, field2: float, field3: int, field4: seq[int]])` |
02:59:59 | FromDiscord | <Elegantbeef> Why wouldnt it |
03:00:33 | FromDiscord | <Elegantbeef> I use a tuple for fungus myself, it's the best way that gives you a bit of protections cause of the parser |
03:01:43 | FromDiscord | <terrygillis> Before now I thought tuple means "two" because of the lmao. Therefore almost never utilised it except for quick multiple returns. |
03:03:35 | FromDiscord | <haoyu233> Does copying happen when passing parameters in a non-var way? I don't modify the parameter data, but I don't want it to be copied when I pass it, e.g. `=destory` in nim 2.0 uses a non-var method. |
03:03:37 | FromDiscord | <Elegantbeef> Ah no they're a product type which means they are as long as you want and can store whatever you want |
03:04:21 | FromDiscord | <Elegantbeef> Nim does copy small types as an optimisation, it does not interfere with hooks |
03:05:11 | FromDiscord | <Elegantbeef> You can make `=dup` and `=copy` error if you wish to prevent implicit copies |
03:15:03 | FromDiscord | <haoyu233> Thanks for the reply, because I use intrusive data structures in my code, and there are a lot of pointers in there that have self-references, so I was worried about them being copied, leading to pointer failures |
03:18:06 | FromDiscord | <Elegantbeef> Sounds like you should disable those hooks then |
03:22:31 | FromDiscord | <elpinguinohelado> sent a code paste, see https://play.nim-lang.org/#ix=4Dvb |
03:22:42 | FromDiscord | <Elegantbeef> You don't |
03:22:52 | FromDiscord | <Elegantbeef> The entire point of scoping is you scope it |
03:24:30 | FromDiscord | <Chronos [She/Her]> Is there no way to get the column and line number of where the JSON parser had an error without committing heinous crimes (string parsing)? |
03:28:12 | FromDiscord | <jos7388> hey im trying to set up good testing for my project |
03:28:17 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1140849417340071956/image.png |
03:28:20 | FromDiscord | <jos7388> this is the output balls gives me |
03:28:29 | FromDiscord | <jos7388> its the first `expectAst` that failed |
03:28:32 | FromDiscord | <jos7388> but it's showing all of this trash |
03:28:44 | FromDiscord | <jos7388> is there a way to just get it to show the exact line that failed or something |
03:28:47 | FromDiscord | <jos7388> instead of the whole test |
03:29:55 | FromDiscord | <Elegantbeef> Use check instead perhaps |
03:35:17 | FromDiscord | <jos7388> i am using check now but its the same thing, even in a simple test |
03:35:21 | FromDiscord | <jos7388> it might be because im using the weird inline tests thing |
03:35:27 | FromDiscord | <jos7388> but it also might just be how balls works idk |
03:36:07 | FromDiscord | <jos7388> same thing happens with a simple test |
03:36:28 | FromDiscord | <jos7388> i think this is what turned me off from balls last time |
03:36:29 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1140851479616434186/image.png |
03:36:35 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Is there no way": I am guessing there isn't, oh well |
03:37:37 | FromDiscord | <jos7388> the output of unittest2 is much more useful |
03:37:39 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1140851774002036736/image.png |
03:38:09 | FromDiscord | <Chronos [She/Her]> Also I'm surprised std/json didn't update to allow for undefined keys to have default values too since that seems like something that'd fit well tbh |
04:39:29 | * | advesperacit joined #nim |
05:01:54 | * | rockcavera quit (Remote host closed the connection) |
05:42:21 | NimEventer | New Nimble package! cflags - A C-compatible bitmask flags interface, with a subset of nim set functionality, see https://github.com/MCRusher/cflags |
05:58:32 | FromDiscord | <odexine> ? |
05:58:59 | FromDiscord | <odexine> I see |
05:59:00 | FromDiscord | <odexine> Makes sense |
06:09:40 | FromDiscord | <joseph54> "I'll help anyone interested on how to earn 100k in just 24hoursย from the crypto market. But you will have to pay me my commission! when you receive your profit! if interested click on the link and send me a direct message by asking me HOWโต๐๐๐๐๐๐โตhttps://t.me/+B7s7bIRsCUZjMjY0 |
06:14:37 | FromDiscord | <demotomohiro> <@&371760044473319454> |
06:38:50 | * | PMunch joined #nim |
06:46:30 | FromDiscord | <aph> hi people, is there a way to send array in winim's SendInput? if not im going to do for loop instead |
07:01:07 | * | junaid_ joined #nim |
07:20:22 | * | Jjp137 quit (Ping timeout: 245 seconds) |
07:28:40 | FromDiscord | <demotomohiro> https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput |
07:29:42 | * | Jjp137 joined #nim |
07:30:34 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Dwh |
07:32:14 | * | azimut joined #nim |
07:43:36 | FromDiscord | <litlighilit> On js backend, How to convert string to cstring?โตโต( this is implicitly done but left a warning) |
07:44:18 | FromDiscord | <Elegantbeef> `cstring myString` |
07:44:19 | FromDiscord | <Elegantbeef> You can just disable the warning realistically there ๐ |
07:44:19 | FromDiscord | <Elegantbeef> It's less of an issue on the JS backend though |
07:44:42 | FromDiscord | <Elegantbeef> It is a performance concern but there is no logical reason why it's dangerous |
07:47:32 | NimEventer | New Nimble package! stack_strings - Library for guaranteed zero heap allocation strings , see https://github.com/termermc/nim-stack-strings/ |
07:48:31 | FromDiscord | <Elegantbeef> And i helped! |
07:48:51 | FromDiscord | <litlighilit> ๐
I've found many methods, never thinking this would work!โตThanks |
07:49:02 | FromDiscord | <Elegantbeef> Welcome to type conversions |
07:50:59 | FromDiscord | <Elegantbeef> Ugh termer making me make issues to make his code betterer |
07:51:21 | termer | Say what |
07:52:04 | termer | I suspect this library will be another thing I spent an entire day on and then I never end up using |
07:52:11 | FromDiscord | <Elegantbeef> > because there is no easy way to return a slice without allocating heap memory |
07:52:11 | termer | that's probably not true actually |
07:53:10 | termer | ok... why the fuck did the nimble package get named "stackstrings" instead of "stack_strings" |
07:53:11 | termer | am I retarded |
07:55:43 | termer | Elegantbeef, Am I wrong with the slice thing |
07:55:50 | FromDiscord | <Elegantbeef> Yes |
07:55:50 | termer | I'm woefully uninformed about Nim slices |
07:56:06 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4Dwo |
07:56:06 | termer | would those just be a pointer to an existing slice or something |
07:56:14 | termer | or I dunno, it's 3AM lol |
07:56:17 | termer | let's see |
07:56:31 | FromDiscord | <Elegantbeef> you can of course apply that to `HSlice` aswell |
07:57:00 | termer | lol what the fuck |
07:57:03 | FromDiscord | <Elegantbeef> `sink static string` and `: static auto` are comical as all fuck |
07:57:05 | termer | ok guess I know what I'm doing tomorrow |
07:57:18 | termer | static auto is actually for a good reason |
07:57:27 | termer | sink static string is stupid |
07:57:39 | FromDiscord | <Elegantbeef> How do you sink a constant, it's data stored in global |
07:57:48 | termer | 3AM programing |
07:58:04 | termer | anyway, the uses of auto in here looks retarded but are because of poor type system |
07:58:04 | FromDiscord | <Elegantbeef> Yea just doing a review ๐ |
07:58:27 | termer | is it possible to return a pointer to an existing array |
07:58:31 | termer | but a slice of it |
07:58:43 | FromDiscord | <Elegantbeef> You mean a `openArray[T]`? |
07:58:45 | termer | or is that what you sent is already doing |
07:58:46 | termer | yeah |
07:58:50 | termer | something, I dunno |
07:58:54 | FromDiscord | <Elegantbeef> use a template |
07:59:03 | termer | like how golang's slices are just pieces of an existing array |
07:59:09 | termer | so no new allocation |
07:59:12 | termer | or whatever |
07:59:25 | FromDiscord | <Elegantbeef> `template toOpenArray(ss: StackString, start, end: int): untyped = ss.data.toOpenArray(start, end)` |
07:59:31 | FromDiscord | <Elegantbeef> There you go we have nim's equivlent |
07:59:45 | FromDiscord | <Elegantbeef> Right but go also does silly thing like raises values up to the heap magically iirc |
08:00:02 | termer | Go's memory is magic |
08:00:07 | termer | I don't think too hard about it |
08:00:54 | FromDiscord | <Elegantbeef> right, but it allows that to happen safely |
08:01:03 | FromDiscord | <Elegantbeef> Since it raises arrays to references and shit afaik |
08:01:11 | termer | right |
08:01:32 | termer | in any case, this library is part of a bigger project which is a zero-allocation HTTP parser |
08:01:44 | termer | which in turn is part of my arduino webserver rewrite |
08:03:22 | termer | There was that one DB product in Zig I found out about that does no heap allocation whatsoever and it piqued my interest in fully stack-based programming in Nim |
08:03:26 | termer | although that's a lot harder with exceptions |
08:03:39 | termer | Especially when you realize how terrible Option is to work with repeatedly |
08:03:51 | FromDiscord | <Elegantbeef> Also you're not nil terminating these strings |
08:04:00 | termer | I don't need to |
08:04:13 | termer | the length is stored with it |
08:04:32 | FromDiscord | <Elegantbeef> You want to nil terminate for if you ever want to use these with C code |
08:04:40 | termer | hmm |
08:04:53 | FromDiscord | <Elegantbeef> "But I use 1 extra byte", but if C code requires that `\0` you just work with it |
08:04:58 | FromDiscord | <odexine> with sentinel based c code |
08:05:12 | FromDiscord | <odexine> safely can be ignored if you never use it |
08:05:32 | FromDiscord | <Elegantbeef> Which is most of it, let's be honest |
08:05:34 | termer | The only times I pass strings to C is when it wants a buffer and I'm usually also passing the size with it |
08:05:41 | FromDiscord | <Elegantbeef> Also your `sink` is cute all around, but this is a stack type |
08:05:45 | FromDiscord | <odexine> a good amount of it has a length-based alternative |
08:05:53 | termer | I'm aware about the sink thing |
08:06:02 | termer | I just went retard mode at one point and kept second-guessing for no reason |
08:06:05 | FromDiscord | <Elegantbeef> Just making sure ๐ |
08:06:19 | termer | I will stand by my use of auto however |
08:06:33 | termer | I tested this code on 1.6.12 and it doesn't even work there because of type system weirdness |
08:06:49 | termer | Apparently there were some very tangible improvements to the type system in 2.0.0 |
08:06:50 | FromDiscord | <Elegantbeef> Also why no put the `$` inside a `when not defined(stackStringPreventAllocation)` |
08:06:56 | FromDiscord | <Elegantbeef> Instead of using fatal inside |
08:07:12 | termer | Because I want a more clear error message |
08:07:49 | FromDiscord | <Elegantbeef> Also no `mitems` or `mpairs` |
08:07:52 | termer | I thought about just not including some of the heap-capable things with `when` but decided against it because the error messages would be confusing |
08:07:56 | FromDiscord | <Elegantbeef> Fuck i'm a monster |
08:07:57 | termer | what are the m variants again |
08:08:02 | FromDiscord | <Elegantbeef> Just giving an unasked for code review |
08:08:05 | FromDiscord | <Elegantbeef> `mutable` |
08:08:12 | FromDiscord | <Elegantbeef> return ` var char` and `(int, var char)` |
08:08:15 | termer | I'd need to look at the implementations of those |
08:08:35 | termer | I can implement those, I don't see a problem with that |
08:08:39 | FromDiscord | <Elegantbeef> It's so you do not need to do a length iteration just to mutate your data |
08:09:01 | termer | cool |
08:09:04 | termer | that's really useful |
08:09:12 | termer | # An implementation of `[]` that accept HSlice is not implemented because there is no easy way to return a slice without allocating heap memory |
08:09:13 | termer | # TODO ^ WRONG, I can do it with this code snippet: https://play.nim-lang.org/#ix=4Dwo (thanks Beef LOL) |
08:09:13 | termer | \ |
08:09:22 | FromDiscord | <odexine> In reply to @termer "I thought about just": you can have the $ in the when define(...alloc...): be a real impl then after that you do an else: proc ... fatal |
08:09:25 | FromDiscord | <odexine> you know what i mean |
08:09:27 | FromDiscord | <odexine> (edit) "mean" => "mean?" |
08:09:46 | FromDiscord | <Elegantbeef> Another thing to consider is `&` can work for static strings and people might want to concat them |
08:09:56 | termer | Not really necessary odexine |
08:10:23 | termer | oh yeah, I can implement & huh |
08:11:06 | FromDiscord | <Elegantbeef> The really nice part is all this code can now work with unicode/parseutils |
08:11:08 | termer | By the way, IndexableChars used to be a concept but it couldn't handle itself |
08:11:19 | FromDiscord | <Elegantbeef> So you already have made a very usable string ๐ |
08:11:28 | FromDiscord | <odexine> someone should really provide an alloc effect xddd |
08:11:33 | termer | Yes |
08:11:34 | termer | Really |
08:11:46 | termer | Elegantbeef, It was absolutely necessary for them to work with unicode cause I can't stand when people forsake unicode support |
08:11:54 | termer | Thanks for the feedback and the praise |
08:11:59 | FromDiscord | <Elegantbeef> You're welcome |
08:12:02 | termer | I'll implement the things you pointed out tomorrow |
08:12:18 | FromDiscord | <Elegantbeef> Both for the feedback and for the unicode support |
08:12:39 | termer | oh yeah, I think I could make a compiler switch for null termination |
08:12:51 | termer | and offer a cstring conversion that does copying if you don't have the switch on |
08:12:59 | termer | I think that'd be a happy medium |
08:13:23 | FromDiscord | <Elegantbeef> Eh `toString` exists |
08:13:34 | FromDiscord | <Elegantbeef> unless you make a stack allocated variation |
08:13:43 | termer | can cstring be stack-allocated |
08:13:46 | termer | I don't think it can |
08:13:54 | termer | but could be wrong |
08:13:55 | FromDiscord | <Elegantbeef> Which is a template that creates a new array and returns the pointer to it |
08:13:56 | termer | I'm not a c programmer |
08:14:03 | FromDiscord | <Elegantbeef> Of course it can be it's a pointer |
08:14:22 | termer | couldn't I just return a pointer to the string itself without copying |
08:14:26 | termer | assuming it was nil termianted |
08:14:27 | FromDiscord | <Elegantbeef> All you need to do is `toCstring` which copies to a an array with 1 extra space and then put a nil terminator at len + 1 |
08:14:28 | termer | or wait |
08:14:40 | FromDiscord | <Elegantbeef> Right it's not always nil terminated which is the issue |
08:14:47 | FromDiscord | <Elegantbeef> If it's a full array it's not a cstring |
08:15:02 | FromDiscord | <Elegantbeef> Or if you reduce the size it's not a cstring |
08:15:08 | FromDiscord | <odexine> In reply to @Elegantbeef "All you need to": no need for the terminator if its already 0-init |
08:15:10 | FromDiscord | <Elegantbeef> Welcome to the worst part about C strings ๐ |
08:15:25 | FromDiscord | <Elegantbeef> Right |
08:15:45 | FromDiscord | <Elegantbeef> Copying the data over implicitly gives you a nil terminate collection |
08:15:50 | FromDiscord | <odexine> also if you make an array in the tocstring proc, wont it be dead after it returns lol |
08:16:03 | FromDiscord | <Elegantbeef> Did i say proc |
08:16:07 | FromDiscord | <Elegantbeef> A template would be what you use |
08:16:07 | FromDiscord | <odexine> i dont remember |
08:16:10 | termer | here's your nil termination bro https://txt.termer.net/view?id=yjw5ftfnsq |
08:16:14 | FromDiscord | <odexine> o template |
08:16:30 | FromDiscord | <Elegantbeef> Lol termer |
08:16:36 | termer | actually I didn't even need unsafeSet cause it's already 0 |
08:16:38 | termer | well |
08:16:47 | FromDiscord | <odexine> i heard you liked termination so i terminated your terminators |
08:16:49 | termer | presumed to be 0 I suppose, I'm pretty sure Nim zeros out new obejcts |
08:16:52 | FromDiscord | <Elegantbeef> I'd say a variation that is guaranteed to be nil terminated is fine, but anyway |
08:17:01 | FromDiscord | <Elegantbeef> I'm outta here |
08:17:03 | termer | Maybe a variation would be fine |
08:17:04 | termer | yeah |
08:17:06 | termer | fuck I'm tired |
08:17:19 | FromDiscord | <odexine> its just 5 pm for me ๐ |
08:17:30 | termer | euros |
08:17:33 | FromDiscord | <odexine> i assume both of you are in the americas or |
08:17:35 | FromDiscord | <odexine> okay |
08:17:37 | termer | USA |
08:17:45 | termer | It's 3:17 |
08:18:29 | FromDiscord | <odexine> go sleep then xd |
08:18:36 | FromDiscord | <odexine> see you ig |
08:18:51 | termer | good night |
08:35:26 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a specific ORM that supports SQLite you recommand? |
08:43:40 | FromDiscord | <System64 ~ Flandre Scarlet> There are 4 of them https://media.discordapp.net/attachments/371759389889003532/1140928785479376896/image.png |
08:51:29 | NimEventer | New post on r/nim by aadoop6: Can I use nim to write memory safe code on embedded systems like the AVR architecture? Can it do memory safety without GC on such architectures?, see https://reddit.com/r/nim/comments/15rn0a3/can_i_use_nim_to_write_memory_safe_code_on/ |
09:02:03 | * | cm quit (Ping timeout: 246 seconds) |
09:03:41 | * | cm joined #nim |
09:12:57 | FromDiscord | <Phil> In reply to @sys64 "Is there a specific": Me? Norm, I like it personally a fair bit |
09:13:01 | FromDiscord | <Phil> (edit) removed "Me?" |
09:13:16 | FromDiscord | <Phil> But that's because I added what I found necessary and I didn't actually understand Ormin tbh |
09:13:58 | FromDiscord | <Phil> The main draw to norm for me was it actually having docs |
09:14:19 | FromDiscord | <Phil> (edit) "The main draw to norm for me was it actually having ... docs" added "easily findable" |
09:15:34 | FromDiscord | <Phil> If you can make Ormin work for you though try that, it looks pretty nice and having the compile-time checked SQL is a feature norm literally can not compete with |
09:16:03 | FromDiscord | <Phil> gatabase I recall being centered around... I think postgres? |
09:17:21 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DwY |
09:17:45 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "Norm, I like it": Norm makes me thinking to C#'s entity framework a bit |
09:18:31 | FromDiscord | <Phil> In reply to @sys64 "Norm makes me thinking": Somewhat, but Imo it has a sensible limitation:โตIt does the bare minimum crap (findAll, findOne, update one, delete on, create one) for you and for the more complex stuff you can easily write your own queries that map to read-only models |
09:19:36 | FromDiscord | <Phil> It is the best documented of the bunch I think, though I'm not sure if it has the best featureset. |
09:20:12 | FromDiscord | <System64 ~ Flandre Scarlet> I'll try that, if I have problems, I can change later |
09:23:48 | FromDiscord | <System64 ~ Flandre Scarlet> Well I have a problem hereโตA Game can have up to 4 players, but a player has one game https://media.discordapp.net/attachments/371759389889003532/1140938883429838949/image.png |
09:25:36 | FromDiscord | <odexine> In reply to @sys64 "Well I have a": remove the `type` in the middle |
09:25:45 | FromDiscord | <odexine> just straight up delete the line, dont change anything else |
09:26:49 | FromDiscord | <System64 ~ Flandre Scarlet> solves the problem, thanks! |
09:33:27 | FromDiscord | <Phil> In reply to @sys64 "Well I have a": Note that you can mark any model that you want to use only for reading (e.g. because you use them for a more complex SELECT query) you can mark wit {.ro.}, which will cause compile-time errors if you ever wrongly try to use that model for saving |
09:33:33 | FromDiscord | <Phil> (edit) "saving" => "saving/updating/deleting" |
09:33:43 | FromDiscord | <Phil> (edit) "wit {.ro.}," => "with {.ro.} or {.readonly.}," |
09:34:25 | FromDiscord | <Phil> Can also be useful for more performance sensitive stuff because you might have models with only a subset of all columns on your table so that you don't fetch useless information. |
09:41:58 | FromDiscord | <System64 ~ Flandre Scarlet> Good to knpwโตAnd how can I create a new sqlite database? The doc doesn't seems to explain that |
09:46:09 | FromDiscord | <Phil> It doesn't? Could've sworn it does, one sec |
09:46:35 | FromDiscord | <Phil> Oh right, it only goes into creating tabels in a DB, not creating a db by itself |
09:47:26 | FromDiscord | <Phil> TBH I've never done that via norm and completely overlooked that that could be a valid feature.โตI tend to use Sqlitebrowser as a GUI to see what's in my DB and that one does it for me. |
09:47:52 | FromDiscord | <Phil> Though I'm pretty sure if you open a connection to an imaginary file path it'll create a DB for your |
09:48:50 | FromDiscord | <System64 ~ Flandre Scarlet> yeah it does |
09:49:04 | FromDiscord | <Phil> In reply to @sys64 "Good to knpw And": Yep, `let con = open("./lala.sqlite3", "", "", "")`creates lala.sqlite3 |
09:49:08 | FromDiscord | <Phil> Ah, too slow |
09:54:39 | FromDiscord | <System64 ~ Flandre Scarlet> Yeah it works! https://media.discordapp.net/attachments/371759389889003532/1140946648416145499/image.png |
09:55:31 | FromDiscord | <System64 ~ Flandre Scarlet> I should add constraints |
09:55:44 | FromDiscord | <System64 ~ Flandre Scarlet> especially on pseudo |
09:57:12 | FromDiscord | <Phil> Absolutely |
09:58:14 | FromDiscord | <System64 ~ Flandre Scarlet> Can Norm do that too? |
09:58:42 | FromDiscord | <Phil> Not that I'm aware of, that's one of the non-core features that nobody implemented yet |
10:00:24 | FromDiscord | <heysokam> sent a code paste, see https://paste.rs/wUSvx |
10:01:24 | FromDiscord | <heysokam> I'm trying to infer that string should be taken as cstrings for `array[N,cstring]`, but nim wants strings by default |
10:01:26 | FromDiscord | <System64 ~ Flandre Scarlet> Or I can enforce this on the constructor |
10:02:53 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dx8 |
10:03:13 | FromDiscord | <Phil> Norm provides one |
10:03:16 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/i6Iv5 |
10:04:17 | FromDiscord | <odexine> sent a code paste, see https://paste.rs/2qEql |
10:04:17 | FromDiscord | <odexine> in static: args.len |
10:04:21 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> what does discard: do? |
10:04:28 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> (edit) "discard:" => "dispath:" |
10:04:33 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> (edit) "dispath:" => "dispatch:" |
10:05:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxa |
10:05:53 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Dxa" => "https://play.nim-lang.org/#ix=4Dxb" |
10:06:07 | FromDiscord | <Phil> But connection pooling sounds easier to me tbh |
10:06:35 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dxc |
10:06:41 | FromDiscord | <odexine> then you simply cant |
10:06:41 | FromDiscord | <heysokam> thats why i was trying to add it, and asked |
10:06:47 | FromDiscord | <odexine> because seqs do not have static lengths |
10:06:54 | FromDiscord | <System64 ~ Flandre Scarlet> I do pooling |
10:06:56 | FromDiscord | <heysokam> but its not a seq |
10:06:56 | FromDiscord | <odexine> and openarray includes seqs |
10:06:58 | FromDiscord | <heysokam> its an array |
10:07:26 | FromDiscord | <odexine> youre getting the length of an openarray (which args is) and openarrays match on seqs too which dont have static lengths |
10:07:26 | FromDiscord | <heysokam> I just want to be able to infer the size, based on the inputs, and its for a static block |
10:07:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxd |
10:07:38 | FromDiscord | <heysokam> In reply to @odexine "youre getting the length": ahhh true that |
10:07:43 | FromDiscord | <odexine> oh sorry, varargs |
10:07:49 | FromDiscord | <odexine> varargs also match seqs iirc |
10:07:59 | FromDiscord | <heysokam> didn't know, thats great to know |
10:08:11 | FromDiscord | <heysokam> how would you achieve this? can you think of a way? |
10:08:23 | FromDiscord | <heysokam> I just want to infer the size, given the inputs |
10:09:03 | FromDiscord | <Phil> (edit) "https://paste.rs/v5Nf7" => "https://play.nim-lang.org/#ix=4Dxe" |
10:09:10 | FromDiscord | <heysokam> and `[]` does not match `array[0,cstring]` by default, neither does `["some"]`, which becomes `array[1,string]`... but i want both to be `array[N,cstring]` |
10:29:37 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "If having to specify": and no gcsafe problems with that? |
10:36:13 | FromDiscord | <Phil> In reply to @sys64 "and no gcsafe problems": Assuming your withDbCon gets to be the only thing that touches that pool you're good |
10:36:39 | FromDiscord | <Phil> Note that sqlite won't magically allow concurrent write because of that |
10:36:47 | FromDiscord | <Phil> The database still locks up upon write |
10:36:48 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1140957253302751242/image.png |
10:37:25 | FromDiscord | <Phil> Try again with written out "connection", might be that you get married to the name of the variable in the template |
10:38:04 | FromDiscord | <System64 ~ Flandre Scarlet> even with "connection" |
10:38:26 | FromDiscord | <Phil> That's weird, does that also happen with compilation? |
10:38:33 | FromDiscord | <Phil> I tend to trust compiler-errors more than nimsuggest |
10:39:26 | FromDiscord | <System64 ~ Flandre Scarlet> the compiler also complains |
10:41:27 | * | dza quit (Quit: ) |
10:41:49 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxl |
10:42:28 | FromDiscord | <System64 ~ Flandre Scarlet> the first part is in a separate file |
10:43:00 | * | dza joined #nim |
10:44:09 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxn |
10:48:03 | FromDiscord | <Phil> In fact you don't even need to export SQLITE_POOLโตWhich gives you a guarantee that nobody can touch that thing outside of your init/destroy and withDbConn procs/templates |
10:49:48 | FromDiscord | <System64 ~ Flandre Scarlet> It works fine, thanks! |
10:52:04 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/PD0gq |
10:54:28 | FromDiscord | <Phil> You mean for when no record matches your query? |
10:55:41 | FromDiscord | <Phil> That is indeed intended behaviour (https://github.com/moigagoo/norm/blob/0449e0189a282d6e8c1018949d790040aff6d787/src/norm/sqlite.nim#L225) โตโตI personally am not a massive fan of that either, I wrapped that proc in my own which returns an optional |
10:56:07 | FromDiscord | <System64 ~ Flandre Scarlet> the weird thing is UserORM exists |
10:56:32 | FromDiscord | <Phil> Enable logging of the query and execute it yourself against the DB to check |
10:58:45 | FromDiscord | <System64 ~ Flandre Scarlet> ``DEBUG SELECT "UserORM".pseudo, "UserORM".password, "UserORM".id FROM "UserORM" WHERE UserORM.pseudo = ? LIMIT 1 <- ['e']`` |
10:59:15 | FromDiscord | <System64 ~ Flandre Scarlet> Why throwing an error? Why not just set my object to Nil? |
10:59:55 | FromDiscord | <Phil> In reply to @sys64 "Why throwing an error?": Not my design choice.โตthough either way you never should be given back nil, rather an option would've sufficed in my book |
11:00:06 | FromDiscord | <Phil> If the API were designed that way that is |
11:02:56 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Dxq |
11:03:50 | FromDiscord | <System64 ~ Flandre Scarlet> Oh I needed to put some instead of user |
11:04:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxr |
11:05:18 | FromDiscord | <Phil> And you can also return within the block |
11:05:58 | FromDiscord | <Phil> Though never mind, your way is slightly better in that it limits how long you keep the connection |
11:06:07 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1140964634254385193/image.png |
11:06:09 | FromDiscord | <System64 ~ Flandre Scarlet> In my API |
11:07:52 | FromDiscord | <Phil> Don't check for nil. There is no nil, there is only an option.โตAre you familiar with the concept or should I go into it quickly? |
11:08:06 | FromDiscord | <System64 ~ Flandre Scarlet> I think you should go into it |
11:12:30 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Dxw |
11:13:03 | FromDiscord | <Phil> If you use Optionals everywhere where a thing might "be something or nothing" one of the nice things is that you can be 100% sure that every ref object you have can not be nil |
11:13:50 | FromDiscord | <System64 ~ Flandre Scarlet> Oh this is a nice feature! |
11:18:16 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Dxz |
11:19:43 | FromDiscord | <System64 ~ Flandre Scarlet> pretty interesting |
11:22:00 | FromDiscord | <Phil> It's basically highly recommended to never, ever, ever deal with nil.โตIf something might not exist, express it via optionals.โตThat does not hold true for other languages, e.g. in java it's... weird and in javascript it's basically "We have a billion operators that are explicitly to make dealing with null acceptable so no Optionals for you" |
11:22:16 | FromDiscord | <Phil> (edit) "It's basically highly recommended to never, ever, ever deal with nil.โตIf something might not exist, express it via optionals.โตThat does not hold true for ... other" added "all" |
11:22:48 | FromDiscord | <System64 ~ Flandre Scarlet> is Optionnal like Nullables types in C#? |
11:22:53 | FromDiscord | <Phil> But quite a lot in general like optionals, Rust has them, I think C++ does as well |
11:22:58 | FromDiscord | <Phil> Never written a single line of C# |
11:23:06 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, sorry then |
11:23:37 | FromDiscord | <Phil> It looks kind of like an optional (?) |
11:23:59 | FromDiscord | <Phil> The type declaration looks a bit odd to me but it does express the same thing seemingly:โตSomething might exist or be null |
11:24:12 | FromDiscord | <Phil> And you can check whether it exists with "hasValue" |
11:24:21 | FromDiscord | <Phil> And unwrap with `x.Value` |
11:24:52 | FromDiscord | <Phil> Yeah, the idea seems to be the same, the words used to express them just differ |
11:25:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DxB |
11:25:45 | FromDiscord | <Phil> I assume in C# everything is heap allocated? |
11:26:47 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "I assume in C#": I think value types (int, structs, floats etc) are on stack |
11:27:11 | FromDiscord | <Phil> It isn't as of my recent googling, C# has structs which get stack allocated.โตMaybe those can't be nullable?โตOtherwise I'm not sure why they chose that wording |
11:27:43 | FromDiscord | <Phil> In reply to @sys64 "I think value types": Yeh, was more whether object-types can be stack allocated and they got structs, so they can. |
11:29:08 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DxD |
11:32:01 | FromDiscord | <System64 ~ Flandre Scarlet> Ooooh alright |
11:40:46 | FromDiscord | <System64 ~ Flandre Scarlet> I have this code that sends an HTTPResponse, is there a way to get the status code? (200, 404 etc) https://media.discordapp.net/attachments/371759389889003532/1140973356213080185/image.png |
12:02:05 | FromDiscord | <System64 ~ Flandre Scarlet> So I can't make assignments in a callback? https://media.discordapp.net/attachments/371759389889003532/1140978715954774106/image.png |
12:08:42 | FromDiscord | <intellij_gamer> Think you are meant to use [addCallback](https://nim-lang.org/docs/asyncfutures.html#addCallback%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29) |
12:11:04 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DxL |
12:12:28 | * | ntat joined #nim |
12:12:29 | * | cedb quit (Quit: WeeChat 4.0.2) |
12:14:15 | NimEventer | New thread by Hobbyman: SnelInstaller, see https://forum.nim-lang.org/t/10409 |
12:14:19 | * | ced1 joined #nim |
12:16:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @intellij_gamer "Think you are meant": I did that but I still have a mismatch https://media.discordapp.net/attachments/371759389889003532/1140982255653752842/image.png |
12:17:38 | FromDiscord | <System64 ~ Flandre Scarlet> Bruh seriously?!โตIt's just async! not a thread! https://media.discordapp.net/attachments/371759389889003532/1140982629253005322/image.png |
12:18:35 | PMunch | Are you still struggling with async? |
12:19:06 | FromDiscord | <System64 ~ Flandre Scarlet> Yes :/ |
12:24:13 | FromDiscord | <System64 ~ Flandre Scarlet> Alright so this is weirdโตWhy does it work perfectly on the browser (the 409 one) and not on my login app? https://media.discordapp.net/attachments/371759389889003532/1140984289975087114/image.png |
12:39:52 | * | sagax quit (Quit: Konversation terminated!) |
12:42:04 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DxU |
12:50:31 | PMunch | That's a very good question.. |
12:52:54 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DxZ |
13:05:20 | * | disso-peach quit (Quit: Leaving) |
13:11:21 | FromDiscord | <System64 ~ Flandre Scarlet> Finally I fixed it!โตI needed to convert the name to cstring |
13:54:16 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4Dyu |
13:54:58 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4Dyu" => "https://play.nim-lang.org/#ix=4Dyv" |
13:57:19 | FromDiscord | <odexine> i dont think that is valid syntax? |
13:57:25 | FromDiscord | <heysokam> yeah thats the idea |
13:57:32 | FromDiscord | <heysokam> that i don't know how to make it valid |
13:57:51 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=4Dyw |
13:58:01 | FromDiscord | <heysokam> let me try that |
13:58:26 | FromDiscord | <heysokam> is there no way to pass the body of the text to the template?โตor is that just a feature of macros only? |
13:58:43 | FromDiscord | <odexine> the body "of the text"? |
13:59:18 | FromDiscord | <heysokam> the body of the arguments, sorry |
13:59:29 | FromDiscord | <heysokam> aka passing that without the parenthesis |
13:59:42 | FromDiscord | <System64 ~ Flandre Scarlet> Does someone know how I can solve this problem please? https://media.discordapp.net/attachments/371759389889003532/1141008318752624690/image.png |
13:59:48 | FromDiscord | <odexine> i dont think it is valid syntax at all |
13:59:52 | FromDiscord | <odexine> In reply to @heysokam "aka passing that without": i mean to this |
13:59:59 | FromDiscord | <odexine> so it cannot work in any sense |
14:00:02 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DyC |
14:00:06 | FromDiscord | <odexine> In reply to @heysokam "I thought that was": that is doable |
14:00:15 | FromDiscord | <heysokam> so whats the difference? |
14:00:22 | FromDiscord | <odexine> syntax |
14:00:58 | FromDiscord | <odexine> In reply to @sys64 "Does someone know how": you cant set external variables in that sense iirc |
14:01:00 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DyH |
14:01:16 | FromDiscord | <odexine> In reply to @heysokam "yeah but is this": no? if nim says its ok for syntax, then it is, if nim says it isnt, then it isnt |
14:01:27 | FromDiscord | <heysokam> yeah im just trying to understand whats ok |
14:01:40 | FromDiscord | <heysokam> trying to make sense of why one is correct and the other not |
14:01:59 | FromDiscord | <heysokam> your () solution worked, btw. tysm |
14:02:08 | FromDiscord | <odexine> the comma is not allowed as is |
14:04:06 | FromDiscord | <heysokam> ic |
14:05:22 | * | PMunch quit (Quit: Leaving) |
14:12:50 | * | xet7 joined #nim |
14:18:56 | FromDiscord | <ieltan> In reply to @sys64 "Does someone know how": Post it on the forum better chance to get a response i think |
14:20:58 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4DyN |
14:23:39 | FromDiscord | <System64 ~ Flandre Scarlet> I did something very hacky but at least it works ๐คฃ https://media.discordapp.net/attachments/371759389889003532/1141014345267036160/loginWindow.nim |
14:28:38 | FromDiscord | <griffith1deadly> In reply to @sys64 "I did something very": why you use waitFor future in complete callback for IT future? |
14:31:19 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @griffith1deadly "why you use waitFor": I think it doesn't work otherwise |
14:32:12 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4DyV |
14:32:39 | FromDiscord | <System64 ~ Flandre Scarlet> will try this |
14:32:54 | FromDiscord | <griffith1deadly> (T) -> void requires import sugar module |
14:33:15 | FromDiscord | <System64 ~ Flandre Scarlet> is then executed once future is complete? |
14:33:23 | FromDiscord | <griffith1deadly> yes |
14:35:38 | FromDiscord | <griffith1deadly> simplest example https://media.discordapp.net/attachments/371759389889003532/1141017356856995871/image.png |
14:38:12 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
14:44:01 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4Dz2 |
14:48:31 | * | xet7 quit (Quit: Leaving) |
14:51:14 | FromDiscord | <System64 ~ Flandre Scarlet> I changed to read(), is that better? https://media.discordapp.net/attachments/371759389889003532/1141021285745438720/loginWindow.nim |
14:52:44 | FromDiscord | <griffith1deadly> yep |
14:53:03 | * | junaid_ quit (Remote host closed the connection) |
14:55:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @griffith1deadly "yep": Is it still possible to improve the entire system? I find it very hacky |
14:57:17 | FromDiscord | <griffith1deadly> as you proc is async you maybe can just waitFor future without callbacks |
14:57:59 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @griffith1deadly "as you proc is": It will block the rest of rendering |
15:00:48 | FromDiscord | <System64 ~ Flandre Scarlet> Btw is there any ways to generate, send and check authentication tokens on Nim? |
15:07:53 | FromDiscord | <System64 ~ Flandre Scarlet> I think it would be cleaner and more secure to send user/password each time I connect to the server |
15:11:57 | FromDiscord | <odexine> what do you meran |
15:11:59 | FromDiscord | <odexine> (edit) "meran" => "mean" |
15:12:55 | FromDiscord | <System64 ~ Flandre Scarlet> Using a token instead of checking password each time |
15:18:30 | FromDiscord | <odexine> In reply to @sys64 "I think it would": so you mean "than" |
15:18:51 | FromDiscord | <System64 ~ Flandre Scarlet> Oh yeah sorry |
15:19:12 | FromDiscord | <odexine> most session tokens are basically "on log in make random string, save to some table, send to user, user sends that every time they use api and server checks table" |
15:20:03 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, the principle is simpler than I thoughtโตSo an User-String table? |
15:23:12 | NimEventer | New Nimble package! strophe - Libstrophe wrapper, see https://github.com/SillaIndustries/nim-strophe |
15:25:41 | FromDiscord | <jviega> Usually not even stored in tables; just digitally signed and validated |
15:26:30 | FromDiscord | <leetnewb> Huh, wrapping libstrophe was on my todo list that I was never going to get to. nice. |
15:27:38 | FromDiscord | <odexine> In reply to @jviega "Usually not even stored": insert dont use stateless tokens for sessions rant here |
15:28:02 | FromDiscord | <odexine> with extremely tiny asterisk noting that its fine if you know what youre doing |
15:28:09 | FromDiscord | <jviega> Well, all of JWT is built on the notion that you can just keep everything you need in the token |
15:30:04 | FromDiscord | <odexine> im not about to start arguing with who i think is an actual cryptographer or something xd |
15:30:16 | FromDiscord | <jviega> Lol |
15:32:22 | FromDiscord | <System64 ~ Flandre Scarlet> I already used tokens with C#, but I think a lib managed that for me |
15:34:06 | FromDiscord | <jviega> I did a JWT implementation just for us (in C tho) that can do more than 10m signs or verifies per second on my laptop, and there's no need to go to a database ๐ |
15:34:44 | FromDiscord | <System64 ~ Flandre Scarlet> 10m == 10 millions? |
15:34:47 | FromDiscord | <jviega> Yes |
15:34:51 | FromDiscord | <System64 ~ Flandre Scarlet> oh wow! |
15:35:11 | FromDiscord | <System64 ~ Flandre Scarlet> I thought cryptography was something CPU demanding? |
15:35:35 | FromDiscord | <jviega> Public key cryptopgraphy is. Symmetric key cryptography is not. |
15:36:08 | FromDiscord | <jviega> But public key crypto is only ever used when necessary anyway. |
15:36:32 | FromDiscord | <System64 ~ Flandre Scarlet> cryptography isn't easy to understand tooโตEspecially public key |
15:36:46 | FromDiscord | <System64 ~ Flandre Scarlet> I did some hashing for my password https://media.discordapp.net/attachments/371759389889003532/1141032743099187312/image.png |
15:36:47 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "password" => "passwords" |
15:36:58 | FromDiscord | <odexine> dont do just hashing |
15:36:58 | FromDiscord | <jviega> It's not supposed to be, you're just supposed to use big, well-vetted high level abstractions such as TLS |
15:37:00 | FromDiscord | <odexine> also |
15:37:10 | FromDiscord | <odexine> better use something that already does it for you, the management of passwords |
15:38:09 | FromDiscord | <jviega> 100% correct, you shouldn't have to be an expert, you should use big black boxes that do what you need that you can trust to address the 100's of risks you don't understand, which is why the things are too complicated in the first place ๐ |
15:38:33 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "better use something that": Is there something for that in Nim? |
15:38:55 | FromDiscord | <odexine> In reply to @jviega "It's not supposed to": it ideally would be simple but oh well |
15:39:06 | FromDiscord | <odexine> In reply to @sys64 "Is there something for": not sure |
15:39:23 | FromDiscord | <jviega> Sure, OpenSSL ships with Nim and has a bunch of this stuff, tho not well documented at the Nim level |
15:39:51 | FromDiscord | <System64 ~ Flandre Scarlet> I can add a salt |
15:40:08 | FromDiscord | <odexine> i think theres also a nacl library somewhere |
15:40:12 | FromDiscord | <odexine> libsodium |
15:40:13 | FromDiscord | <jviega> I don't 100% love NimCrypto, but it's used in a lot of places, and has pbkdf2 which is the minimum I'd consider for password hashing |
15:40:32 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jviega "I don't 100% love": Stronger than SHA 256? |
15:40:37 | FromDiscord | <jviega> Adding a salt will still leave 1000 other risks |
15:40:54 | FromDiscord | <odexine> In reply to @sys64 "Stronger than SHA 256?": sha256 alone should not be used for password hashing |
15:41:15 | FromDiscord | <jviega> Sha265 is a very low-level algorithm, NimCrypto is a library that provides much higher level (and standard) algorithms |
15:41:38 | FromDiscord | <odexine> i think you should not worry about the implementation like oh does it use insert some jumble of letters here and just see if people still consider the library as prod.ready or something like that |
15:41:48 | FromDiscord | <jviega> You don't understand how hard it is to do good password hashing. You need to at least use pbkdf2 if not a more modern replacement. |
15:41:50 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "libsodium": Opussum I think? |
15:41:53 | FromDiscord | <Chronos [She/Her]> Nvm |
15:41:59 | FromDiscord | <jviega> It is a well trusted standard |
15:42:13 | FromDiscord | <System64 ~ Flandre Scarlet> Alright will use thatโตIt's also for a school project btw |
15:42:57 | FromDiscord | <odexine> if its just for school okay maybe you can ignore a lot of this stuff but hey, if you decide to go further than just school then you have it ready, if you listen to jtv |
15:43:23 | FromDiscord | <System64 ~ Flandre Scarlet> Gotta listen to him so |
15:43:39 | FromDiscord | <System64 ~ Flandre Scarlet> It would be some code I can reuse later |
15:43:45 | FromDiscord | <jviega> pbkdf2 is one function call and basically does everything you need it to do except stick the result somewhere. |
15:44:20 | FromDiscord | <odexine> pretty much |
15:45:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jviega "pbkdf2 is one function": Is that in NimCrypto? |
15:45:34 | FromDiscord | <jviega> Yes |
15:46:05 | * | lucasta_ quit (Ping timeout: 246 seconds) |
15:48:01 | FromDiscord | <terrygillis> I keep getting: `(1, 1) Error: undeclared identifier: 'MZ'` despite having only valid imports on the first line (literally `import os, std/[macros, strutils]`). What is happening? The vscode extension is also not showing error of any sort. |
15:49:01 | FromDiscord | <jviega> I believe MZ are the first two bytes of a PE binary file, so you're likely trying to import from something that's pointing to a binary file? |
15:49:24 | FromDiscord | <odexine> jtv what the fuck |
15:49:35 | FromDiscord | <odexine> thats some hella intuition |
15:50:20 | FromDiscord | <jviega> Yeah, I'll bet I'm right though ๐ |
15:50:46 | FromDiscord | <terrygillis> no really, literally that's my only imports from the std lib |
15:51:00 | FromDiscord | <terrygillis> import os, std/[macros, strutils] |
15:51:02 | FromDiscord | <System64 ~ Flandre Scarlet> Wow what's going on? https://media.discordapp.net/attachments/371759389889003532/1141036335717679165/image.png |
15:51:05 | FromDiscord | <odexine> do you have a binary file somehow called os in the directory |
15:51:17 | FromDiscord | <terrygillis> nope |
15:51:19 | FromDiscord | <jviega> I'm saying, however it's happening, there's a binary somewhere in your nim path |
15:52:00 | FromDiscord | <jviega> Because a) MZ doesn't appear on the line it's complaining about, and b) MZ on Windows will be the first two bytes of plenty of binaries, and that's the error you'd get |
15:52:28 | FromDiscord | <terrygillis> suddenly it cropped up and no matter how I modify the code now the error from the compiler is still the same, different from the extension output |
15:52:33 | FromDiscord | <System64 ~ Flandre Scarlet> I don't see pbkdf2 here either https://media.discordapp.net/attachments/371759389889003532/1141036716178813010/image.png |
15:52:35 | FromDiscord | <jviega> T is which hash algorithm to use (use sha256). |
15:52:43 | FromDiscord | <jviega> I don't know why M and N aren't just bytes |
15:53:05 | FromDiscord | <jviega> You just pasted the first two lines of pbkdf2 |
15:53:16 | FromDiscord | <odexine> sent a long message, see http://ix.io/4Dzy |
15:53:31 | FromDiscord | <jviega> I'd hope there are docs or exampels for you. |
15:54:01 | FromDiscord | <System64 ~ Flandre Scarlet> pbkdf2 isn't even declared for me, weird |
15:54:42 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, just needed to import |
15:55:57 | FromDiscord | <jviega> Sadly they have neither examples nor docs for it. I really don't love that library. |
15:56:36 | FromDiscord | <System64 ~ Flandre Scarlet> Is there an alternative to that? |
15:57:57 | FromDiscord | <jviega> Well, not unless you delve into how to call into C libraries from Nim. I do tend to just use OpenSSL, but I understand their C API as well as anyone can, so it's not much of a problem for me |
15:58:51 | FromDiscord | <terrygillis> ok i don't know how the compiler just magically works again with code |
15:58:59 | FromDiscord | <terrygillis> no rhyme or reason |
15:59:24 | FromDiscord | <terrygillis> (edit) "ok i don't know how the compiler just magically works again with ... code" added "the same" |
15:59:40 | FromDiscord | <odexine> sounds good |
15:59:43 | FromDiscord | <odexine> :baqua: |
16:09:24 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DzD |
16:17:17 | FromDiscord | <odexine> owasp recommends c = 600000 for sha256 |
16:17:40 | FromDiscord | <odexine> https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#pbkdf2 |
16:19:15 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, good to know |
16:27:52 | * | Mister_Magister quit (Ping timeout: 240 seconds) |
16:33:58 | * | Mister_Magister joined #nim |
16:35:11 | FromDiscord | <jviega> mySalt should always just be 16 random bytes |
16:35:26 | FromDiscord | <jviega> (when you're storing; used the stored bytes when recomputing for validation) |
16:44:43 | FromDiscord | <jviega> BTW, for that, I use this: |
16:44:58 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DzO |
16:45:27 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DzP |
16:45:54 | FromDiscord | <jviega> or `secureRand[uint64]()` etc |
17:03:05 | * | cornfeedhobo quit (Ping timeout: 246 seconds) |
17:04:12 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4DA1 |
17:11:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @jviega "mySalt should always just": But how can I compare the passwords then? |
17:15:17 | FromDiscord | <jviega> You re-use the salt when you recompute |
17:15:57 | FromDiscord | <System64 ~ Flandre Scarlet> but the salt is randomly generated? |
17:16:40 | FromDiscord | <jviega> Only when you're enrolling someone |
17:16:44 | FromDiscord | <jviega> Then you keep the salt around |
17:22:44 | FromDiscord | <odexine> In reply to @sys64 "but the salt is": the salt is random per user |
17:23:16 | FromDiscord | <odexine> each user has a different salt but the salt doesnt change unless their password is changed too (iirc) |
17:24:03 | * | ced1 quit (Quit: WeeChat 4.0.3) |
17:25:16 | FromDiscord | <odexine> In reply to @user2m "can anyone explain how": test2 works for me? what version of nim are you on |
17:26:59 | FromDiscord | <heysokam> if I have a file that does `.{importcpp:"somesymbol" ...`โตdoes my entire project need to be compiled with the cpp backend? |
17:28:30 | FromDiscord | <jviega> Sorry I was on a call, Rika explained it well; the salt is per-user. You can change per-password if you like, but that's basically irrelevent |
17:31:10 | * | pbsds quit (Ping timeout: 246 seconds) |
17:31:59 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=4DAj |
17:32:11 | * | pbsds joined #nim |
17:32:50 | FromDiscord | <Phil> In reply to @user2m "can anyone explain how": I can confirm that on nim 2.0.0 this works, both cases |
17:33:20 | FromDiscord | <Phil> Does fail on 1.6.10 though |
17:33:45 | FromDiscord | <user2m> In reply to @isofruit "I can confirm that": hmmm that's odd |
17:33:48 | FromDiscord | <jviega> If it's a string constant why on earth would you want to copy the full thing to the stack ever? |
17:34:00 | FromDiscord | <user2m> In reply to @odexine "test2 works for me?": 1.16.12 |
17:34:35 | FromDiscord | <Phil> In reply to @user2m "1.16.12": Looks like a bugfix with ranges being kind of an unspecified type and that not interacting well with strings that made it into 2.0.0 |
17:34:39 | FromDiscord | <Phil> Did you install via choosenim? |
17:34:50 | FromDiscord | <Phil> Because then you can just update to nim 2.0.0 if you want |
17:35:32 | FromDiscord | <Phil> There aren't really that many breaking changes, the only one I had to go through was db_sqlite & co migrating to a db_connector package |
17:37:37 | FromDiscord | <Phil> In reply to @sys64 "but the salt is": Generally, you store the salt together with the number of iterations and the password in your database, Django e.g. does it as one string:โต`$pbkdf2_sha256$180000$SomeSalt$SomeVeryLongHashWithASpecificAmountOfChars` |
17:37:44 | FromDiscord | <user2m> In reply to @isofruit "Looks like a bugfix": yeah there was some issue with nim 2.0 and the jwt library I was using. I'll have to look back at it. it's no biggie to use 1.16 atm |
17:37:53 | FromDiscord | <m4ul3r> In reply to @jviega "If it's a string": position independent code that relies only on the .text section - obviously #security related |
17:38:37 | FromDiscord | <jviega> Last time I tried wasn't very long ago, and still was getting memory leaks galore. I'm definitely not in a hurry to move to 2.0 |
17:38:58 | FromDiscord | <Phil> Mind you I have absolutely no sort of security expert looking over this, I basically coded this together based on what I learned from mratsim and reading through the docs of libsodium, but for easy dealing with password hashing I wrote myself nimword |
17:39:10 | FromDiscord | <Phil> (edit) "Mind you I have absolutely no sort of security expert looking over this, ... Imyself.โตI" added "nor am" | "nor amI ... basically" added "myself.โตI" |
17:39:20 | FromDiscord | <jviega> Just looking to ASLR all the things?? |
17:40:21 | FromDiscord | <Phil> (edit) "Mind you I have absolutely no sort of security expert looking over this, nor am I myself.โตI basically coded this together based on what I learned from mratsim and reading through the docs of libsodium, but for easy dealing with password hashing I wrote myself nimword" => "sent a long message, see http://ix.io/4DAm" |
17:41:21 | FromDiscord | <jviega> Are you trying to randomize the space between the constants you're using or something? |
17:44:54 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DAo |
17:45:16 | FromDiscord | <Phil> (edit) "http://ix.io/4DAo" => "http://ix.io/4DAp" |
17:45:30 | FromDiscord | <Phil> (edit) "http://ix.io/4DAp" => "http://ix.io/4DAq" |
17:46:02 | FromDiscord | <Phil> (edit) "http://ix.io/4DAq" => "http://ix.io/4DAr" |
17:46:51 | FromDiscord | <Phil> (edit) "http://ix.io/4DAr" => "http://ix.io/4DAt" |
17:47:08 | FromDiscord | <jviega> So Argon had a big security issue immediately after it got standardized that led to having to revise it. The best algorithm for it is more recent, and has a strong proof attached to it, something called Balloon Hashing, which was out of Stanford I believe. But the revised Argon is fine too; still, nothing wrong w/ good ol' PBKDF2, even if I can objectively detail a few ways in which Balloon hashing is the one everyone should be using f |
17:47:42 | FromDiscord | <Phil> God fucking dangit, literally can not move fast enough to keep up with security |
17:48:12 | FromDiscord | <Phil> Is Balloon hashing in libsodium? Might include it in nimword and if it were that would make it easier |
17:48:15 | FromDiscord | <jviega> Well, like Rika says, this is entirely my area. |
17:48:35 | FromDiscord | <jviega> No, it is newer than libsodium by a lot |
17:48:56 | FromDiscord | <Phil> ... there isn't perchance a wrapper around whatever C-implementation exists, is there= |
17:48:58 | FromDiscord | <Phil> (edit) "there=" => "there?" |
17:49:52 | FromDiscord | <jviega> IDK. IIRC the stanford implementation was actually in Python |
17:50:12 | FromDiscord | <jviega> It's not too hard to implement |
17:50:21 | FromDiscord | <jviega> But why does it matter? ๐ |
17:51:26 | FromDiscord | <odexine> it doesnt matter |
17:51:27 | FromDiscord | <Phil> Eh, because I wrote myself a package for easy password hashing that also supports argon2 (and easily swapping between implementations for that matter) I felt somewhat responsible to provide the best solutions I can there. |
17:51:31 | FromDiscord | <odexine> pbkdf2 is fine |
17:51:47 | FromDiscord | <odexine> best in security is not always best to use |
17:51:51 | FromDiscord | <jviega> 100% pbkdf2 is good enough. |
17:52:26 | FromDiscord | <odexine> theres also support to consider (in which case it is exactly your problem rn, you dont know any library implementing or exposing it to nim) |
17:53:49 | FromDiscord | <jviega> Wouldn't scare me personally given my experience, but tbqh I'm far more likely to just reach for pbkdf2. With Argon's history, I don't really trust it until I hear there's a well vetted proof around it |
17:55:10 | FromDiscord | <Phil> I mean the lib pretty much got Argon and pbkdf2-HMAC with either SHA256 or 512.โตAdding one more would've been nice either way, but I really don't fancy actually dealing with C myself. |
17:55:12 | FromDiscord | <jviega> Also, I don't ever really want to have to be an identity provider anyway, doing it well is a lot of work |
17:55:16 | FromDiscord | <jviega> OAUTH is your friend |
17:55:17 | FromDiscord | <odexine> idk, for as much as how awful sounding "go blindly follow the cryptographer" sounds, i dont know of a better thing to do than that xdddd |
17:55:30 | FromDiscord | <odexine> "but oauth isnt an id provider |
17:55:31 | FromDiscord | <odexine> (edit) "provider" => "provider"" |
17:55:49 | FromDiscord | <odexine> kinda dont like the whole oauth oidc thing, its kinda a mess |
17:56:13 | FromDiscord | <odexine> In reply to @isofruit "I mean the lib": i hear for crypto libs, less is more |
17:56:16 | FromDiscord | <jviega> No, oauth allows me to identify users without having to do a lot of the crap you need |
17:56:25 | FromDiscord | <odexine> harder to fuck things up if you got less options to choose |
17:56:43 | FromDiscord | <jviega> It's ugly, but it's widespread and ultimately is far less work |
17:57:09 | FromDiscord | <jviega> One of the many many areas where the Nim ecosystem should have something that it doesn't |
18:01:02 | FromDiscord | <Phil> Just looked for an oauth package to make that simpler, 1 present =/โตThough the pipelines stated it worked for devel and stable 3 days ago, so possibly workable |
18:02:06 | FromDiscord | <jviega> Oh really? What's the URL? |
18:02:32 | FromDiscord | <jviega> It's not too much work to wrap C projects these days too |
18:03:22 | FromDiscord | <Phil> Just like with macros I have this mental block when it comes to C.โตRecently overcame it for macros, but C is still one of those things where the conventions seem weird and I really don't like how it treats types |
18:04:09 | FromDiscord | <jviega> Once you wrap it w/ Furthark you don't need to worry about the C ๐ |
18:04:10 | FromDiscord | <Phil> https://github.com/CORDEA/oauthโตThe libโตhttps://github.com/CORDEA/oauth/actionsโตThe pipelines showing it worked recently |
18:05:04 | FromDiscord | <Phil> In reply to @jviega "Once you wrap it": I mean kinda, I still need to read the docs and understand what they're trying to do and how they're trying to achieve it.โตNot all that rarely you need to deal with providing memory sizes that come from ??? locations and what-not |
18:05:12 | FromDiscord | <jviega> Ah that one yeah. It hasn't had a commit in a hell of a long time. |
18:05:42 | FromDiscord | <Phil> Yeah, while that's true the pipelines work and ran recently so I'd cross my fingers and hope it worked if I were to try it |
18:06:24 | FromDiscord | <jviega> In my view, things like that should be put into the std library instead of trying to take stuff out. The language should own ensuring it's current. If I see something like that is some random guy's unupdated project for an evolving standard, I'm very unlikely to take the risk. |
18:07:32 | FromDiscord | <jviega> I really don't understand the move to excise crap, it seems like it's a bad move for driving adoption. |
18:09:10 | FromDiscord | <Phil> I think the idea is that how currently libs and compiler are coupled you've got to make a new nim-version to update the libs and the effort that goes into it feels not worth it.โตThe base assumption being that libs can be updated independently quicker and with less effort as needed.โตWhich I assume you're aware of though, so that argument makes no sense to you? |
18:10:49 | FromDiscord | <jviega> That's irrelevent ultimately. The nim language should be trying to have as big a standard library as possible; the internal release management issues are a solvable implementation detail. |
18:15:31 | FromDiscord | <jviega> When I hammer on "lack of ecosystem", a lot of the problem is essentially, dev needs very common thing X that's easy to find in any other language? Well, you can choose from 1-4 unmaintained things, most of which aren't going to be very complete; the alternative? They have to do a lot of work, whether it's writing or wrapping. |
18:16:38 | FromDiscord | <jviega> That includes incredibly basic stuff like writing to a damn S3 bucket. There isn't a good library for that, never mind all the other AWS services. Or GCP services. Or Azure services. |
18:19:26 | FromDiscord | <jviega> How about using a secrets management API? Couldn't find anything good there either. Stuff that's 101 basic crap that's easy to find in other languages... the languages either maintain, or are so popular the big vendors maintain. |
18:19:35 | FromDiscord | <odexine> it being on the stdlib wouldnt really change the fact that someones gotta maintain it |
18:20:20 | FromDiscord | <jviega> Right, but if it's actually in the umbrella of the "official org" such as it is, when the creator abandons working on it, it's easier to get other people to pick up the pieces instead of forking |
18:20:33 | FromDiscord | <jviega> Forking a project those people don't want to work on anywa |
18:20:51 | FromDiscord | <jviega> It would def make it easier to get people involved in nurturing the community |
18:23:28 | FromDiscord | <jviega> When I find a project that's abandonware, like an s3 lib say, that I have to patch up to make it work, I then submit a PR and that person just ignores it, because that was years ago, and not even remotely interesting to them. So nobody benefits, and nobody's going to come to my page to look to see if my fork is marginally better, etc. It's much better off getting important stuff into the tent, so to speak |
18:24:18 | FromDiscord | <jviega> I've had several PRs for nim projects that I yanked after 6 months of monthly pings trying to get a response. |
18:25:35 | FromDiscord | <nomad> sent a code paste, see https://play.nim-lang.org/#ix=4DAI |
18:26:55 | FromDiscord | <odexine> https://media.discordapp.net/attachments/371759389889003532/1141075564883619891/image.png |
18:27:03 | FromDiscord | <odexine> oh i didnt see the text below |
18:28:28 | FromDiscord | <odexine> prolly different dns resolvers for browser and winapi |
18:28:44 | FromDiscord | <nomad> maybe but how do i fix that |
18:38:29 | * | rockcavera joined #nim |
18:57:16 | * | ced1 joined #nim |
19:30:21 | FromDiscord | <nervecenter> What libraries exist for quad precision floats? |
19:30:42 | FromDiscord | <nervecenter> or arbitrary precision |
19:39:31 | FromDiscord | <m4ul3r> In reply to @nomad "maybe but how do": You need to url encode the `@` |
19:40:21 | FromDiscord | <m4ul3r> This works for me https://media.discordapp.net/attachments/371759389889003532/1141094043883941918/image.png |
19:42:06 | FromDiscord | <m4ul3r> In reply to @jviega "Are you trying to": Just trying to avoid the use of the data section |
19:43:44 | FromDiscord | <nomad> In reply to @m4ul3r "You need to url": thank you so much, i was at the brink of punching a hole through something haha ๐ |
19:46:28 | * | ntat quit (Quit: leaving) |
19:58:13 | qwr | I disagree, "as big a standard library as possible" is not a good goal. it is easy to not foresee future requirements or do stupid design decisions, and then you have to live with this. what's reasonable, is to have commonly useful things in standard library, which is subjective and compromise, but still useful and it seems that nim standard library seems to be kind of like that |
20:00:21 | NimEventer | New thread by DMisener: \suggestions on handling \destructuring of array/seq into a list of named fields?, see https://forum.nim-lang.org/t/10410 |
20:09:39 | FromDiscord | <jviega> sent a long message, see http://ix.io/4DB5 |
20:10:58 | FromDiscord | <jviega> But the lack of ecosystem is a huge, huge barrier, and a bigger reason for the rest of my team not wanting to use it than the syntax and any quirks in the language itself. Just makes everything seem like so much more work than if they went and did it in Go. |
20:11:03 | FromDiscord | <jviega> And they're right |
20:12:09 | FromDiscord | <Elegantbeef> But but there are no popular languages with similar syntax to Nim! ๐ |
20:12:14 | FromDiscord | <jviega> LOL |
20:13:02 | FromDiscord | <jviega> The syntax is mostly not very relevant to the people I work with, tho there are obviously plenty of people who will either love or hate things. |
20:13:47 | FromDiscord | <jviega> Even 9 months into nim, I still hate the choice of & for array additions, for instance |
20:13:55 | FromDiscord | <Elegantbeef> It's very much a nothing burger but people bikeshed it |
20:13:58 | FromDiscord | <Elegantbeef> Compiler, Tooling, Libraries, Package dependencies is all that really matters |
20:14:00 | FromDiscord | <jviega> But I don't really care, other than I still get it wrong all the fucking time ๐ |
20:14:22 | FromDiscord | <jviega> Yup totally agreed, and it's good to see work on the tooling w/ Atlas |
20:15:23 | FromDiscord | <jviega> But the philosophy seems to be to shed responsibility on libraries, but there's not a big enough community yet, so when you need to reach for something external, it always feels like abdandonware |
20:15:39 | FromDiscord | <jviega> And even then, there's often nothing decent ๐ |
20:16:14 | FromDiscord | <Elegantbeef> Right, but being in the stdlib is another issue for a multitude of reasons |
20:16:40 | FromDiscord | <jviega> stdlib isn't important. That's an implementation detail. What's important is that it be "official" and supported. |
20:17:10 | FromDiscord | <Elegantbeef> Ok you just mean under the nim-lang umbrella which is fine |
20:18:48 | FromDiscord | <jviega> For instance, when someone writes a halfway decent AWS library because none exists, but then they abandon it, it eventually goes stale. Maybe I'll PR against one, but those people did it because nothing was out there and they needed it, they don't want to keep getting dragged back into it. |
20:19:10 | FromDiscord | <jviega> I've got several PRs like that that have lingered for 6 months myself. |
20:19:19 | FromDiscord | <jviega> Nobody's going to come looking for my fork, either. |
20:19:55 | FromDiscord | <jviega> If it's 'official', then it's easy for me to know, if they all suck, at least if I try to improve the one that's there, then someone else will pick it up |
20:20:48 | FromDiscord | <jviega> It's really disheartening to people looking for basic stuff every other language has, and seeing crappy libraries where nothing has been commited for 3 years, and they're not 'official'. If they were official, that's more imply, "wow, it's so good we haven't had to touch it in 3 years" |
20:21:40 | FromDiscord | <Elegantbeef> That's a mixed bag, cause people will come in here and be like "This thing hasnt been commited on in 2 days, it must be a dead repo" |
20:22:14 | FromDiscord | <jviega> Well, when you've got one huge repo for the org, less attention gets paid to individual modules, let's say |
20:22:25 | FromDiscord | <jviega> In terms of the "this is abandonware" reaction |
20:22:34 | FromDiscord | <Elegantbeef> But yea having important packages under a nim-lang org is nicer |
20:23:31 | * | advesperacit quit () |
20:23:31 | * | krux02 joined #nim |
20:25:00 | FromDiscord | <jviega> Once Nim's bigger, the big vendors will clearly be willing to release their own supported nim packages (e.g., aws, gcp, etc). But until then, not supporting those things well is an issue. Most recent one for me is finding anything decent to abstract away dealing with all the common secret manager libs. I end up writing too much crap myself that should just be easy and official |
20:25:50 | * | cornfeedhobo joined #nim |
20:25:53 | FromDiscord | <jviega> The bar for me being, it's major tech, and easy to find supported versions in most any other language I'd consider |
20:31:28 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @m4ul3r "This works for me": Can you do routing with Puppy? |
20:32:18 | FromDiscord | <_gumbercules> I'm going to be so glad when the trend of naming Nim libraries with words that end in `y` dies |
20:32:29 | FromDiscord | <jviega> Lol |
20:33:00 | FromDiscord | <Elegantbeef> That's one way of saying "I dislike treeform" ๐ |
20:33:48 | FromDiscord | <_gumbercules> More like I don't appreciate their convention of naming libraries. I barely know treeform - it'd be difficult for me to hate them. |
20:34:02 | FromDiscord | <Elegantbeef> I of course was joking |
20:34:06 | FromDiscord | <_gumbercules> I know ๐ |
20:34:10 | FromDiscord | <_gumbercules> Just don't want anyone to get the wrong impression |
20:34:33 | FromDiscord | <Elegantbeef> Do you hate my pun based naming scheme? |
20:35:19 | FromDiscord | <jviega> As my kids remind me any time I try to use a pun, "dad jokes are bad jokes" |
20:35:22 | FromDiscord | <_gumbercules> If effort goes into the name I appreciate it |
20:35:29 | FromDiscord | <Elegantbeef> Kashae - memoization libraryโตFungus - Rust style ADT macrosโตTraitor - trait libraryโตOopsie - oop introspection library |
20:35:33 | FromDiscord | <_gumbercules> Effort and thought |
20:35:34 | FromDiscord | <Elegantbeef> Cmon jviega those are good names |
20:36:16 | FromDiscord | <jviega> Oh, I still like puns myself, I have 4 kids, so I must like them a lot |
20:37:15 | FromDiscord | <m4ul3r> In reply to @sys64 "Can you do routing": can you elaborate? I haven't use much puppy and just tested what was shared? |
20:37:35 | FromDiscord | <Elegantbeef> Isnt puppy an http client not a server so why would it do routine? |
20:37:41 | FromDiscord | <Elegantbeef> routing even |
20:37:56 | FromDiscord | <m4ul3r> isn't that what mummy is for? |
20:38:16 | FromDiscord | <m4ul3r> They meant hosting a webserver? |
20:38:31 | FromDiscord | <_gumbercules> Somewhat off topic but one day my wife brought home some chick-fil-a and these amazing cards that came with one of their kids meals apparently: https://media.discordapp.net/attachments/371759389889003532/1141108681753239583/p_20230809_175633.png |
20:39:03 | FromDiscord | <_gumbercules> They're pretty amazing |
20:39:12 | FromDiscord | <_gumbercules> Definitely upped my dad joke game |
20:39:14 | FromDiscord | <jviega> Guess I need to eat some CFA this week |
20:39:14 | FromDiscord | <System64 ~ Flandre Scarlet> It's for fetching API, might be interesting |
20:42:58 | FromDiscord | <_gumbercules> Why do watermelons have fancy weddings? They cantaloupe ๐ฅ ๐ฟ |
20:53:18 | termer | completely uncalled for |
20:53:31 | FromDiscord | <_gumbercules> what's that? |
20:53:58 | termer | oh wait you're showing those cards LOL I thought you decided to start telling horrible jokes out of the blue |
20:54:46 | FromDiscord | <_gumbercules> xD |
20:55:10 | FromDiscord | <_gumbercules> I have a whole deck of them if you want me to keep going |
20:58:23 | FromDiscord | <_gumbercules> but really - I don't have a problem with puns or dad jokes. It's more when the name of everything has to fit some strict but unnecessary convention, like ending in `y` , that someone will start to lose me. |
20:59:17 | FromDiscord | <.maverk> hello |
21:42:03 | termer | hello |
21:42:26 | termer | _gumercules, I love those kinds of jokes and I also love shitting on them |
21:43:05 | qwr | jviega: the problem you described is that there is simply (yet) not enough people willing to maintain all libraries that might be useful |
21:43:56 | FromDiscord | <_gumbercules> In reply to @qwr "<@1046486398850576494>: the problem you": We're approaching two decades of Nim being a thing - when will there be enough people if there are ever going to be enough? |
21:44:08 | FromDiscord | <jviega> I think plenty of people would be willing to help out w/ such things if they knew it wasn't going to be wasted effort. |
21:44:13 | FromDiscord | <jviega> Exactly right |
21:44:20 | FromDiscord | <jviega> If you don't make it easy for people to add value they won't |
21:45:31 | qwr | this probably matters to some people, but others maintain things they find useful for themselves or where they simply enjoy doing it |
21:46:14 | FromDiscord | <jviega> Sure, and they can keep doing that, but it doesn't help the community grow, now does it. |
21:47:28 | FromDiscord | <jviega> Having to do days or weeks of work to build stuff that is well supported and can be done in a few mins in Go, Python, C, Rust, Java, ... is an incredibly common barrier I'm seeing just from trying to get people to use it internally. |
21:50:07 | * | disso-peach joined #nim |
21:50:18 | qwr | using C or rust library should be easy in nim |
21:50:37 | qwr | can't imagine spending days on it |
21:50:37 | FromDiscord | <jviega> Great, then wrap a bunch of crap and keep people from bouncing out of the language |
21:51:37 | FromDiscord | <jviega> Well you'd be right, because most people just don't bother. |
21:52:37 | FromDiscord | <jviega> Again, your approach might be fine for you, and it is for me personally, but it's not even remotely good for helping the broader Nim community. Paraphrasing what Gumbercules said, expect to spend another 20 years with no significant adoption. |
21:52:44 | FromDiscord | <_gumbercules> In reply to @qwr "using C or rust": Using a Rust library in Nim is only trivial if it exports a C API and most people are just going to use Rust if Rust can already do what they want done. |
21:52:52 | qwr | that's true, and then they bother fighting days and weeks with go deficiencies and java framework monstrosities |
21:53:14 | FromDiscord | <jviega> And even then, watching people hitting their heads on trying to wrap C, even with some good guides around, is tiresome |
21:53:29 | termer | To me, the case has always been that Nim has no killer feature so nobody knows why they're using it |
21:53:38 | FromDiscord | <_gumbercules> Nim has basically zero enterprise software support - like no one is going to pick Nim to author a production software component used in a larger organization because they'd need to bring too much to the table |
21:54:01 | termer | Nim can be a bit difficult to use in a team setting I'd imagine |
21:54:07 | FromDiscord | <_gumbercules> And for better or worse, enterprise software support is what drives the wider software development world towards tech adoption |
21:54:10 | FromDiscord | <jviega> No, they feel 100% more productive in Go. I know dozens of people in the tech world who gave Nim a look, and this ecosystem problem was a non-starter for all of them. |
21:54:14 | qwr | even rust, with all the mindshare it has, is having difficult time in enterprise settings |
21:54:20 | FromDiscord | <jviega> But you keep telling yourself that Go's not productive enough for them |
21:54:35 | FromDiscord | <jviega> While the Nim user base grows aenemicly |
21:54:42 | FromDiscord | <_gumbercules> In reply to @qwr "even rust, with all": Sure but they're miles ahead of Nim and in less time |
21:55:09 | FromDiscord | <jviega> Yes, and the reason I wouldn't want to use Rust isn't ecosystem, it's because it's the modern perl, in terms of it being a write-only language. |
21:55:28 | FromDiscord | <_gumbercules> Hell Odin is already used in a industry leading product and it's been a blip on the radar compared to Nim. Zig has appealed to a much wider audience than Nim as well, in a much shorter time span, and it has no killer product. |
21:56:06 | termer | Zig's killer product is C |
21:56:15 | termer | that's always been clear, and that's what they market it as |
21:56:16 | qwr | well to me it seems that number 1 criteria in enterprise is "can you hire bunch of programmers who barely know this _cheaply_?" |
21:56:18 | FromDiscord | <jviega> Yup, because they act like a community, instead of a bunch of individuals who happen to use some guy's pet project |
21:56:19 | FromDiscord | <_gumbercules> Nim has a history of driving users and contributors away, there are no two ways about it and until that is understood and fixed I think Nim will maintain its footing if it doesn't see some slippage |
21:56:44 | qwr | you can't really apply any merit-based logic against that |
21:56:53 | FromDiscord | <_gumbercules> In reply to @qwr "well to me it": I mean - all languages start out with one user |
21:57:12 | FromDiscord | <_gumbercules> Golang, Rust and Zig did - and they all somehow overcame the lack of users and thrived |
21:57:56 | termer | People like to talk about community a lot, but I legit think the reason Nim suffers so much is that it has no direction and no killer app |
21:58:02 | qwr | yes and there the initial growth after C++ has always been massive marketing - java, C#, go |
21:58:03 | termer | its killer app is being whatever you want |
21:58:08 | FromDiscord | <jviega> No, false. I have run large enterprise software teams, and language selection in the tech world tends to be, "whatever the individuals want, we're not going to disenfranchise them". But I still would urge people to consider whether someone else is going to pick up that Rust code in a year and read it. |
21:58:30 | FromDiscord | <jviega> It's the developers who don't want to use Nim |
21:58:53 | termer | I mean, to be honest, I'm extremely hesitant to use Nim in a production setting, at least for my applications |
21:59:00 | termer | which are network-based |
21:59:10 | qwr | and if you've hired bunch of people by criteria that they know java, then the common language between them tends to be java etc |
21:59:14 | FromDiscord | <jviega> Hell, I've written 100K lines of Nim in 9 months, and I wouldn't recommend it to anyone who isn't already using it, even though I enjoy it for me. |
21:59:21 | termer | LOL yeah |
21:59:49 | termer | I dunno, it feels like it really has a hard time evolving past a toy |
21:59:56 | FromDiscord | <_gumbercules> Yeah most of the time I tell people about Nim I preface my glowing review with - if I were running a software company to do we / you do - I probably wouldn't choose Nim |
22:00:01 | FromDiscord | <jviega> Yup, and this is the mindset holding it back.. |
22:00:08 | termer | _gumbercules, That's how I talk about it |
22:00:11 | termer | but |
22:00:19 | termer | I'm actively trying to make things I can use in production |
22:00:26 | termer | but it's hard |
22:00:31 | termer | I think a lot of improvement could be made by removing like half the features |
22:00:33 | qwr | there is one much more mature language with similar growth to nim that i also like very much - ocaml |
22:01:10 | qwr | its been around like eternity, its really stable, and the use and libraries are very limited |
22:01:14 | termer | The NimWorks people are working on NimSkull, which in its current state is basically Nim with more narrowed features |
22:01:28 | FromDiscord | <jviega> Also not a success by any means, qwr, so I am waiting to hear your point. |
22:02:19 | FromDiscord | <_gumbercules> In reply to @termer "The NimWorks people are": I'm not sure how much it has in common with Nim anymore - certainly quite a bit - but I don't think the intention is to maintain any sort of compatibility with Nim |
22:02:21 | qwr | jviega: that is the point, that its not a success in mindshare, while technically sound (except maybe multicore support until like last year) |
22:02:35 | termer | There is no intention to maintain compatibility, which is why I don't use it |
22:02:45 | termer | but its purpose is good and is what I wish Nim would do |
22:02:53 | FromDiscord | <jviega> OCAML at least was and continues to be responsible for many academic papers and ideas that drive design in other successful languages. |
22:03:21 | * | disso-peach quit (Quit: Leaving) |
22:03:29 | FromDiscord | <jviega> If you're happy w/ Nim being not fit for most people that's fine, but being an absolute tosser to people who are trying to help it get adoption is unfathomable. |
22:03:49 | termer | I want it to become more successful |
22:03:54 | termer | I really do |
22:03:55 | qwr | jviega: maybe your right that one common denominator is standard library (nims is honestly the better one here) |
22:03:59 | FromDiscord | <jviega> I'm talking to qwr |
22:04:08 | termer | my bad |
22:06:06 | FromDiscord | <jviega> There's nothing fundamentally wrong w/ languages as pet projects. I've got that merit badge. But unless it's your decision and you're saying, "This is only ever going to be a pet project", then arguing it's good enough staying a pet project while others are trying to help it evolve is just a jerk move. |
22:06:55 | termer | I've seen people talk about this on other forums, specifically the fact that there isn't a clear map of where the language is going |
22:07:34 | qwr | i'm not trying to stop anything, only thought that throwing kitchen sink into stdlib might not be too useful in the end, but maybe i'm wrong |
22:07:36 | FromDiscord | <jviega> Yeah, the external perception I've heard from friends who went to Zig instead is, "let's continue to dink around with different memory management approaches forever" |
22:07:42 | FromDiscord | <_gumbercules> I think the fact that those empowered to change the situation don't even pay attention to conversations like ^ (so far as I can tell - and I'm not attempting to bash anyone here or claim people aren't working hard) is proof that the level of desire to see Nim evolve its community and grow its user base is lacking |
22:07:46 | FromDiscord | <jviega> You're definitely wrong ๐ |
22:08:06 | FromDiscord | <jviega> It is a broader problem of no investment in community building, but that's one huge part of it |
22:08:25 | FromDiscord | <jviega> Exactly that, Gumbercules. |
22:09:21 | termer | Community building as priority is kind of backwards when community forms around things people want to use in the first place |
22:09:46 | termer | People want to use Nim for fun but it's lacking direction at the core language level |
22:10:06 | FromDiscord | <jviega> I think plenty of people have had interest, but been driven away due to the lack of investment in ecosystem / community |
22:10:13 | FromDiscord | <_gumbercules> People want to use and contribute to Nim but the channels to do so need to be easy to swim in and wide open - which they are not |
22:10:25 | termer | are they not |
22:10:37 | termer | well contribution, I'm not sure |
22:10:41 | termer | I've never contributed to the compiler |
22:10:54 | FromDiscord | <_gumbercules> If you want examples of attempts at contributing to Nim just to see how dififcult it can be, I'm happy to provide them |
22:10:55 | FromDiscord | <_gumbercules> haxscramper and fusion is a good one |
22:10:55 | FromDiscord | <_gumbercules> disruptek and incremental compiliation is another good one |
22:10:56 | termer | and stdlib is mostly a no-go because you can only add to it |
22:11:12 | termer | man I really wish the whole CPS in the compiler thing panned out |
22:11:16 | FromDiscord | <_gumbercules> I mean - writing and maintaining a package is still contributing to the language's ecosystem |
22:11:26 | termer | There's a post by Araq in a GitHub issue thread where he flat out said CPS is the future |
22:11:33 | termer | I would agree, if that's what actually happened |
22:11:47 | termer | CPS is miles better than async/await in both performance and usability |
22:12:12 | FromDiscord | <_gumbercules> krux02 is another good example of a contributor who couldn't seem to find balance with leadership - there are a myriad of examples from the history of Nim |
22:12:34 | termer | I only know vague bits about the story of Fusion and concurrency wars |
22:13:38 | FromDiscord | <jviega> For me, I don't even know why I keep shouting about things, other than I have written a lot of code. As much as I like it, I'm unlikely to ever do another new project in Nim. |
22:14:23 | FromDiscord | <jviega> Tho the one I'm working on is looking likely to end up being adopted into the Linux Foundation in Nov time frame, which has me really a bit nervous about it all being in a language I cannot recommend. |
22:14:24 | qwr | hm, and why? |
22:14:26 | termer | I'm hanging out in #nim-embedded and am pretty optimistic about doing projects on microcontrollers |
22:14:56 | termer | I'm also optimistic about CPS and am going to try driving more adoption of it |
22:15:12 | * | qwr is using nim for personal projects simply because its most easy to use / fastest / optimal solution in many cases |
22:15:15 | FromDiscord | <jviega> I've just told you. There's too much friction on common things for strong engineers in the tech world. |
22:15:33 | termer | What's your project jviega |
22:17:22 | qwr | it's stdlib is often good enough, language is nice to use, compiler catches common errors and produces small and fast binary - idk any other language with that combination of properties |
22:18:03 | FromDiscord | <jviega> In a nutshell, makes it very easy for people to connect what's running on production systems to who wrote it and the exact commit it was built from. Collects arbitrary metadata, including stuff like SBOMs, signs software, collects runtime environmental info, but nobody needs to even be aware it's running (it fully wraps the docker command, and can fully wrap entry points for software, etc). |
22:18:49 | FromDiscord | <jviega> Already have several big companies using a preview like Cloudflare, even though the first source release isn't for a few more weeks. |
22:18:52 | termer | That's pretty cool |
22:19:23 | FromDiscord | <jviega> Yup, it includes injecting metadata directly into artifacts like elf executables, etc. |
22:19:42 | termer | qwr, I like doing network programming, and while the stdlib appears to be nice for I/O, asyncnet is really hard to use in a way that won't leak or cause performance issues |
22:19:44 | FromDiscord | <_gumbercules> In reply to @qwr "it's stdlib is often": Nice to use is subjective, same with the stdlib often being good enough. I'd argue that a langauge that allows me to do the things I need to get done in an efficient manner is a language that is nice to use. |
22:19:57 | termer | Nim's stdlib is generally nice to use |
22:20:11 | termer | json is good, blocking I/O is good, threading is good |
22:20:15 | FromDiscord | <jviega> If it has what you need |
22:20:26 | termer | my biggest problem is async |
22:20:27 | FromDiscord | <jviega> No the Json is passable at best |
22:20:48 | termer | I unmarshall JSON to objets |
22:20:50 | termer | *objects |
22:20:55 | termer | it does that well and I don't worry about it |
22:21:02 | termer | I know there's jsony |
22:21:09 | qwr | maybe i don't care about corner cases because i'm fine with using different languages for different tasks... |
22:21:41 | FromDiscord | <jviega> I hate the async paradigm in general. I don't see why people love taking sequential programs and then obfuscating the control flow ๐ |
22:22:32 | termer | as someone who does network programming, I can tell you all sorts of ways why it's useful |
22:22:42 | termer | it's not always necessary |
22:22:53 | termer | but everything I build that uses async I expect to be able to handle thousands of people at once |
22:23:14 | termer | maybe it's stockholm syndrome, but async in general is pretty crystal clear to me |
22:23:32 | termer | Everything's async in the kernel anyway |
22:24:05 | FromDiscord | <jviega> No, everything is multi-threaded |
22:24:46 | termer | threads are done by a scheduler that runs asynchronously |
22:25:04 | FromDiscord | <jviega> I'm fine with parallel programming in general. I've done a lot in the arena. Async is a horrible abstraction that doesn't even really get you parallelism |
22:25:09 | termer | fundamentally you have an event loop that polls hardware and dishes out events |
22:25:19 | termer | synchronous I/O without interrupts is just an abstraction |
22:25:22 | FromDiscord | <_gumbercules> colored anything sucks |
22:25:53 | termer | I'm enjoying Go, not having to think about that |
22:26:01 | termer | but the dislike for async is really overblown |
22:26:06 | termer | it's not that hard to reason about |
22:26:13 | FromDiscord | <jviega> False. Having a fair scheduler running across potentially multiple CPU threads is 100% different than the async paradigm that is actually deterministicly executing, UNFAIR, but obfuscating your flow |
22:26:56 | termer | it's not 100% different but it is quite a bit different for sure |
22:26:58 | FromDiscord | <_gumbercules> https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ |
22:27:05 | termer | Keep in mind I'm not talking about async/await |
22:27:25 | FromDiscord | <System64 ~ Flandre Scarlet> TbhโตEven if I love Nim, I don't really like how async/await works on Nim |
22:27:33 | termer | I can tell you exactly how it works |
22:27:37 | termer | I've read the entire implementation |
22:27:46 | FromDiscord | <Elegantbeef> The next line is "it doesnt" |
22:27:50 | FromDiscord | <_gumbercules> I don't like how it works in any language because again colored functions suck |
22:27:55 | FromDiscord | <jviega> Can't tell you how many times I've laughed at people who think their program works okay, change something in module A, then totally unrelated thing in module Z breaks because the interleaving of the iterator yields has changed. |
22:28:00 | termer | I wasn't gonna say that but now that's all I feel like saying Elegantbeef |
22:28:09 | FromDiscord | <yandall> Is there a way to manually free a var when using mm:orc? |
22:28:27 | FromDiscord | <Elegantbeef> `=destroy`, but why do you manually need to free anything |
22:28:55 | FromDiscord | <Elegantbeef> Note calling `=destroy` manually without disarming the destructor will double destroy |
22:28:56 | termer | If you want to be doing manual memory management, you're free to work with raw ptr types using alloc, etc., but I don't know why you'd want to do that |
22:29:06 | termer | couldn't you do GC_unref Elegantbeef |
22:29:10 | termer | if you know it's the last usage |
22:29:11 | FromDiscord | <_gumbercules> In reply to @termer "If you want to": because you're interoping with C? |
22:29:19 | FromDiscord | <Elegantbeef> That doesnt destroy it though termer |
22:29:20 | FromDiscord | <jviega> If you say "async programming", these days that's an abstraction over an iterator yielding. It's not a real concurrent programming model even |
22:29:26 | FromDiscord | <yandall> I'm still investigating the problem but it seems that the response from a request doesn't geet freed so overtime my server keeps growing in memory size |
22:29:37 | FromDiscord | <Elegantbeef> `GCRunOrc` |
22:29:54 | termer | jviega, Kotlin's coroutines are nice |
22:30:02 | termer | CPS works similarly |
22:30:20 | termer | break up functions into state machines that are put into a queue |
22:30:36 | termer | better abstraction than promises which are shitty containers for callbacks and values |
22:30:54 | FromDiscord | <jviega> Sure, I'm okay with a bunch of other approaches. Again, I've done a ton of parallel programming. |
22:30:55 | FromDiscord | <yandall> Everytime the memory goes to 15mb is because I manually restarted the container https://media.discordapp.net/attachments/371759389889003532/1141136968021987328/image.png |
22:30:57 | termer | The way Nim does asyncmacro is clever but really makes it hard to understand what's going on |
22:31:17 | termer | and anyway, clever never automatically meant good |
22:31:42 | termer | My biggest issue is that async is really polarizing at a technical level when it comes to libraries |
22:31:47 | FromDiscord | <Elegantbeef> Stop wanting to do more than one operation at a time, rocks were never meant to do more than one thing |
22:31:59 | termer | I tried using Chronos but you basically had to rewrite the world or port a bunch of libs to chronos that used asyncdispatch |
22:32:08 | termer | at the same time, I really did give asyncdispatch a real college try |
22:32:13 | termer | it didn't end well |
22:33:20 | termer | Chronos is probably fine but it's hard to use due to lack of documentation |
22:33:52 | termer | The other thing is that because of all the allocation in both asyncdispatch and Chronos, you see real performance differences between refc and ORC, with ORC performing much worse |
22:34:16 | termer | When people talk about how fast httpbeast is, that's because it doesn't even use asyncdispatch |
22:34:41 | termer | it implements its own event loop that doesn't touch any of that stuff and interacts with the OS directly |
22:35:47 | termer | Thank you for coming to my weekly asyncdispatch hate seminar |
22:35:54 | FromDiscord | <jviega> Well, generally reference counting tends to be less efficient in absolute numbers, but better amortized (no pauses). |
22:36:12 | termer | for sure |
22:36:25 | termer | I happen to enjoy the memory efficiency gains you get from not having a GC |
22:36:32 | termer | but it's not a silver bullet |
22:36:46 | FromDiscord | <jviega> "memory efficiency"?? |
22:36:51 | termer | A lot of Rust people dunking on Go completely misunderstand that you still have to be allocating and deallocating |
22:37:00 | termer | efficiency as in you use less cause you don't have to have a GC watching things |
22:37:06 | termer | it also piles up less |
22:37:44 | FromDiscord | <jviega> Nothing. inherently more memory efficient. In fact, compacting collectors can end up with lower memory footprints, and much better locality |
22:38:08 | termer | I came from Java where I was so shaken by the horrible "allocate 1GiB and then cut it back down to 300MiB in 30 seconds" cycles that I didn't want to touch GC ever again |
22:39:11 | termer | however I will say this: these become non-issues if you're simply careful about not allocating too much |
22:40:16 | termer | I'm just a guy learning this stuff along the way, so I'm no expert |
22:40:30 | termer | ultimately I just wanna write software that works well |
22:40:47 | FromDiscord | <jviega> Another reason I don't like Rust is, safety alone isn't enough of a reason to work EVEN HARDER than C on memory management |
22:41:07 | termer | Rust lost its charm for me when I found out it has no compiler safeguards against cycles |
22:42:08 | termer | I still like the idea of Rust and will learn it someday |
22:42:38 | termer | but right now Nim scratches my fun programming itch and Go is becoming my productivity language |
22:42:39 | FromDiscord | <Elegantbeef> > it has no compiler safeguards against cycles |
22:42:43 | FromDiscord | <Elegantbeef> Isnt it impossible to make cycles? |
22:42:49 | termer | not at all |
22:43:07 | termer | you can read online about people being surprised that leaking memory "isn't considered unsafe" |
22:43:37 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DBy |
22:43:59 | FromDiscord | <Elegantbeef> Should be nothing |
22:44:10 | FromDiscord | <heysokam> does putting it in a pragma guarantee that it will be compile time even if it has runtime things? |
22:44:18 | FromDiscord | <Elegantbeef> No |
22:44:31 | FromDiscord | <heysokam> so its not like a static block, i assume |
22:44:42 | FromDiscord | <Elegantbeef> It's just passing in an argument |
22:45:03 | FromDiscord | <heysokam> wdym? |
22:45:22 | FromDiscord | <Elegantbeef> `{.somePragma.}: body` is just annotating the body with the pragma |
22:45:30 | FromDiscord | <Elegantbeef> You cannot even use `{.myMacro.}` |
22:45:32 | termer | jviega, I'll keep doing work to try to develop something useful with CPS and then if that fails then maybe I will become blackpilled |
22:45:41 | FromDiscord | <Elegantbeef> That only applies to procs |
22:45:44 | FromDiscord | <heysokam> In reply to @Elegantbeef "`{.somePragma.}: body` is just": so it doesn't really do anything? |
22:46:03 | FromDiscord | <Elegantbeef> Depends on the context |
22:46:10 | FromDiscord | <heysokam> i wanted to do something like the `{.compile: "somefile.c".}` pragma |
22:47:02 | FromDiscord | <heysokam> but i need context on where the contents are -actually- called from |
22:47:37 | FromDiscord | <Elegantbeef> You cannot make a pragma afaik |
22:47:38 | FromDiscord | <heysokam> something like `currentSourcePath()` should return the name of the file calling the pragma/template/macro... instead of the original where it is stored |
22:47:42 | FromDiscord | <Elegantbeef> A functional pragma\ |
22:48:06 | FromDiscord | <Elegantbeef> The only pragmas users can write are annotation |
22:48:15 | FromDiscord | <Elegantbeef> with the exception of Nim converting proc pragmas to macro calls |
22:49:08 | FromDiscord | <heysokam> i have this i made with your help, but i don't remember how i was using itโตhttps://github.com/heysokam/nstd/blob/27a08131fedfb9f340623ca8ebb44b2d02ee3fcf/src/nstd/compile.nim#L11-L25 |
22:49:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DBz |
22:49:26 | FromDiscord | <heysokam> basically it works like the compile pragma, but i don't remember if the call is a pragma or just a regular call |
22:49:40 | FromDiscord | <Elegantbeef> It's a regular call |
22:49:47 | FromDiscord | <heysokam> kk |
22:49:53 | FromDiscord | <Elegantbeef> Like I said you cannot make functional pragmas |
22:50:02 | FromDiscord | <Elegantbeef> they can only be used for annotation |
22:50:04 | FromDiscord | <heysokam> so i would need a template or a macro then, no biggie |
22:50:48 | FromDiscord | <heysokam> what should i use for this? macro?โตbasically its repeated code that will be used in multiple files, with only a couple of parameters changing the behavior |
22:51:44 | FromDiscord | <heysokam> also, @ElegantBeouf, according to the comment i was invoking it from a pragma ๐ค |
22:52:12 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DBB |
22:52:22 | FromDiscord | <heysokam> ah no wait... thats what it generates |
22:52:33 | FromDiscord | <heysokam> nvm sry ignore me ๐ |
22:55:18 | FromDiscord | <Elegantbeef> I alway so |
22:55:21 | FromDiscord | <Elegantbeef> do\ |
22:56:49 | FromDiscord | <jviega> lol |
22:58:42 | FromDiscord | <heysokam> tru |
23:01:28 | FromDiscord | <heysokam> how can I get the `let rootDir = projectDir()/" ???? "` origin guaranteed, so that I can find the path of the nimble file, and not the path of the `.nim` file being compiled? |
23:05:18 | FromDiscord | <Elegantbeef> macros.projectPath perhaps, i do not know |
23:16:39 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DBG |
23:18:34 | FromDiscord | <graveflo> do we just use `nimble init` to set up our new project skeletons with atlas or is there a fancy new way to structure project folders? |
23:18:52 | FromDiscord | <Elegantbeef> araq says use nimble init |
23:19:01 | FromDiscord | <graveflo> sounds good to me |
23:22:18 | FromDiscord | <arne> I saw my name mentioned |
23:24:45 | FromDiscord | <levantguy> sent a code paste, see https://paste.rs/mb4mJ |
23:25:29 | FromDiscord | <krux02> @levantguy looks like a good candidate to use a `for-loop` for |
23:26:31 | FromDiscord | <Elegantbeef> A for loop in my imperative language?! I'd never! |
23:30:42 | FromDiscord | <levantguy> In reply to @arne "<@718748800478609418> looks like a": argh, I was hoping for a parameter or a way to set format |
23:32:14 | FromDiscord | <krux02> a `\x` is technically speaking not part of hexadecimal representation, it's just used as a crutch for the language to provide the context that a literal is in hexadecimal |
23:33:34 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DBJ |
23:38:02 | FromDiscord | <heysokam> is there an equivalent to `execShellCmd` for the vm during compile time? |
23:38:11 | FromDiscord | <Elegantbeef> `staticExec` |
23:39:09 | FromDiscord | <heysokam> but that's gorge |
23:39:31 | FromDiscord | <Elegantbeef> Ok? |
23:39:33 | FromDiscord | <heysokam> i need it to just run the command like normal, because its running external buildsystem commands |
23:39:49 | FromDiscord | <heysokam> gorge returns the string, which means you only get the output after it ends |
23:41:09 | FromDiscord | <Elegantbeef> Well `osProc.execCmdEx` is wrapped for the VM but aside from that you got nothing else |
23:41:18 | FromDiscord | <Elegantbeef> Wrap the call in side of a shell call that doesnt eat the stdin/out and returns the error code otherwise |
23:41:42 | FromDiscord | <Elegantbeef> I guess that doesnt work now that I said that outloud |
23:41:46 | FromDiscord | <heysokam> doesn't that mean i have to call for each platform's shell manually? |
23:54:18 | FromDiscord | <_gumbercules> In reply to @arne "I saw my name": That was me I think friend. My bad haha |
23:54:34 | FromDiscord | <_gumbercules> Hope you are well! |
23:55:13 | FromDiscord | <krux02> thanks, I am well |
23:55:42 | FromDiscord | <krux02> I am working for a startup now, doing scala programming again. |
23:56:30 | FromDiscord | <_gumbercules> Niceeee! I haven't touched Scala since working at Wargaming but I do miss it from time to time! |
23:56:58 | FromDiscord | <_gumbercules> And yeah you've definitely come full circle |