00:00:06 | FromDiscord | <QuiteQuietQ> ok, I thought there is something similar to `setTimeout` :D... and I read the code on geeksforgeeks wrong, it is not using set timeout, nvm |
00:05:01 | FromDiscord | <Gumbercules> Oh for the JS backend yeah |
00:05:15 | FromDiscord | <Gumbercules> I figured you were referring to the C backend, apologies |
00:07:59 | FromDiscord | <BobBBob> it seems like most nim code has any custom types in one big block at the top of the code, but whats the "standard" way to organize procs after that? because usually in other languages you have method functions for a type and they all get bunched together but nim doesnt really have those so you could put them wherever |
00:15:48 | * | fallback quit (Quit: IRCNow and Forever!) |
00:16:21 | FromDiscord | <Elegantbeef> Indeed you can put them anywhere |
00:16:31 | FromDiscord | <Elegantbeef> Generally you write the code in such away that you build upon previous things |
00:17:36 | FromDiscord | <PunchCake> Sooo guys |
00:17:59 | FromDiscord | <PunchCake> I need an easy to use mobile framework for nim |
00:18:11 | FromDiscord | <Elegantbeef> Unlike other languages aside from hooks there are no concepts of type bound operations really(araq wants to change this) so there is no real enforced design requirement |
00:18:12 | FromDiscord | <PunchCake> It doesnt matter if its native or not |
00:18:23 | FromDiscord | <Elegantbeef> Your options are very limited |
00:18:31 | FromDiscord | <PunchCake> What are my options |
00:18:39 | FromDiscord | <PunchCake> I heard about wiish for nim |
00:18:46 | FromDiscord | <PunchCake> Aka why is it so hard |
00:18:53 | FromDiscord | <PunchCake> To make a cross platform app |
00:18:56 | FromDiscord | <Elegantbeef> Partly due to how mobile works, partly due to the small dev pool |
00:18:57 | FromDiscord | <Elegantbeef> nimx and fidget work iirc |
00:19:41 | FromDiscord | <PunchCake> Nimx looks very ugly |
00:19:52 | FromDiscord | <Elegantbeef> Nice |
00:19:58 | FromDiscord | <PunchCake> To the point where if I'd ship my app I'd get bitch slapped to oblivion |
00:20:12 | FromDiscord | <Elegantbeef> Cool, perhaps Nim isnt for this project |
00:20:15 | FromDiscord | <Elegantbeef> Atleast for the frontend |
00:20:41 | FromDiscord | <Elegantbeef> You could use kotlin or java for the front end and call into native Nim code |
00:20:54 | FromDiscord | <PunchCake> I dont know why is it this hard |
00:21:16 | FromDiscord | <PunchCake> Opengl can run on nearly every major os |
00:21:21 | FromDiscord | <PunchCake> Including mobile |
00:21:26 | FromDiscord | <Elegantbeef> Cause mobile devices are designed in such a way to encourage the use of specific languages |
00:21:51 | FromDiscord | <PunchCake> Welp react native is used a lot in production |
00:22:00 | FromDiscord | <PunchCake> And look at it its doing very well |
00:22:07 | FromDiscord | <Elegantbeef> You can technically use any language but you're encouraged to use JVM and Swift |
00:22:31 | FromDiscord | <Elegantbeef> It's not an easy task to replicate react unpaid |
00:22:42 | FromDiscord | <Andreas> In reply to @Elegantbeef "Cause mobile devices are": yes, IOS lingua-franca = Swift | Android= Java |
00:22:45 | FromDiscord | <PunchCake> The thing is kotlin itself is simple but the amount og complexity of the apis is insane |
00:23:16 | FromDiscord | <PunchCake> (edit) "og" => "of" |
00:23:42 | FromDiscord | <Elegantbeef> 2400 contributors and funded/developed by facebook |
00:24:02 | FromDiscord | <PunchCake> Hm yeah |
00:24:15 | FromDiscord | <PunchCake> I dont really understand why we are forced to use java for android |
00:24:41 | FromDiscord | <Elegantbeef> Ok so then time for you to make a Nim cross platform GUI for Desktop and Mobile |
00:24:54 | FromDiscord | <Elegantbeef> Cause that's the language all of their OS interaction is written in |
00:25:09 | FromDiscord | <PunchCake> I thought about it |
00:25:09 | FromDiscord | <Elegantbeef> To use other languages you have to bind to that code somehow |
00:25:29 | FromDiscord | <BobBBob> isnt there qt bindings for nim now |
00:25:36 | FromDiscord | <PunchCake> There is |
00:25:39 | FromDiscord | <Elegantbeef> Sure but QT doesnt support mobile |
00:25:47 | FromDiscord | <PunchCake> It does bro |
00:25:49 | FromDiscord | <PunchCake> Qt5 |
00:26:17 | FromDiscord | <Elegantbeef> Guess i was thinking gtk |
00:26:48 | FromDiscord | <BobBBob> good luck getting it to work well on mobile though haha |
00:26:52 | FromDiscord | <Elegantbeef> If you really wanted to you could use the JNI to wrap the relevant java class you wanted |
00:27:09 | FromDiscord | <Elegantbeef> But anything is going to be much more work than just using a JVM language |
00:27:26 | FromDiscord | <PunchCake> Agreed |
00:27:41 | FromDiscord | <PunchCake> Maybe i could put in the work so other devs dont have to go through this bullshit |
00:27:48 | FromDiscord | <PunchCake> Aka take one for the team |
00:28:32 | FromDiscord | <PunchCake> Or i could just use react native its plenty fast and easy to use |
00:28:54 | FromDiscord | <BobBBob> if I remember the reason android is based around java is because back when it started it was to ensure cross platform compatibility and now theyve already got everything in java so they just have to go with it, as for apple it's just standard apple vendor lock in |
00:29:13 | FromDiscord | <Elegantbeef> It's not even really vendor lock in anymore in apple's case |
00:29:27 | FromDiscord | <Elegantbeef> Just a bit of NIH mixed with fancy ideas |
00:29:39 | FromDiscord | <PunchCake> In reply to @BobBBob "if I remember the": Idk why they didn't make their own language tailored for android |
00:29:45 | FromDiscord | <BobBBob> In reply to @Elegantbeef "Just a bit of": pssh that's what they tell you |
00:30:05 | FromDiscord | <Elegantbeef> Swift is now a cross platform language |
00:30:09 | FromDiscord | <BobBBob> In reply to @PunchCake "Idk why they didn't": i think it was originally a small independent project before getting bought (?) by google |
00:30:09 | FromDiscord | <Elegantbeef> Not that any one uses it as one |
00:30:11 | FromDiscord | <PunchCake> Nice joke |
00:30:15 | FromDiscord | <Elegantbeef> But it's totally allowed now |
00:30:36 | FromDiscord | <PunchCake> Bro fr? |
00:30:47 | FromDiscord | <PunchCake> I can use swift for cross plat dev now |
00:30:57 | FromDiscord | <Elegantbeef> Yes |
00:31:08 | FromDiscord | <PunchCake> The thing is i dont wanna support this walled garden bollocks so i dislike swift |
00:31:53 | FromDiscord | <PunchCake> And i think nimqt is the most reliable and stable bindings avaliable for qt right |
00:32:42 | FromDiscord | <Elegantbeef> If I really wanted to use Nim I'd just use either react native or a JVMlanguage / swift and call into a Nim dynamic library |
00:32:56 | FromDiscord | <Elegantbeef> Anything else is just an exuberant amount of time |
00:33:16 | FromDiscord | <PunchCake> So basically write all the logic in nim and write all the ui in js with the button callbacks |
00:33:21 | FromDiscord | <PunchCake> Sounds like a good idea |
00:40:10 | FromDiscord | <Nilts> `Error: unhandled exception: over- or underflow [OverflowDefect]` |
00:40:26 | FromDiscord | <Nilts> for `let n = Date.now()` |
00:45:44 | FromDiscord | <spoon> date.now? |
00:45:53 | FromDiscord | <spoon> this works |
00:45:58 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEh |
00:46:13 | FromDiscord | <Nilts> In reply to @spoon "date.now?": https://nim-lang.org/docs/jscore.html#now%2CDateLib |
00:47:17 | * | azimut quit (Ping timeout: 255 seconds) |
00:48:05 | FromDiscord | <spoon> compiling to js then? |
00:48:09 | FromDiscord | <Nilts> yes |
00:51:13 | FromDiscord | <Nilts> any ideas? |
00:52:48 | FromDiscord | <spoon> does now() from times not work with js? |
00:54:06 | FromDiscord | <Nilts> In reply to @spoon "does now() from times": it should not work from times, or depend on the js one. |
00:54:22 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEj |
00:57:02 | FromDiscord | <spoon> times from stdlib does work with the js backend i just tested but if you need it for compatability... |
00:57:16 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4rEk |
00:59:11 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4rEl |
00:59:36 | * | derpydoo joined #nim |
01:00:03 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEn |
01:00:05 | FromDiscord | <spoon> what version of nim are you running? |
01:00:10 | FromDiscord | <spoon> i tested on devel |
01:00:37 | FromDiscord | <Nilts> In reply to @spoon "what version of nim": latest |
01:00:54 | FromDiscord | <Nilts> Although i cannot get devl, only head |
01:00:56 | FromDiscord | <spoon> latest release or devel? |
01:01:02 | FromDiscord | <spoon> are you using choosenim? |
01:01:08 | FromDiscord | <Nilts> In reply to @spoon "are you using choosenim?": yes |
01:01:17 | FromDiscord | <spoon> can do `choosenim devel` to get it |
01:01:46 | FromDiscord | <spoon> and `choosenim stable` if that doesn't work out |
01:01:59 | FromDiscord | <spoon> see if that fixes anything |
01:02:15 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEp |
01:02:21 | FromDiscord | <spoon> missed an e |
01:02:35 | FromDiscord | <Elegantbeef> `devel` is hard to spell |
01:02:50 | FromDiscord | <impbox [ftsf]> the devel is in the details |
01:02:54 | FromDiscord | <Nilts> lol, i have been spelling it wrong this whole time |
01:05:08 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEq |
01:05:24 | FromDiscord | <Nilts> Could be on a completely different line. Nim's bug reporting has done that too me. |
01:05:32 | FromDiscord | <spoon> how are you compiling it? |
01:05:44 | FromDiscord | <spoon> are you running `nim js filename.nim`? |
01:06:56 | FromDiscord | <Nilts> In reply to @spoon "are you running `nim": no other flags |
01:08:03 | FromDiscord | <spoon> hmm, are you using the function from jscore for compatibility reasons or something? |
01:08:55 | FromDiscord | <Nilts> In reply to @spoon "hmm, are you using": I am pretty sure it is the only one. And it is native, so faster ig |
01:09:20 | FromDiscord | <spoon> the one from times does work, i tested with the js backend to make sure |
01:09:45 | FromDiscord | <Nilts> In reply to @spoon "the one from times": also, I want an int, not a datetime |
01:11:03 | FromDiscord | <spoon> if you know what unit it uses there are functions to convert it into s, ms, unix time, etc |
01:11:30 | FromDiscord | <spoon> but since mine compiles i imagine the problem might be on another line |
01:11:53 | FromDiscord | <Nilts> In reply to @spoon "but since mine compiles": arg, nim's buggy error reporting |
01:12:21 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEr |
01:12:23 | FromDiscord | <Nilts> I just realized. It only tracks like every 5 lines for the js backend |
01:12:39 | FromDiscord | <spoon> is error reporting different for js? |
01:12:53 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEs |
01:13:31 | FromDiscord | <Nilts> In reply to @spoon "is error reporting different": idk, but i have seen lots of places where it just says it is at an earlier line becuase on inaccuracy. |
01:13:53 | FromDiscord | <spoon> i've never had that problem with the c backend |
01:13:54 | FromDiscord | <spoon> hm |
01:14:57 | * | nanxiao joined #nim |
01:17:23 | FromDiscord | <Nilts> In reply to @spoon "run this snippet through": works. not devl, but works |
01:17:37 | FromDiscord | <Nilts> different machine |
01:19:05 | FromDiscord | <spoon> where is basicproc from? |
01:21:08 | FromDiscord | <Nilts> In reply to @spoon "where is basicproc from?": `type BasicProc = proc ()` |
01:24:28 | FromDiscord | <spoon> i'm getting a different error now: `Error: undeclared identifier: 'cstringArrayToSeq'` |
01:29:04 | NimEventer | New Nimble package! embedfs - Embed directories in executables, easily, see https://github.com/iffy/nim-embedfs |
01:44:26 | FromDiscord | <Nilts> In reply to @spoon "i'm getting a different": with what code? |
01:50:58 | FromDiscord | <spoon> In reply to @not logged in "with what code?": something i imported is trying to use nativesockets which i believe doesn't work with js |
01:51:49 | FromDiscord | <spoon> apparently importing system does that |
01:53:43 | FromDiscord | <spoon> nope, it was asyncdispatch |
01:53:57 | FromDiscord | <spoon> compiled the function succesfully |
02:10:07 | * | nanxiao quit (Quit: Client closed) |
02:26:43 | * | nanxiao joined #nim |
02:27:03 | * | fallback joined #nim |
03:17:22 | * | fallback quit (Read error: Connection reset by peer) |
03:24:13 | NimEventer | New Nimble package! yanyl - A library for using YAML with Nim, see https://github.com/tanelso2/yanyl |
03:40:02 | * | rockcavera quit (Read error: Connection reset by peer) |
03:41:53 | * | rockcavera joined #nim |
03:41:53 | * | rockcavera quit (Changing host) |
03:41:53 | * | rockcavera joined #nim |
03:45:59 | * | deadmarshal_ quit (Ping timeout: 246 seconds) |
04:11:25 | * | nanxiao quit (Quit: Client closed) |
05:36:23 | * | nanxiao joined #nim |
05:55:02 | * | advesperacit joined #nim |
06:05:04 | FromDiscord | <kubo39> what is over- or underflow errors? they seems totally different.. |
06:09:40 | FromDiscord | <Elegantbeef> They're idientical some operation would have caused an integer to either go under `int.low` or above `int.high` |
06:09:52 | FromDiscord | <Elegantbeef> identical even |
06:11:18 | FromDiscord | <kubo39> i know it is overflow. |
06:11:38 | FromDiscord | <Elegantbeef> What? |
06:11:57 | FromDiscord | <Elegantbeef> Overflow is going over int.high, underflow is going under int.low |
06:12:36 | FromDiscord | <kubo39> typically underflow means floating point underflow AFAIK. |
06:12:44 | FromDiscord | <kubo39> https://en.wikipedia.org/wiki/Arithmetic_underflow |
06:13:42 | FromDiscord | <Elegantbeef> > When the term integer underflow is used, the definition of overflow may include all types of overflows, or it may only include cases where the ideal result was closer to positive infinity than the output type's representable value closest to positive infinity. |
06:13:43 | FromDiscord | <kubo39> going under int.low is also overflow |
06:14:04 | FromDiscord | <Elegantbeef> integer underflow is also an acceptable term for going below int.low |
06:14:44 | FromDiscord | <Elegantbeef> There is a whole entry about the definition and it's ambiguity |
06:16:27 | FromDiscord | <Elegantbeef> So i'd say that given colloquialisms it's fine to call below low is underflow |
06:18:36 | FromDiscord | <kubo39> oh, I've found these sentence in integer overflow page. |
06:20:35 | FromDiscord | <Elegantbeef> One of those cases when the term makes sense in the context sorta, so it's adopted as an acceptable term |
06:21:06 | * | nanxiao quit (Quit: Client closed) |
06:25:32 | FromDiscord | <kubo39> ok. |
06:28:41 | * | arkurious quit (Quit: Leaving) |
07:02:06 | * | nanxiao joined #nim |
07:10:39 | * | rockcavera quit (Remote host closed the connection) |
07:17:37 | * | kenran joined #nim |
07:44:17 | * | PMunch joined #nim |
07:48:51 | * | PMunch quit (Client Quit) |
07:54:21 | * | PMunch joined #nim |
08:27:31 | FromDiscord | <4zv4l> why isn't it valid ? |
08:27:32 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4rFq |
08:27:43 | FromDiscord | <4zv4l> I get invalid control flow |
08:27:54 | FromDiscord | <4zv4l> this is the function |
08:27:56 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4rFr |
08:36:31 | PMunch | You have to have a `tmp` as the last thing in the block |
08:36:36 | PMunch | Otherwise it won't return it |
08:37:06 | PMunch | Oh, and `break tmp` doesn't work like that |
08:37:43 | PMunch | Try something like this: https://play.nim-lang.org/#ix=4rFw |
08:38:20 | PMunch | The `break X` syntax is to break out of a named block. So `break tmp` would break out of `block tmp:` |
08:42:06 | * | nanxiao quit (Quit: Client closed) |
08:44:59 | NimEventer | New question by Elliot Cox: Which is the library for data visualization on Nim?, see https://stackoverflow.com/questions/75831559/which-is-the-library-for-data-visualization-on-nim |
08:54:43 | * | nanxiao joined #nim |
09:29:36 | PMunch | I think my obsession with inline blocks might've gone too far.. http://ix.io/4rFM/ |
09:37:00 | * | deadmarshal_ joined #nim |
09:41:45 | Zevv | looks fine to me |
09:45:11 | * | azimut joined #nim |
09:52:47 | FromDiscord | <4zv4l> In reply to @PMunch "The `break X` syntax": oh ok yeah makes sense |
09:53:02 | FromDiscord | <4zv4l> In reply to @PMunch "Try something like this:": I created a proc xD↵easier I guess |
09:53:13 | * | nanxiao quit (Quit: Client closed) |
09:53:18 | FromDiscord | <4zv4l> is there a way to access an array value like the json like if the bound is not correct, not throw an error ? |
09:53:26 | FromDiscord | <4zv4l> like I have to check around the current case |
09:53:34 | FromDiscord | <4zv4l> but if the case is at the border of the array I guess a panic |
09:58:45 | * | Notxor joined #nim |
10:02:05 | * | randomuser464876 joined #nim |
10:05:50 | * | kenran quit (Remote host closed the connection) |
10:06:13 | * | kenran joined #nim |
10:41:04 | * | nanxiao joined #nim |
10:45:19 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rGb |
10:45:40 | FromDiscord | <sOkam!> something like pairs, but pairs doesn't seem to work on iterables 🤔 |
10:47:47 | * | nanxiao quit (Quit: Client closed) |
10:53:55 | * | nanxiao joined #nim |
10:54:08 | ormiret | sOkam: enumerate |
10:54:15 | FromDiscord | <amadan> Like have an incrementing index? Maybe https://nim-lang.org/docs/enumerate.html#enumerate.m%2CForLoopStmt |
11:00:48 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4rGe |
11:01:45 | FromDiscord | <ieltan> I am on 1.6.10 |
11:02:17 | * | nanxiao quit (Quit: Client closed) |
11:08:01 | * | jmdaemon quit (Ping timeout: 240 seconds) |
11:11:34 | Amun-Ra | ieltan: typeof Natural \n typeof 4 |
11:12:17 | Amun-Ra | Natural is a range |
11:12:29 | * | beholders_eye joined #nim |
11:22:43 | NimEventer | New thread by mhComa: Why this code works?, see https://forum.nim-lang.org/t/10033 |
11:27:20 | * | randomuser464876 quit (Quit: Client closed) |
11:30:23 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4rGj |
11:31:00 | * | beholders_eye quit (Ping timeout: 252 seconds) |
11:31:02 | FromDiscord | <Yardanico> typeof of a type returns the typedesc |
11:31:05 | FromDiscord | <ieltan> In any case, how do i rewrite `4 is Natural` so it works in my usecase? |
11:32:35 | FromDiscord | <choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=4rGk |
11:34:38 | FromDiscord | <Yardanico> In reply to @ieltan "In any case, how": https://forum.nim-lang.org/t/2470#62085 is an easy solution |
11:34:54 | FromDiscord | <Yardanico> `proc contains[T](a: typedesc[range], b: T): bool = b in a.low..a.high` courtesy of beef |
11:35:33 | FromDiscord | <Yardanico> then you can just do `echo 1 in Natural` because in Nim `in` operator calls `contains` overloaded for the types you're checking |
11:36:32 | FromDiscord | <Yardanico> In reply to @choltreppe "hey all, I want": You can actually do a similar thing but do it with `compiles` so that the code is checked to be side-effect free at compile-time, and then you error if it's not |
11:36:45 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/2923 for example |
11:40:02 | FromDiscord | <ieltan> In reply to @Yardanico "https://forum.nim-lang.org/t/2470#62085 is an easy": Oh man thanks ! |
11:40:19 | FromDiscord | <ieltan> (This should be included in the stdlib imo) |
11:43:00 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rGm |
11:43:00 | FromDiscord | <ieltan> Ah it breaks when you feed it floats |
11:43:01 | FromDiscord | <ieltan> 😢 |
11:43:10 | FromDiscord | <Yardanico> because Natural is for ints |
11:43:20 | FromDiscord | <ieltan> yeah |
11:43:21 | FromDiscord | <Yardanico> In reply to @Yardanico "something like this, although": @choltreppe try adding an `echo` inside the `checkSideEffects` and see it error out |
11:43:30 | FromDiscord | <ieltan> should check for floats ig |
11:43:43 | FromDiscord | <Yardanico> In reply to @ieltan "should check for floats": ranges can only be of one type |
11:44:07 | FromDiscord | <ieltan> In reply to @Yardanico "ranges can only be": No, i mean, in my code |
11:44:21 | FromDiscord | <Yardanico> In reply to @Yardanico "<@705152179782025308> try adding an": although making it a macro would be better so that it would show error in the place where it's used, and not in the template |
11:44:24 | FromDiscord | <choltreppe> In reply to @Yardanico "something like this, although": I actually just found a better solution for my problem :/ but thanks for your help |
11:44:30 | FromDiscord | <Yardanico> can you share it? |
11:45:02 | FromDiscord | <ieltan> Oh, what about `Positive` ? |
11:45:24 | FromDiscord | <Yardanico> what about it? |
11:45:25 | FromDiscord | <ieltan> its a range too oosp |
11:45:51 | FromDiscord | <Yardanico> In reply to @ieltan "its a range too": if you just want to check for numbers being in some range, you can just write procs that check it |
11:45:59 | FromDiscord | <Yardanico> ranges are just a short-hand for checking if a number is in the range manually |
11:46:20 | FromDiscord | <Yardanico> and for documenting needed arguments better |
11:46:33 | FromDiscord | <choltreppe> my original problem was that I wanted to assert specific variables dont get modified. so I noticed noSideeffect would be too harsh. and since I know wich vars are of interrest I can just do the good old `let x = x` showdowing inside a block trick. |
11:47:54 | FromDiscord | <ieltan> In reply to @Yardanico "if you just want": I already did that and I just want to avoid floats and negative numbers, but x.Natural takes cares of not having floats |
11:48:00 | FromDiscord | <ieltan> negatives are still a problem |
11:48:19 | FromDiscord | <Yardanico> not sure what you mean, use positive? |
11:49:12 | FromDiscord | <ieltan> Yeah i got it, thanks ! |
11:49:32 | FromDiscord | <Yardanico> In reply to @ieltan "Yeah i got it,": also btw, ranges aren't some special magic, you can just define them in your own code too |
11:58:53 | FromDiscord | <sOkam!> How is ennumerate used with an iterable? |
11:59:05 | FromDiscord | <sOkam!> (edit) "ennumerate" => "enumerate" |
12:12:00 | FromDiscord | <Yardanico> In reply to @sOkam! "How is enumerate used": you just do `enumerate(iterable)`? |
12:12:08 | FromDiscord | <Yardanico> iterable should have items defined of course so it can be iterated on |
12:22:44 | * | PMunch quit (Quit: Leaving) |
12:30:01 | * | derpydoo quit (Ping timeout: 240 seconds) |
12:56:24 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rGL |
12:56:47 | FromDiscord | <sOkam!> i mean a literal iterable, not an object that can be iterated |
12:57:30 | FromDiscord | <sOkam!> enumerate seems to be working fine for strings,seq,etc... but the input is an iterable, not an object that can be iterated |
13:03:08 | FromDiscord | <konradmb> I need an aligned slice of memory, so I'm using posix\_memalign(). Then I need to free it, so I use c\_free().↵I think I'm supposed to use dealloc() in Nim, but it gives SIGSEGV when freeing. So are there any drawbacks when I use c\_free()? |
13:03:54 | FromDiscord | <spoon> are you using --mm:none? |
13:04:53 | FromDiscord | <konradmb> No, default devel, so orc |
13:05:49 | FromDiscord | <spoon> wondering if its smart enough not to insert an extra dealloc at compiletime |
13:07:54 | FromDiscord | <konradmb> Wait, what? So gc will free externally allocated memory from C? |
13:08:39 | FromDiscord | <konradmb> Or you mean to just leak? |
13:11:00 | FromDiscord | <spoon> i'd have to run benchmarks but on old memory management models i never had a problem with allocating external c anything |
13:24:03 | FromDiscord | <Gumbercules> In reply to @konradmb "Wait, what? So gc": No it won't. Use c_free. |
13:24:48 | FromDiscord | <Gumbercules> The memory wasn't allocated using Nims allocator - it doesn't have anything to do with GC. |
13:28:49 | * | nanxiao joined #nim |
13:38:11 | FromDiscord | <tandy> has anyone use nimporter with a futhark wrapped library? |
13:38:11 | FromDiscord | <tandy> has anyone used nimporter with a futhark wrapped library? |
13:42:21 | * | nanxiao quit (Quit: Client closed) |
13:47:56 | FromDiscord | <Phil> PMunch , the words of futhark have been uttered |
13:48:16 | FromDiscord | <Phil> (edit) "PMunch , ... the" added "I summon thee," |
14:04:18 | * | beholders_eye joined #nim |
14:11:18 | * | rockcavera joined #nim |
14:16:10 | FromDiscord | <0ffh> In reply to @Isofruit "PMunch , I summon": I think @PMunch should work better, only there's two @PMunch |
14:16:35 | FromDiscord | <Phil> In reply to @0ffh "I think <@696333749570371585> should": I'm trying to reach the much more used matrix account, which reacts on mere name mentions |
14:16:56 | FromDiscord | <0ffh> In reply to @Isofruit "I'm trying to reach": Ah, I see! 👍 |
14:19:04 | * | advesperacit quit (Ping timeout: 276 seconds) |
14:27:29 | FromDiscord | <Gumbercules> In reply to @konradmb "I need an aligned": It'd be really nice if we could do this in Nim |
14:29:02 | FromDiscord | <Gumbercules> I mean we can... But we either have to use mimalloc or malloc |
14:29:12 | * | jmdaemon joined #nim |
14:30:11 | FromDiscord | <Gumbercules> Nim's general purpose allocator doesn't offer any procedures related to controlling alignment |
14:32:14 | arkanoid | is it possible to make nim load dynamic libs in such a way that ldd would list them? |
14:33:00 | FromDiscord | <Yardanico> yes, you can link with them with -l C compiler option |
14:33:02 | FromDiscord | <PMunch> In reply to @Isofruit "PMunch , I summon": Who dares interrupt my slumber! |
14:34:43 | * | derpydoo joined #nim |
14:35:00 | arkanoid | Yardanico, mmm weird, I'm doing that, prog works at runtime, but ldd is not listing my libfoo.so like if it gets loaded at runtime. I'm compiling with -lfoo |
14:36:01 | FromDiscord | <PMunch> In reply to @tandy "has anyone used nimporter": Haven't tried this, but I guess it should work |
14:36:29 | FromDiscord | <PMunch> Never used nimporter though, so really I have no idea |
14:36:47 | FromDiscord | <Yardanico> works here @arkanoid, although I've tried it with pcre and not a custom library |
14:37:17 | FromDiscord | <Yardanico> basically use std/re in code and then compile with `--passC:"-lpcre"` and it shows up with ldd |
14:37:30 | FromDiscord | <Yardanico> i'll try with a custom lib now as well |
14:38:01 | arkanoid | Yardanico, please don't waste time on this. I'll try in a VM as it sounds weird to me too |
14:38:16 | arkanoid | thanks for the feedback |
14:38:19 | FromDiscord | <Yardanico> eh, it's not like I'm a very busy person :P |
14:44:45 | * | jmdaemon quit (Ping timeout: 255 seconds) |
14:54:37 | FromDiscord | <ajusa> In reply to @Yardanico "eh, it's not like": Merge my PR to cosmonim then 😛 |
14:54:48 | FromDiscord | <Yardanico> there's a PR for it?! |
14:55:00 | FromDiscord | <Yardanico> sorry missed it |
14:55:09 | FromDiscord | <Yardanico> merged |
14:55:34 | FromDiscord | <Yardanico> lemme edit the readme so it mentions cloning recursively |
14:55:50 | FromDiscord | <ajusa> Ah forgot to add that, thanks |
14:56:08 | FromDiscord | <ajusa> The Cosmo include package makes a bunch of stuff compile out of the box thankfully |
15:01:33 | FromDiscord | <Yardanico> @ajusa looks like that stubs repo is missing a file needed for nim asyncdispatch though |
15:01:38 | FromDiscord | <Yardanico> sys/signalfd.h which I had in my stubs dir |
15:02:43 | FromDiscord | <Yardanico> hm weird, I remember cosmonim being able to compile asyncserv without stdlib patches later on, but seems like it's still the same |
15:03:47 | FromDiscord | <ajusa> In reply to @Yardanico "sys/signalfd.h which I had": Oops, I don't use async/await so I never verified that |
15:04:31 | FromDiscord | <ajusa> Easiest thing to do would be a PR to the stubs repo though |
15:04:35 | FromDiscord | <Yardanico> yeah |
15:06:56 | FromDiscord | <Yardanico> <https://github.com/fabriziobertocci/cosmo-include/pull/6> |
15:11:38 | FromDiscord | <Yardanico> btw @ajusa just curious, what projects did you use cosmopolitan for? |
15:12:32 | FromDiscord | <ajusa> In reply to @Yardanico "btw <@102899813149855744> just curious,": I was working on getting https://github.com/lovebrew/lovebrew to work with cosmonim |
15:12:41 | FromDiscord | <Yardanico> oh |
15:12:44 | FromDiscord | <ajusa> And I got it working as well locally, never made a PR |
15:13:21 | FromDiscord | <ajusa> As it's a game distributor for multiple different OS, it helps if it runs on all those OSs without issues 🙂 |
15:13:27 | FromDiscord | <Yandall> sent a code paste, see https://play.nim-lang.org/#ix=4rI2 |
15:13:40 | FromDiscord | <Yardanico> nope, a variable can only be of one type |
15:13:45 | FromDiscord | <Yardanico> you can use object variants though |
15:13:48 | FromDiscord | <Yardanico> (edit) "you can use object variants though ... " added "to achieve something similar" |
15:15:15 | FromDiscord | <Yardanico> something like this |
15:15:17 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rI3 |
15:15:28 | FromDiscord | <Yardanico> you can make a nice constructor proc so you don't have to write the heavy object construction syntax every time |
15:15:29 | FromDiscord | <debris> sent a code paste, see https://play.nim-lang.org/#ix=4rI4 |
15:15:43 | FromDiscord | <debris> (Sorry to burst in.) |
15:16:16 | FromDiscord | <Yardanico> @debris hi, is there any reason you can't just make proc overloads for each type? |
15:16:38 | FromDiscord | <Yardanico> for example you can have `proc newPoint(num: float64): FPoint = FPoint(kind: number, number: num)` |
15:16:39 | * | onetwo381 joined #nim |
15:16:44 | FromDiscord | <Yardanico> and just make more overloads for different types |
15:17:05 | FromDiscord | <Yardanico> or you can make a single proc that switches between kinds at compile-time which is essentially the same |
15:17:14 | FromDiscord | <Yardanico> with `when/elif/else` |
15:17:36 | FromDiscord | <debris> I want to be able to extend the types ad infinitum, this might not be scalable in this case↵(@Yardanico) |
15:17:48 | FromDiscord | <ringabout> See also => https://github.com/nim-lang/RFCs/issues/418#issuecomment-907698310 |
15:17:49 | FromDiscord | <Yardanico> and yeah, if you always have same kind name and value, you can use a template to achieve what you wanted to achieve with a macro |
15:18:19 | * | onetwo38 quit (Ping timeout: 246 seconds) |
15:18:19 | * | onetwo381 is now known as onetwo38 |
15:18:39 | FromDiscord | <Yardanico> also, I think `void` type for a variable is not something that'd work? |
15:19:02 | FromDiscord | <ringabout> Hopefully https://github.com/nim-lang/Nim/pull/21559 will be merged for v2. |
15:19:07 | FromDiscord | <Yandall> sent a code paste, see https://play.nim-lang.org/#ix=4rI5 |
15:19:17 | FromDiscord | <debris> `ref void` , then? IIRC Lua uses null pointers for its `nil` value. |
15:19:20 | FromDiscord | <Yardanico> yes, see https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
15:19:29 | FromDiscord | <Yardanico> In reply to @debris "`ref void` , then?": you can just do `discard` to have an empty branch |
15:19:41 | FromDiscord | <Yardanico> although then you'll need to write a specific overload for an empty value since there won't be an empty field |
15:20:28 | FromDiscord | <Yardanico> something like this maybe @debris ? |
15:20:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rI7 |
15:21:12 | FromDiscord | <Yardanico> thanks to ufcs you can then do fancy stuff like `number.newPoint(1.0)` |
15:22:37 | FromDiscord | <debris> Oh, this is perfect! I think I'll take a look at templates some more.↵(@Yardanico) |
15:22:47 | FromDiscord | <debris> And that notation looks great too. |
15:23:08 | FromDiscord | <Yardanico> templates are "just" code substitution, you have to be careful with them because they just replace all references to the argument in their body to the argument itself |
15:23:15 | FromDiscord | <Yardanico> even if you don't write `` |
15:23:29 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#templates |
15:24:40 | FromDiscord | <Yandall> @Yardanico the case statement has to use an enum? Or can I just use a string? |
15:25:14 | FromDiscord | <Yardanico> if you mean in the object itself for object variants, it has to be an ordinal type, so no strings |
15:25:45 | FromDiscord | <Yandall> Understand. Thanks |
15:25:52 | FromDiscord | <Yandall> (edit) "Understand." => "Understood." |
15:40:26 | FromDiscord | <Yardanico> @ajusa asynchttpserver does work after a bit of stdlib patching, in fact I could do the same by just defining -d:android, and then there's only one place that needs fixing - IN6_IS_ADDR_V4MAPPED not being defined in cosmopolitan https://media.discordapp.net/attachments/371759389889003532/1088849813321302126/image.png |
15:40:58 | FromDiscord | <Yardanico> I wonder if I can just define that thing myself to make the compiler happy |
15:41:14 | FromDiscord | <Yardanico> since it seems to be a simple C macro https://media.discordapp.net/attachments/371759389889003532/1088850015922954332/image.png |
15:41:35 | FromDiscord | <ajusa> Probably? Even if you have to use .emit. that'd work |
15:42:23 | FromDiscord | <Yardanico> wait actually Nim already includes a custom impl of it when -d:lwip is defined |
15:42:28 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1088850329010970755/image.png |
15:42:55 | FromDiscord | <Yardanico> although it also changes some other things so defining it is not desirable I think, but I can just copy it without modifying the stdlib, lemme try |
15:44:50 | FromDiscord | <Yardanico> although even -d:android defines some stuff, I think adding cosmLibc define to Nim would be good, but I don't know if it's worth adding more defines like that to the compiler :P |
15:45:29 | FromDiscord | <Yardanico> but yes it just works with `-d:android` and that proc impl copied with exportc |
15:59:53 | FromDiscord | <Yardanico> updated cosmonim |
16:19:51 | FromDiscord | <Nerve> In reply to @Yardanico "": Hey is that Iosevka font, or something else? |
16:21:16 | FromDiscord | <Yardanico> In reply to @Nerve "Hey is that Iosevka": yeah, Iosevka Semibold with font-weight 400 |
16:21:23 | FromDiscord | <Yardanico> theme is https://marketplace.visualstudio.com/items?itemName=jackjyq.brogrammer-plus |
16:21:56 | * | azimut quit (Ping timeout: 255 seconds) |
16:31:37 | FromDiscord | <Entikan> is there something like python's defaultdict for nim? |
16:35:43 | * | arkurious joined #nim |
16:35:55 | FromDiscord | <Yardanico> In reply to @Entikan "is there something like": If you mean having default values for all keys that don't exist, I don't think so, but making one should be quite easy |
16:36:14 | * | kenran quit (Remote host closed the connection) |
16:38:06 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rIA |
16:38:13 | FromDiscord | <Yardanico> ofc you can make it always have default as a value and not as a proc |
16:48:33 | FromDiscord | <0ffh> Not bad for automatically generated code.↵I think ``d.table.getOrDefault(key,d.default) `` would be faster and less code. |
16:49:07 | FromDiscord | <Yardanico> In reply to @0ffh "Not bad for automatically": I did modify it a bit, it's not 100% copilot :) and yeah, getOrDefault should be better because it will shave off 1 extra key check |
16:50:25 | FromDiscord | <Yardanico> @0ffh there's a problem with using getOrDefault here though |
16:50:37 | FromDiscord | <0ffh> In reply to @Yardanico "I did modify it": Nevertheless, I really feel I must get myself CoPilot or something similar sooner or later. |
16:50:45 | FromDiscord | <Yardanico> since it's a proc, it always evaluates default, even if the key is in the table |
16:50:53 | FromDiscord | <Yardanico> so if the default proc does some side effects it'll bring undesirable results |
16:51:37 | FromDiscord | <Yardanico> there's https://nim-lang.org/docs/tables.html#withValue.t%2CTable%5BA%2CB%5D%2CA%2Cuntyped%2Cuntyped%2Cuntyped with which you can only have one key check, but it requires the table to be `var` |
16:54:09 | FromDiscord | <0ffh> In reply to @Yardanico "so if the default": Yeah, right! I didn't even really notice default is a proc, not just a value. 😂 ↵That's the downside to call without () in Nim I suppose, at the invocation point you can't tell a member from a method (in OO parlance).↵That's of course exactly the same issue that's also the upside... 🤔 |
16:55:57 | FromDiscord | <Yardanico> In reply to @0ffh "Yeah, right! I didn't": well the code does use d.default() with parens :) |
16:56:18 | FromDiscord | <0ffh> Mine doesn't =) |
16:56:41 | FromDiscord | <0ffh> Q: What's the reason for a default proc? |
16:57:27 | FromDiscord | <0ffh> Instead of just a value, I mean. |
16:57:48 | FromDiscord | <Yardanico> because defaultdict in Python does that |
16:58:23 | FromDiscord | <Yardanico> at least one of its overloads |
16:58:29 | FromDiscord | <0ffh> Okay, I suppose "they must have a good reason" is a reason in itself. |
16:58:53 | FromDiscord | <0ffh> Not very satisfying though... 😂 |
17:20:16 | * | fallback joined #nim |
17:23:26 | FromDiscord | <Entikan> In reply to @0ffh "Instead of just a": it's nice for n-sized 3d coordinates |
17:23:49 | FromDiscord | <0ffh> After looking at the examples in the Python docs, I think the reason is that it doesn't use a lot of value types.↵Imagine e.g. I gave it an empty list as the default value. When I read from an uninitialized key, I get that list. If I then modify that list, it modifies the default value. |
17:24:34 | FromDiscord | <0ffh> Similar for all kinds of Python objects. |
17:25:22 | FromDiscord | <Entikan> `voxels[iVec3(8,8,4)].add(sand)` |
17:25:38 | FromDiscord | <0ffh> You'd have the same problem in Nim with ref objects. |
17:25:54 | FromDiscord | <0ffh> In reply to @Entikan "`voxels[iVec3(8,8,4)].add(sand)`": Yeah, I see that's also a point. |
17:26:19 | FromDiscord | <Yardanico> @Entikan you have to care about performance though, I'd imagine doing this for a lot of voxels will be quite slow |
17:26:57 | FromDiscord | <Entikan> it's mostly a solution for memory, so you don't have to store giant arrays of air |
17:27:08 | FromDiscord | <Entikan> the default tile is air |
17:27:09 | FromDiscord | <0ffh> In reply to @Yardanico "<@716041936758374501> you have to": Yeah, I think it only works nicely if the voxel space is sparsely populated. |
17:27:28 | FromDiscord | <Entikan> (edit) "tile" => "tile/voxel" |
17:27:53 | FromDiscord | <Yardanico> In reply to @Entikan "it's mostly a solution": hm, then I guess you can write some custom code instead of such a type? it'd not look as pretty but it'll be custom for your needs so it shouldn't be slow |
17:28:00 | FromDiscord | <Yardanico> just getOrDefault should actually be enough for your usecase |
17:28:16 | FromDiscord | <Yardanico> voxels.getOrDefault(iVec(8, 8, 4), someStaticVarForAirTile) |
17:28:27 | FromDiscord | <Entikan> yeah that would do fine |
17:28:58 | FromDiscord | <Entikan> danke |
17:30:37 | * | jmdaemon joined #nim |
17:46:33 | FromDiscord | <Phil> Recompiling my project↵I eagerly await the day where the default gcc linker is faster than a snail |
17:55:18 | FromDiscord | <Yardanico> In reply to @Isofruit "*Recompiling my project* I": why not use mold if it's such a big project? |
17:55:20 | FromDiscord | <Yardanico> or are you using LTO? |
17:55:22 | FromDiscord | <Yardanico> (edit) "LTO?" => "LTO or something?" |
17:56:00 | FromDiscord | <Yardanico> <https://github.com/rui314/mold> |
17:56:05 | FromDiscord | <Phil> In reply to @Yardanico "or are you using": That's the one, ` --define:lto` |
17:56:20 | FromDiscord | <Yardanico> well, if you're developing something, don't use LTO for faster iteration times |
17:56:31 | FromDiscord | <Yardanico> LTO is only supposed to be used for final release builds really, and maybe for testing |
17:56:32 | FromDiscord | <Yardanico> (edit) "LTO is only supposed to be used for final release builds really, and maybe for testing ... " added "them" |
17:56:47 | FromDiscord | <Yardanico> it will slow down linking considerably for bigger projects obviously |
17:56:53 | FromDiscord | <Phil> Oh I am not, I am just mildly annoyed that doing prod builds takes like 3-5 minutes until the docker images are uploaded |
17:57:00 | FromDiscord | <Phil> Of which linking is at least 1-2 minutes |
17:57:14 | FromDiscord | <Yardanico> oh, have you tried clang's thinlto? |
17:57:19 | FromDiscord | <Phil> Nope |
17:57:24 | FromDiscord | <Yardanico> i mean it should be faster to compile and performance-wise shouldn't be too much worse |
17:57:46 | FromDiscord | <Yardanico> change `-flto` to `-flto=thin` and see if it's faster, assuming you use clang that is |
17:57:52 | FromDiscord | <Yardanico> if you use zig cc you are using clang |
17:58:25 | FromDiscord | <Phil> Nah, musl-gcc |
17:58:29 | FromDiscord | <Yardanico> :( |
17:58:46 | FromDiscord | <Yardanico> too bad :nimAngry: |
18:01:16 | FromDiscord | <Phil> Hmmmm I'm running into an.. "interesting" issue |
18:01:32 | FromDiscord | <Phil> So my webserver has 1 CPU thread available, since it is a potato as I am cheap as fuck |
18:02:40 | FromDiscord | <Phil> Now when my prologue application receives a request to reset the password of an account, it next needs to authenticate against the email-provider that I use for those purposes.↵That authentication fails, but that's fine currently, it's allowed to, I haven't updated the password yet.↵What is troubling is that during that time the entire webserver becomes unresponsive to further requests |
18:02:45 | FromDiscord | <Phil> And I don't fully understand why |
18:02:56 | FromDiscord | <Yardanico> how are you doing that authentication? |
18:03:12 | FromDiscord | <Yardanico> if it blocks it's evident (I think) that you're doing some blocking non-async operation |
18:03:30 | FromDiscord | <Phil> The authentication is most definitely blocking |
18:03:33 | FromDiscord | <Yardanico> like if you're doing newHttpClient and not newAsyncHttpClient |
18:03:49 | FromDiscord | <Phil> But what is weird is that the handler itself is an async proc, so it shouldn't call the entire server |
18:04:10 | FromDiscord | <Yardanico> well, it doesn't really matter if the handler is async, if the handler has blocking code it'll block the entire server since the whole async thing runs in a single thread |
18:04:47 | FromDiscord | <Yardanico> you really only have three solutions: 1) rewrite the code so it's truly async 2) use threading to execute blocking code in a different thread 3) live with the server blocking during auth :P |
18:04:49 | FromDiscord | <Phil> Well crap |
18:05:44 | FromDiscord | <Yardanico> how is the authentication done? |
18:05:51 | FromDiscord | <Yardanico> if it's some http requests you can just rewrite it to use the async version of the httpclient |
18:06:07 | FromDiscord | <Yardanico> smtp module in NIm also has an async version |
18:06:15 | FromDiscord | <Yardanico> (edit) "NIm" => "Nim" | "Nimalso has an async version ... " added "if you're using smtp" |
18:06:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rIU |
18:06:21 | FromDiscord | <Yardanico> yeah just use async smpt version :) |
18:06:26 | FromDiscord | <Yardanico> https://nim-lang.org/docs/smtp.html#AsyncSmtp |
18:07:03 | FromDiscord | <Phil> smtp was also moved out of the std lib right? |
18:07:09 | FromDiscord | <Yardanico> yeah I think |
18:07:11 | FromDiscord | <Yardanico> in devel |
18:07:15 | FromDiscord | <Phil> Trying to wrap my head around why I have an explicit require of smtp |
18:07:20 | FromDiscord | <Phil> Checks out |
18:07:27 | FromDiscord | <Yardanico> just change it to call newAsyncSmtp, and add `await` to `connect`, `startTls`, `auth`, `sendMail` |
18:07:31 | FromDiscord | <Yardanico> and it should theoretically just work |
18:07:35 | FromDiscord | <Yardanico> ah, and make the proc itself {.async.} |
18:15:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rIX |
18:16:25 | FromDiscord | <Phil> The proc declaration line is line 115 btw |
18:16:33 | FromDiscord | <Yardanico> the problem is "just" that you can't capture vars in async coroutines |
18:16:40 | FromDiscord | <Yardanico> you have to wrap the thing you want to mutate in a `ref` |
18:16:44 | FromDiscord | <Yardanico> and pass that to your async coroutine |
18:17:08 | FromDiscord | <Phil> But there must be a good reason for why I can't do that, what is the compiler exactly trying to protect me from here? |
18:17:16 | FromDiscord | <Yardanico> I think it's really just a limitation of the async code |
18:18:19 | FromDiscord | <Yardanico> err, not async, but general closure code |
18:18:19 | FromDiscord | <Yardanico> see e.g. <https://github.com/nim-lang/Nim/issues/17187> |
18:18:46 | FromDiscord | <Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4rJ0 |
18:20:28 | FromDiscord | <Phil> Okay how do I get the ref of that?↵I typically just do `new someConstruct` and bam, ref gained.↵I can't do `new(User)` because that'll just generate me a normal user |
18:20:33 | FromDiscord | <Phil> since User is already a ref type |
18:20:41 | FromDiscord | <Phil> Do I have to define a new type? |
18:20:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rJ1 |
18:21:31 | FromDiscord | <Yardanico> In reply to @Gumbercules "I'm wrapping a C": I think a forum post would be better for a question like this |
18:21:37 | FromDiscord | <Gumbercules> Blah |
18:21:59 | FromDiscord | <Gumbercules> I'll create one later today - need to head to the store |
18:22:07 | FromDiscord | <Gumbercules> Figured someone might know off the top of their head, but yeah, probably wishful thinking |
18:22:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rJ2 |
18:22:45 | FromDiscord | <Gumbercules> if I knew what exactly the `extern` keyword did in Zig I could probably figure it out on my own |
18:22:53 | FromDiscord | <Gumbercules> but besides the lame description in Zig's docs, I have no clue |
18:22:59 | FromDiscord | <Yardanico> In reply to @Isofruit "That won't run, here": you misunderstood me a bit, my example is for when your User type is not a ref |
18:23:08 | FromDiscord | <Gumbercules> I also don't understand why copying the C API type exactly doesn't produce the expected results |
18:24:41 | FromDiscord | <Phil> I think now I'm confused.↵I'm supposed to generate var ref User right, in my case User is already a ref-type (since it's a norm-model, which are ref-types)? ↵How do I get there? |
18:25:34 | FromDiscord | <Yardanico> In reply to @Isofruit "I think now I'm": no, you just get a ref User |
18:25:44 | FromDiscord | <Yardanico> the content in the refs is mutable |
18:25:51 | FromDiscord | <Yardanico> you can't modify the reference itself |
18:25:58 | FromDiscord | <Yardanico> unless you do `var ref X` |
18:26:18 | FromDiscord | <Yardanico> and in your case you only seem to need to modify the contents of it, right? |
18:26:21 | FromDiscord | <Yardanico> lemme show |
18:26:44 | FromDiscord | <Phil> Yeah, it's basically assign user the new password hash and store in db, but the async-proc (the email sender) doesn't even need that |
18:27:23 | FromDiscord | <Phil> The email sender just needs the current user, that's all.↵That user will subsequently in later procs be updated with the new password (I don't allow updating the user if I can't send you the password reset mail) |
18:27:25 | FromDiscord | <PunchCake> So guys how hard would it be to make a native gui lib in nim? |
18:27:37 | FromDiscord | <Phil> Beyond my expertise level |
18:27:40 | FromDiscord | <PunchCake> Nim lacks a native gui lib that looks good so badly |
18:27:50 | FromDiscord | <PunchCake> The only option would be qt |
18:27:53 | FromDiscord | <PunchCake> Bindings |
18:28:31 | FromDiscord | <Yardanico> In reply to @Isofruit "The email sender just": yes, so you can either just make your `User` type a `ref object`, or create `UserRef = ref User` and pass that to async procs that need to mutate the User |
18:28:48 | FromDiscord | <Yardanico> the former is simpler, it will have some overhead of dynamic allocation of course, but I doubt it's noticeable for a web app |
18:29:18 | FromDiscord | <Phil> I mean, the definition of of user is already `type User {.defaults, tableName: USER_TABLE.} = ref object of Model` |
18:29:32 | FromDiscord | <Yardanico> huh, then you don't even need to specify `var` |
18:29:33 | FromDiscord | <Phil> So it should already be a ref object |
18:29:38 | FromDiscord | <Yardanico> because you can mutate the contents of the object itself |
18:29:39 | FromDiscord | <Gumbercules> In reply to @PunchCake "So guys how hard": as hard as it would be in any other language |
18:29:44 | FromDiscord | <Yardanico> (edit) "because you can mutate the contents of the object itself ... " added "already" |
18:29:58 | FromDiscord | <PunchCake> Where can i start |
18:30:04 | FromDiscord | <Gumbercules> if you want to assess the difficulty, look at the various native windowing APIs (win32, cocoa, X) |
18:30:12 | FromDiscord | <PunchCake> I wanna contribute to this lovely language |
18:30:13 | FromDiscord | <Gumbercules> well - using something like |
18:30:19 | FromDiscord | <Yardanico> for some inspiration see <https://github.com/simonkrauter/NiGui>, it's abandoned though |
18:30:26 | FromDiscord | <Yardanico> oh, it's not abandoned, my bad |
18:30:30 | FromDiscord | <Gumbercules> https://github.com/simonkrauter/NiGui would be a good starting point |
18:30:32 | FromDiscord | <Yardanico> haha |
18:30:34 | FromDiscord | <Gumbercules> xD |
18:30:47 | FromDiscord | <Gumbercules> this library is on the right track more than any other |
18:31:03 | FromDiscord | <Yardanico> also there's <https://github.com/neroist/uing> for a wrapper of libui-ng which is a C library that wants to do the same as NiGui but for C |
18:31:05 | FromDiscord | <Gumbercules> still a LOT of work that needs doing though |
18:31:08 | FromDiscord | <PunchCake> Idk why windows doesnt use winui 3 as the native gui lib |
18:31:13 | FromDiscord | <PunchCake> Not this ugly bs |
18:31:38 | FromDiscord | <Phil> In reply to @Yardanico "because you can mutate": Yes but also I like the explicitness of var |
18:32:01 | FromDiscord | <Phil> buuut thanks to the hint I figured out how to go about it |
18:32:07 | FromDiscord | <Yardanico> just remember that `var` for refs actually incurs additional runtime overhead since it makes the reference itself mutable, so the reference is passed as a double pointer |
18:32:13 | FromDiscord | <Yardanico> of course again it's not noticeable for a web app |
18:32:13 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rJ4 |
18:32:51 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rJ5 |
18:33:17 | FromDiscord | <Phil> Unless it starts costing me actual milliseconds I'll always prefer explicitness over non-explicitness |
18:33:39 | FromDiscord | <Yardanico> it's just that some people might get the wrong idea and think you need to modify the reference itself since that's what it means exactly |
18:34:34 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rJ7 |
18:34:49 | FromDiscord | <Phil> .... shit, I want immutable ref types |
18:34:53 | FromDiscord | <Yardanico> they exist |
18:34:56 | FromDiscord | <Yardanico> but they won't work for async procs |
18:34:58 | FromDiscord | <PunchCake> How hard would it be to bring this to nim ↵https://github.com/iced-rs/iced |
18:35:04 | FromDiscord | <PunchCake> Probably not too hard yes? |
18:35:08 | FromDiscord | <Yardanico> In reply to @Isofruit ".... shit, I want": funcs with strictFuncs does exactly that |
18:35:27 | FromDiscord | <Yardanico> <https://nim-lang.org/docs/manual_experimental.html#strict-funcs> |
18:35:42 | FromDiscord | <Phil> Yeah but then it'll screw me over when I want to start logging |
18:35:47 | FromDiscord | <Phil> As that's a side-effect |
18:36:01 | FromDiscord | <Yardanico> obviously, but you can of course cheat and mark your logging as not having a side effect |
18:36:14 | FromDiscord | <Yardanico> like <https://nim-lang.org/docs/system.html#debugEcho%2Cvarargs%5Btyped%2C%5D> |
18:36:23 | FromDiscord | <Yardanico> it's literally `echo` but marked as noSideEffect so it can used for debugging in funcs |
18:37:25 | FromDiscord | <Phil> ... maybe I should provide a "functional-logging" package that's a light wrapper over std/logging and slaps a noSideEffect pragma over all procs |
18:38:12 | FromDiscord | <Phil> God I hate how mutable ref-types are |
18:38:25 | FromDiscord | <Yardanico> but you do bring a useful point about adding a separate feature for strict immutability even for refs |
18:38:39 | FromDiscord | <Yardanico> although idk how much code that will add to the compiler |
18:38:53 | FromDiscord | <Yardanico> so that you can have strict immutability for refs without caring about side effects in general |
18:40:40 | FromDiscord | <hotdog> In reply to @Isofruit "God I hate how": I agree, it complicates the mental-model when reading Nim |
18:41:01 | FromDiscord | <hotdog> (I’m jumping into the conversation, I have no idea what the context is) |
18:41:03 | FromDiscord | <Phil> Up until 5 seconds ago I was fine because I just treated the pointers as if they were value-types |
18:41:17 | FromDiscord | <Phil> And then Yard let my world go up in flames |
18:41:27 | FromDiscord | <Yardanico> :nimRawr: |
18:42:21 | FromDiscord | <Phil> In reply to @hotdog "(I’m jumping into the": I basically just realized that in my web project whenever I used `var <SomeNormModel>` that was entirely pointless |
18:42:51 | FromDiscord | <Phil> And all the times I was like "This is nice to do, I can guarantee they won't screw around with my values in there" were me building on false hopes |
18:43:08 | FromDiscord | <Phil> "They" being me 5 days later |
19:03:54 | FromDiscord | <Phil> Well, at least that improves my understanding of ref types |
19:08:57 | FromDiscord | <TechnoRazor> sent a code paste, see https://play.nim-lang.org/#ix=4rJk |
19:09:17 | FromDiscord | <TechnoRazor> (edit) "https://play.nim-lang.org/#ix=4rJk" => "https://play.nim-lang.org/#ix=4rJl" |
19:10:42 | FromDiscord | <Phil> Unlikely to be as... I am actually not aware of anybody other than me that is actively playing around with them occasionally and I don't deal with generic types |
19:11:45 | FromDiscord | <Phil> So would be really cool if you filed an issue 😄 !↵@ringabout since that may be of interest for you as well |
19:13:43 | FromDiscord | <Yardanico> In reply to @Isofruit "So would be really": i mean he added them himself, so it is indeed interesting for him :) |
19:15:27 | FromDiscord | <Phil> On an unrelated note, I really should be looking at some service I can use to send mail emails through, using google mail has screwed me over multiple times now |
19:38:43 | FromDiscord | <ieltan> In reply to @Isofruit "I basically just realized": What's up with Norm models? |
19:39:01 | FromDiscord | <ieltan> Oh it is that they're `red object`? |
19:39:05 | FromDiscord | <Phil> In reply to @ieltan "What's up with Norm": Norm models are ref-types, and ref-types are never immutable |
19:39:18 | FromDiscord | <ieltan> (edit) "Oh ... it" added "is" | removed "is" | "`red" => "`ref" |
19:39:22 | FromDiscord | <Ayy Lmao> Would getting `Error: unhandled exception: ccgtypes.nim(197, 17) `false` mapType: tyUntyped [AssertionDefect]` be a compiler bug? |
19:39:26 | FromDiscord | <ieltan> Yeah I get it |
19:39:31 | FromDiscord | <Elegantbeef> Well ref type are immutable 😄 |
19:39:32 | FromDiscord | <Yardanico> In reply to @Ayy Lmao "Would getting `Error: unhandled": any compiler crash is a compiler bug |
19:39:36 | FromDiscord | <Elegantbeef> Just the pointer is immutable not the data |
19:39:45 | FromDiscord | <Yardanico> In reply to @Elegantbeef "Just the pointer is": yeah Phil means the actual data |
19:40:09 | FromDiscord | <Elegantbeef> Looks like you've got a `tyUntyped` past semantic analysis |
19:40:17 | FromDiscord | <Elegantbeef> So that means somehow you have a `untyped` somewhere in the ast |
19:40:59 | FromDiscord | <Ayy Lmao> I was using `expandMacros` and taking that away seems to fix it thankfully. |
19:42:18 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4rJx |
19:42:27 | * | rockcavera quit (Read error: Connection reset by peer) |
19:42:45 | * | rockcavera joined #nim |
19:42:45 | * | rockcavera quit (Changing host) |
19:42:45 | * | rockcavera joined #nim |
19:42:55 | FromDiscord | <Ayy Lmao> I am doing very cursed things so I guess it is understandable. |
19:43:16 | * | kenran joined #nim |
19:44:52 | FromDiscord | <PunchCake> is this the guy who made nim |
19:44:53 | FromDiscord | <PunchCake> https://github.com/Araq |
19:46:36 | FromDiscord | <Yardanico> yes |
19:52:25 | FromDiscord | <PunchCake> @treeform bro what happened to fidget? |
19:52:33 | FromDiscord | <Phil> In reply to @Elegantbeef "Just the pointer is": Given that I don't aspire to code in realms where I care to do pointer math or the like, that makes ref-types super painful |
19:57:27 | * | fallback quit (Quit: IRCNow and Forever!) |
20:02:15 | FromDiscord | <BobBBob> sent a code paste, see https://play.nim-lang.org/#ix=4rJC |
20:02:19 | FromDiscord | <BobBBob> just wondering if this is a thing, it's not important if it's not |
20:02:49 | FromDiscord | <Phil> In reply to @BobBBob "if I create an": You can define your own `[]` and `[]=` proc, aka operator overloading |
20:02:57 | FromDiscord | <Phil> well in this case it's more about defining your own operator |
20:03:32 | FromDiscord | <BobBBob> I guess that's worth it in my case |
20:04:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rJD |
20:04:54 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4rJD" => "https://play.nim-lang.org/#ix=4rJE" |
20:04:59 | FromDiscord | <Yardanico> you can define the dot operator too |
20:05:19 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual_experimental.html#special-operators-dot-operators |
20:05:22 | FromDiscord | <Phil> Yeah but `x.5` seems just a smidge odd |
20:05:27 | FromDiscord | <Yardanico> true |
20:05:42 | FromDiscord | <Yardanico> ah right didn't fully read the question, yeah, `.` isn't needed here |
20:05:50 | NimEventer | New thread by noah: Bun.sh supports nimlang, see https://forum.nim-lang.org/t/10034 |
20:09:17 | FromDiscord | <BobBBob> what about something like getting x.len? |
20:09:38 | FromDiscord | <BobBBob> instead of x.s.len |
20:12:59 | FromDiscord | <BobBBob> actually I got it, thanks |
20:14:47 | FromDiscord | <Phil> The answer would've been "it works the same" 😄 |
20:15:00 | FromDiscord | <Phil> since len can also just be written as a proc |
20:24:01 | FromDiscord | <Marcus> Is nim2c the best approach for wrapping a c++ lib with nim? |
20:28:51 | FromDiscord | <0ffh> @Phil About that immutable ref type you wanted. As an approximation, what about encapsulating a ref type in a distinct type that overloads ``.`` so you can read-access the object members but not write them? I know it's not the same, but it would at least approximate some of the behaviour of an immutable ref, |
20:29:52 | FromDiscord | <0ffh> (edit) "@Phil ... Aboutref." added "" | "ref," => "ref." |
20:30:09 | FromDiscord | <0ffh> (edit) "what" => "how" |
20:36:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rJL |
20:36:44 | FromDiscord | <Elegantbeef> I guess i should've implemented the `.` op 😄 |
20:42:18 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4rJN |
20:43:10 | FromDiscord | <jmgomez> Just deleted my message because the scroll on discord is kinda messed up and the original of the reply appeared as the last one lol |
20:44:05 | FromDiscord | <Elegantbeef> Welcome to discord! |
20:44:39 | FromDiscord | <jmgomez> 😛 |
20:46:29 | FromDiscord | <jmgomez> BTW Beef did a small video on the integration of NimVM in NUE, from the minute 9 to 10 do a small showcase in case you want to check it out |
20:47:06 | FromDiscord | <jmgomez> It mixes what we discussed the other day about replacing functions ad hoc in the vm |
20:53:07 | FromDiscord | <Elegantbeef> I see, looks good. Too bad verse exists 😛 |
20:56:04 | FromDiscord | <jmgomez> yeah, that was bad timing but it wont reach UE anytime soon, the perf so far is bad and no low level interop so you need to use C++ too |
20:56:52 | FromDiscord | <jmgomez> the transactional model that they presented sounds great for their use case though |
20:57:28 | FromDiscord | <Elegantbeef> Yea i seen some funny things about it |
20:57:44 | FromDiscord | <Elegantbeef> It doesnt implement floats according to the standard so NaN == NaN |
20:58:00 | FromDiscord | <Elegantbeef> Makes sense for their design, but just a funny feature |
21:02:08 | FromDiscord | <jmgomez> didnt know that one. I planed to do a perf comparison but probably I wont even bother... it compiles to the BP VM |
21:06:26 | FromDiscord | <Elegantbeef> I do still want to see you implement that generic plugin system! |
21:09:59 | FromDiscord | <jmgomez> I probably will! Want to complete the vm integration (so you can modify the editor too fro the VM) and maybe later I hack around and editor so people dont run away when they see no editor support.. |
21:10:07 | FromDiscord | <jmgomez> (edit) "and" => "an" |
21:10:28 | FromDiscord | <jmgomez> (edit) "I probably will! Want to complete the vm integration (so you can modify the ... editorvs" added "UE" | "UEeditor too fro the VM) and maybe later I hack around an editor so people dont run away when they see no ... editor" added "vs code" |
21:30:03 | * | beholders_eye quit (Ping timeout: 260 seconds) |
21:38:13 | * | cfa joined #nim |
21:42:39 | FromDiscord | <Nilts> In reply to @spoon "compiled the function succesfully": so what is the issue? |
21:43:49 | FromDiscord | <spoon> In reply to @not logged in "so what is the": it worked after i removed any libraries like asyncdispatch that referenced the nativesockets library which i believe is incompatible with js |
21:44:27 | FromDiscord | <Nilts> In reply to @spoon "it worked after i": why would you use async dispatch instead of asyncjs |
21:44:53 | FromDiscord | <spoon> i just removed the async library altogether |
21:45:14 | FromDiscord | <spoon> i mean it compiled i didnt unit test it |
21:56:39 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rKa |
21:57:39 | * | cfa left #nim (#nim) |
22:02:04 | FromDiscord | <Ayy Lmao> Is there a way to do expandMacros without the code needing to be valid? |
22:03:44 | FromDiscord | <Elegantbeef> `dumpTree` |
22:03:50 | FromDiscord | <Elegantbeef> `expandMacros` takes a `typed` parameter |
22:03:54 | FromDiscord | <Elegantbeef> `dumptree` takes an untyped parameter |
22:04:12 | FromDiscord | <Nilts> In reply to @Ayy Lmao "Is there a way": if the macro is yours, do result.repr |
22:05:32 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "`dumptree` takes an untyped": Is there a way to fold it back into more readable nim code? |
22:06:02 | FromDiscord | <Elegantbeef> You can make your own macro that prints the repr |
22:06:05 | FromDiscord | <Elegantbeef> But what's the point of that |
22:06:13 | FromDiscord | <Elegantbeef> A macro that doesnt expand macros doesnt make sense |
22:07:12 | FromDiscord | <Ayy Lmao> I guess what I want is a way to see if a macro looks like it is outputting the correct result without needing the code to compile. |
22:07:29 | FromDiscord | <Ayy Lmao> But I'm not sure if that's possible. |
22:08:24 | FromDiscord | <Ayy Lmao> Basically expandMacros but untyped. |
22:09:40 | FromDiscord | <Ayy Lmao> dumpTree isn't dumping the result of the macro being unfolded |
22:10:06 | * | kenran quit (Remote host closed the connection) |
22:14:12 | FromDiscord | <spoon> In reply to @not logged in "same error same part,": it compiles |
22:14:38 | FromDiscord | <Elegantbeef> Well to have a macro expand it has to be compiled, unless you do `echo result.repr` |
22:14:50 | FromDiscord | <Nilts> In reply to @spoon "it compiles": you have to run it XD, it is a runtime error |
22:15:54 | FromDiscord | <spoon> actually no i forgot to save it |
22:16:01 | FromDiscord | <spoon> 😭 i need to fix my nvim icons |
22:18:52 | FromDiscord | <spoon> `jstt2.js(1, 37) Error: identifier expected, but got '9.1'` https://media.discordapp.net/attachments/371759389889003532/1088950085230022727/image.png |
22:18:59 | FromDiscord | <spoon> oh good, an error on the comment |
22:19:19 | FromDiscord | <Nilts> In reply to @spoon "oh good, an error": i think your ide is borken |
22:19:34 | FromDiscord | <spoon> no that was the output from `nim js` |
22:19:49 | FromDiscord | <spoon> but yes my icons are broken :^) |
22:26:17 | FromDiscord | <Ayy Lmao> In reply to @Elegantbeef "Well to have a": I guess result.repr is kind of what I'm looking for now that I think about it. |
22:27:07 | FromDiscord | <debris> sent a code paste, see https://play.nim-lang.org/#ix=4rKf |
22:28:12 | FromDiscord | <Elegantbeef> Why did you use a macro |
22:28:12 | FromDiscord | <Elegantbeef> Just make a proc |
22:29:01 | FromDiscord | <debris> Can a proc access the discovered field like that? I don't want to write it on a case-by-case basis for each single type ever. |
22:29:09 | FromDiscord | <Elegantbeef> For your `$` you need to traverse the ast |
22:29:27 | FromDiscord | <Elegantbeef> ok then use a template |
22:29:41 | FromDiscord | <Elegantbeef> Sorry not traverse the AST but the type |
22:30:38 | FromDiscord | <Elegantbeef> Also cause i'm a shill https://github.com/beef331/fungus might interest you |
22:32:49 | FromDiscord | <debris> I'm not very knowledgeable on any of this, sorry, but I'll bookmark it for once I have enough experience with strongly typed languages and their macros.↵How would I compose such a macro? |
22:32:50 | FromDiscord | <debris> I'm not very knowledgeable on any of this, sorry, but I'll bookmark it for once I have enough experience with strongly typed languages and their macros.↵How would I compose such a template? |
22:33:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rKh |
22:33:55 | FromDiscord | <Elegantbeef> But that's not for your `$` |
22:34:18 | FromDiscord | <Elegantbeef> You have to have case statement to traverse the type and print the string |
22:34:41 | FromDiscord | <Elegantbeef> Well get the string |
22:35:00 | FromDiscord | <debris> This I already have, yeah. |
22:35:07 | FromDiscord | <Elegantbeef> Well you had a macro 😄 |
22:35:12 | FromDiscord | <debris> Ah, crap... so no way to work it backwards? |
22:35:47 | FromDiscord | <Elegantbeef> I mean the default `$` does not expect each discriminated union to be it's own type |
22:35:56 | FromDiscord | <Elegantbeef> You could make a macro that does it |
22:36:08 | FromDiscord | <Elegantbeef> Which is probably ideal |
22:36:16 | FromDiscord | <Elegantbeef> But that requires learning macros |
22:36:39 | FromDiscord | <debris> Hm. How similar are they to lisp macros? |
22:37:43 | FromDiscord | <debris> To me they seem much more capable than C's and superficially similar to lisp's, but I'm not sure how far the similarities go |
22:40:14 | FromDiscord | <Elegantbeef> They're AST based macros that are written in Nim |
22:40:17 | FromDiscord | <Elegantbeef> They're nothing like C macros |
22:40:25 | FromDiscord | <Elegantbeef> Nim's templates are more akin to C macros but still not |
22:40:34 | FromDiscord | <Elegantbeef> Cause Nim templates are dispatched based off types |
22:40:42 | FromDiscord | <Elegantbeef> But they're just code subsitution |
22:40:55 | FromDiscord | <Elegantbeef> Nim macros are inspired by lisps |
22:42:04 | FromDiscord | <debris> I see, do you think such a `$` macro would be trivial to write? If so I think I can take a crack at it on my own |
22:46:27 | FromDiscord | <Elegantbeef> Luckily since it's not a general macro it's not too complicated |
22:47:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rKo |
22:47:44 | FromDiscord | <Elegantbeef> You would then use `getImpl` on the enum which would be `enm: typed` in your macro and iterate it's fields to emit a `if fp.kind == ...` |
22:48:00 | FromDiscord | <Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 might help a tinge |
22:50:56 | FromDiscord | <Nilts> In reply to @spoon "no that was the": ik? |
22:51:47 | FromDiscord | <spoon> In reply to @not logged in "ik?": just saying it wasnt my editor |
22:52:26 | FromDiscord | <Nilts> In reply to @spoon "just saying it wasnt": so did you get the error to? |
22:52:55 | FromDiscord | <spoon> yep |
22:55:43 | FromDiscord | <spoon> so is it clearing and resetting timer every call? |
22:57:22 | * | fallback joined #nim |
22:58:54 | FromDiscord | <Elegantbeef> debris\: https://play.nim-lang.org/#ix=4rKs here's some help |
23:00:01 | FromDiscord | <debris> Crap, yeah, no way I'd have figured this out on my own, thank you. I'll accommodate it in my source. |
23:00:25 | FromDiscord | <Elegantbeef> It's typed AST so it's a bit unusual to learn |
23:01:04 | FromDiscord | <Elegantbeef> But writing enough macros makes you capable of easily moving to the compiler |
23:03:30 | FromDiscord | <Nilts> In reply to @spoon "so is it clearing": that part already works. It is the date.time part that does not |
23:05:18 | FromDiscord | <spoon> weird because it worked for me in the small echo example |
23:05:48 | FromDiscord | <Nilts> what worked/what browser are you using? |
23:11:05 | FromDiscord | <spoon> firefox, the example you gave still didn't work |
23:21:34 | FromDiscord | <spoon> In reply to @not logged in "what worked/what browser are": instead of now, i tried Date.UTC and it appears to work |
23:24:36 | FromDiscord | <Nilts> In reply to @spoon "instead of now, i": let me try |
23:29:54 | FromDiscord | <Nilts> In reply to @not logged in "let me try": no errors, but the code does not work as intended |
23:30:28 | * | Notxor quit (Remote host closed the connection) |
23:31:15 | FromDiscord | <spoon> i believe both return the current time in ms |
23:33:02 | FromDiscord | <spoon> but my question is are the last two lines of the function execute every call? if so its constantly moving the goal post |
23:33:24 | FromDiscord | <spoon> In reply to @not logged in "no errors, but the": i gtg but try indenting them inside the if statement |
23:41:41 | FromDiscord | <Nilts> In reply to @spoon "i gtg but try": clearTimeout(timer)↵ timer = setTimeout(f, timeout)↵Are not meant to be in the if statment. It is a separate runner |
23:42:38 | FromDiscord | <Nilts> ah, Date.UTC() returns NaN |
23:42:45 | FromDiscord | <Nilts> What do i do XD |
23:56:23 | * | fallback quit (Quit: IRCNow and Forever!) |