<< 24-03-2023 >>

00:00:06FromDiscord<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:01FromDiscord<Gumbercules> Oh for the JS backend yeah
00:05:15FromDiscord<Gumbercules> I figured you were referring to the C backend, apologies
00:07:59FromDiscord<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:21FromDiscord<Elegantbeef> Indeed you can put them anywhere
00:16:31FromDiscord<Elegantbeef> Generally you write the code in such away that you build upon previous things
00:17:36FromDiscord<PunchCake> Sooo guys
00:17:59FromDiscord<PunchCake> I need an easy to use mobile framework for nim
00:18:11FromDiscord<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:12FromDiscord<PunchCake> It doesnt matter if its native or not
00:18:23FromDiscord<Elegantbeef> Your options are very limited
00:18:31FromDiscord<PunchCake> What are my options
00:18:39FromDiscord<PunchCake> I heard about wiish for nim
00:18:46FromDiscord<PunchCake> Aka why is it so hard
00:18:53FromDiscord<PunchCake> To make a cross platform app
00:18:56FromDiscord<Elegantbeef> Partly due to how mobile works, partly due to the small dev pool
00:18:57FromDiscord<Elegantbeef> nimx and fidget work iirc
00:19:41FromDiscord<PunchCake> Nimx looks very ugly
00:19:52FromDiscord<Elegantbeef> Nice
00:19:58FromDiscord<PunchCake> To the point where if I'd ship my app I'd get bitch slapped to oblivion
00:20:12FromDiscord<Elegantbeef> Cool, perhaps Nim isnt for this project
00:20:15FromDiscord<Elegantbeef> Atleast for the frontend
00:20:41FromDiscord<Elegantbeef> You could use kotlin or java for the front end and call into native Nim code
00:20:54FromDiscord<PunchCake> I dont know why is it this hard
00:21:16FromDiscord<PunchCake> Opengl can run on nearly every major os
00:21:21FromDiscord<PunchCake> Including mobile
00:21:26FromDiscord<Elegantbeef> Cause mobile devices are designed in such a way to encourage the use of specific languages
00:21:51FromDiscord<PunchCake> Welp react native is used a lot in production
00:22:00FromDiscord<PunchCake> And look at it its doing very well
00:22:07FromDiscord<Elegantbeef> You can technically use any language but you're encouraged to use JVM and Swift
00:22:31FromDiscord<Elegantbeef> It's not an easy task to replicate react unpaid
00:22:42FromDiscord<Andreas> In reply to @Elegantbeef "Cause mobile devices are": yes, IOS lingua-franca = Swift | Android= Java
00:22:45FromDiscord<PunchCake> The thing is kotlin itself is simple but the amount og complexity of the apis is insane
00:23:16FromDiscord<PunchCake> (edit) "og" => "of"
00:23:42FromDiscord<Elegantbeef> 2400 contributors and funded/developed by facebook
00:24:02FromDiscord<PunchCake> Hm yeah
00:24:15FromDiscord<PunchCake> I dont really understand why we are forced to use java for android
00:24:41FromDiscord<Elegantbeef> Ok so then time for you to make a Nim cross platform GUI for Desktop and Mobile
00:24:54FromDiscord<Elegantbeef> Cause that's the language all of their OS interaction is written in
00:25:09FromDiscord<PunchCake> I thought about it
00:25:09FromDiscord<Elegantbeef> To use other languages you have to bind to that code somehow
00:25:29FromDiscord<BobBBob> isnt there qt bindings for nim now
00:25:36FromDiscord<PunchCake> There is
00:25:39FromDiscord<Elegantbeef> Sure but QT doesnt support mobile
00:25:47FromDiscord<PunchCake> It does bro
00:25:49FromDiscord<PunchCake> Qt5
00:26:17FromDiscord<Elegantbeef> Guess i was thinking gtk
00:26:48FromDiscord<BobBBob> good luck getting it to work well on mobile though haha
00:26:52FromDiscord<Elegantbeef> If you really wanted to you could use the JNI to wrap the relevant java class you wanted
00:27:09FromDiscord<Elegantbeef> But anything is going to be much more work than just using a JVM language
00:27:26FromDiscord<PunchCake> Agreed
00:27:41FromDiscord<PunchCake> Maybe i could put in the work so other devs dont have to go through this bullshit
00:27:48FromDiscord<PunchCake> Aka take one for the team
00:28:32FromDiscord<PunchCake> Or i could just use react native its plenty fast and easy to use
00:28:54FromDiscord<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:13FromDiscord<Elegantbeef> It's not even really vendor lock in anymore in apple's case
00:29:27FromDiscord<Elegantbeef> Just a bit of NIH mixed with fancy ideas
00:29:39FromDiscord<PunchCake> In reply to @BobBBob "if I remember the": Idk why they didn't make their own language tailored for android
00:29:45FromDiscord<BobBBob> In reply to @Elegantbeef "Just a bit of": pssh that's what they tell you
00:30:05FromDiscord<Elegantbeef> Swift is now a cross platform language
00:30:09FromDiscord<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:09FromDiscord<Elegantbeef> Not that any one uses it as one
00:30:11FromDiscord<PunchCake> Nice joke
00:30:15FromDiscord<Elegantbeef> But it's totally allowed now
00:30:36FromDiscord<PunchCake> Bro fr?
00:30:47FromDiscord<PunchCake> I can use swift for cross plat dev now
00:30:57FromDiscord<Elegantbeef> Yes
00:31:08FromDiscord<PunchCake> The thing is i dont wanna support this walled garden bollocks so i dislike swift
00:31:53FromDiscord<PunchCake> And i think nimqt is the most reliable and stable bindings avaliable for qt right
00:32:42FromDiscord<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:56FromDiscord<Elegantbeef> Anything else is just an exuberant amount of time
00:33:16FromDiscord<PunchCake> So basically write all the logic in nim and write all the ui in js with the button callbacks
00:33:21FromDiscord<PunchCake> Sounds like a good idea
00:40:10FromDiscord<Nilts> `Error: unhandled exception: over- or underflow [OverflowDefect]`
00:40:26FromDiscord<Nilts> for `let n = Date.now()`
00:45:44FromDiscord<spoon> date.now?
00:45:53FromDiscord<spoon> this works
00:45:58FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEh
00:46:13FromDiscord<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:05FromDiscord<spoon> compiling to js then?
00:48:09FromDiscord<Nilts> yes
00:51:13FromDiscord<Nilts> any ideas?
00:52:48FromDiscord<spoon> does now() from times not work with js?
00:54:06FromDiscord<Nilts> In reply to @spoon "does now() from times": it should not work from times, or depend on the js one.
00:54:22FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEj
00:57:02FromDiscord<spoon> times from stdlib does work with the js backend i just tested but if you need it for compatability...
00:57:16FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4rEk
00:59:11FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=4rEl
00:59:36*derpydoo joined #nim
01:00:03FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEn
01:00:05FromDiscord<spoon> what version of nim are you running?
01:00:10FromDiscord<spoon> i tested on devel
01:00:37FromDiscord<Nilts> In reply to @spoon "what version of nim": latest
01:00:54FromDiscord<Nilts> Although i cannot get devl, only head
01:00:56FromDiscord<spoon> latest release or devel?
01:01:02FromDiscord<spoon> are you using choosenim?
01:01:08FromDiscord<Nilts> In reply to @spoon "are you using choosenim?": yes
01:01:17FromDiscord<spoon> can do `choosenim devel` to get it
01:01:46FromDiscord<spoon> and `choosenim stable` if that doesn't work out
01:01:59FromDiscord<spoon> see if that fixes anything
01:02:15FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEp
01:02:21FromDiscord<spoon> missed an e
01:02:35FromDiscord<Elegantbeef> `devel` is hard to spell
01:02:50FromDiscord<impbox [ftsf]> the devel is in the details
01:02:54FromDiscord<Nilts> lol, i have been spelling it wrong this whole time
01:05:08FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEq
01:05:24FromDiscord<Nilts> Could be on a completely different line. Nim's bug reporting has done that too me.
01:05:32FromDiscord<spoon> how are you compiling it?
01:05:44FromDiscord<spoon> are you running `nim js filename.nim`?
01:06:56FromDiscord<Nilts> In reply to @spoon "are you running `nim": no other flags
01:08:03FromDiscord<spoon> hmm, are you using the function from jscore for compatibility reasons or something?
01:08:55FromDiscord<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:20FromDiscord<spoon> the one from times does work, i tested with the js backend to make sure
01:09:45FromDiscord<Nilts> In reply to @spoon "the one from times": also, I want an int, not a datetime
01:11:03FromDiscord<spoon> if you know what unit it uses there are functions to convert it into s, ms, unix time, etc
01:11:30FromDiscord<spoon> but since mine compiles i imagine the problem might be on another line
01:11:53FromDiscord<Nilts> In reply to @spoon "but since mine compiles": arg, nim's buggy error reporting
01:12:21FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=4rEr
01:12:23FromDiscord<Nilts> I just realized. It only tracks like every 5 lines for the js backend
01:12:39FromDiscord<spoon> is error reporting different for js?
01:12:53FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rEs
01:13:31FromDiscord<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:53FromDiscord<spoon> i've never had that problem with the c backend
01:13:54FromDiscord<spoon> hm
01:14:57*nanxiao joined #nim
01:17:23FromDiscord<Nilts> In reply to @spoon "run this snippet through": works. not devl, but works
01:17:37FromDiscord<Nilts> different machine
01:19:05FromDiscord<spoon> where is basicproc from?
01:21:08FromDiscord<Nilts> In reply to @spoon "where is basicproc from?": `type BasicProc = proc ()`
01:24:28FromDiscord<spoon> i'm getting a different error now: `Error: undeclared identifier: 'cstringArrayToSeq'`
01:29:04NimEventerNew Nimble package! embedfs - Embed directories in executables, easily, see https://github.com/iffy/nim-embedfs
01:44:26FromDiscord<Nilts> In reply to @spoon "i'm getting a different": with what code?
01:50:58FromDiscord<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:49FromDiscord<spoon> apparently importing system does that
01:53:43FromDiscord<spoon> nope, it was asyncdispatch
01:53:57FromDiscord<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:13NimEventerNew 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:04FromDiscord<kubo39> what is over- or underflow errors? they seems totally different..
06:09:40FromDiscord<Elegantbeef> They're idientical some operation would have caused an integer to either go under `int.low` or above `int.high`
06:09:52FromDiscord<Elegantbeef> identical even
06:11:18FromDiscord<kubo39> i know it is overflow.
06:11:38FromDiscord<Elegantbeef> What?
06:11:57FromDiscord<Elegantbeef> Overflow is going over int.high, underflow is going under int.low
06:12:36FromDiscord<kubo39> typically underflow means floating point underflow AFAIK.
06:12:44FromDiscord<kubo39> https://en.wikipedia.org/wiki/Arithmetic_underflow
06:13:42FromDiscord<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:43FromDiscord<kubo39> going under int.low is also overflow
06:14:04FromDiscord<Elegantbeef> integer underflow is also an acceptable term for going below int.low
06:14:44FromDiscord<Elegantbeef> There is a whole entry about the definition and it's ambiguity
06:16:27FromDiscord<Elegantbeef> So i'd say that given colloquialisms it's fine to call below low is underflow
06:18:36FromDiscord<kubo39> oh, I've found these sentence in integer overflow page.
06:20:35FromDiscord<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:32FromDiscord<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:31FromDiscord<4zv4l> why isn't it valid ?
08:27:32FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4rFq
08:27:43FromDiscord<4zv4l> I get invalid control flow
08:27:54FromDiscord<4zv4l> this is the function
08:27:56FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4rFr
08:36:31PMunchYou have to have a `tmp` as the last thing in the block
08:36:36PMunchOtherwise it won't return it
08:37:06PMunchOh, and `break tmp` doesn't work like that
08:37:43PMunchTry something like this: https://play.nim-lang.org/#ix=4rFw
08:38:20PMunchThe `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:59NimEventerNew 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:36PMunchI think my obsession with inline blocks might've gone too far.. http://ix.io/4rFM/
09:37:00*deadmarshal_ joined #nim
09:41:45Zevvlooks fine to me
09:45:11*azimut joined #nim
09:52:47FromDiscord<4zv4l> In reply to @PMunch "The `break X` syntax": oh ok yeah makes sense
09:53:02FromDiscord<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:18FromDiscord<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:26FromDiscord<4zv4l> like I have to check around the current case
09:53:34FromDiscord<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:19FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rGb
10:45:40FromDiscord<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:08ormiretsOkam: enumerate
10:54:15FromDiscord<amadan> Like have an incrementing index? Maybe https://nim-lang.org/docs/enumerate.html#enumerate.m%2CForLoopStmt
11:00:48FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4rGe
11:01:45FromDiscord<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:34Amun-Raieltan: typeof Natural \n typeof 4
11:12:17Amun-RaNatural is a range
11:12:29*beholders_eye joined #nim
11:22:43NimEventerNew 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:23FromDiscord<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:02FromDiscord<Yardanico> typeof of a type returns the typedesc
11:31:05FromDiscord<ieltan> In any case, how do i rewrite `4 is Natural` so it works in my usecase?
11:32:35FromDiscord<choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=4rGk
11:34:38FromDiscord<Yardanico> In reply to @ieltan "In any case, how": https://forum.nim-lang.org/t/2470#62085 is an easy solution
11:34:54FromDiscord<Yardanico> `proc contains[T](a: typedesc[range], b: T): bool = b in a.low..a.high` courtesy of beef
11:35:33FromDiscord<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:32FromDiscord<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:45FromDiscord<Yardanico> https://forum.nim-lang.org/t/2923 for example
11:40:02FromDiscord<ieltan> In reply to @Yardanico "https://forum.nim-lang.org/t/2470#62085 is an easy": Oh man thanks !
11:40:19FromDiscord<ieltan> (This should be included in the stdlib imo)
11:43:00FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rGm
11:43:00FromDiscord<ieltan> Ah it breaks when you feed it floats
11:43:01FromDiscord<ieltan> 😢
11:43:10FromDiscord<Yardanico> because Natural is for ints
11:43:20FromDiscord<ieltan> yeah
11:43:21FromDiscord<Yardanico> In reply to @Yardanico "something like this, although": @choltreppe try adding an `echo` inside the `checkSideEffects` and see it error out
11:43:30FromDiscord<ieltan> should check for floats ig
11:43:43FromDiscord<Yardanico> In reply to @ieltan "should check for floats": ranges can only be of one type
11:44:07FromDiscord<ieltan> In reply to @Yardanico "ranges can only be": No, i mean, in my code
11:44:21FromDiscord<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:24FromDiscord<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:30FromDiscord<Yardanico> can you share it?
11:45:02FromDiscord<ieltan> Oh, what about `Positive` ?
11:45:24FromDiscord<Yardanico> what about it?
11:45:25FromDiscord<ieltan> its a range too oosp
11:45:51FromDiscord<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:59FromDiscord<Yardanico> ranges are just a short-hand for checking if a number is in the range manually
11:46:20FromDiscord<Yardanico> and for documenting needed arguments better
11:46:33FromDiscord<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:54FromDiscord<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:00FromDiscord<ieltan> negatives are still a problem
11:48:19FromDiscord<Yardanico> not sure what you mean, use positive?
11:49:12FromDiscord<ieltan> Yeah i got it, thanks !
11:49:32FromDiscord<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:53FromDiscord<sOkam!> How is ennumerate used with an iterable?
11:59:05FromDiscord<sOkam!> (edit) "ennumerate" => "enumerate"
12:12:00FromDiscord<Yardanico> In reply to @sOkam! "How is enumerate used": you just do `enumerate(iterable)`?
12:12:08FromDiscord<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:24FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rGL
12:56:47FromDiscord<sOkam!> i mean a literal iterable, not an object that can be iterated
12:57:30FromDiscord<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:08FromDiscord<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:54FromDiscord<spoon> are you using --mm:none?
13:04:53FromDiscord<konradmb> No, default devel, so orc
13:05:49FromDiscord<spoon> wondering if its smart enough not to insert an extra dealloc at compiletime
13:07:54FromDiscord<konradmb> Wait, what? So gc will free externally allocated memory from C?
13:08:39FromDiscord<konradmb> Or you mean to just leak?
13:11:00FromDiscord<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:03FromDiscord<Gumbercules> In reply to @konradmb "Wait, what? So gc": No it won't. Use c_free.
13:24:48FromDiscord<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:11FromDiscord<tandy> has anyone use nimporter with a futhark wrapped library?
13:38:11FromDiscord<tandy> has anyone used nimporter with a futhark wrapped library?
13:42:21*nanxiao quit (Quit: Client closed)
13:47:56FromDiscord<Phil> PMunch , the words of futhark have been uttered
13:48:16FromDiscord<Phil> (edit) "PMunch , ... the" added "I summon thee,"