00:06:29 | * | mengu1 joined #nim |
00:35:19 | * | deadmarshal_ quit (Ping timeout: 246 seconds) |
00:45:08 | * | mengu1 quit (Quit: Client closed) |
00:50:14 | * | deadmarshal_ joined #nim |
01:00:03 | * | nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in) |
01:04:02 | * | nazgulsenpai joined #nim |
03:18:43 | FromDiscord | <nasuray> In reply to @heysokam "iis that possible?": Should be no different than running it with tsx it's just looking for the class names in the file when you run the postcss cleanup (though if you use UnoCSS there is no need for this step as it only generates css for what you actually use) |
03:41:26 | FromDiscord | <drunkenalcoholic> Noob question, butr is there away to loop through 33..47 AND 58..64 in the same loop with out including 48..57? https://media.discordapp.net/attachments/371759389889003532/1193398963391438899/image.png?ex=65ac9265&is=659a1d65&hm=2c1a4bd16713cfd68767b81498a336d92d5bba38da6a7223eab8261e67eea50f& |
03:47:10 | FromDiscord | <Elegantbeef> Nope make your own iterator |
03:47:43 | * | azimut quit (Ping timeout: 240 seconds) |
03:47:55 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/wiki/Code-snippets#iterate-a-group-of-iterables-together |
03:47:58 | FromDiscord | <Elegantbeef> Or make a macro |
03:54:30 | FromDiscord | <drunkenalcoholic> @ElegantBeef Thanks you, that macro is exactly what I wanted. thanks again |
04:18:19 | * | deadmarshal_ quit (Ping timeout: 255 seconds) |
04:45:22 | * | nazgulsenpai quit (Ping timeout: 276 seconds) |
04:46:32 | * | nazgulsenpai joined #nim |
04:57:03 | * | deadmarshal_ joined #nim |
05:07:17 | * | deadmarshal_ quit (Ping timeout: 240 seconds) |
05:59:50 | * | deadmarshal_ joined #nim |
06:25:17 | * | xet7 quit (Quit: Leaving) |
06:26:15 | FromDiscord | <pk.kyle> sent a code paste, see https://play.nim-lang.org/#ix=html> |
06:29:44 | * | xet7 joined #nim |
06:33:42 | FromDiscord | <Phil> Other than a macro I don't think so |
06:34:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
06:34:30 | FromDiscord | <Elegantbeef> Or use an array |
06:35:58 | FromDiscord | <Phil> ... am I being silly? Shouldn't a threading/channel block if one thread is doing recv on it and the other tries to send?↵Because it only has one lock for both producers and consumers, right? So if a consumer holds the lock to read the next message... doesn't that block the sender out from putting stuff in? |
06:36:46 | FromDiscord | <Phil> I'm looking at channelSend and it definitely acquires the lock and then does not release it until sth was sent |
06:37:35 | FromDiscord | <Phil> Same with channelReceive, that thing acquires the lock and then blocks until it gets sth. Which categorically I'm not sure it can given that it kinda has the lock |
06:38:46 | FromDiscord | <Phil (he/him)> sent a code paste, see https://play.nim-lang.org/#ix=html> |
06:40:37 | FromDiscord | <pk.kyle> sent a code paste, see https://play.nim-lang.org/#ix=html> |
06:43:22 | FromDiscord | <Phil (he/him)> Did a slight correction as this was still showing my prior experiment with Channel, but with Chan it also does not deadlock |
06:43:51 | FromDiscord | <Elegantbeef> Looking at the source at least on a first glance you seem to be right |
06:44:11 | FromDiscord | <Phil (he/him)> I'm currently trying to wrap my head around waitgroups because that's the only thing I can imagine changing things somehow |
06:44:36 | * | xet7 quit (Remote host closed the connection) |
06:45:04 | NimEventer | New thread by aiac: Fixme: the proc parameters always use Copy by default? , see https://forum.nim-lang.org/t/10856 |
06:49:11 | FromDiscord | <Phil> The heck is a SysCond |
06:49:29 | FromDiscord | <Elegantbeef> A condition variable that is abstracted for Unix and Windows |
06:49:42 | * | xet7 joined #nim |
06:50:09 | * | xet7 quit (Remote host closed the connection) |
06:50:09 | FromDiscord | <Elegantbeef> https://linux.die.net/man/3/pthread_cond_wait |
06:51:13 | * | xet7 joined #nim |
06:51:23 | FromDiscord | <Phil> So a thing different per OS and unified for simplification purposes.↵Now what a condition variable is I don't understand the specifications off.↵Like is that just a boolean variable? Does it have defined implications? |
06:52:12 | FromDiscord | <Elegantbeef> It's an OS primitive is all I'm willing to say |
06:52:42 | FromDiscord | <Elegantbeef> It allows you to 'notify' another variable when an event happens afaik |
06:55:08 | FromDiscord | <Phil (he/him)> Okay so "wait" is the lock wait proc, you're waiting for the lock to release |
06:55:08 | FromDiscord | <Elegantbeef> As far as I can understand it's a way to prevent spin locking |
06:55:46 | FromDiscord | <Phil (he/him)> Now what does it mean to wait on a lock. Do you release the lock while you wait? |
06:55:56 | FromDiscord | <Phil (he/him)> And then acquire it again when the wait is over? |
06:56:19 | FromDiscord | <Phil (he/him)> Time to write an experiment |
06:56:53 | FromDiscord | <Elegantbeef> Or just read what `pthread_cond_wait` does 😄 |
06:57:21 | FromDiscord | <Elegantbeef> sent a long message, see <!doctype html> |
06:57:30 | FromDiscord | <Elegantbeef> The mutex is the `Lock` in this case |
06:58:14 | FromDiscord | <Phil (he/him)> Hmmmmmmmm |
06:58:46 | FromDiscord | <Phil (he/him)> Isn't the consequence of that, that for a basic queue you really don't need 2 locks.↵It might be considered a performance optimization under heavy lock contention but I really can't imagine it, it makes things more complicated |
06:58:55 | FromDiscord | <Phil (he/him)> \basic threadsafe queue |
06:59:47 | FromDiscord | <Phil (he/him)> I'm asking because mratsim had a paper posted in the threading channel issue that was about it being changed to use 2 locks before that got reverted |
07:00:09 | FromDiscord | <Elegantbeef> leorize is a better person to ask |
07:00:16 | * | jkl quit (Quit: Gone.) |
07:00:22 | FromDiscord | <Elegantbeef> My knowledge with threading is limited to surface level |
07:00:22 | FromDiscord | <Phil (he/him)> How dare he sleep while I'm mildly hungover and curious |
07:00:41 | FromDiscord | <Elegantbeef> Hey he's in Canada iirc and it's saturday night.... he should be awake |
07:00:44 | FromDiscord | <Phil (he/him)> I assume he sleeps at leats |
07:00:47 | FromDiscord | <Elegantbeef> It's at most like 2\:30am |
07:00:50 | FromDiscord | <Phil (he/him)> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1193449121495920731): I assume he sleeps at least |
07:01:19 | FromDiscord | <Phil (he/him)> I'll be honest, for old folks like me that's late af and you should've gone to sleep 2h ago at least |
07:01:33 | FromDiscord | <Elegantbeef> It's 12am here |
07:01:35 | FromDiscord | <Elegantbeef> Fucking boomer |
07:02:05 | FromDiscord | <Elegantbeef> I'm saying at most it's 2\:30am(maybe 3\:30am) do not recall how far newfoundland is ahead of mountain time |
07:02:06 | * | jkl joined #nim |
07:02:09 | FromDiscord | <Phil (he/him)> 👴️ |
07:02:29 | FromDiscord | <Elegantbeef> Might be 4\:30 hours ahead |
07:02:42 | FromDiscord | <wannabelokesh> it's 12\:32 pm here |
07:02:51 | FromDiscord | <Elegantbeef> Ah it's 3\:30 am |
07:03:15 | FromDiscord | <Elegantbeef> Exactly 12\:30 hours across the world from me |
07:03:27 | FromDiscord | <wannabelokesh> it's somebody living after 12\:32pm 7jan2024, can you predict future? |
07:03:43 | FromDiscord | <Phil (he/him)> Only the past |
07:03:50 | FromDiscord | <Phil (he/him)> The worlds shittiest superpower |
07:05:04 | FromDiscord | <wannabelokesh> predicting past. isn't that worthless? |
07:05:23 | FromDiscord | <Elegantbeef> Nah they have universities about palaeontology and history |
07:06:49 | FromDiscord | <Phil (he/him)> Depends on how much you like memories and remembering things |
07:07:02 | FromDiscord | <Elegantbeef> Here I though phil would've sobered up |
07:07:07 | FromDiscord | <Elegantbeef> thought\ |
07:07:34 | FromDiscord | <wannabelokesh> ohhh, where I live, we have 11th and 12th standard, streams divided into 3 as med(if passed, can pursue doctors higher studies later), non-med(for engg basically), commerse(accounting, econimics, banking and all shtt) and arts(history, politics and all dumbA$$). ↵I chose non-med and it's like 5 years now. |
07:08:16 | FromDiscord | <Elegantbeef> So uhh Nim huh? |
07:08:34 | FromDiscord | <wannabelokesh> I love it. I took a diver so deeper, I could nver reach the surface/sealevel. |
07:09:15 | FromDiscord | <wannabelokesh> BTW, I wanna reach the space this room 'might be' a part of..? any idea? |
07:09:52 | FromDiscord | <Elegantbeef> [#nim\:envs.net](https://matrix.to/#/#nim:envs.net) |
07:10:07 | FromDiscord | <Elegantbeef> Risky thing to link a space to a matrix user |
07:10:12 | FromDiscord | <Elegantbeef> That's like 3 seconds away from spam |
07:10:30 | FromDiscord | <Elegantbeef> Fucking kidding me |
07:10:31 | FromDiscord | <favour4568> "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 group link and send me a direct message ↵https://t.me/+FGhsj-vpp7dmZDc0↵by asking me HOW |
07:10:44 | FromDiscord | <Phil (he/him)> But have you considered getting banned? |
07:11:14 | FromDiscord | <wannabelokesh> why? please expand that explanation |
07:11:16 | FromDiscord | <Phil (he/him)> Also Beef, perfect timing |
07:11:17 | FromDiscord | <Elegantbeef> Coincidence I think not! |
07:11:39 | FromDiscord | <Elegantbeef> Matrix has a spam issue |
07:12:05 | FromDiscord | <Elegantbeef> The absurd thing is it's always matrix.org |
07:12:09 | FromDiscord | <Elegantbeef> Never any other homeserver |
07:12:50 | FromDiscord | <Phil (he/him)> So you mean typically only rooms on the matrix.org server get targetted? |
07:13:01 | FromDiscord | <Elegantbeef> No this is envs.net |
07:13:11 | FromDiscord | <Elegantbeef> I mean that it's users on matrix.org |
07:13:52 | FromDiscord | <Elegantbeef> Wait no this is on matrix.org |
07:13:53 | FromDiscord | <wannabelokesh> what? why? |
07:14:09 | FromDiscord | <Elegantbeef> It's a free service that does not have any requirements like linking sms to talk |
07:15:54 | FromDiscord | <Elegantbeef> I just find it funny how it's always the `matrix.org` server, ostensibly if you wanted to spam it'd be quicker to host your own homeserver and then just join |
07:17:02 | FromDiscord | <sOkam! 🫐> is it possible to create a varargs function that has a non-vararg element at the end? |
07:19:14 | FromDiscord | <Elegantbeef> Yes |
07:20:04 | FromDiscord | <sOkam! 🫐> what has priority, the args or the static element? |
07:20:21 | FromDiscord | <Elegantbeef> the varargs if the next element is the same type |
07:20:39 | FromDiscord | <sOkam! 🫐> kk |
07:21:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:21:35 | FromDiscord | <sOkam! 🫐> yeah that's the idea |
07:23:22 | FromDiscord | <MDuardo> Hi↵Wanted to ask...↵Can you use Matplotlib in Nim?I managed to make Numpy to work but my brain can't manage Matplotlib |
07:23:48 | FromDiscord | <Elegantbeef> Arent there plotting libraries with bindings/ported? |
07:24:35 | FromDiscord | <MDuardo> Yeah but Nimpy made them redundant |
07:24:46 | FromDiscord | <Elegantbeef> Uh no |
07:25:05 | FromDiscord | <Elegantbeef> Relying on a python runtime and interop is not redundant it's hell |
07:25:46 | FromDiscord | <Phil (he/him)> Different usecases really |
07:25:49 | FromDiscord | <MDuardo> So the bindings are still worth it? |
07:26:08 | FromDiscord | <Elegantbeef> I'd rather not have python anywhere inside my toolchain so up to you |
07:26:30 | FromDiscord | <Phil (he/him)> For reference MDuardo\:↵Executing Python code will always be slower than executing equivalent well written nim code (the exception being where python actually calls into highly optimized C/Fortran libs like with numpy) |
07:26:57 | FromDiscord | <Phil (he/him)> It is also more complicated to distribute because now it's not just a binary and potentially assets, you also need to make sure the user has the necessary python version and python libs installed |
07:27:25 | FromDiscord | <Phil (he/him)> Numpy is still a highly useful project for... god damn that spammer is in offtopic |
07:27:43 | FromDiscord | <Elegantbeef> > the exception being where python actually calls into highly optimized C/Fortran libs like with numpy↵Well you arent calling python so no exception required |
07:27:47 | FromDiscord | <Phil (he/him)> No wait, wtf, that wasn't offtopic, that was the GTK channel |
07:28:09 | FromDiscord | <Phil (he/him)> As in, the spammer we just had now is in the official GTK Room, funny how that works |
07:28:24 | FromDiscord | <Elegantbeef> the gtk room is not on matrix.org is it? |
07:28:52 | FromDiscord | <Phil (he/him)> https://app.element.io/#/room/#gtk:gnome.org↵I think that's their own instance |
07:28:58 | FromDiscord | <Elegantbeef> Indeed |
07:29:49 | FromDiscord | <Phil (he/him)> anyway, Numpy is still really useful to even be able to integrate into python code bases or use python in nim code bases where speed and/or distributing it are not that much of a factor |
07:31:06 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:32:03 | FromDiscord | <Phil (he/him)> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1193455836446597210): Nimpy is still a highly useful project for... god damn that spammer is in offtopic |
07:32:27 | FromDiscord | <Elegantbeef> You need atleast 1 vararg to be able to skip it or to explicitly do `[]` or `other = 1` or an overload that has no varargs |
07:32:34 | FromDiscord | <Elegantbeef> The last is the one that does not work |
07:32:52 | FromDiscord | <sOkam! 🫐> oh 😦 |
07:33:08 | FromDiscord | <sOkam! 🫐> then I need to send the args to the end |
07:33:44 | FromDiscord | <sOkam! 🫐> or, I guess I could create a non-varargs version for that case |
07:34:35 | FromDiscord | <Elegantbeef> Nah cause it's ambiguous |
07:34:49 | FromDiscord | <sOkam! 🫐> exactly what happened right now, lol |
07:35:40 | FromDiscord | <sOkam! 🫐> could there be a way out of it in some way? |
07:35:54 | FromDiscord | <Elegantbeef> `other = ...` |
07:36:11 | FromDiscord | <sOkam! 🫐> well the idea is to not need the qualifier |
07:38:50 | FromDiscord | <Elegantbeef> Well varargs go last then 😄 |
07:39:04 | FromDiscord | <Elegantbeef> Varargs almost always should be last |
07:40:00 | FromDiscord | <sOkam! 🫐> but then i cannot do `thing 1,2,3,4, mything` and also `thing mything`... and would be forced to do `thing mything, 1,2,3,4` |
07:40:05 | * | Jjp137 quit (Ping timeout: 240 seconds) |
07:41:01 | FromDiscord | <odexine> Well how else is Nim supposed to distinguish |
07:41:39 | FromDiscord | <sOkam! 🫐> i was asking how to distinguish, not blaming nim |
07:42:06 | FromDiscord | <sOkam! 🫐> im just wondering if there is a way around it, so i don't have to varargs after, since the syntax im trying to mirror has the varargs before |
07:42:27 | FromDiscord | <odexine> No I believe not, not without extra fuckery |
07:44:46 | FromDiscord | <sOkam! 🫐> is there a way to require varargs to contain minimum 1item? |
07:46:38 | FromDiscord | <Elegantbeef> Nope they're fancy `openArray`s |
07:48:46 | FromDiscord | <Elegantbeef> You can cheese it with an overload that errors |
07:49:39 | FromDiscord | <rudy.in> uwu |
07:49:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:50:10 | FromDiscord | <Elegantbeef> The above forces atleast 2 for instance |
08:24:35 | * | redj quit (Remote host closed the connection) |
08:27:04 | * | redj joined #nim |
08:43:14 | * | xet7 quit (Remote host closed the connection) |
09:09:26 | FromDiscord | <sOkam! 🫐> is there a way to get a simple http server from a folder with live reload with nim?↵_i know about nimhttpd, but it does not do live reload and it fails to even update the contents_ |
09:11:46 | FromDiscord | <Phil> Errr... how do you figure out which memory management strategy your user is running?↵Particularly asking because I kinda want to check for orc which is the default, but I don't want to have to do "when not defined every other strategy" |
09:11:58 | FromDiscord | <Phil> Specifically just want to figure out if system.roots exists, which only exists under orc afaik |
09:12:24 | FromDiscord | <Elegantbeef> `defined(orc)` |
09:12:48 | FromDiscord | <Elegantbeef> or is it `gcOrc` |
09:28:06 | FromDiscord | <sOkam! 🫐> how do you nest macros? |
09:28:41 | FromDiscord | <Elegantbeef> Huh? |
09:28:49 | FromDiscord | <sOkam! 🫐> i have a macro that returns type N, but im nesting it to overload it, and its returning NimNode, but i need it to return N to return the proper type 🤔 |
09:29:11 | FromDiscord | <Elegantbeef> Stop returning `NimNode` |
09:29:15 | FromDiscord | <Elegantbeef> Make it return`untyped` |
09:29:24 | FromDiscord | <sOkam! 🫐> im not returning that, im returning my type |
09:30:03 | FromDiscord | <sOkam! 🫐> `Error: type mismatch: got 'HtmlNode' for 'newBody("", [])' but expected 'NimNode = ref NimNodeObj'` |
09:30:14 | FromDiscord | <Elegantbeef> What? |
09:30:30 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:30:44 | FromDiscord | <Elegantbeef> Your return type should be `untyped` for macros |
09:31:10 | FromDiscord | <sOkam! 🫐> it was working before nesting it, and i didn't write it originally |
09:31:34 | FromDiscord | <sOkam! 🫐> im just trying to add the functionality to say `bodys style="mystyle=properties": ...` |
09:32:45 | FromDiscord | <Elegantbeef> though you could also do `newCall(bindSym"bodys", inner)` |
09:32:45 | FromDiscord | <Elegantbeef> But you've just remade templates! 😄 |
09:33:37 | FromDiscord | <sOkam! 🫐> i havent remade anything, im just hacking someone elses code to do what i want it to do |
09:33:50 | FromDiscord | <sOkam! 🫐> i have no idea if this is good code or bad code, im just hacking around |
09:34:06 | FromDiscord | <Elegantbeef> You have remade templates |
09:34:46 | FromDiscord | <sOkam! 🫐> sure, maybe you have the skill to do the things in proper ways. i don't. im just trying to add a `style=...` property to an existing library |
09:35:27 | FromDiscord | <sOkam! 🫐> if there is a better way, let me know in better ways. because i have no idea what I'm writing, as its usual with macros+me |
09:49:19 | FromDiscord | <requiresupport> whats a good replacement for threadpools module that was deprecated? I don't wanna have to change my code too much. Warning gives multiple options: `malebolgia`, `taskpools` or `weave` |
09:50:24 | * | Jjp137 joined #nim |
09:51:41 | FromDiscord | <whisperecean> How can I compile my nim project to produce a self-contained binary? I need libpq to be compiled in |
09:54:25 | FromDiscord | <sOkam! 🫐> @whisperecean you need to either static link to libpq, or distribute the dll with your app |
09:58:08 | FromDiscord | <whisperecean> How can I do that? |
10:16:47 | FromDiscord | <sOkam! 🫐> In reply to @whisperecean "How can I do": depends on the library and your buildsystem setup↵easiest way is to rely on the library's buildsystem, and then pass `--passL:/path/to/thelib.a`↵but your setup can vary wildly, so hard to give better specifics without understanding your app |
10:21:45 | FromDiscord | <whisperecean> Do you know how can I verify that it was statically linked? |
10:21:54 | FromDiscord | <whisperecean> i did -passL:-static |
10:22:04 | FromDiscord | <whisperecean> also having an issue building it on mac @m..@s..@s..@[email protected]@[email protected]:17:10: fatal error: 'sys/syscall.h' file not found |
10:22:35 | * | fallback quit (Ping timeout: 256 seconds) |
10:23:11 | FromDiscord | <graveflo> are you using a library or a module? |
10:23:48 | FromDiscord | <whisperecean> I am trying to statically compile my program that uses libpq |
10:24:19 | FromDiscord | <graveflo> on linux it should have `.a` extension to be a static library. Just making sure that is what you are working with |
10:24:25 | FromDiscord | <whisperecean> sent a long message, see <!doctype html> |
10:24:35 | FromDiscord | <whisperecean> Does that mean I am fine? |
10:25:31 | FromDiscord | <graveflo> Maybe someone else can chime in but those look like dynamic module addresses not statically compiled |
10:25:56 | FromDiscord | <Elegantbeef> Those are `.so` s those are dynamic libraries |
10:26:12 | FromDiscord | <Elegantbeef> Just ship the dlls |
10:26:22 | FromDiscord | <Elegantbeef> static linking is more of a pain to get through |
10:26:38 | FromDiscord | <whisperecean> I dont want to ship dlls (puke) |
10:27:00 | FromDiscord | <graveflo> there really are two types of people |
10:38:22 | FromDiscord | <whisperecean> Does anybody know how can I fix this? ssystem.nim.c:17:10: fatal error: 'sys/syscall.h' file not |
10:38:26 | FromDiscord | <whisperecean> Not related to static linking |
11:14:38 | Amun-Ra | that should be in default search path |
11:16:36 | FromDiscord | <whisperecean> What does this mean? Error: unhandled exception: field 's' is not accessible for type 'DbValue' using 'kind = dvkInt' [FieldDefect] |
11:17:26 | Amun-Ra | sounds like it's an object variant |
11:17:58 | Amun-Ra | and 's' field is defiled for other object kind than dvkInt |
11:18:09 | Amun-Ra | 'https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants' |
11:18:33 | Amun-Ra | defined* |
11:27:32 | PMunch | sOkam, replied to you GitHub issue now :) |
11:29:16 | FromDiscord | <whisperecean> postgres.nim(320) rawSelect↵Error: unhandled exception: Database select query . These errors are super hard to debug |
11:30:46 | FromDiscord | <sOkam! 🫐> In reply to @PMunch "sOkam, replied to you": just saw it! ty ty ✍️ |
11:31:03 | PMunch | Unfortunately it's probably not the answer you wanted |
11:31:23 | PMunch | If you do figure anything out though please let me know |
11:31:40 | PMunch | libclang is quite terribly documented, and most of what I know about it is from trial and error |
11:32:13 | FromDiscord | <whisperecean> What can I do in this case? I dont understand a thing |
11:32:26 | FromDiscord | <whisperecean> I only get failed [DbError]...this is useless |
11:32:50 | PMunch | Sharing some code will make it infinitely much easier for us to tell you what's going on |
11:36:16 | FromDiscord | <sOkam! 🫐> In reply to @PMunch "libclang is quite terribly": I very much noticed 😦 |
11:36:37 | FromDiscord | <sOkam! 🫐> that's why I decided to ask, I didn't even understand the docs |
11:37:38 | FromDiscord | <sOkam! 🫐> what if you (or we, or whomever someone) wrote a parser just for understanding well-formed macros in some way? 🤔 |
11:38:01 | FromDiscord | <sOkam! 🫐> how does c2nim solve this, in comparison? |
11:38:05 | FromDiscord | <whisperecean> I just have this: https://glot.io/snippets/gs8n1n5umn |
11:38:39 | PMunch | I mean that is basically what Futhark is doing already |
11:38:49 | PMunch | A parser for understanding macros |
11:38:55 | PMunch | It's very limited though |
11:39:05 | PMunch | c2nim parses everything |
11:39:05 | * | antranigv quit (Ping timeout: 256 seconds) |
11:39:17 | PMunch | So whatever macro support it has also applies here |
11:40:10 | FromDiscord | <whisperecean> How can I get a better output about what's wrong cuz this is useless |
11:46:53 | FromDiscord | <sOkam! 🫐> kk |
11:47:58 | * | gooba quit (Remote host closed the connection) |
11:48:05 | NimEventer | New thread by choltreppe: Cleanly terminating a thread if it takes too long, see https://forum.nim-lang.org/t/10857 |
11:56:51 | FromDiscord | <whisperecean> Anyone? :< |
11:59:55 | FromDiscord | <sOkam! 🫐> @ElegantBeef whats the simplest setup to `readFile( file.nims )`, evaluate it with nimscripter and get the value of a string or a function contained inside it? |
12:00:15 | FromDiscord | <sOkam! 🫐> (edit) "it" => "that string" | "it?" => "the script?" |
12:00:34 | * | antranigv joined #nim |
12:00:40 | FromDiscord | <sOkam! 🫐> In reply to @whisperecean "Anyone? :<": the question is very unclear, that's why nobody is answering |
12:03:52 | * | gooba joined #nim |
12:07:54 | * | antranigv quit (Ping timeout: 260 seconds) |
12:08:05 | * | xet7 joined #nim |
12:09:46 | FromDiscord | <whisperecean> Just as unclear as the exception... |
12:10:00 | FromDiscord | <whisperecean> I am doing a simple raw SQL select and dont get any meaningful result |
12:10:05 | FromDiscord | <whisperecean> what can be unclear about that? |
12:10:13 | FromDiscord | <graveflo> no one has a magic crystal ball |
12:10:25 | FromDiscord | <odexine> Need more details |
12:10:29 | FromDiscord | <whisperecean> But surely people do sql selects using nim |
12:10:49 | FromDiscord | <graveflo> tbh idk why anyone would do that |
12:11:10 | FromDiscord | <xtrayambak> woops, I've managed to freak the compiler out :P https://media.discordapp.net/attachments/371759389889003532/1193527246212845568/image.png?ex=65ad09de&is=659a94de&hm=17b3941d054ae9c8cbbc0d5b393827f33c018edcea0d255a1accf9c69d649ec5& |
12:11:23 | FromDiscord | <odexine> In reply to @whisperecean "But surely people do": Yes but more details about what was done is needed to understand the issue |
12:11:45 | FromDiscord | <whisperecean> @odexine I pasted a code snippet |
12:12:08 | FromDiscord | <odexine> I missed it |
12:12:10 | FromDiscord | <odexine> I’ll look |
12:13:05 | FromDiscord | <odexine> Do you mind posting the full error? I’m still not sure what’s wrong |
12:13:06 | FromDiscord | <xtrayambak> I'm messing around with macros, they're pretty fun |
12:13:11 | FromDiscord | <whisperecean> field 's' is not accessible for type 'DbValue' using 'kind = dvkOther -> I dont know where this comes from or how to get a more useful output |
12:13:23 | FromDiscord | <whisperecean> what even is a field 's' wtf |
12:14:00 | * | antranigv joined #nim |
12:14:09 | FromDiscord | <odexine> It’s one of the fields in the DbValue type |
12:14:53 | FromDiscord | <odexine> What library are you using? |
12:17:02 | FromDiscord | <whisperecean> norm and postgres |
12:24:29 | * | azimut joined #nim |
12:27:37 | FromDiscord | <odexine> I found one bug, the select has the wrong order |
12:27:57 | FromDiscord | <odexine> The fields on the object should have the same order on the query |
12:28:15 | FromDiscord | <whisperecean> Ok I can try that |
12:28:23 | FromDiscord | <whisperecean> Where did u see it mentioned? |
12:28:32 | FromDiscord | <odexine> I’m not sure if it will fix it though |
12:28:40 | FromDiscord | <odexine> https://norm.nim.town/apidocs/norm/postgres.html#rawSelect%2C%2Cstring%2CT%2Cvarargs%5BDbValue%2CdbValue%5D |
12:29:40 | FromDiscord | <whisperecean> I am trying to simplify the query but I dont think I can do what I want to do |
12:30:08 | FromDiscord | <whisperecean> I just want to do select user from useres where id = 454 |
12:30:22 | FromDiscord | <whisperecean> I dont get it.... |
12:31:38 | FromDiscord | <odexine> You probably shouldn’t use raw select |
12:32:06 | FromDiscord | <whisperecean> ...... |
12:32:20 | * | deadmarshal_ quit (Remote host closed the connection) |
12:33:48 | FromDiscord | <whisperecean> I was trying to use raw select to have a minimal example as I dont know if I need the whole model for a table or I can have a partial one if I want to select just 2 fields |
12:36:46 | FromDiscord | <odexine> Well in that case he |
12:36:48 | FromDiscord | <odexine> Hm |
12:36:55 | FromDiscord | <Phil> You can have partial ones |
12:37:12 | FromDiscord | <Phil> As someone who uses norm extensively with partial models, that is very possible |
12:37:39 | FromDiscord | <whisperecean> so how can I just retrieve something from a table by id |
12:37:48 | FromDiscord | <asakura44> what is the difference between ``float`` and ``float64`` is ``float`` a c type or what ? |
12:37:51 | FromDiscord | <whisperecean> I dont get it... |
12:38:22 | FromDiscord | <asakura44> are u talking to me mate ? |
12:38:42 | FromDiscord | <whisperecean> no |
12:38:47 | FromDiscord | <whisperecean> I am talking about my problem. |
12:39:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:39:33 | FromDiscord | <whisperecean> waaat |
12:39:39 | FromDiscord | <whisperecean> I think Nim is too immature to use |
12:40:50 | FromDiscord | <asakura44> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:41:27 | FromDiscord | <Phil> In reply to @whisperecean "I think Nim is": I mean, there's other libs if that ORM doesn't suit you.↵IIRC Debby was another ORM, gatabase exists since you use postgres IIRC etc. |
12:42:10 | FromDiscord | <Phil> In reply to @asakura44 "why did not you": That's not what distinguishes those.↵const = cpompile time variable↵let = immutable runtime variable↵var = mutable runtime variable |
12:42:12 | FromDiscord | <whisperecean> I am not writing anything complex just wanted to retrieve some data for testing |
12:42:18 | FromDiscord | <Phil> (edit) "cpompile" => "compile" |
12:42:43 | FromDiscord | <xtrayambak> In reply to @whisperecean "I think Nim is": Nope, what makes you think that? From my usage, Nim is perfectly capable for anything any other language can do. |
12:43:05 | FromDiscord | <Phil> In reply to @asakura44 "what is the difference": No, float is an alias.↵When compiling on 64 bit systems, float is identical to float64 as in an alias of float64.↵On 32 bit systems it is identical to float 32 |
12:43:20 | FromDiscord | <asakura44> In reply to @isofruit "That's not what distinguishes": what is the difference ????? |
12:43:29 | FromDiscord | <asakura44> let and const seems the same |
12:43:52 | FromDiscord | <asakura44> In reply to @isofruit "No, float is an": machine dependent ? |
12:44:01 | FromDiscord | <Phil> What's your background? As in, do you know what compiling is and does the word "compile time" ring a bell? |
12:44:11 | FromDiscord | <Phil> In reply to @asakura44 "machine dependent ?": OS dependent mostly. |
12:44:20 | FromDiscord | <asakura44> In reply to @isofruit "What's your background? As": of course i know |
12:44:33 | FromDiscord | <asakura44> compile time means before producing executable file |
12:44:49 | FromDiscord | <asakura44> that moment of actions we call it compile time |
12:45:27 | FromDiscord | <Phil> Aye. There can be a lot of computation you might want to do specifically then and not at runtime, const variables do for example not exist at runtime.↵What happens is their value gets copy pasted to wherever the variable is being used |
12:45:33 | FromDiscord | <asakura44> nim here ------ compile time here ----- executable here |
12:45:54 | FromDiscord | <asakura44> In reply to @isofruit "Aye. There can be": i see |
12:45:56 | FromDiscord | <whisperecean> In reply to @xtrayambak "Nope, what makes you": Literally the function phil posted |
12:45:59 | FromDiscord | <Phil> You might for example want to read in a config file when you build the binary |
12:46:14 | FromDiscord | <Phil> In reply to @whisperecean "Literally the function phil": That was for me doing a larger application for a generic repository. You can of course do it much simpler |
12:46:35 | FromDiscord | <whisperecean> In reply to @isofruit "I mean, there's other": But if i define partial model can i at least retrieve by those other properties easily? |
12:46:57 | FromDiscord | <Phil> This was the maximum convenience way for me.↵hard code the table name, inline the query params, not even sure you need the explicit dbValue conversion as it should do that implicitly |
12:49:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:50:12 | FromDiscord | <xtrayambak> In reply to @whisperecean "Literally the function phil": It seems like he tried do a fix-it-all type of solution, you can obviously narrow it down to your personalized needs |
12:51:04 | FromDiscord | <Phil> In reply to @xtrayambak "It seems like he": I was, I used this kind of function for basically hundreds of different queries and wanted a rock solid base to generalize on top of that was mildly more convenient than norms default one (which requires you to instantiate a model yourself) |
12:51:47 | FromDiscord | <Phil> In fact you can even narrow the above down and replace morel with "result" entirely |
12:51:54 | FromDiscord | <Phil> (edit) |
12:52:13 | FromDiscord | <Phil> (edit) "morel" => "model" |
12:55:33 | FromDiscord | <xtrayambak> Btw, does anyone know how to use format specifiers? |
12:55:52 | FromDiscord | <xtrayambak> I can't figure out how, the only thing I found was a simple text "diagram"-thing in the docs |
13:15:42 | FromDiscord | <whisperecean> @phil |
13:15:51 | FromDiscord | <whisperecean> @Phil I tried that but it does not work... |
13:16:53 | FromDiscord | <Phil> Generally it helps to write minimal example and provide the error message it writes |
13:17:06 | FromDiscord | <Phil> (edit) "example" => "examples" |
13:17:54 | FromDiscord | <whisperecean> Ah wait I had rawselect there |
13:19:41 | FromDiscord | <whisperecean> But do you have to have the id in the model or that is implicit? |
13:20:04 | FromDiscord | <Phil> Your type inherits from Model no? |
13:20:07 | FromDiscord | <Phil> That has an id field |
13:20:21 | FromDiscord | <whisperecean> ref object of Model yes |
13:20:35 | FromDiscord | <Phil> You get the id field through the inheritance |
13:23:44 | FromDiscord | <whisperecean> Does this make sense? https://glot.io/snippets/gs8pyoc5je |
13:25:25 | FromDiscord | <Phil> You can simply do `Users(user: user, uuid:uuid)`, that is equivalent to your newUsers proc |
13:26:41 | FromDiscord | <whisperecean> Ok done. |
13:27:13 | FromDiscord | <whisperecean> Getting type mismatch for the .select...checking it |
13:30:05 | FromDiscord | <whisperecean> No idea... |
13:30:05 | FromDiscord | <whisperecean> https://glot.io/snippets/gs8q50j0qr |
13:32:42 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
13:33:09 | FromDiscord | <Phil> This is an example using an in-memory db, but the logic applies for postgres as well |
13:34:55 | FromDiscord | <whisperecean> Which is what I am doing |
13:34:56 | FromDiscord | <whisperecean> ... |
13:35:18 | FromDiscord | <whisperecean> But in the error...which field is even the mismatch? |
13:36:37 | FromDiscord | <Phil> Show the line of code here.↵One likely issue is you used let to instantiate the model |
13:38:24 | FromDiscord | <whisperecean> Nope using var |
13:39:42 | FromDiscord | <Phil> I mean without seeing the surrounding code as in how you instantiate the model etc. there's not that much I can say |
13:40:29 | FromDiscord | <odexine> In reply to @isofruit "No, float is an": It is not, floats are always 64 bit no matter the architecture IIRC |
13:41:06 | FromDiscord | <Phil> > the generic floating-point type; its size used to be platform-dependent, but now it is always mapped to float64. This type should be used in general.↵I was sitting on outdated information |
13:41:49 | FromDiscord | <whisperecean> Yes sorry just hard to strip out the sensitive data |
13:41:57 | FromDiscord | <whisperecean> I figured it out...it was caused by norm/[model,sqlite,postgres] |
13:42:47 | FromDiscord | <Phil> that should lead to an ambiguous call error, not ty... you used a postgres db connection with an sqlite select proc didn't you |
13:43:00 | FromDiscord | <whisperecean> looks like |
13:43:12 | FromDiscord | <whisperecean> but how do I use it with postgres select? |
13:44:02 | FromDiscord | <Phil> I mean, first why not remove the sqlite import? |
13:44:54 | FromDiscord | <whisperecean> I want to read some data from postgres db and save it locally to a sqlite one |
13:45:02 | FromDiscord | <Phil> ahhhhh check |
13:46:14 | FromDiscord | <Phil> This kind of stuff is why seeing a full minimal example helps. There's 50 things potentially going on and you're asking me for a blind diagnosis 😛 |
13:46:41 | FromDiscord | <whisperecean> Yeah agree sorry for that |
13:47:18 | FromDiscord | <Phil> What the error tells you is there's 4 "select" procs defined by norm.↵2 are for postgres, 2 for sqlite.↵The first 2 are for whatever db the connection you have is not for (see the 1 at the start, that is the number of the parameter where the mismatch happens) |
13:47:59 | FromDiscord | <Phil> the third proc says "can't be me, the connection fits but I'm for sequences, not individual models", so that's not the one you're looking for |
13:48:01 | FromDiscord | <whisperecean> That's weird but is not visible to me from the error :/ |
13:48:36 | FromDiscord | <Phil> the 4th one complains that 414 is not a dbValue type (which norm should auto convert from whatever you input to dbValue). |
13:48:44 | FromDiscord | <Phil> You can force the issue here by writing 414.dbValue() instead |
13:48:55 | FromDiscord | <Phil> or 454 I think |
13:49:19 | FromDiscord | <whisperecean> That gives ambigious call but shows sqlite select |
13:49:28 | FromDiscord | <Phil> Yes, now we're cooking |
13:49:35 | FromDiscord | <Phil> This is the error you should've had in the first place 😄 |
13:49:48 | FromDiscord | <Phil> to tell it specifically to use the sqlite proc, you can prefix with the module name |
13:49:56 | FromDiscord | <graveflo> `dbConn; obj: var T` first and second parameter bound to the same type? |
13:49:57 | FromDiscord | <Phil> sqlite.select(dbCon, test.... etc.) |
13:50:26 | FromDiscord | <Phil> In reply to @graveflo "`dbConn; obj: var T`": dbConn is defined using `using` which is why the type doesn't show up in the error message |
13:50:32 | FromDiscord | <Phil> Just for general reference |
13:50:45 | FromDiscord | <whisperecean> so what should I do when I want to use postgres select? 😦 |
13:50:48 | FromDiscord | <Phil> Not a fan of `using` myself, that fact just ads to it |
13:50:54 | FromDiscord | <whisperecean> postgres.select(dbCon, model....)? |
13:51:09 | FromDiscord | <Phil> In reply to @whisperecean "so what should I": first, different connection because your current connection is to the sqlite db |
13:51:18 | FromDiscord | <Phil> But yeah, after that postgres.select(dbCon, model) etc. |
13:51:42 | FromDiscord | <whisperecean> hmmm nope that does not seem to be it |
13:51:47 | FromDiscord | <whisperecean> my connection in open is postgres |
13:51:56 | FromDiscord | <asakura44> what does the range keyword do in nim ? is it the same as .. ? |
13:52:25 | FromDiscord | <whisperecean> I am doing just let dbcon = postgres.open(DB_HOST, DB_USER, DB_PASS, DB_NAME) |
13:53:39 | FromDiscord | <whisperecean> Ahhh i am going nuts |
13:53:49 | FromDiscord | <whisperecean> this types should help instead they just obfuscate the issue |
13:53:53 | FromDiscord | <whisperecean> (edit) "this" => "these" |
13:56:34 | FromDiscord | <whisperecean> In reply to @isofruit "But yeah, after that": This also does not work. It's still sqlite as far as I can see from the 454.dbValue() |
13:56:57 | FromDiscord | <Phil> Still no crystal ball to infer what that exactly means |
13:57:05 | FromDiscord | <Phil> Or what error you see |
13:57:57 | FromDiscord | <whisperecean> see the same error like i am calling sqlite select |
14:00:13 | FromDiscord | <Phil> I mean, I still can not magical crystal-ballify what your code is, so hard to help.↵One quicker way that'll avoid some headache would be to just not use them in the same module and instead have them in separate files. |
14:00:38 | FromDiscord | <Phil> That or jumping to e.g. debby |
14:01:46 | FromDiscord | <whisperecean> Nim is too immature to use :< |
14:01:59 | FromDiscord | <Phil> Brave thing to say after using one library. |
14:02:30 | FromDiscord | <whisperecean> But it should be obvious and easy to call function for appropriate type |
14:02:35 | FromDiscord | <whisperecean> Instead the error does not event show it |
14:04:02 | * | rockcavera joined #nim |
14:05:27 | FromDiscord | <Phil> It is trying to do that.↵What it can't do is do so when something is ambiguous. ↵In this case that is likely dbvalue since both sqlite and postgres have their own way procs for translating fields into column-types that overlap here. ↵It's basically the way norm was built in this case that does not work well for how you want to use it. |
14:07:32 | FromDiscord | <whisperecean> But I cant seem to force it to use the postgres select... |
14:09:18 | FromDiscord | <whisperecean> Should not that also be pretty straightforward? |
14:10:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:11:14 | FromDiscord | <whisperecean> I dont mind specifying the modules I just dont know how and where... |
14:11:17 | FromDiscord | <Phil> Because both have that proc defined.↵And because this is internal inside norm where that disambiguation is happening you can't really get at it.↵That's the oversight that's killing you here and just demonstrates the modules weren't written with the intention of using both at the same time |
14:11:36 | FromDiscord | <whisperecean> I see |
14:11:39 | FromDiscord | <whisperecean> That's pretty bad |
14:12:08 | FromDiscord | <Phil> Imagine me throwing my hands in the air, it is free software |
14:12:16 | FromDiscord | <whisperecean> Ok let me try to just get the data at least with the select |
14:13:11 | FromDiscord | <whisperecean> Do you think It's possible to workaround it? |
14:13:19 | FromDiscord | <whisperecean> like do the imports in different files |
14:13:29 | FromDiscord | <Phil> Just use them in separate modules |
14:13:29 | FromDiscord | <Phil> Yeah exactly that |
14:14:34 | FromDiscord | <Phil> Have one module provide a proc "loadData" and the other "writeData" and bam, abstraction |
14:17:53 | FromDiscord | <whisperecean> This is bs...this just does not work |
14:18:03 | FromDiscord | <whisperecean> I spent the whole day just trying to get a simple sql select working |
14:19:33 | FromDiscord | <whisperecean> I get a query back when executing it: SELECT "users".user, "users".uuid, "users".id FROM "users" WHERE users.id = ? LIMIT 1 |
14:19:49 | FromDiscord | <whisperecean> when I execute this manually and replace ? with the id it just works |
14:19:52 | FromDiscord | <whisperecean> in the sql console |
14:19:59 | FromDiscord | <whisperecean> But here i get a DbError... |
14:20:00 | FromDiscord | <whisperecean> like wtf |
14:22:49 | FromDiscord | <Phil (he/him)> I mean, if this is just to vent, fair, if you expect help, crystal balls have never been further away from me |
14:26:12 | PMunch | @whisperecean, if you want help, share code |
14:26:22 | PMunch | Otherwise we're basically just guessing |
14:26:24 | FromDiscord | <whisperecean> This is literally what I have |
14:26:26 | FromDiscord | <whisperecean> https://glot.io/snippets/gs8roullyl |
14:26:29 | FromDiscord | <whisperecean> Just this nothing more. |
14:26:35 | FromDiscord | <whisperecean> users is a table with lowercase |
14:29:59 | PMunch | And I assume you've printed out your credentials and stuff to make sure those get passed in correctly? |
14:31:12 | PMunch | Are you sure you're supposed to use a question mark? |
14:31:30 | PMunch | Judging by the tests in norm it seems like you're supposed to use $1 |
14:32:41 | FromDiscord | <whisperecean> Yes I can connect (printed out the creds). |
14:32:50 | FromDiscord | <whisperecean> @Phil posted ? and it's also in the examples |
14:33:12 | FromDiscord | <Phil> For sqlite, yes, the examples are also all for sqlite |
14:33:25 | FromDiscord | <whisperecean> lol.... |
14:33:46 | FromDiscord | <Phil> > Also, make sure you have SQLite installed. On most Linux distributions, it should be preinstalled. To install SQLite in macOS, use brew. On Windows, use scoop. Should you want to follow this tutorial while using postgres, then please be aware that placeholders in postgres are not indicated with ?, but with $1, $2, $3... etc. instead. |
14:33:57 | FromDiscord | <Phil> > Should you want to follow this tutorial while using postgres, then please be aware that placeholders in postgres are not indicated with ?, but with $1, $2, $3... etc. instead. |
14:36:40 | FromDiscord | <whisperecean> Yeah it does not work with with that either |
14:37:11 | FromDiscord | <whisperecean> remoteState.select(test, "users.id = $1", 454) |
14:38:27 | FromDiscord | <whisperecean> Error: unhandled exception: field 's' is not accessible for type 'DbValue' using 'kind = dvkInt' [FieldDefect |
14:38:59 | PMunch | Could you pastebin the whole error? |
14:39:01 | FromDiscord | <Phil> Mark your fields as exported |
14:39:16 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
14:39:40 | FromDiscord | <graveflo> does the number have tot be a string there? |
14:39:47 | FromDiscord | <graveflo> (edit) "tot" => "to" |
14:40:35 | FromDiscord | <Phil> No wait this is about s |
14:40:40 | FromDiscord | <Phil> not your own fields |
14:40:43 | FromDiscord | <graveflo> looks like an object variant with an integer type enum `dvkInt` |
14:41:22 | FromDiscord | <whisperecean> if i put "454" i get a failed select query |
14:41:30 | FromDiscord | <whisperecean> so that gets rid of the error with field 's' |
14:41:52 | FromDiscord | <whisperecean> hmm getting somewhere |
14:42:00 | FromDiscord | <whisperecean> remoteState.select(test, "users.id = $1", test.id) if I do this |
14:42:04 | FromDiscord | <whisperecean> I get No record found |
14:42:27 | FromDiscord | <whisperecean> So I guess i just have to find out how to test.id to 454 |
14:43:21 | FromDiscord | <whisperecean> but how... |
14:43:43 | FromDiscord | <graveflo> idk ive never "test.id to 454" before |
14:44:43 | FromDiscord | <whisperecean> sigh |
14:51:31 | PMunch | I was about to install postgres to see if I could help up, but my system was a bit outdated so I'm doing a large update instead.. |
14:52:41 | FromDiscord | <whisperecean> Thanks for that but you should not have to install postgres to debug this that's bs |
14:53:01 | FromDiscord | <whisperecean> How can we not figure out how to retrieve data from postgres using an ID |
14:53:03 | FromDiscord | <whisperecean> that's ridiculous |
14:53:11 | FromDiscord | <whisperecean> That's like basic functionality |
14:54:13 | PMunch | I assume you're just doing something silly |
14:54:17 | PMunch | So I wanted to look for myself |
14:54:24 | PMunch | Because as you said this shouldn't be hard |
14:54:41 | PMunch | But I've never used norm before so without trying it myself I'm not sure what's going on |
14:55:36 | FromDiscord | <whisperecean> remoteState.select(test, "users.id = $1", test.id) i am pretty sure here it understands I want an ID |
14:55:41 | FromDiscord | <whisperecean> but i cant tell it the number |
14:58:12 | PMunch | Hmm, what happens if you put an `id: int` field in your `user` type? |
14:58:37 | FromDiscord | <whisperecean> Redifinition error |
14:58:48 | FromDiscord | <whisperecean> sent a long message, see <!doctype html> |
14:59:04 | PMunch | Ah right |
14:59:09 | PMunch | That makes sense |
15:00:21 | FromDiscord | <whisperecean> If I do before test.id = 454 and then pass test.id in the select I get the field 's' is not accessible for type 'DbValue' using 'kind = dvkInt' |
15:00:51 | PMunch | What is the schema of your database by the way? |
15:01:32 | FromDiscord | <whisperecean> I think you got it |
15:01:57 | FromDiscord | <whisperecean> I am not setting the schema anywhere |
15:02:33 | FromDiscord | <whisperecean> But I dont see where? |
15:03:14 | PMunch | Huh? |
15:03:29 | PMunch | I mean you have an existing database don't you? |
15:04:12 | FromDiscord | <whisperecean> Database->schemas->tables |
15:04:17 | FromDiscord | <whisperecean> So where do I set the schema? |
15:04:32 | FromDiscord | <mengu> https://norm.nim.town/tutorial/tables.html |
15:04:35 | PMunch | I have no idea what that path is supposed to mean |
15:04:54 | PMunch | The schema is the definition for how your tables are defined |
15:05:08 | FromDiscord | <mengu> if you haven't ran `createTables` then you won't have a schema unless you created via sql |
15:05:12 | PMunch | Every SQL database (except perhaps an empty one), has a schema |
15:05:18 | FromDiscord | <Phil> The models are the schema essentially. |
15:05:45 | FromDiscord | <Phil> The model defines which table it is associated with, the fields define which columns must exist (there may be additional ones which norm will ignore) |
15:06:07 | FromDiscord | <whisperecean> In reply to @mengu "if you haven't ran": But I am not creating a database or tables or schemas. I am trying to read from it |
15:06:12 | FromDiscord | <Phil> (edit) "ignore)" => "ignore if there are no fields for those columns)" |
15:06:34 | PMunch | Yeah, and I'm guessing that the `field 's' is not accessible for type 'DbValue' using 'kind = dkvInt'` might come from norm trying to assign some incompatible type |
15:06:35 | FromDiscord | <Phil> All that should be needed to be done is define a datatype and use the select proc with a connection to that db |
15:07:06 | FromDiscord | <Phil> essentially it's trying to have a string where there is an int |
15:07:09 | FromDiscord | <mengu> In reply to @whisperecean "But I am not": ah, sorry, I thought you didn't have a db schema, misunderstood |
15:07:35 | FromDiscord | <whisperecean> The database has many schemas and I am trying to read data from a particular table from a particular schema |
15:07:39 | FromDiscord | <Phil> Which is either when creating the query or when parsing the response back |
15:07:44 | FromDiscord | <whisperecean> but now I realized I dont specify the schema anywhere |
15:08:01 | FromDiscord | <whisperecean> But I dont understand how to do this |
15:08:58 | FromDiscord | <Phil> For the most part what norm does is string generation.↵I'd say abuse the `tableName` pragma to pass in `<schemaname>.<tablename>` and see if it generates the correct SQL |
15:09:16 | FromDiscord | <Phil> Well "abuse", this is likely one of the reasons why it exists |
15:10:20 | FromDiscord | <whisperecean> trying to find out how |
15:13:52 | FromDiscord | <whisperecean> Yeah I dont know |
15:13:57 | FromDiscord | <whisperecean> think I will just abandon nim |
15:14:31 | FromDiscord | <Phil (he/him)> I mean I suggested Debby... Like twice |
15:15:18 | FromDiscord | <whisperecean> But I am risking into running into debbie issues |
15:15:24 | FromDiscord | <whisperecean> I dont even know if that solves my problems |
15:17:06 | FromDiscord | <odexine> you could say the same with switching languages unless its to one you already know |
15:18:07 | FromDiscord | <whisperecean> I have a working Python solution I was just wondering if I could use Nim.... |
15:19:32 | PMunch | You definitely can |
15:19:52 | FromDiscord | <graveflo> for a task like this if you have working python code and you don't need the advantages that Nim naturally has, then I would call you crazy for using Nim instead |
15:27:27 | FromDiscord | <whisperecean> Well still pretty frustrating experience and we did not even figure out how to do a simple select |
15:28:00 | FromDiscord | <graveflo> just use python |
15:29:39 | PMunch | Okay, update done |
15:29:43 | PMunch | Postgres installed |
15:29:46 | PMunch | Let's see |
15:31:50 | FromDiscord | <whisperecean> If you want to test it i have a postgres database which has many schemas. My table is in the public schema. |
15:32:54 | PMunch | That'd be great |
15:34:25 | FromDiscord | <whisperecean> I think u can just create 2 schemas |
15:34:35 | FromDiscord | <whisperecean> Just so it does not auto connect or something |
15:39:20 | FromDiscord | <whisperecean> Well another problem I might face later is that uuid in postgres is not string |
15:40:26 | PMunch | Did you see this by the way? https://norm.nim.town/debug.html |
15:40:44 | PMunch | That could very well be the issue you are currently facing |
15:40:51 | FromDiscord | <whisperecean> But just slap there 2 colums with strings |
15:40:52 | PMunch | It's probably stored as a numerical value |
15:41:24 | PMunch | Could you try to set `uuid: int` in your sample? |
15:42:30 | FromDiscord | <whisperecean> No I think my problem is with the schemas |
15:42:35 | FromDiscord | <whisperecean> and fetching by id |
15:42:40 | FromDiscord | <whisperecean> I removed the uuid field completely |
15:45:53 | FromDiscord | <whisperecean> I am gonna hit the gym but will be back in an hour. If you will still give it a try :< |
15:51:18 | PMunch | Hmm, interesting |
15:51:51 | * | deadmarshal_ joined #nim |
15:51:54 | PMunch | Using Norm on a fresh postgres install with an empty database and calling `createTables` gave me a syntax error in the SQL query.. |
16:08:23 | FromDiscord | <whisperecean> Maybe its broken |
16:23:58 | * | PMunch quit (Quit: leaving) |
16:50:07 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:50:31 | * | azimut quit (Ping timeout: 240 seconds) |
16:51:53 | * | azimut joined #nim |
16:52:14 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:54:41 | * | deadmarshal_ quit (Quit: IRCNow and Forever!) |
16:58:48 | * | xet7 quit (Remote host closed the connection) |
16:58:50 | * | fallback joined #nim |
17:03:48 | FromDiscord | <Phil> In reply to @whisperecean "Maybe its broken": Part part.↵Postgres syntax the way you need to write it here with the table access is really fucking weird it turns out. |
17:03:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:04:12 | NimEventer | New thread by ASVI: Why nim don't allow it ?, see https://forum.nim-lang.org/t/10858 |
17:04:36 | FromDiscord | <Phil> I may have made some changes here or there to experiment, I keep forgetting about how postgres requires you to put your table name in quotation marks sometimes |
17:04:51 | FromDiscord | <Phil> Which is case sensitive mind you |
17:08:03 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:16:20 | * | deadmarshal_ joined #nim |
17:59:24 | FromDiscord | <whisperecean> Oh nice! I am gonna try it. |
18:02:31 | FromDiscord | <whisperecean> It's still does not work for me cuz of the schema |
18:02:49 | FromDiscord | <Phil> in your case try changing tableName to "<scheme>.users" |
18:03:06 | FromDiscord | <Phil> where you type in your own scheme into it |
18:03:41 | FromDiscord | <whisperecean> Yes tried but it does not work. I am trying to paste the query to sql console without schema to see if it's the correct query |
18:04:50 | FromDiscord | <Phil> @moigagoo if you've got time.↵Other than that I'm occupied with channels and really don't have the minspace right now |
18:04:58 | FromDiscord | <Phil> (edit) "minspace" => "mindspace" |
18:05:46 | FromDiscord | <Phil> You can try rawSelect which should do it, but remember to specify the columns in order, or try Debby |
18:06:54 | FromDiscord | <whisperecean> I think I got it |
18:07:04 | FromDiscord | <whisperecean> I mean I have the raw SQL that works from a different schema |
18:07:09 | FromDiscord | <whisperecean> so now need to translate it to norm |
18:08:13 | FromDiscord | <Phil> Generally norm is just a query generator for a few bits.↵It saves you the SELECT and the FROM block, what you specify after is typically just WHERE and later |
18:08:29 | FromDiscord | <whisperecean> SELECT "public".users.status, "public".users.id FROM "public".users WHERE "public".users.id = 454 LIMIT 1 |
18:08:32 | FromDiscord | <whisperecean> This is how it should be |
18:08:56 | FromDiscord | <whisperecean> At least this is what works in sql console from a different schema |
18:09:28 | FromDiscord | <Phil> Ah, just for reference, triple quotes are just multi-line-strings |
18:10:29 | FromDiscord | <whisperecean> But how do i do this? |
18:10:42 | FromDiscord | <whisperecean> I cant do this with tableName pragma i think |
18:11:05 | FromDiscord | <Phil> Look at the SQL that gets generated via the logger |
18:11:12 | FromDiscord | <Phil> See where the generated SQL differs from yours |
18:11:33 | FromDiscord | <whisperecean> Yeah i see the sql in failed query |
18:11:52 | FromDiscord | <Phil (he/him)> No, look at the exact log message |
18:14:33 | FromDiscord | <whisperecean> I know but I cant do what I want to do |
18:14:36 | FromDiscord | <whisperecean> I mean I dont know how lol |
18:14:51 | FromDiscord | <whisperecean> i nead to add the schema with quotes "public".users.status |
18:26:28 | FromDiscord | <whisperecean> It works for the """user.id = 3 """ |
18:26:39 | FromDiscord | <whisperecean> but dont know how to do it for users 😄 |
19:18:48 | FromDiscord | <whisperecean> If anybody else has an idea… |
19:25:00 | * | jmdaemon quit (Ping timeout: 268 seconds) |
19:48:32 | FromDiscord | <aintea> Is there a naming convention for an object constructor ? |
19:52:53 | FromDiscord | <aintea> For example, I have this |
19:53:32 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:59:45 | FromDiscord | <leorize> `newTypeName` |
20:02:06 | FromDiscord | <griffith1deadly> initTypeName for `object`, newTypeName for `ref object` |
20:11:23 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:11:48 | FromDiscord | <Elegantbeef> It is ideal as you can use it with generics |
20:12:09 | FromDiscord | <Robyn [She/Her]> This way, you'd run `Type.init` or `MyType.new`, and I like the syntax personally so |
20:12:16 | FromDiscord | <Robyn [She/Her]> (edit) |
20:55:33 | FromDiscord | <ambient3332> It's a little awkward when on Windows other parts of the program only work on --cc:gcc and others work only with --cc:vcc 😦 |
20:58:33 | FromDiscord | <Elegantbeef> Smells like UB |
20:59:10 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:59:37 | FromDiscord | <Elegantbeef> Ah I take it back |
21:02:40 | FromDiscord | <Phil> I am a strong advocate for my way |
21:02:51 | FromDiscord | <Phil> Well for the only sensible way imo, can't claim it for myself |
21:03:25 | FromDiscord | <Phil> How the hell things about contructors and goes "I'mma just do a very long proc name that will not mesh with overloading at all" |
21:03:30 | FromDiscord | <Phil> (edit) "How" => "Who" |
21:03:35 | FromDiscord | <Phil> (edit) "things" => "thinks" |
21:05:17 | FromDiscord | <Phil> Ideally all your params have default assignments so you can always do `new(ProgrammingLanguage)` |
21:15:04 | * | lucasta joined #nim |
21:31:11 | * | redj quit (Ping timeout: 245 seconds) |
21:32:33 | * | redj joined #nim |
21:39:21 | * | Guest99 joined #nim |
21:41:51 | * | lucasta quit (Quit: Leaving) |
21:44:26 | * | Guest99 quit (Quit: Client closed) |
21:55:10 | FromDiscord | <ambient3332> I had to put "C:\Users\hyppa\.choosenim\toolchains\mingw64\bin" into path as it doesn't seem to be put automatically |
21:55:28 | FromDiscord | <ambient3332> (edit) ""C:\Users\hyppa\.choosenim\toolchains\mingw64\bin"" => ""C:\Users\hyppa\\.choosenim\toolchains\mingw64\bin"" |
21:56:03 | FromDiscord | <ambient3332> Plus windows giving error message as a dialog pop up that doesn't show up in some terminals... oof |
22:01:58 | FromDiscord | <whisperecean> hmm figured the query does not need to be quoted |
22:03:30 | FromDiscord | <whisperecean> This is nuts |
22:03:40 | FromDiscord | <whisperecean> either none of it is quoted or just the schema |
22:03:44 | FromDiscord | <whisperecean> I am really going insane 😄 |
22:07:31 | FromDiscord | <whisperecean> ok at this point i think only @moigagoo knows |
22:37:43 | * | azimut quit (Ping timeout: 240 seconds) |
22:49:50 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "Ideally all your params": What if macro for constructor proc |
22:50:25 | FromDiscord | <Robyn [She/Her]> Literally just something like `Type.constructor(param: Type, anotherParam = value) =` |
22:50:39 | FromDiscord | <Elegantbeef> https://github.com/beef331/constructor#struct-intialisers who if |
22:51:40 | FromDiscord | <Elegantbeef> You idea is pointless cause you can just do `T(param: ..., anotherParam: ...)` |
22:52:14 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "https://github.com/beef331/constructor#struct-intia": Oh fun |
22:52:20 | * | entikan joined #nim |
22:52:38 | FromDiscord | <Robyn [She/Her]> > `asset` |
22:52:52 | FromDiscord | <Elegantbeef> PRs welcome 😛 |
22:53:21 | FromDiscord | <Robyn [She/Her]> Ah yes lemme PR a single thing to the README |
22:53:31 | FromDiscord | <Elegantbeef> I mean you can |
22:53:56 | FromDiscord | <Elegantbeef> But I already fixed it |
22:53:58 | FromDiscord | <Elegantbeef> So yea |
22:54:13 | entikan | how do I give an alternate name to a function? |
22:54:26 | FromDiscord | <Robyn [She/Her]> Lol |
22:54:32 | FromDiscord | <Elegantbeef> use another proc or a template |
22:54:44 | FromDiscord | <Elegantbeef> Or use a variable like `let myOtherProc = myProc` |
22:54:50 | FromDiscord | <Robyn [She/Her]> In reply to @entikan "how do I give": `template myAlias: typeof myProc = myProc`? |
22:55:11 | FromDiscord | <Elegantbeef> That's less than ideal though cause `myAlias()(...)` is required |
22:55:40 | FromDiscord | <Robyn [She/Her]> Mine doesn't work yeah |
22:55:50 | FromDiscord | <Elegantbeef> I mean it does |
22:55:52 | FromDiscord | <Elegantbeef> It's just not nice |
22:56:02 | FromDiscord | <nnsee> `const aliasedProc = oldProc` ? |
22:56:20 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "It's just not nice": Yeah :p |
22:56:22 | FromDiscord | <nnsee> oh beef already said that |
22:56:29 | FromDiscord | <Robyn [She/Her]> In reply to @nnsee "`const aliasedProc = oldProc`": This works |
22:56:29 | FromDiscord | <Elegantbeef> That works aswell but not on closures |
22:56:37 | FromDiscord | <Robyn [She/Her]> He said `let` 😛 |
22:56:39 | FromDiscord | <Elegantbeef> So all depends on what the proc is |
22:57:27 | FromDiscord | <nnsee> how to do this when there are multiple procs with different type signatures though |
22:57:28 | entikan | ah yeah, let or const would be ambiguous in this case |
22:57:38 | entikan | exactly |
22:57:43 | FromDiscord | <Robyn [She/Her]> Ah so then a template is the only real way |
22:57:51 | FromDiscord | <Elegantbeef> `const myProc = (proc(_: Arg, _ Arg2))(name)` |
22:57:57 | FromDiscord | <Robyn [She/Her]> You'd have to put the params into the template |
22:58:03 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "`const myProc = (proc(_:": You can do thT? |
22:58:09 | FromDiscord | <nnsee> TIL |
22:58:16 | FromDiscord | <Robyn [She/Her]> (edit) "thT?" => "that?" |
22:58:17 | FromDiscord | <Robyn [She/Her]> Damn |
22:58:39 | FromDiscord | <Robyn [She/Her]> Time to make a package that adds the British spellings to every American word- |
22:58:43 | entikan | so for each overflow I'd need a seperate template? |
22:58:46 | FromDiscord | <Robyn [She/Her]> Using aliases only |
22:59:07 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "`const myProc = (proc(_:": Beefs solution seems good, he tends to know more than me :p |
22:59:11 | FromDiscord | <Elegantbeef> Overload\ |
22:59:20 | entikan | euh yeh, overload |
22:59:21 | FromDiscord | <Elegantbeef> Why are you aliasing procedures like this anyway |
22:59:46 | entikan | because I'm using a library that has some long as variable names I'd like to call a lot |
22:59:51 | entikan | euh proc names |
23:00:19 | entikan | so, sugar |
23:00:34 | entikan | I like my code petite and sweet |
23:04:27 | entikan | in this specific case it's `initLVector4f()` I'd much rather have that be vec4, but it has 6 overloads |
23:15:59 | * | azimut joined #nim |
23:16:35 | * | lucasta joined #nim |
23:59:13 | FromDiscord | <voidwalker> Anyone have experience building ridesharing/carpooling, or any sort of geolocation based matching service ? I wonder if nim would be a good fit to build the backend of something like that. Probably not, given the lack of devs, being a rather specialized domain (to implement optimally), lack of libs |