<< 09-12-2021 >>

00:00:05arkanoidI want to access PPyObject from a PyObject here: https://github.com/yglukhov/nimpy/blob/3ca0f3c58b70ee67823b6575fd43f279db70b7e3/nimpy.nim#L13
00:00:21*krux02 quit (Remote host closed the connection)
00:00:35arkanoidso I'm doing cast[PPyObject](myPyObject)
00:01:23FromDiscord<Elegantbeef> Seems like it'd be better to just export the fields, maybe with a conditional
00:03:33FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Hr8 something like this
00:04:18FromDiscord<Elegantbeef> No clue if a PR would be accepted
00:05:12arkanoidno no, I don't intend to make a PR, I just want to know if I manage to interface https://numpy.org/doc/stable/reference/c-api with numpy
00:05:50arkanoidI like nim because I want to use it for science, but interop from python and nim curretly rely on value copy
00:06:10FromDiscord<Elegantbeef> Yea i know
00:06:21arkanoidit works nicely, but if you want to go back and forth python and nim is not convenient
00:06:46arkanoidso currently nim can be used for large functions with small inputs
00:06:54FromDiscord<Elegantbeef> if only i cared to use python
00:07:33FromDiscord<Elegantbeef> That joke is implying i'd probably get annoyed and have made it work
00:07:46arkanoidI would be happy to kick python from my life, but a lot of work for science rely on it today
00:10:12arkanoidactually there are larger projects that aims to bridge different science stacks to handle zero-copy between them: https://arrow.apache.org/
00:11:28arkanoidquestion is if it is better to have one fast lib for nim (arraymancer, datamancer), or rely on interop
00:11:33FromDiscord<Elegantbeef> I dont know much about python \<-\> native interop so cannot say much, seems if you can map the python object to a Nim object and have the abillity to allocate in the python interpreter you're golden
00:11:48FromDiscord<Elegantbeef> But that means you need embeded python, not an external interpreter afaik
00:19:17arkanoidElegantbeef, it depents on the "glue" object you rely on. Numpy is a possibility, apache arrow another, but there's no silver bullet
00:20:30arkanoidand apparently there's there's no intention to sacrifice stability over performance here https://github.com/SciNim/scinim/issues/8
00:22:12FromDiscord<treeform> In reply to @Mister_Magister "<@107140179025735680> only issue i": I have added made it possible to "check if query contains parameter": https://github.com/treeform/urlly/commit/9a51fa34b6d4775e02191af5169bac481eab02c4
00:36:11FromDiscord<treeform> In reply to @Mister_Magister "<@107140179025735680> only issue i": You don't have to `parseUrl("?" & req.url.query)` any more it will now parse without the leading ? https://github.com/treeform/urlly/commit/4a5fa3fd6e8d5389667075c7dd1176110e340718
00:40:52*src quit (Quit: Leaving)
00:49:12FromDiscord<ynfle (ynfle)> How do I print a seq in nim-gdb?
00:51:12arkanoiddo you know why this type is OverflowDefect? https://play.nim-lang.org/#ix=3Hrf
01:12:29arkanoidnevermind, excessive empty spaces. Not sure why the error is OverflowDefect though
01:16:11FromDiscord<Fish-Face> how do you create a `set[char]` from a string?
01:16:49FromDiscord<Elegantbeef> !eval import std/setutils; echo "hello".toSet
01:16:51NimBot{'e', 'h', 'l', 'o'}
01:18:36FromDiscord<Fish-Face> danke
01:41:36FromDiscord<evoalg> In reply to @Elegantbeef "!eval import std/setutils; echo": I'm wondering if you mind-read Michal as to why he used a func instead of toSet? https://github.com/MichalMarsalek/Advent-of-code/blob/master/2021/Nim/day8.nim
01:42:13FromDiscord<Elegantbeef> Probably didnt know it existed
01:43:05FromDiscord<evoalg> are you saying you looked into Michal's mind and saw nothing?
01:43:13FromDiscord<Elegantbeef> Perhaps
01:43:48FromDiscord<Elegantbeef> My telepathy is a bit under utilised so i could be wrong
01:43:49FromDiscord<ynfle (ynfle)> Any help with this error message `Error: 's' is of type <var seq[seq[int]]> which cannot be captured as it would violate memory safety`?
01:44:17FromDiscord<Elegantbeef> You'e attempting to capture a `var` which is unsafe
01:44:18FromDiscord<ynfle (ynfle)> I'm using `s.apply((x: var seq[int]) => some operate)`
01:44:34FromDiscord<ynfle (ynfle)> In a function with `s: var seq[seq[int]]`
01:44:34FromDiscord<Elegantbeef> What's the entire code?
01:45:17FromDiscord<ynfle (ynfle)> a mess 😉
01:45:26FromDiscord<ynfle (ynfle)> It's AOC
01:45:30FromDiscord<ynfle (ynfle)> I'm going to sleep
01:45:36FromDiscord<ynfle (ynfle)> I'll think about it tomorrow
01:45:36FromDiscord<Elegantbeef> anyway use `applyIt` instead
01:45:56FromDiscord<Elegantbeef> You're making a closure procedure which is capturing `s`
01:48:16nrds<Prestige99> Is there a way in nim to prevent overflows or underflows in math operations? E.g. https://play.nim-lang.org/#ix=3Hrn
01:49:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Hro
01:49:34FromDiscord<Elegantbeef> Unless you mean "I want compiler errors"
01:49:43FromDiscord<Elegantbeef> I dont want runtime errors\
01:51:03FromDiscord<Elegantbeef> What are you after prestige?
01:51:08nrds<Prestige99> Ye just trying to avoid the runtime error if possible. Like if I'm doing something simple checking if x - y > 0, it could crash
01:51:31nrds<Prestige99> eh just theoretical atm
01:51:31FromDiscord<Elegantbeef> Then yes the way would be to check if it's valid
01:51:57FromDiscord<codic> If you don't want runtime errors you can also use the `+%/-%/%//%` operators etc, which overflow instead of panic
01:52:06FromDiscord<codic> overflow as in wrap around
01:52:16nrds<Prestige99> oh interesting
01:52:16FromDiscord<Elegantbeef> Well he doesnt want it to wrap he just wants to safely check
01:52:26nrds<Prestige99> yeah
01:52:35nrds<Prestige99> was hoping there'd be a non-cumbersome way to do so
01:52:46FromDiscord<Elegantbeef> My suggestion would be subrange types or procs
01:55:48FromDiscord<Fish-Face> In reply to @evoalg "I'm wondering if you": haha well it is for AoC but I have no idea how to read Michal's code there
01:55:50FromDiscord<Fish-Face> mine is way longer
01:58:04FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3Hrr
02:00:21FromDiscord<Elegantbeef> Something like this prestige https://play.nim-lang.org/#ix=3Hrs
02:00:53FromDiscord<Elegantbeef> I think you need to make a PR to fix it
02:02:33nrds<Prestige99> hm I wonder what the expected behavior should be
02:03:00nrds<Prestige99> I almost would want it to stay at int.low or int.high if it would have exceeded those values, but that's just my pref
02:03:18nrds<Prestige99> I mean I can code that into what you sent ofc but if I were to make a PR
02:03:37FromDiscord<Elegantbeef> The PR was to impbox
02:03:45FromDiscord<Elegantbeef> The current behaviour is the correct behaviour
02:03:46nrds<Prestige99> o :P
02:04:24nrds<Prestige99> yeah it's not bad
02:11:09FromDiscord<nwilburn> Hey would this be the appropriate place to ask potentially stupid questions?
02:11:24FromDiscord<Elegantbeef> Well i'm here to provide stupid answers
02:13:13arkanoidhaha
02:14:28FromDiscord<nwilburn> sent a code paste, see https://play.nim-lang.org/#ix=3Hrw
02:14:36*vicfred quit (Quit: Leaving)
02:15:00FromDiscord<Elegantbeef> You're making a `ref ref Gitlabclient`
02:15:12FromDiscord<Elegantbeef> `proc newGitlabClient(api_endpoint: string, api_key: string): ref GitlabClient =` make that `GitlabClient`
02:15:51FromDiscord<Elegantbeef> Right now you're allocating the first `ref`and the second one is unallocated hence the nil error
02:17:17FromDiscord<nwilburn> Oops! Changed that however I am still getting the same Illegal storage access error
02:17:49FromDiscord<Elegantbeef> Do you have the full code somewhere?
02:17:59FromDiscord<nwilburn> Yea one sec I can push it up somewhere
02:18:08FromDiscord<Elegantbeef> Thanks
02:20:46FromDiscord<nwilburn> https://github.com/ragingpastry/tap/tree/improve-documentation/src (Hold your breath before you enter. I'm sure it smells something fierce)
02:22:07FromDiscord<nwilburn> Is the traceback https://media.discordapp.net/attachments/371759389889003532/918326610015432724/unknown.png
02:23:51FromDiscord<Elegantbeef> Check if `glClient.isNil` or `glClient.client.isNil`
02:24:48FromDiscord<Elegantbeef> There is much reason i can see presently for you to use `ref object` anywho for your glClient
02:25:45FromDiscord<nwilburn> Yea I moved to ref object because I don't really understand how that all works and it wasn't working when I was just using object haha. Also yea glClient.client is nil
02:26:22FromDiscord<Elegantbeef> Well you just use `var GitlabClient` instead of `GitlabClient` when you want to mutate it 😛
02:26:33FromDiscord<Elegantbeef> Ok so now to see why it get's nil'd
02:26:59FromDiscord<Elegantbeef> https://github.com/ragingpastry/tap/blob/improve-documentation/src/cli.nim#L21 you dont use `newGitlabClient`
02:27:14FromDiscord<nwilburn> doh!
02:31:36FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Hrz one example at how normal objects are supposed to be used
02:34:02FromDiscord<nwilburn> Thanks!
02:34:43FromDiscord<Elegantbeef> Though the constuctor you made is idiomatic it doesnt play well with generics
02:40:49FromDiscord<nwilburn> Cheers! Got it working thanks much
02:40:58FromDiscord<Elegantbeef> No problem
02:51:21*arkurious quit (Quit: Leaving)
03:19:16*rockcavera quit (Remote host closed the connection)
03:45:12FromDiscord<impbox [ftsf]> argh, i'm so confused
03:47:06FromDiscord<impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3HrJ
03:47:14FromDiscord<impbox [ftsf]> any idea what could cause this?
03:48:28FromDiscord<impbox [ftsf]> https://gist.github.com/ftsf/21dba0c07a8f0614b81ed2728540de74 compiles fine
03:49:20FromDiscord<impbox [ftsf]> it's not like it's being called from another template, so the template nesting should be identical
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:30*supakeen joined #nim
07:11:52*anddam quit (Ping timeout: 256 seconds)
07:16:01*anddam joined #nim
07:29:33*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
07:31:44*Lord_Nightmare joined #nim
07:38:35*neurocyte0132889 joined #nim
07:38:35*neurocyte0132889 quit (Changing host)
07:38:35*neurocyte0132889 joined #nim
07:40:22FromDiscord<Cypheriel> Is there a cleaner way to do `foo[y1..y2, x1..x2] = foo[y1..y2, x1..x2].map(bar)`?
07:40:44FromDiscord<Cypheriel> A certain line of mine is getting a bit stupidly long because of this
07:40:49FromDiscord<Rika> what is foo
07:40:50FromDiscord<Rika> type
07:40:57FromDiscord<Cypheriel> `Tensor`
07:41:06FromDiscord<Rika> i cannot help you here
07:41:08FromDiscord<Cypheriel> I should've specified, my bad
07:41:16FromDiscord<Cypheriel> I'm a bit confused as to what to do lol
08:13:03*jjido joined #nim
08:15:11*PMunch joined #nim
08:34:11*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:52:23*src joined #nim
08:53:34FromDiscord<retkid> how do i know when my code is presentable to the world
08:53:35FromDiscord<retkid> well
08:53:38FromDiscord<retkid> i kinda do know
08:53:48FromDiscord<retkid> should i include a db or just the tools to generate the db?
09:14:19PMunch@retkid, you publish it and gauge the response :P
09:14:33PMunchNot quite sure what you mean about the db question
09:14:39FromDiscord<Rika> “Presentable” depends on who sees it
09:15:01FromDiscord<Rika> Probably means should he provide a sample database
09:15:29PMunchOh I see
09:15:31FromDiscord<Rika> Usually applications that rely on a database generate one when needed or fail gracefully when one is found but is malformed
09:15:57PMunchI mean you could publish a database of test data or something, but it should be done outside of your repo (you don't want large binaries in a git repository)
09:16:24FromDiscord<Rika> I guess it depends on what this database is actually consisting of
09:16:36PMunchNot really
09:17:42PMunchI mean if the repository contains a script to build a database or instructions on how to do it then the repo is "complete". But if it takes a long time to do it, or it's easy to mess it up it's nice to also have somewhere that people can go and download a test database.
09:17:55PMunchBut this database shouldn't be put in the Git repository
09:18:24FromDiscord<retkid> well
09:18:25PMunchIf you don't have another hosting solution then you could of course create a separate Git repository for your binaries
09:18:37FromDiscord<retkid> the re are tools in the git which can generate the same or very similar database
09:18:44FromDiscord<retkid> but currently that process takes like 16 hours
09:19:11PMunchYeah, so you probably want to share your database as well. Just don't put it in the main repo
09:19:13FromDiscord<Rika> I mean if it’s an empirical dataset in a database then there literally isn’t much else to do other than publish it
09:19:27FromDiscord<Rika> Otherwise if it’s for config or whatever then you generate it
09:19:44FromDiscord<Rika> Publish it not in the git repo
09:20:17FromDiscord<retkid> Ok I'll include the code i used to make it, but put a warning that it'll take a very long to make it, that is, if you can get HTTPclient to not bug out when you close it 4392 times
09:20:23FromDiscord<retkid> (edit) "Ok I'll include the code i used to make it, but put a warning that it'll take a very long to make it, that is, if you can get HTTPclient to not bug out when you close it 4392 times ... " added "with threadpool"
09:20:40PMunchTrust me, you don't want to have build artifacts in your repo and suddenly it takes a couple hours and a hard-disk and a half to download it
09:20:54FromDiscord<retkid> well, its not a big dataset
09:20:55FromDiscord<Rika> Totally
09:21:25PMunch@retkid, I guess it's bigger than your code-files though?
09:21:29FromDiscord<retkid> just, building the db takes pinging someone elses DB 16,000 times
09:21:38PMunchAnd can't easily use diffs to store variances between versions
09:21:59PMunchYes, please publish the DB as well, just not in your repo
09:22:05PMunchLink to it or something
09:22:14FromDiscord<retkid> oh lol
09:22:18FromDiscord<retkid> i accidentally deleted the db
09:22:21FromDiscord<retkid> ............................
09:22:21FromDiscord<Rika> What
09:22:23FromDiscord<Rika> How
09:22:25PMunchHaha :P
09:22:30FromDiscord<Rika> Rest in peace
09:22:32FromDiscord<retkid> i was cleaning up in vscode
09:22:35FromDiscord<retkid> :|
09:22:44FromDiscord<Rika> Generate it again, have fun
09:22:52FromDiscord<Rika> This time make a backup haha
09:23:00FromDiscord<retkid> i had a backuo
09:23:04FromDiscord<retkid> (edit) "backuo" => "backup"
09:23:06FromDiscord<Rika> Had?
09:23:08FromDiscord<retkid> deleted it to
09:23:09FromDiscord<retkid> (edit) "to" => "too"
09:23:13FromDiscord<Rika> My goodness
09:23:13FromDiscord<retkid> :|
09:23:54FromDiscord<retkid> well shit
09:24:00FromDiscord<retkid> im starting it halfway done though
09:24:08FromDiscord<retkid> so instead of 16 hours it'll be like 12
09:24:32FromDiscord<Rika> Wow that’s long
09:24:44FromDiscord<retkid> well you try pinging a slow as db 16000 times
09:24:47FromDiscord<Rika> This thing you’re requesting from really has a bad API does it
09:25:04FromDiscord<retkid> im also using python because nim has no NLP
09:25:08FromDiscord<retkid> and i dont wanna make one
09:25:18FromDiscord<Rika> Async?
09:25:24FromDiscord<retkid> no l
09:25:32FromDiscord<retkid> native language processer
09:25:36FromDiscord<Rika> I mean do you use async
09:25:37FromDiscord<retkid> (edit) "processer" => "processor"
09:25:39FromDiscord<Rika> I know NLP
09:25:45FromDiscord<retkid> oh yea
09:25:49FromDiscord<retkid> i didn't thread or async it
09:25:55FromDiscord<retkid> i'll do it
09:25:58FromDiscord<Rika> Maybe that’s why lol
09:26:02FromDiscord<retkid> (edit) "it" => "that"
09:26:08FromDiscord<Rika> Not really sure if it would help though
09:26:55FromDiscord<retkid> i need to get good at async
09:26:59PMunchApparently there is something called Git LFS: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-git-large-file-storage
09:27:07PMunchTo store large files in Git repos
09:27:17FromDiscord<retkid> well, i'd love to tell you how big it was
09:27:19FromDiscord<retkid> but i cant
09:27:24FromDiscord<retkid> the raw data is only 12mb
09:27:37FromDiscord<retkid> but it expands quite a bit
09:27:52FromDiscord<retkid> i would make it smaller if i use base64
09:27:54FromDiscord<retkid> (edit) "base64" => "base64, etc"
09:28:08PMunchSmaller if you used base64?
09:28:22FromDiscord<retkid> if i compress it i mean
09:28:25PMunchbase64 typically makes stuff way bigger
09:28:26PMunchAh
09:28:30FromDiscord<Rika> LFS is an extension for those who store massive monorepos
09:28:32FromDiscord<Rika> Afaik
09:28:40FromDiscord<retkid> actually
09:28:42FromDiscord<retkid> i have a copy of my db
09:28:51FromDiscord<retkid> well
09:28:58FromDiscord<retkid> i need to rebuild it
09:29:04FromDiscord<retkid> but i have all its contents in json form
09:29:18FromDiscord<retkid> 3 backups 😎
09:29:57FromDiscord<retkid> its not super big of a dB
09:30:00FromDiscord<retkid> (edit) "dB" => "only 20 m"
09:30:02FromDiscord<retkid> (edit) "m" => "mb"
09:30:33PMunchAha, so basically Git LFS just creates a small file with an ID for your file in the remote repo. Then it uploads the file to the host in the normal way. And then when you pull a branch it will pull the actual large file from the web host.
09:30:36PMunchPretty clever
09:31:38FromDiscord<Cypheriel> am I confused or.. is it not possible to convert a range with negative step to a sequence
09:33:01PMunchA large file in a Git context is like anything above a couple kilobytes, maybe up to about a megabyte.
09:33:01FromDiscord<retkid> In reply to @Cypheriel "am I confused or..": anything is possible if you try hard enough
09:33:01FromDiscord<Cypheriel> my brain already hurts enough 😔
09:33:01FromDiscord<Cypheriel> I can't even get ranges with steps working in inim
09:33:01PMunch@Cypheriel, it's certainly possible. But remember that the normal `..` iterator can only go up
09:33:01FromDiscord<retkid> I have no clue what a range is or a negative step
09:33:01FromDiscord<retkid> well no
09:33:01FromDiscord<retkid> (edit) removed "no"
09:33:01FromDiscord<Elegantbeef> !eval import std/sequitls; countDown(10, 0).toSeq
09:33:01FromDiscord<retkid> if you start from a on the left
09:33:02NimBotCompile failed: /usercode/in.nim(1, 11) Error: cannot open file: std/sequitls
09:33:07FromDiscord<retkid> you can use its absolute value to go down
09:33:07FromDiscord<Elegantbeef> !eval import std/sequitls; echo countDown(10, 0).toSeq
09:33:09NimBotCompile failed: /usercode/in.nim(1, 11) Error: cannot open file: std/sequitls
09:33:17FromDiscord<Elegantbeef> god damn it
09:33:25PMunch!eval import std/sequtils; echo countDown(10, 0).toSeq
09:33:27NimBot@[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
09:33:28FromDiscord<Elegantbeef> !eval import std/sequtils; countDown(10, 0).toSeq
09:33:30NimBotCompile failed: /playground/nim/lib/pure/collections/sequtils.nim(854, 7) Error: expression 'result`gensym0' is of type 'seq[int]' and has to be used (or discarded); start of expression here: /usercode/in.nim(1, 39)
09:33:31FromDiscord<Elegantbeef> There we go no more spam
09:33:34FromDiscord<retkid> for y in 10 .. 0:↵ echo 0 - y
09:33:40FromDiscord<retkid> (edit) "10" => "-10"
09:33:44FromDiscord<retkid> or something like that
09:33:51FromDiscord<Cypheriel> idk if I'd want to use `countDown`, though
09:33:59FromDiscord<Cypheriel> I kinda just want to do what I'd do in Python
09:34:12FromDiscord<Cypheriel> which is like `list(range(10, 0, -1))`
09:34:18PMunch@Elegantbeef, haha you seem to struggle a bit with getting your snippets to run properly :P
09:34:19FromDiscord<retkid> https://play.nim-lang.org/
09:34:22FromDiscord<retkid> this makes stuff easier
09:34:23FromDiscord<Cypheriel> but where the step is variable
09:34:33FromDiscord<retkid> nim playground is really useful for visualizing this stuff imo
09:34:54FromDiscord<Elegantbeef> `toSeq(countDown(10, 0, -1))`
09:34:58FromDiscord<Elegantbeef> How is that any different?
09:35:01PMunch@Cypheriel, well then you have to write `range` for yourself
09:35:12FromDiscord<Rika> He probably wants a unified count down and up
09:35:28PMunchWhich Nim doesn't have AFAIK
09:35:31FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3HsE
09:35:35FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3HsE" => "https://play.nim-lang.org/#ix=3HsF"
09:35:41PMunchI mean it's easy enough to write one
09:35:41FromDiscord<Cypheriel> :faint:
09:35:56FromDiscord<Cypheriel> I fear I've exhausted a fair majority of my brain power
09:35:56FromDiscord<Rika> I’ll be honest, I don’t know what reason there is to not have one
09:35:59FromDiscord<retkid> a lot of things nim is missing because nobody wants to actually sit down and do not fun things
09:36:13FromDiscord<retkid> like NLP is cool and all
09:36:17FromDiscord<retkid> but who wants to actually make one
09:36:25FromDiscord<Rika> A few probably do what to
09:36:26FromDiscord<Rika> Want
09:36:35FromDiscord<retkid> well fuck
09:36:40PMunch@Rika, no idea, I guess the rationale that `..` doesn't do it is that it means an extra check every time you want to do iteration over a range
09:36:50FromDiscord<Rika> We just don’t have the size to have those kinds of people
09:37:01FromDiscord<retkid> i mean, i kinda want to
09:37:02FromDiscord<retkid> but also
09:37:04FromDiscord<retkid> i really do not
09:37:07FromDiscord<Elegantbeef> Yea pmunch i think that's the reason
09:37:13FromDiscord<Rika> Then you are not that kind
09:37:20FromDiscord<Elegantbeef> This comes up every so often
09:37:28FromDiscord<Cypheriel> I spent probably like a good hour wondering why my stuff wasn't working, and then I eventually found out that my ranges converted to sequences broke if any step was negative and became empty
09:37:57PMunchBut why there isn't a combined countup/countdown I have no idea, such a simple thing that really should just be included..
09:38:10FromDiscord<retkid> it would be cool but learning everything about English grammar, figuring out a fast way to classify it, scraping thousands and thousands and thousands of websites, seems not fun
09:38:17FromDiscord<Cypheriel> Needless to say... I've spent a stupid amount of time echoing random things https://media.discordapp.net/attachments/371759389889003532/918436379782959104/Screenshot_20211209_023745.png
09:38:19FromDiscord<retkid> (edit) "would" => "wouldn't"
09:38:30FromDiscord<retkid> (edit) "wouldn't" => "would"
09:38:35PMunchI guess `countup` should probably have an `assert x > y` in it..
09:38:50FromDiscord<Rika> I’d say it’s more common to expect .. to count both up and down than to expect it to be a bit quicker
09:39:25FromDiscord<Rika> In reply to @PMunch "I guess `countup` should": Then a lot of peoples code would break, some people depend on 0..0 being empty
09:39:32PMunchHmm, but that would still exist in `-d:release`.. Is there an assert which is the opposite of doAssert? ie. one that only gets checked in debug mode?
09:39:39FromDiscord<Rika> I feel like I’ve encountered a lot of code that expects that
09:39:45PMunch>= then :P
09:39:56PMunchAnd 0..0 isn't empty, it's 0
09:39:58FromDiscord<Rika> 0.. -1 as well
09:40:02FromDiscord<Rika> Yeah
09:40:04PMunch.. is inclusive ;)
09:40:06FromDiscord<Rika> I meant what I said
09:40:09FromDiscord<Elegantbeef> Well it'd also not be consistent
09:40:16FromDiscord<Cypheriel> so... what am I to do, then?
09:40:22FromDiscord<Cypheriel> surely I'm not to right my own range D:
09:40:32FromDiscord<Rika> If you want what you described
09:40:35FromDiscord<Rika> Then you write it
09:40:36FromDiscord<Elegantbeef> It takes all of 3 seconds
09:40:50FromDiscord<impbox [ftsf]> you could wait for someone else to write it
09:40:53FromDiscord<Rika> It’s just an if positive count up else count down
09:41:01FromDiscord<Cypheriel> I'm not sure where I'd even start...
09:41:10FromDiscord<Rika> In reply to @impbox "you could wait for": Probably that Python like library Yardanico wrote
09:41:23FromDiscord<Hamid_Bluri> take a look at `iterator`s
09:41:24FromDiscord<Rika> In reply to @Rika "It’s just an if": @Cypheriel it’s just this literally
09:41:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HsJ
09:41:52FromDiscord<Cypheriel> what the
09:41:58FromDiscord<Rika> “What the” what?
09:42:20FromDiscord<Rika> You’ll have to assert that count is not 0
09:42:23FromDiscord<Rika> At the start
09:42:29FromDiscord<Rika> Lest you explode
09:42:30FromDiscord<Elegantbeef> Also that you dont go over b
09:42:43FromDiscord<retkid> lol i found an npm package that used coffeescript
09:42:52PMunch@Cypheriel, something like this: https://play.nim-lang.org/#ix=3HsK
09:42:57FromDiscord<Cypheriel> In reply to @Rika "Lest you explode": I think my brain has already exploded
09:43:07FromDiscord<Rika> In reply to @retkid "lol i found an": Haha
09:43:10FromDiscord<Elegantbeef> There we go pmunch 😀
09:43:12PMunchOr what @Elegantbeef posted :P
09:43:22FromDiscord<Elegantbeef> Well what i posted has 2 buhgs
09:43:34FromDiscord<Rika> When are we getting `yield from`
09:43:37FromDiscord<Hamid_Bluri> yes 2 buhgs
09:43:50PMunch@Rika, yield from?
09:43:53FromDiscord<Rika> In reply to @Rika "When are we getting": It would be nice if we had it…
09:44:02PMunchAh, like yield everything from this iterator
09:44:05FromDiscord<Rika> Same thing as looping the iterator and yielding the result
09:44:06FromDiscord<Rika> Yes
09:44:08FromDiscord<Elegantbeef> should be `while i in min(a, b)..max(a.b)` and ensuring `count` != 0
09:44:14PMunchInstead of having to write `for x in iter: yield x`
09:44:18FromDiscord<Rika> Yes
09:44:19PMunchThat would be pretty neat
09:44:38FromDiscord<Elegantbeef> Not overly worth the effort in my view
09:44:40FromDiscord<Rika> Actually I think it could be a template
09:45:10FromDiscord<Cypheriel> oh hey. I understand now
09:45:19FromDiscord<Rika> Yeah it could just be a template with the for loop and yield thing hm
09:45:19PMunchIf you call it `yieldFrom` it'd be easy to do as a template
09:45:24FromDiscord<Rika> Yeah
09:45:29FromDiscord<Elegantbeef> yep
09:45:36FromDiscord<Rika> And we already do that anyway (ala notIn)
09:45:37FromDiscord<impbox [ftsf]> the from sounds odd
09:45:54FromDiscord<Rika> Well you’re yielding the values from the iterator
09:45:56FromDiscord<Rika> So yield from
09:46:03FromDiscord<retkid> so apparently well written JS will surpass NIM's JS compiler by like 20 : 1
09:46:13FromDiscord<impbox [ftsf]> makes me think of COMEFROM =p
09:46:17FromDiscord<Rika> No, you should turn optimisations on
09:46:43FromDiscord<retkid> you think i didn't compile with optimizations? thats a thing for JS?
09:46:44FromDiscord<Rika> Also again, Nim output is not optimised or aiming to be short
09:46:53FromDiscord<Rika> It is a thing for JS
09:47:02FromDiscord<impbox [ftsf]> compile with `-d:danger`
09:47:02*jjido joined #nim
09:47:05FromDiscord<retkid> yea
09:47:12FromDiscord<Elegantbeef> Nim's runtime checks and debug info is still included without `danger/release`
09:47:18FromDiscord<retkid> but i dont think it'll be as fast as the JS it seems kinda crazy
09:47:18FromDiscord<impbox [ftsf]> but yeah, i wouldn't be surprised if hand coded assembly or js is faster than nim generated code
09:47:33PMunchSomething like this: https://play.nim-lang.org/#ix=3HsM
09:47:34FromDiscord<retkid> well the Assembly thing is expected
09:47:38FromDiscord<Rika> You can further optimise by directly using the js apis and not Nim’s shims for its own functions
09:47:51FromDiscord<Elegantbeef> Well the main issue afaik is that JS has advanced a bit so there are some things that could be changed to make it a bit faster
09:47:56FromDiscord<Rika> Yes
09:48:03FromDiscord<Rika> Nim is stuck in ES3 afaik
09:48:06FromDiscord<retkid> I don't think i can get faster than the original code, it seems really smoothe
09:48:08FromDiscord<retkid> (edit) "smoothe" => "smooth"
09:48:28FromDiscord<Elegantbeef> ftfy pmunch https://play.nim-lang.org/#ix=3HsN
09:48:34FromDiscord<retkid> look at that
09:48:35FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3HsO
09:48:41FromDiscord<Cypheriel> oh gosh... I've just realized a problem
09:48:56FromDiscord<Cypheriel> since this new range isn't an actual range... I can't use it with tensor slicing
09:49:08PMunch@Elegantbeef, probably a good idea :P
09:49:29FromDiscord<Elegantbeef> Not really cause it sucks
09:49:42PMunch`iterable` sucks?
09:49:42FromDiscord<Elegantbeef> `[10]` cannot be used in place of iterable
09:49:53FromDiscord<Elegantbeef> Yea there are many issues with it imo
09:50:08FromDiscord<Elegantbeef> It's a good idea but badly implemented
09:50:17FromDiscord<Elegantbeef> You cannot pass iterators to iterators
09:50:44FromDiscord<Elegantbeef> Objects/collections that have `items/pairs` do not implicitly pass to them
09:51:42FromDiscord<retkid> holy shit
09:51:45FromDiscord<Elegantbeef> You cannot use it in a typeclass so `template doThing(a: int or iterable[int])` doesnt work for both `int` and an `iterable`
09:51:56FromDiscord<retkid> with -d:danger the code went from 1200 lines to 14
09:52:00FromDiscord<retkid> this might be faster
09:52:19FromDiscord<Elegantbeef> Well Nim's js still has runtime checks
09:52:21PMunchHaha, might be :P
09:52:27FromDiscord<Elegantbeef> danger removes most them
09:52:48PMunchDanger sounds so ominous
09:52:51madpropsis `something in someseq` as fast as `sometable.hasKey(somekey)` ?
09:52:53FromDiscord<retkid> compilers are magic
09:52:56FromDiscord<Elegantbeef> Suffice to say I like the idea of iterable but the implementation we have makes me sad
09:52:57FromDiscord<retkid> well its danger
09:53:01PMunchIt's like we're expecting it to break :P
09:53:15PMunchmadprops, nope, it's way slower
09:53:17FromDiscord<retkid> In reply to @Elegantbeef "Suffice to say I": whats wrong with iterable
09:53:31FromDiscord<Cypheriel> is it just me or are some of these error messages absolutely terrible
09:53:41FromDiscord<retkid> oh yea
09:53:41FromDiscord<Elegantbeef> retkid i just explained
09:53:43FromDiscord<retkid> tons of them suck
09:53:48FromDiscord<Elegantbeef> Some error messages do indeed suck
09:54:03PMunch`something in someseq` literally goes through the entire sequence and looks for your item. `sometable.hasKey(someKey)` hashes your key to a memory address and then looks it up directly to see if it exists.
09:54:11FromDiscord<retkid> well
09:54:14PMunchThat's kinda the whole point with using tables
09:54:16FromDiscord<retkid> even if its flawed
09:54:21FromDiscord<retkid> i think its better we have them, then not
09:54:47FromDiscord<Elegantbeef> the table is O(1) the seq is O(n)
09:54:52PMunch@Cypheriel, some of them can be a bit confusing. But most of the time if you know the concepts at play they're pretty easy to read
09:55:01FromDiscord<Elegantbeef> Depending on the values/range you can use a bitset which is the best of both
09:55:20FromDiscord<Cypheriel> So apparently `count_down()` doesn't accept negative step... good to know, idk how I'd not expected that
09:55:43PMunchOh yeah, if you only care about if it exists or not then a set is better than a table
09:55:53FromDiscord<Rika> Both count down and count up accept positives only
09:56:13PMunch@Cypheriel, how would a negative step work?
09:56:32PMunchYou'd have to go all the way until the number wrapped round before you arrived at your destination..
09:56:34FromDiscord<Cypheriel> It wouldn't, which is why I'm annoyed I didn't spot it sooner
09:56:36FromDiscord<Elegantbeef> You iterate backwards until you over/underflow
09:56:38FromDiscord<Elegantbeef> 😀
09:57:02FromDiscord<Cypheriel> Praise the lord, I think I've finally got what I wanted
09:57:17FromDiscord<petsqui> when I write a macro that accepts some `Thing[T]` can I somehow extract the concrete type of T
09:57:18PMunchI wouldn't be the least bit surprised if I actually found something like that in an old C codebase @Elegantbeef :P
09:57:22FromDiscord<petsqui> (edit) "T" => "T?"
09:57:29PMunch@petsqui, yes
09:57:34FromDiscord<retkid> its still much slower but not as bad
09:57:39FromDiscord<retkid> the JS is just super optimized
09:58:31FromDiscord<Cypheriel> woo, praise. Fixing the range fixed my AoC solution
09:58:35FromDiscord<Cypheriel> I never wanna deal with that ever again
09:58:44FromDiscord<Elegantbeef> There you go petsqui
09:58:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3HsT
09:58:54FromDiscord<Elegantbeef> Yea cyph that was an issue i had for that day aswell
09:59:03FromDiscord<Elegantbeef> remembers he hasnt done AoC for a few days now
10:00:16PMunch@petsqui, https://play.nim-lang.org/#ix=3HsU
10:00:32FromDiscord<petsqui> In reply to @PMunch "<@325637384517713920>, https://play.nim-lang.org/#i": thank you!
10:00:53FromDiscord<Elegantbeef> Pmunch was slow on that one
10:01:08PMunchI'm rusty >_<
10:01:15FromDiscord<Elegantbeef> No this is nim
10:01:28PMunchI'm Nimmy?
10:01:57FromDiscord<Elegantbeef> Nah you're timmy
10:03:40PMunchUgh, so many of my macros have broken with recent versions of Nim..
10:03:52FromDiscord<Cypheriel> welp. sometimes I wonder if I'm a masochist for choosing to use Nim for things like Advent of Code
10:04:06FromDiscord<Cypheriel> There's a lot of cool stuff... but also a lot of... not-so-cool stuff
10:04:08PMunchApparently notificatcher doesn't build on anything later than 1.2.6..
10:04:35FromDiscord<Elegantbeef> I mean you made your problem harder than it was
10:04:56PMunch@Cypheriel, I think it's mostly a matter of knowing which tools you have available to you
10:05:07FromDiscord<Cypheriel> In reply to @Elegantbeef "I mean you made": I did?
10:05:19FromDiscord<Cypheriel> tbh I couldn't even comprehend my problem
10:05:47FromDiscord<Elegantbeef> Using tensors and other fancy stuff for that problem is self harm imo
10:05:48PMunch@Cypheriel, if you want to see how I solve them, and how little trouble I run into, you can check my solving on YouTube: https://www.youtube.com/playlist?list=PL9Yd0XwsGAqyd_lKcHm3f_nlE8vMdacV0
10:06:05PMunchWait, you're using tensors for AoC?
10:06:10PMunchWhich day?
10:06:26FromDiscord<Cypheriel> 4 and 5 ._.
10:06:44FromDiscord<Cypheriel> I heard somebody talking about them and I thought maybe this was a good time to try and learn about that kind of stuff
10:06:50FromDiscord<Cypheriel> it was something I've wanted to learn anyways
10:06:54FromDiscord<Cypheriel> but eheh...
10:07:00FromDiscord<Elegantbeef> If you want to see less masochisitic approaches https://github.com/beef331/aoc2021
10:07:30PMunchI think you might be the first person to use tensors to score bingo sheets :P
10:07:40FromDiscord<Cypheriel> LMAO
10:07:52PMunchBut using AoC to learn new stuff is a good idea :)
10:08:03FromDiscord<Cypheriel> I... had a lot of trouble figuring out how to get the nth column of a matrix
10:11:02FromDiscord<Cypheriel> In reply to @Elegantbeef "If you want to": what on Earth. So much shorter than my solution...
10:11:17FromDiscord<Elegantbeef> How does he do it!
10:11:35FromDiscord<Cypheriel> My whole part two as 94 lines
10:12:38FromDiscord<Elegantbeef> My philosophy on programming is it's fun to work through problems but writing code sucks, so i try not to write a lot of code 😛
10:13:30FromDiscord<Cypheriel> I mean me as well... but I keep feeling like "ugh, the only way I know to do this is the long way"
10:15:07FromDiscord<Elegantbeef> In the case of 4/5 i have a ton of experience with grids so it was basically 100% the usual for what i work with
10:17:46FromDiscord<Elegantbeef> Anyway i'm going to sleep, maybe i'll be interested in doing the day's i've missed, though the fish one had me going "Yep this is just a math solution i dont know"
10:18:44FromDiscord<Cypheriel> I should probably be heading to bed, as well... I stayed up trying to solve this darn puzzle. Thank y'all for the help and sharing some insight
10:25:28*src quit (Quit: Leaving)
10:45:49*dv2 joined #nim
10:56:28FromDiscord<gogolxdong (liuxiaodong)> What's the default gc of 1.6
11:01:19FromDiscord<Yardanico> refc
11:01:27FromDiscord<Yardanico> it's been the default and is still the default
11:01:35FromDiscord<Yardanico> ORC is expected to become the default in nim 2.0
11:05:17FromDiscord<Yardanico> https://github.com/nim-lang/RFCs/issues/437 for more info
11:07:07FromDiscord<gogolxdong (liuxiaodong)> ok, here is an error which not sure has business of swtiching arc/orc to default gc↵`C:\Users\root\nimcache\fight_r\@mfight.nim.c: In function 'claim_fight_6436':↵C:\Users\root\nimcache\fight_r\@mfight.nim.c:5169:72: error: redeclaration of 'fmtRes' with no linkage↵ 5169 | NimStringDesc fmtRes;`
11:08:12FromDiscord<gogolxdong (liuxiaodong)> I remembered it compiles before.
11:08:17FromDiscord<Yardanico> yeah, that's a Nim bug, are you using ARC/ORC or refc?
11:08:42FromDiscord<Yardanico> there has only been one similar issue with ARC but it's been closed since https://github.com/nim-lang/Nim/issues/13622
11:10:49FromDiscord<gogolxdong (liuxiaodong)> yes, I'm using arc/orc and switched to default gc because websocket of nim-json-rpc has issues with arc/orc.
11:11:38FromDiscord<Yardanico> so is this bug with refc?
11:11:54FromDiscord<Yardanico> anyway, I don't think I can help much without the code to reproduce it :(
11:23:24FromDiscord<gogolxdong (liuxiaodong)> switch to default gc gives me this compile error, cps threadpool works but memory grow fast , not sure whether memory leaks.
11:24:56FromDiscord<gogolxdong (liuxiaodong)> use cps means unable to listen event using websocket of json-rpc-client.
11:29:04FromDiscord<gogolxdong (liuxiaodong)> listening on websocket is required now, I remember it worked before. Does nim has some change in these days?
11:30:53*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:05:28FromDiscord<geohuz> Hi, I'm trying to cross compile my web app using jester, and I use docker run --rm -v `pwd`:/usr/src/app -w /usr/src/app nimlang/nim "nimble install -y jester; nim c -r myapp.nim", I specified to install dependency package on the command line, is there any way to have a dependency list file so compileer can install them automatically ?
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:12:08PMunch@geohuz, what I normally do is create a .nimble file that list the requirements, then either run `nimble build` to build my application, or `nimble install` a dummy package that is just a list of requirements.
12:12:44PMunchThe latter is what I do to populate the playground with packages, but it really only makes sense if you want to build a docker image with a set of packages already installed.
12:18:09FromDiscord<geohuz> Ok, so I should use nimble init to create it and add dependenies in the file then run nimble build
12:18:55FromDiscord<geohuz> @PMunch , is it correct?
12:19:09PMunchYes
12:19:28FromDiscord<geohuz> Ok, thanks! @PMunch
12:19:29PMunchYou essentially want to create a Nimble project for your program, and then use Nimble to build it
12:20:01arkanoidI perfectly understand "prt UncheckedArray[T]", but what is "UncheckedArray[T]"?
12:21:53PMunchA piece of memory holding an unknown number of T
12:25:21PMuncharkanoid, you would typically use it for flexible array members in a struct: https://www.geeksforgeeks.org/flexible-array-members-structure-c/
12:27:28arkanoidhm, ok
12:31:22arkanoidgot it, it's spacer inside a struct
12:32:02arkanoidbut it makes sizeof unreliable
12:33:54PMunchYup
12:34:05PMunchAnd it's not really a spacer
12:34:32PMunchIt makes a bit more sense if you come from C :P
12:36:30PMunchTo get a pointer to a struct in C you typically call `malloc(sizeof(mystruct))` or similar. If you know that `mystruct` has a flexible array member with e.g. ints you could do `malloc(sizeof(mystruct) + 42 * sizeof(int))` to create a pointer to mystruct where the flexible member would now be able to hold 42 integers.
12:37:39PMunchIf you now store the number 42 somewhere in that struct you can now do one pointer dereference and then directly be able to iterate over your data.
12:37:40arkanoidsure, that's what I mean with "spacer". Struct is now a piece of memory with non-fixed size
12:37:51PMunchCorrect
12:38:13PMunchI thought you meant "spacer" as in "padding", but that is incorrect
12:38:29arkanoidis this the only way to build structs not 1:1 with its sizeof?
12:38:44PMunchWell..
12:38:55arkanoidwell, "only way", let me take it with a grain of salt
12:39:05arkanoidI know you can do everything
12:39:14PMunchI mean you can always malloc more or less memory than you actually need for a struct
12:46:56arkanoidSure. Thanks for the info
12:52:37*Guest70 joined #nim
12:53:10*Guest70 quit (Client Quit)
12:54:47NimEventerNew Nimble package! contractabi - ABI Encoding for Ethereum contracts, see https://github.com/status-im/nim-contract-abi
13:27:42*rockcavera joined #nim
13:27:42*rockcavera quit (Changing host)
13:27:42*rockcavera joined #nim
13:58:35*Guest461 joined #nim
14:03:20*u0_a185 quit (Read error: Connection reset by peer)
14:07:23*arkurious joined #nim
14:19:49*Guest461 quit (Quit: Client closed)
16:28:09FromDiscord<ajusa> Is there a way to force a library to use header files instead of dynamic linking? Or do I need to modify the library itself and make it use header files?
16:29:02Amun-RaI don't quite get the question
16:29:43FromDiscord<IsaacPaul> huh? you link a library via dynamically or statically. Headers are kinda different for both. One has some sort of dll export, the other has functions without it
16:29:44FromDiscord<Yardanico> In reply to @ajusa "Is there a way": if you're talking about some wrapper, then yes, you need to modify it so it uses header files instead
16:29:57FromDiscord<Yardanico> if it's hardcoded to dynamic libs
16:30:16Amun-Rayou can either: use dynlib (loading library at runtime, may faile), use dynlib pragma (loading library at runtime (may not fail) or compile directly into binary
16:30:21FromDiscord<ajusa> Yup, https://github.com/nim-lang/sdl1/blob/master/src/sdl.nim seems to be hardcoded to dynlib. I'll want to change the dynlib to the header pragma then I assume.
16:30:24Amun-Rafail*
16:30:33FromDiscord<Yardanico> In reply to @ajusa "Yup, https://github.com/nim-lang/sdl1/blob/master/s": any reason you'd want sdl1 specifically?
16:30:35FromDiscord<ajusa> 3ds
16:30:37FromDiscord<Yardanico> oh
16:30:45FromDiscord<ajusa> no dynamic libraries on that target either lol
16:30:45FromDiscord<IsaacPaul> nice
16:31:02*xet7 joined #nim
16:31:11FromDiscord<Yardanico> In reply to @ajusa "no dynamic libraries on": you really just have to change `dynlib: LibName` to header in proc definitions
16:31:22FromDiscord<Yardanico> assuming all object definitions are correct you don't really need to set `header` pragma for them
16:32:13Amun-Ramhm
16:33:12FromDiscord<ajusa> In reply to @Yardanico "you really just have": Not quite sure what you mean? Don't I need to tell it which header to look for
16:33:21FromDiscord<Yardanico> In reply to @ajusa "Not quite sure what": well that's what I meant
16:33:36FromDiscord<Yardanico> you don't have to do much other than replacing the dynlib pragma with the header pragma pointing to the header
16:33:40FromDiscord<Yardanico> for proc declarations
16:33:49FromDiscord<ajusa> Ah I see what you meant now, yup we're on the same page
16:49:26*src joined #nim
16:52:42*terminalpusher joined #nim
17:34:11FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HuP
17:36:01FromDiscord<Professor Actual Factual> (edit) "https://play.nim-lang.org/#ix=3HuP" => "https://play.nim-lang.org/#ix=3HuQ"
17:40:38*terminalpusher quit (Remote host closed the connection)
17:41:14*terminalpusher joined #nim
17:44:09FromDiscord<Clonkk> Difficult to says for sure without knowing the code, but I think it's when you try to do async operation using non-async socket
17:44:42FromDiscord<Clonkk> So look into https://nim-lang.org/docs/asyncdispatch.html
17:46:04FromDiscord<Clonkk> You can look into the async layer of the ZMQ bindings also https://github.com/nim-lang/nim-zmq/blob/master/zmq/asynczmq.nim
17:46:33FromDiscord<Clonkk> Where it takes a raw file descriptor and makes it into an AsyncSocket and register it in the dispatch loop
17:47:04FromDiscord<Clonkk> Not sure if that's what you're looking for, but from the error message it looks like raw socket operation failing into an async context \:)
17:49:58FromDiscord<Professor Actual Factual> Thank you for the link. Ya Im using a proprietary library from someone who claims its an async http client, I wonder if there is a bug on their code where like you said they are using a non-async socket.
17:50:13FromDiscord<Professor Actual Factual> (edit) "client," => "client library,"
17:50:39FromDiscord<Clonkk> Maybe it's just not declared as async from Nim's perspective and that's why you get an error
17:51:25FromDiscord<Clonkk> Technically, an async dispatch loop written in pure C could achieve the functionality of an async http server but from Nim's `{.async.}` context not be seen as async ?
17:52:27FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=3HuW
17:53:04FromDiscord<Clonkk> Are you sure mixing async and thread is a good idea ?
17:53:15FromDiscord<Professor Actual Factual> Thats the thing, this is just an experiment
17:54:23FromDiscord<Clonkk> Ah ok then you might be interested in https://github.com/yglukhov/asyncthreadpool
17:54:26FromDiscord<Professor Actual Factual> If i could get async multithreaded to work it would be what my client wants. First thread is Producer IO-bound, second thread is Consumer CPU-bound. I'd rather not mix the two, but I dont know of a better way
17:54:48FromDiscord<Clonkk> Which allows you to spawn function from a threadpool and return `Future[T]` variable
17:59:37FromDiscord<Clonkk> I would limit the scope of the async to their own thread and then use some messaging queue primitive for inter-thread communication. You can use channels (either built-ins or the more experimental https://github.com/nim-lang/threading ) or ZMQ to achieve this; I mention ZMQ because I4ve used extensively as an inter-process / inter-thread messaging queue (only downsize is necessity to copy data unless you're confortable handling raw shared
18:02:58FromDiscord<Professor Actual Factual> In reply to @Clonkk "I would limit the": I have looked into channels, but this is a latency-sensitive application, I'd rather not commit to copying. I can use it as a worst case scenario though. But I think you are correct in seperating the async stuff in one thread only. I currently did a greedy approach where I have all my procs (both async/sync) in a single object, which is what I'm passing to between these threads.
18:04:07ZevvPMunch: logs on the fire yet?
18:06:48FromDiscord<Clonkk> If I'm not mistaken, Nim's channels can send `ref` with --gc\:arc so no copy involved.ZMQ benefit is to use its patterns to easily distribute workload on multiple running thread but it usually does require to perform one copy of your data but - depending on your application - that may not represent a bottleneck.↵(@Professor Actual Factual)
18:08:09FromDiscord<Professor Actual Factual> In reply to @Clonkk "If I'm not mistaken,": Oh snap, can't believe I haven't thought of something that obvious lol, I am using ref objects so copy wouldn't be too bad.
18:08:33FromDiscord<Professor Actual Factual> I will try that tonight, hopefully it works
18:09:02FromDiscord<Professor Actual Factual> (edit) "works" => "works, thank you"
18:09:04FromDiscord<Clonkk> If oyu only have need for basic patterns, channels should suffice
18:26:29NimEventerNew thread by Geohuz: Could not run program which compiling with static linked lib, see https://forum.nim-lang.org/t/8697
18:59:28*xet7 quit (Quit: Leaving)
19:06:59FromDiscord<hmmm> yoyo how do I auto unroll some strings I have in a seq in a type object?
19:07:18FromDiscord<hmmm> don't tell me I can't I'm lazy 🤔
19:07:19FromDiscord<IsaacPaul> what do you mean by unroll>
19:07:44FromDiscord<hmmm> I mean first element of string goes in first element of type object and so on
19:07:50FromDiscord<hmmm> of seq string
19:08:08FromDiscord<IsaacPaul> oh.. so you want to serialize an array of strings into an object
19:08:12FromDiscord<hmmm> YES!
19:08:25FromDiscord<hmmm> big brainy isaac computing the answer...
19:08:27FromDiscord<hmmm> tick tick tick
19:09:22FromDiscord<IsaacPaul> Honestly sounds like a terrible way to serialize objects. Is there a built-in solution that does what you want? idk
19:09:30FromDiscord<Mocha> Is there some way to access nimble package information from within the package, e.g. the version number/author?
19:09:43FromDiscord<hmmm> are you really telling me I can't? 😒
19:10:06*jjido joined #nim
19:10:13FromDiscord<IsaacPaul> I'm saying idk, but I'm also saying that if you could you probably shouldn't... lol
19:11:13FromDiscord<hmmm> ok I think about it some more and will come back again 🤔
19:12:06FromDiscord<IsaacPaul> (edit) "probably" => "_probably_"
19:35:25Amun-Rahmm, I've found another bug in 1.6
19:42:44arkanoidhow can I wrap a static C function a.k.a. internal linkage?
19:47:57FromDiscord<pmunch> @hmmm\: pretty easy with a macro
19:48:04FromDiscord<pmunch> If you want to get your toes wet
19:49:39arkanoidPMunch: I'm facing another edge case with futhark where I'd like to import a function with internal linkage
19:54:49*averell quit (Quit: .)
20:01:25FromDiscord<hmmm> hmmm my toes are already frozen. Macros seems overkill for lowly me. I'm trying my hand at constructors but the more I go the more it seems a dumb way to go about it
20:15:59FromDiscord<nwilburn> Has anybody had any luck getting a statically compiled binary working on windows with HTTPS client support? My google-fu has not returned a whole lot of positive information about this
20:20:05FromDiscord<hmmm> my own personal google-fu says that if I get no results for "how to blabla python" it can't be done 🧐
20:20:53FromDiscord<hmmm> but if it can be done in python there are very good chances you can do it nim 😃
20:21:56*averell joined #nim
20:22:53*PMunch_ joined #nim
20:24:41FromDiscord<Recruit_main707> strictly speaking you can do anything even in brainfuck, if you hate yourself hard enough
20:25:01*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
20:26:38*PMunch quit (Killed (NickServ (GHOST command used by PMunch_)))
20:26:39FromDiscord<leorize> @nwilburn\: if you just want to ship the binary, you won't have a good time since nim's tls implementation requires a cacert.pem file in PATH or next to the executable
20:26:43*PMunch_ is now known as PMunch
20:27:04*PMunch_ joined #nim
20:27:11FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3HvV
20:27:17FromDiscord<hmmm> it unpacks the seq into the vars
20:28:27PMunchNew advent of code stream will be live in a couple of minutes :)
20:28:40FromDiscord<hmmm> go git them munchie!
20:28:54FromDiscord<hmmm> the yellow
20:29:02FromDiscord<nwilburn> In reply to @leorize "<@784085658292715520>\: if you just": 😦 ↵Honestly I just ignore SSL certs at the moment. When I was attempting to build windows it just failed completely which was disappointing. I can deal with proper cert management later, but was hoping that somebody has some experience with HTTPS + nim + windows and a single binary
20:29:05*neurocyte0132889 joined #nim
20:29:05*neurocyte0132889 quit (Changing host)
20:29:05*neurocyte0132889 joined #nim
20:29:33PMunch!eval let (a, b, c) = (100, 200, 300); echo b
20:29:35NimBot200
20:29:38PMunchNim has that for tuple unpacking
20:30:05FromDiscord<leorize> @nwilburn\: `--dynlibOverrideAll`, then `--passL` your way to static openssl
20:30:23FromDiscord<Solitude> In reply to @hmmm "speaking of which, it": https://github.com/technicallyagd/unpack
20:30:35FromDiscord<nwilburn> hmm ok I'll play around with it. Thanks!
20:32:47FromDiscord<ni-max> sent a code paste, see https://play.nim-lang.org/#ix=3HvW
20:33:13FromDiscord<hmmm> my boi solitude that thingy looks like something that can work for me 🥳
20:38:01PMunchStream is live! https://www.twitch.tv/pmunche
20:45:03*NimBot joined #nim
20:45:03*neurocyte0132889 quit (Ping timeout: 265 seconds)
20:48:13*happycorsair[m] quit (Ping timeout: 250 seconds)
20:49:31*nixfreaknim[m] quit (Ping timeout: 250 seconds)
20:50:38*cheer[m] quit (Ping timeout: 268 seconds)
20:53:04FromDiscord<geekrelief> Is there an equivalent of `astGenRepr` for `PNode`?
21:02:00*krux02 joined #nim
21:02:40*cheer[m] joined #nim
21:22:39*nixfreaknim[m] joined #nim
21:36:18arkanoidPMunch: thanks! bye
21:36:38PMunchThank you for watching :)
21:36:38*PMunch quit (Quit: leaving)
21:38:28FromDiscord<Elegantbeef> PNode means you're playing with the VM?↵(@geekrelief)
21:40:15FromDiscord<Elegantbeef> If so you can steal the code here though `parseObject` needs to be replaced, but havent been arsed yet https://github.com/beef331/nimscripter/blob/master/src/nimscripter/vmconversion.nim
21:59:38*vicfred joined #nim
22:00:36*terminalpusher quit (Remote host closed the connection)
22:19:59*happycorsair[m] joined #nim
22:20:41arkanoidI'm trying to run this line here https://github.com/SciNim/scinim/blob/a6f937ad7a78708333a93e51a1355035491090d7/scinim/numpyarrays.nim#L134 where T is int, I'm getting "numpyarrays.nim(134, 20) Error: cannot instantiate: 'T'". What does it mean?
22:21:53arkanoidis it because NumpyArray[T] type is not exported?
22:22:04*happycorsair[m] quit (Read error: Connection reset by peer)
22:22:05*nixfreaknim[m] quit (Write error: Connection reset by peer)
22:22:07*cheer[m] quit (Write error: Connection reset by peer)
22:24:56*cheer[m] joined #nim
22:24:58arkanoidfound the problem, I have to use function(obj) instead of obj.function to don't get in the way of nimpy
22:25:14*happycorsair[m] joined #nim
22:25:14*nixfreaknim[m] joined #nim
22:33:03FromDiscord<Elegantbeef> arkanoid if you want to use a generic proc with method call syntax you need to do `obj.proc[: T]`
22:33:51arkanoidthanks!
22:34:16FromDiscord<Elegantbeef> This overrides the ambiguity
22:42:14arkanoidis there a way to get line by line the total heap size / memory consumption?
22:42:54arkanoidI'm gettings results by running valgrind after each edit but it's long and boring
22:43:27FromDiscord<Elegantbeef> Perhaps stepping through the program? I dont know though
22:46:04FromDiscord<geekrelief> In reply to @Elegantbeef "PNode means you're playing": I'm trying to fix an issue with nimterop where named nested unions aren't being renamed like they are in c2nim.
22:47:16FromDiscord<Elegantbeef> Ah then i dont know what to say
22:48:06FromDiscord<geekrelief> no worries, I'll try to muddle through it. Thanks. I'm hoping to get to use nimscripter soon. 👍
22:48:13*nixfreaknim[m] quit (Quit: Client limit exceeded: 20000)
22:49:12*cheer[m] quit (Quit: Client limit exceeded: 20000)
22:49:13*nixfreaknim[m] joined #nim
22:49:49*happycorsair[m] quit (Quit: Client limit exceeded: 20000)
23:05:50arkanoidElegantbeef, the `obj.proc[: T]` trick seems not working in my context
23:06:03*cheer[m] joined #nim
23:06:03*happycorsair[m] joined #nim
23:06:09FromDiscord<Elegantbeef> Code example?
23:07:20arkanoidlet me reduce to min example
23:09:15arkanoidElegantbeef: https://play.nim-lang.org/#ix=3Hx4
23:09:47FromDiscord<Elegantbeef> Why are you accquoting the entire thing?
23:10:12FromDiscord<Elegantbeef> pyObj.toTensor0Copyint64 should work
23:10:28FromDiscord<Elegantbeef> God damn it matrix really destroyed that
23:10:51FromDiscord<Elegantbeef> Anyway drop the accquotes and it should work
23:12:02FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3Hx5
23:12:35FromDiscord<Elegantbeef> The accquotes were just cause some chat clients can render codeblocks/lines and makes life lovely
23:13:25arkanoidhaha, I tough the ` were part of the fix ^^". It is working with [: T] .... but why?
23:13:41FromDiscord<Elegantbeef> Like i said that overrides the ambiguity
23:13:55FromDiscord<Elegantbeef> `a.doThing[T]` is taken as `[T](a.doThing)`
23:14:10arkanoidI'm using IRC so everything is lovely, and by lovely I mean not even parsed
23:14:19FromDiscord<Elegantbeef> sorry `[](a.doThing, T)`
23:14:37FromDiscord<Elegantbeef> But `a.doThing[: T]` is `doThing[T](a)`
23:14:43FromDiscord<Elegantbeef> Oh i know how it is
23:14:50FromDiscord<Elegantbeef> It's shit, and anyone that says otherwise is a liar
23:16:28arkanoidpossibly, yes, but it works nicely with ssh and tmux
23:17:11FromDiscord<Elegantbeef> Eh i'm just joking of course whatever works for you
23:17:20FromDiscord<Elegantbeef> I mean matrix even has TUI 😛
23:17:54arkanoidI never explored martrix, don't even know the advantage. What has more than old irc?
23:18:15arkanoidfor a programmer and the community he likes, I mean
23:19:11FromDiscord<Elegantbeef> It has more modern things like spaces which group channels together, it also has voip and file uploading(of course not that interesting to irc users)
23:19:26*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:20:03FromDiscord<Elegantbeef> Though there is only 1 on 1 voip implemented at the moment
23:32:16arkanoidElegantbeef, interesting
23:33:52arkanoidthere's no nim language in client filter list :(
23:42:37FromDiscord<Elegantbeef> Welcome to the world of tomorrow!
23:43:13FromDiscord<arkanoid> Damn, too many pixels!
23:44:03FromDiscord<Elegantbeef> What client are you using?\>
23:44:47FromDiscord<arkanoid> currently the web based @ element.io, not sure which one to pick, I went to the original. Thinking about trying weechat one \:P
23:45:21FromDiscord<Elegantbeef> But the code blocks! 😛
23:45:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Hxb
23:46:18FromDiscord<arkanoid> cool! how is done? `eval echo "foobar"`
23:46:59FromDiscord<Elegantbeef> It's 3 backticks for code blocks
23:47:09FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#ix=
23:47:14FromDiscord<Elegantbeef> It's much like github MD
23:47:25FromDiscord<Elegantbeef> so you can specify a language after the first 3 ticks
23:48:31FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#ix=3Hxc
23:49:10FromDiscord<Elegantbeef> There is an in development matrix sdk for Nim so Nim client soon TM
23:49:49arkanoidas a system administrator I am interested in setting up private server now
23:50:37FromDiscord<Elegantbeef> Aw shit you're now in the whole thing 😛
23:50:41arkanoidstatus is sponsor of matrix?
23:51:09FromDiscord<Elegantbeef> Are they?
23:51:20FromDiscord<Elegantbeef> Interesting they are
23:51:41arkanoidare they using matrix as backend for the "im" part?
23:52:30FromDiscord<Elegantbeef> Doesnt seem they have a library for matrix so i assume not
23:56:36arkanoidin #<roomname>:<serverhost> does the <roomname> part remain contains across federated servers?
23:56:46arkanoids/contains/costant
23:56:51FromDiscord<Elegantbeef> I believe so
23:57:15arkanoidfeels strange to me, it means that a server may pollute all the others, I'd guess no
23:57:39FromDiscord<Elegantbeef> How does it pollute?
23:57:54FromDiscord<Elegantbeef> They're delimited by their host domain
23:58:20arkanoidmanual says "Rooms are distributed and do not exist on any single server"
23:59:41FromDiscord<Elegantbeef> I think that's just talking about how communication works, afaik the host domain deliminates rooms, cause if i dont have a host domain in my "known rooms" how would another room interfere