<< 18-05-2020 >>

00:00:20FromDiscord<Elegant Beef> Then the latter is the method you'd want to use, but idk how well it'd work
00:01:05FromDiscord<Elegant Beef> Since the return type is a PPuChar iirc
00:01:41PrestigeYeah, trying to deref it and convert it to the correct type
00:02:12*krux02 quit (Ping timeout: 260 seconds)
00:03:52PrestigeI have the memory address, number of elements, and the size of each element in bytes. Should be able to convert this to a seq or array somehow
00:04:32skrylar[m]var X is basically ptr X
00:05:19PrestigeI have var propReturn = ptr T, just not super familiar with working with memory in Nim
00:05:54Prestigetrying to convert propReturn into array[numElement, T]
00:06:18Prestigeor seq
00:06:52skrylar[m]for a seq you would have to have the seq be the type it olds, set_len(seq, count), copymem(addr seq[0], <input>, count*T.sizeof), assuming they are plain old data
00:07:12skrylar[m]i believe its possible for fixed sizes to cast something to an unchecked array, sometimes
00:07:32skrylar[m](well technically the unchecked can be any size but you have to bring the safety yourself)
00:19:00*krux02_ quit (Remote host closed the connection)
00:36:14*lritter quit (Ping timeout: 240 seconds)
00:37:18*lritter joined #nim
00:50:53*lritter quit (Remote host closed the connection)
00:56:18*dadada quit (Ping timeout: 260 seconds)
00:57:37*dadada joined #nim
00:58:00*dadada is now known as Guest50185
01:09:34*konvertex quit (Ping timeout: 246 seconds)
01:11:21*Tlongir joined #nim
01:14:02*zacharycarter joined #nim
01:15:12FromDiscord<slymilano> Nice, I'm back to coding Nim! 😄 It's been two months.
01:15:42FromDiscord<slymilano> Anyone figure out how to set up Github Actions to cross compile releases for Linux, Mac and Windows automatically? gist or similar?
01:16:36*NimBot joined #nim
01:18:46*zacharycarter quit (Ping timeout: 256 seconds)
01:22:20*Guest50185 quit (Ping timeout: 272 seconds)
01:27:41*dadada joined #nim
01:28:05*dadada is now known as Guest64773
01:32:07*chemist69 quit (Ping timeout: 272 seconds)
01:33:46*chemist69 joined #nim
01:39:34*ryan_ joined #nim
01:40:00*ryan_ is now known as notsick
01:40:07*notsick is now known as iamnotshane
01:42:49*Tlongir quit (Ping timeout: 264 seconds)
01:46:24*arecaceae quit (Remote host closed the connection)
01:46:49*arecaceae joined #nim
01:50:38FromGitter<kayabaNerve> I just found a fun bug
01:50:48FromGitter<kayabaNerve> Anyone here have experience with Nim codegen bugs?
01:51:50*Guest64773 quit (Ping timeout: 260 seconds)
01:52:54FromGitter<kayabaNerve> As in, I'm looking for a workaround for https://github.com/nim-lang/Nim/issues/14387
01:55:48FromGitter<kayabaNerve> I tried creating a temp out of .get() and .get()[]. Doesn't affect it. Due to the location of this value creation, I can't inline it/make it some from the start to fix this.
01:56:58FromGitter<kayabaNerve> (basically, I need a way to preserve this exact behavior yet add a middleman after the none() so it generates valid code)
01:57:35*dadada__ joined #nim
01:59:30*zacharycarter joined #nim
01:59:30*iamnotshane is now known as dontslaptang
02:09:17*muffindrake quit (Ping timeout: 244 seconds)
02:11:22*muffindrake joined #nim
02:14:21*bok quit (Quit: WeeChat 2.8)
02:21:36*dadada__ quit (Ping timeout: 265 seconds)
02:27:32*dadada joined #nim
02:27:35leorize@slymilano: see fusion CI
02:27:37leorize!repo fusion
02:27:56leorizehttps://github.com/nim-lang/fusion/blob/master/.github/workflows/ci.yml
02:27:56*dadada is now known as Guest97048
02:28:39leorizePrestige: you can cast it into an UncheckedArray, then turn it into an openArray, then convert that into a seq :P
02:32:38*zacharycarter quit (Ping timeout: 272 seconds)
02:41:53FromGitter<kayabaNerve> Found my work-around, as best as I could. Not viable overall though...
02:51:38*Guest97048 quit (Ping timeout: 272 seconds)
02:54:21PrestigeInteresting
02:56:26leorizeit'd be: toOpenArray(cast[ptr UncheckedArray[T]](ptr T), size)
02:56:37leorize^ that's enough for you to pass it around as parameters
02:56:48leorizeif you want it to be a seq, use the `@` operator
02:57:33*dadada__ joined #nim
02:59:42*mono joined #nim
03:02:41*monok quit (Ping timeout: 265 seconds)
03:17:14*Senketsu joined #nim
03:19:54FromDiscord<Prodigle> Is there a way to get an element's parent in the dom module for JS?
03:21:24*dadada__ quit (Ping timeout: 258 seconds)
03:27:36*dadada joined #nim
03:27:59*dadada is now known as Guest50589
03:29:17*Senketsu quit (Ping timeout: 272 seconds)
03:33:22*chemist69 quit (Ping timeout: 260 seconds)
03:33:31*waleee-cl quit (Quit: Connection closed for inactivity)
03:33:59*chemist69 joined #nim
03:51:18*Guest50589 quit (Ping timeout: 260 seconds)
03:55:31shashlickHow do I get ram usage of a short running program on Linux
03:57:35*dadada__ joined #nim
04:01:00disruptekshashlick: time will record rss iirc.
04:01:10*dddddd quit (Ping timeout: 265 seconds)
04:06:01*supakeen quit (Quit: WeeChat 1.9.1)
04:06:44*supakeen joined #nim
04:11:00shashlickyep, that worked
04:11:12shashlickis there a proc in stdlib to reduce n spaces to 1
04:14:46*narimiran joined #nim
04:19:36disruptekmultireplace should work.
04:21:19*dadada__ quit (Ping timeout: 260 seconds)
04:21:30disruptek~nimconf
04:21:31disbotnimconf: 11missing a landing page for advertisement. -- disruptek
04:25:52disruptekshashlick: sorry, it's not multireplace i'm thinking of.
04:26:17disrupteki dunno.. split on space, drop empty, join with space?
04:27:35*dadada joined #nim
04:27:58*dadada is now known as Guest89325
04:28:38disrupteka while loop is probably faster, sadly.
04:39:19shashlickwent with splitWhitespace().join(" ")
04:39:34shashlickimproving nimterop performance - already sped up toast 50%
04:39:50shashlickregex is the worst
04:40:57shashlickthinking of going with --gc:none since toast is short running but RAM usage goes from 22MB to 96MB
04:51:12*Guest89325 quit (Ping timeout: 256 seconds)
04:55:26FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> Anyone use SSL/TLS socket stuff with Visual Studio?
04:55:51FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> I can't get VSC to stop nagging me about things like `newContext` even with `-d:ssl` in the compiler config
04:57:39*dadada__ joined #nim
04:59:34FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> *sigh* never mind, the Nim plugin for VSC completely ignores changes to `nim.buildCommand`
05:08:22FromDiscord<slymilano> @𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭 try to put a nim.cfg file in your project root
05:08:30FromDiscord<slymilano> vsc maybe sniffs it out from there
05:08:49FromDiscord<slymilano> (edit) 'nim.cfg' => '`nim.cfg`' | '`nim.cfg`file in your project root ... ' => '`nim.cfg`file in your project rootwith the line `-d:ssl`'
05:09:11FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> I'm actually reading through the code right now trying to figure out what on earth it's doing
05:09:57FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> yep, dammit, the check aspect doesn't actually pass any compiler flags
05:10:26leorizeuse configuration files
05:10:48leorize@slymilan: did you see my message above regarding github actions?
05:10:55FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> Yes I know I will, but it should work in VSC as well
05:11:10FromDiscord<𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> may have to figure out how to fix this and submit a PR
05:11:30FromDiscord<slymilano> @leorize nice that sounds like it'll fit in nicely
05:11:37FromDiscord<slymilano> next weekend project: cross-platform builds
05:11:40FromDiscord<slymilano> (edit) 'next weekend project: cross-platform builds ... ' => 'next weekend project: cross-platform buildsin github actions'
05:11:56FromDiscord<slymilano> if I edit in discord, do you guys see that edit, in irc? probably not...
05:12:17FromDiscord<Elegant Beef> Yep as a new message
05:12:32FromDiscord<Elegant Beef> Atleast that's how the old bot did it
05:14:49leorizenow it's a diff
05:15:09leorizewould be better if it has colors, but this is already really good compared to the old bot
05:17:07leorize@slymilan: you can query me for help regarding CI with Nim :) it's something that I'm also working on improving
05:24:01FromDiscord<slymilano> i appreciate that, one of Nim's biggest selling points imho
05:24:05FromDiscord<slymilano> ease of distribution
05:25:12FromDiscord<slymilano> left my program running for about an hour, and RAM usage went up from 1MB to 230MB, and climbing steadily. Do I have a memory leak somewhere, I'm new to Nim: https://github.com/sergiotapia/torrentinim/blob/master/src/torrentinim.nim
05:33:52FromDiscord<Elegant Beef> Well you're constantly remaking a http client, but that's not a memory issue as i assume that is disposed of properly
05:35:38leorizeI see spawn, I see bugs :P
05:35:50FromDiscord<Elegant Beef> I also dont like the recursive function calls
05:35:56FromDiscord<Elegant Beef> but im just being nit picky 😄
05:36:29leorizerecursive is fine once you go to the C level (they can optimize them)
05:36:33leorizewe can't yet though :P
05:37:18FromDiscord<Elegant Beef> Especially in this case i'd do a while true, over recursion, i only use recursion when it's a neccesity
05:38:17leorize@slymilano: you're creating many httpclients and you're not freeing them
05:38:30FromDiscord<Elegant Beef> Oh so that is the issue
05:39:55FromDiscord<Elegant Beef> I dont really see why you'd even need to make it more than once
05:40:01leorizealso you might wanna try "ormin", would help with the amount of sqls :p
05:42:26leorize@Elegant Beef: http/1.1 is not a thing everywhere
05:42:46FromDiscord<Elegant Beef> Huh?
05:42:50leorizehttp/1.1 pipelining*
05:43:26leorizeand pipelining is really buggy, though I'd expect modern servers to have this sorted out by now
05:43:53leorizebut modern browsers don't even enable pipelining by default anymore
05:44:10FromDiscord<Elegant Beef> I dont know if what i said is clear, but for each of their modules they make a new http client every tick, and i was just saying they could create one inside those modules and re use it
05:44:47leorizeI just told you why reusing is not always an option :P
05:44:56FromDiscord<Elegant Beef> Ah
05:45:09FromDiscord<Elegant Beef> I just assumed what i said wasnt clear cause of the explanation 😄
05:45:58FromDiscord<Elegant Beef> Im a numpty i dont know anything
05:57:27*drewr quit (Ping timeout: 260 seconds)
05:59:35*solitudesf joined #nim
06:21:34*ryan_ joined #nim
06:22:00*ryan_ is now known as gonger
06:22:13*noonien quit (Quit: Connection closed for inactivity)
06:23:31*dontslaptang quit (Ping timeout: 246 seconds)
06:31:09FromDiscord<slymilano> @leorize how do I "free" the httpclient 🤔
06:31:22FromDiscord<slymilano> nim-lang.org/docs/httpclient.html doesn't have any clues
06:31:29leorizeclose()
06:31:58FromDiscord<slymilano> thanks will try that 😄
06:32:33FromDiscord<Rika> arc when
06:34:23leorizewhen it's done
06:49:10AraqRika: next milestone is 'koch boot --gc:arc' has to work
06:54:40FromDiscord<Rika> oh nice
06:57:02FromDiscord<slymilano> Hm... ram still growing steadily with new .close calls for my httpclients
06:57:03FromDiscord<slymilano> https://github.com/sergiotapia/torrentinim/commit/9647eb865f3d21dbc9e76fa8d8fe0a753560d33e
06:57:52FromDiscord<slymilano> I tried to move the client outside the proc, to stop spinning a new client every time, but then `spawn` stopped working, saying: `Error: 'spawn' takes a GC safe call expression`
07:00:12*rockcavera quit (Remote host closed the connection)
07:00:51*PMunch joined #nim
07:18:27*livcd joined #nim
07:25:22FromDiscord<uniminin> where can i ask for help
07:25:44FromDiscord<Rika> here
07:25:46FromDiscord<Rika> @uniminin
07:25:57FromDiscord<Rika> oh that was a recent message oops lmao
07:26:16*filcuc joined #nim
07:26:25FromDiscord<uniminin> how can i capture output from a system command
07:27:07FromDiscord<Rika> look into the `osproc` module or something
07:27:27FromDiscord<uniminin> already doing
07:29:15FromDiscord<Rika> ? then `outputHandle`?
07:29:23FromDiscord<uniminin> ahh. found it nvm
07:29:45FromDiscord<Rika> https://nim-lang.org/docs/io.html#open%2CFile%2CFileHandle%2CFileMode use this for the handle after
07:30:04FromDiscord<uniminin> thanks
07:36:06*dadada__ quit (Ping timeout: 256 seconds)
07:37:28FromDiscord<Elegant Beef> @slymilano why are you even using threads?
07:37:44FromDiscord<Elegant Beef> Not like this is a task that's going to benefit from async
07:42:34*dadada joined #nim
07:42:58*dadada is now known as Guest70884
07:43:23alehander92bung87 ohhh
07:43:37alehander92i should've told you
07:44:08FromDiscord<Elegant Beef> I'd have gone for something like this, but i honestly dont mind causing my main thread to slow down↵https://play.nim-lang.org/#ix=2mAH
07:44:25alehander92about int/float: i think easy is to just make a option for compilation: usually
07:44:36alehander92i think a lib uses mostly one or the other for numbers
07:44:57alehander92so if you can just tell beforehand "this code uses mostly ints" and fix manually the edge cases
07:44:59alehander92its ok
07:45:31alehander92otherwise i think you need to trace yeah similarly to python-deduckt or ruby-deduckt
07:45:40alehander92https://github.com/metacraft-labs/ruby-deduckt
07:46:56alehander92there were many other tools for that in python, probably ruby: so probably there must be some tool like that for JS
07:47:11alehander92but this is probably far more complicated
07:53:36FromDiscord<uniminin> sent a code paste, see https://discordapp.com/channels/371759389889003530/371759389889003532/711848952395464784
07:53:52FromDiscord<uniminin> what's wrong here?
07:54:13FromDiscord<uniminin> (edit)
07:57:49*gangstacat quit (Ping timeout: 272 seconds)
07:58:24*gangstacat joined #nim
07:59:28FromDiscord<uniminin> shell is not cross-platform and there should be a mechanism in nim to get this data?
08:06:34*Guest70884 quit (Ping timeout: 260 seconds)
08:09:27*fredrikhr joined #nim
08:12:37*dadada__ joined #nim
08:19:14FromGitter<bung87> @alehander92 https://github.com/bung87/ts2nim/blob/master/__tests__/bridge-spec.ts I can translate .d.ts automaticlly now.
08:23:09alehander92awesone!
08:23:12alehander92whats next
08:23:27FromGitter<bung87> @alehander92 yeah, that's the important thing I worried, I need a tool trace the variable, and detect if it is int or float. always using float is annoy
08:24:14FromGitter<bung87> in size,width,height etc, using float is wired.
08:25:39FromGitter<bung87> basiclly "Modules for JS backend" can using my tool for tranlation. by translate @types/*
08:26:25FromGitter<bung87> is embed a js engine a good idea for this task?
08:29:14FromGitter<bung87> or just go directly check how deduckt lib implemented?
08:34:39alehander92bung87 well, we instrument
08:34:49alehander92and other tools also do that
08:34:59alehander92using `tracing` hooks from python/ruby's stdlib
08:35:14alehander92so first one has to check if javascript/javascript egnines expose
08:35:16alehander92stuff like that
08:35:36FromGitter<Willyboar> Hello guys
08:35:40alehander92if they do you can just hook on the enter and exit of each call!
08:35:54*dadada__ quit (Ping timeout: 240 seconds)
08:36:08alehander92and just record the runtime types of an argument and in the end check the statistic: e.g. 28 int 4 float cases
08:36:15alehander92and export this in e.g. json
08:36:27alehander92it sounds fun in principle
08:37:20alehander92you need to run e.g. tests for that goal tho: e.g. `yourtracetool <somescriptusinglib.js> # => types.json`
08:37:25alehander92but as i said
08:37:38alehander92think about that: usually a lib for logic might use mostly ints
08:37:47alehander92another for shapes/games mostly floats
08:37:53alehander92so an easy workaround
08:38:10alehander92might be to just provide a flag/config for the user to type out
08:38:29alehander92e.g. {`all`: `int`, `special_edge_case_function.b`: `float`}
08:39:17*ryan_ joined #nim
08:42:02*gonger quit (Ping timeout: 260 seconds)
08:42:30*dadada joined #nim
08:42:54*dadada is now known as Guest47111
08:45:10FromGitter<bung87> awesome tips , flat may not need, default behaviour seem enough, in the end developer only need changes few types
08:46:44alehander92yeah
08:46:50alehander92well, still add
08:46:53alehander92a flag for int/float i think
08:46:56FromGitter<bung87> and if I can get tool do `tracing ` and can embed it, I can just do all in nim
08:47:06alehander92because it can still be many types once
08:47:17alehander92but yeah tracing can be optional
08:47:30FromGitter<bung87> ok, an optional flag
08:48:10FromGitter<bung87> going well so far :P
08:50:51alehander92yeahhp
08:50:53alehander92i am glad
08:50:55alehander92to have such a tool
08:51:41*konvertex joined #nim
08:58:53*ryan_ quit (Quit: Leaving)
08:59:07*Tlongir joined #nim
09:05:54*Guest47111 quit (Ping timeout: 240 seconds)
09:12:35*dadada__ joined #nim
09:17:15*Trustable joined #nim
09:17:56Zevvbwha I wanted to approach Lua coroutines in Nim, but now I reinvented async and futures
09:18:44alehander92Araq
09:18:57alehander92cool stuff! the c optimizer
09:19:11Zevvalehander92: what's that?
09:19:23alehander92https://github.com/nim-lang/Nim/pull/14382/files
09:19:24disbotwip; don't merge, experiments only
09:19:26alehander92i am not sure
09:19:28alehander92what's the plan
09:19:46alehander92but seems as an interesting approach
09:20:06alehander92zevv yeah whats different about lua's coroutines
09:20:16alehander92do they specify explicitly yield target !
09:20:46ZevvYou can go into an ordinary proc from a coroutine and yield from there
09:20:54Zevvwhen you're running inside a coroutine context
09:21:12Zevvalso the yield() returns what is passed by resume() and vice versa
09:21:37Zevvit's nice for making filter-like stuff for example, and commonly used to do async in lua.
09:22:05Zevvfor some reason lua coro's are much easier on my brain then nim async. I use them a lot and they "just work" as I intend.
09:25:07FromDiscord<mratsim> I've been reading on Rust async story this weekend and thinkg how it stacked vs coroutines. All I have to say is that it's a complex subjects
09:25:21FromDiscord<mratsim> (oh and of course making those threadsafe)
09:26:33Zevvwait what - is this a optimization step that reparses Nim's generated C to optimize on that?!
09:26:56Araqyes, but before you laugh.
09:27:01ZevvI don't laugh
09:27:03Araqit's also a study on linear IRs
09:27:16ZevvI know linear IRs :)
09:27:22Araqand how fast you can make a compiler go if you abandon the old ways
09:28:12alehander92Araq i respect that i did it for sourcemaps :D :D :D
09:28:48alehander92hm, but do you mean you can make a compiler without ast
09:28:59Zevvsure you can.
09:29:04alehander92yeah, but is it sensible
09:29:19alehander92btw guys
09:29:31alehander92what do you think about the idea about "superfastrecompile"
09:29:44Araqfwiw it does function deduplication on a 2MB .c file in 0.2s on my laptop
09:30:26alehander92e.g. you detect a string changed in byte 24-28: you reparse only this function, you dont typecheck again, you know in the finaly binary 3 byte regions are mapped to the const value of the string (deps)
09:30:31alehander92and you directly replace them
09:30:58Araqalehander92, that's a fairy tale and operates on the wrong abstraction level
09:31:26alehander92it's very niche probably
09:31:31Araqknown systems (including Smalltak environments) that do it this way: zero
09:32:05Zevvlinear IR is nice and all, but doing at the C level is monstrous
09:32:26alehander92but why? it doesn't seem insane for some cases
09:32:30alehander92i admit zig's idea of incremental linking got me the "change n bytes in final binary directly" thing, but
09:33:28Araqhere is what you can do: measure. you think sending a 2MB source code file to nimsuggest via /tmp is slow and so nimsuggest should get spans of edited text instead. measure it. I did.
09:33:56dadada__any way to get the actual type that was used for the GenericParam here? https://play.nim-lang.org/#ix=2mB3
09:34:02alehander92i agree, but it just sounds cool in principle :D :D
09:34:31alehander92otherwise changing the c backend is much more work right?
09:35:26AraqZevv, I know but I was to curious not to do it
09:35:30Zevvdadada__: no, you lost that when you went untyped
09:35:50ZevvAraq: Its pretty brave anyway :)
09:36:02FromDiscord<él liquido> Zevv: but closure iterators are basically Lua coroutines
09:36:06alehander92actually almost yes: you can generate code that does `when` etc
09:36:14alehander92but yeah, indirectly
09:36:19alehander92^dadada_
09:37:10dadada__Zevv: I changed to varargs[typed], and this isn't helping, so you must mean something else?
09:37:18alehander92Araq btw i am running the parser in a `||` `openmp` loop and it segfaults, has anyone tried that until now
09:37:48alehander92(its absolutely my code false somewhere :D)
09:38:11Zevvdadada__: with untyped you can't do `asdfasdf` in your code block, right?
09:38:51dadada__Zevv: you mean with typed, yes, you're right, so I removed it, but it doesn't help with getting infos about T
09:39:05Zevvdadada__: lemme check
09:39:30*madpata joined #nim
09:39:35Araqoh spoiler: sending files via /tmp to nimsuggest is lost in the noise
09:40:45ZevvAraq: that is not really surprising, is it
09:41:14Zevvdadada__: oh wait you are trying to do typed macros
09:41:15Zevvha
09:41:26ZevvI always get told not to do that when I run into problems
09:41:43AraqZevv, apparently it is for many, see also LSP's protocol
09:42:20Zevvdadada__: this is what mratsim always answers when I have similar questions: https://github.com/nim-lang/RFCs/issues/44
09:42:22disbot[RFC] Working with types in macro is difficult.
09:43:18AraqZevv, I also tested it on Windows on a not SSD which was the worst setup I could think of :-)
09:43:40Zevvdadada__: I ran into a lot of issues with this in the past, I now just pass the type to the macro as an argument.
09:43:55alehander92this works
09:43:59alehander92but you can still generate code
09:44:10alehander92which checks the type or invokes another typed macro
09:44:21*dddddd joined #nim
09:44:22ZevvAraq: stuff will barely touch your platters anyway when you do this kind of thing
09:44:25alehander92it is an useful pattern: imho
09:44:45Zevvit boils down to some memcpys and your kernel making a note "I should write this to disk one day, probably"
09:45:09dadada__ Zevv: this was the route that I now wanted to go to as a workaround, but syntactically foo[int]() would've been nicer, why is the macro[T]() in existence if it doesn't work?
09:45:27alehander92Araq what i wonder about the linear IR is if one can do a very high lines/second compilation speed
09:45:55Zevvdadada__: I don't know, but I gave up on that.
09:46:09madpataBased on https://play.nim-lang.org/#ix=2mB5 I think that macro expansion is done pre-order. Is it possible to write a macro that first fully expands the given Node and then does it's work on that?
09:47:00dadada__madpata: good question!
09:47:56Araqalehander92, well yes, it's super fast and enables further optimization. for example, you can do alpha conversion without recursions
09:50:30alehander92Araq TIL about alpha conversion
09:50:51*Zevv was also reading up because he didn't want to ask the obvious :)
09:52:23FromDiscord<uniminin> hello?
09:52:28Zevvhello!
09:52:36FromDiscord<uniminin> sent a code paste, see http://ix.io/2mB7
09:52:42FromDiscord<uniminin> how can i print arguments if there more?
09:53:07FromDiscord<uniminin> sent a code paste, see http://ix.io/2mB8
09:53:17*liblq-dev joined #nim
09:53:21Araqmadpata, to expand the node use a 'typed' macro argument
09:53:22FromDiscord<Recruit_main707> not sure, but maybe arguments[0..^1]
09:53:34FromDiscord<uniminin> how?
09:53:39FromDiscord<uniminin> can you show me an example
09:53:45FromDiscord<él liquido> @uniminin maybe loop through them? `for arg in arguments: echo arg`
09:54:02FromDiscord<él liquido> or use `strutils.join`: `import strutils; echo arguments.join()`
09:54:28FromDiscord<uniminin> for loop for this case is kinda sucks
09:54:41FromDiscord<uniminin> for example i want to echo args after index 2 or 3
09:54:48FromDiscord<uniminin> i dont want to echo all
09:54:58FromDiscord<él liquido> then use `for arg in arguments[2..^1]`
09:55:12FromDiscord<él liquido> `^1` means last element
09:55:17FromDiscord<uniminin> what is `..`
09:55:18FromDiscord<él liquido> (edit) 'element' => 'index'
09:55:21FromDiscord<él liquido> range
09:55:26FromDiscord<uniminin> ah
09:55:26FromDiscord<uniminin> thanks
09:55:29Zevvuniminin: your question is not really clear. You can just do `echo argumetns`
09:55:31Zevvand you get the mall
09:55:35Zevv /them all/
09:55:42Zevvbut that's probably not what you're looking for, right
09:55:47FromDiscord<uniminin> yes
09:55:50FromDiscord<uniminin> i've got the idea
09:56:16Zevvyou can also import strutils and do `echo arguments.join(" ")`
09:56:42madpatabeware of rangeerrors. You better check the number of arguments you get before doing stuff like arguments[2..^1]
09:56:50FromDiscord<Recruit_main707> @uniminin are u gonna be active around RLBot any time? :P
09:56:55madpataAraq: thanks!
09:57:00FromDiscord<uniminin> i guess
09:57:14FromDiscord<Recruit_main707> cool
09:58:14FromDiscord<uniminin> what's so cool about it
10:05:30FromDiscord<Recruit_main707> about RLBot?
10:06:30FromDiscord<Recruit_main707> oh, i see what you mean, nothing in particular, its just cool to have new people around, and the fact that you at least know nim is also really cool
10:08:33FromDiscord<uniminin> nim is cool
10:08:35FromDiscord<uniminin> i like it
10:24:26Zevvoh btw ar4q, can you say something about https://forum.nim-lang.org/t/6349?
10:25:36PMunchZevv, why wouldn't that be safe?
10:26:02PMunchOh, iterator arguments..
10:26:03PMunchHmm
10:29:12dadada__what are the rules for where you can define types? I sometimes wrongly assumed you could only do it at the top level
10:29:20dadada__not I tried to define one in a proc on playground and it worked
10:29:41dadada__but I can remember that I tried it somewhere else (maybe it was in a unittest test section) where it didn't work
10:30:00dadada__s/not I/now I
10:30:31liblq-devZevv: I think it would work fine
10:30:54liblq-devbut then I'm not into x86_64 low level details
10:35:00Zevvliblq-dev: well it seems to work, but I wonder if if that is a bobrossian happy little accident, or by design
10:35:26filcucwhat's the best option for getting a function pointer and iterate over the function params in order to create a string..the function paramater should be generic
10:35:40liblq-devZevv: well I'd say it's by design, otherwise it wouldn't be a feature
10:35:58filcucfurthermore i would need to check the function pointer pragmas
10:36:21filcucshould i use a template or a macro?
10:36:58liblq-devonly macros can introspect that sort of thing
10:37:36liblq-devyou can write a macro that uses getImpl() to get the implementation of a proc symbol
10:37:56liblq-devkeep in mind that the parameter to which you pass the proc must be `typed`
10:38:29liblq-devotherwise you'll get nnkIdent instead of nnkSym, and nnkIdent nodes cannot be used with getImpl() etc.
10:40:14filcucok thanks
10:41:06FromDiscord<Recruit_main707> why are some people getting quoted in #news when they talk in chat???
10:41:54FromDiscord<uniminin> how do i properly execute system commands in nim?
10:42:25dadada__does nim have a method or lib for getting a range/slice without failing when a part doesn't exist ie. [0..1000] and only 10..50 exist, should simply deliver the part that does exist? I'm asking this, because I don't want to feel stupid when I roll my own
10:42:37dadada__if you want to know why, it's simply for convenience
10:42:50FromDiscord<Recruit_main707> uniminin: https://forum.nim-lang.org/t/3990 maybe you find this useful
10:44:18liblq-dev@Recruit_main707 it's because Yardanico's bot just mirrors whatever disbot says :P
10:45:00PMunchIsn't it because disbot grabs links from here to post in #news but it's a bit too aggressive?
10:46:22FromDiscord<uniminin> @Recruit_main707 it stucks in interactive? doesnt shows output when taking input?? https://media.discordapp.net/attachments/371759389889003532/711892428923207721/unknown.png
10:47:30FromDiscord<Recruit_main707> try to compile it and run it separately
10:47:44FromDiscord<uniminin> did
10:47:45FromDiscord<uniminin> same
10:48:03FromDiscord<uniminin> https://media.discordapp.net/attachments/371759389889003532/711892851952320592/unknown.png
10:48:32FromDiscord<uniminin> sent a code paste, see http://ix.io/2mBj
10:48:53FromDiscord<Recruit_main707> it seems to be waiting for an input?
10:48:58FromDiscord<uniminin> yes
10:49:05FromDiscord<uniminin> without any ouput
10:49:31FromDiscord<uniminin> i.e https://media.discordapp.net/attachments/371759389889003532/711893221122506842/unknown.png
10:50:23FromDiscord<Recruit_main707> what happens if you use `execShellCmd` intead?
10:51:29FromDiscord<uniminin> where is it from
10:51:38FromDiscord<Recruit_main707> os
10:51:43FromDiscord<uniminin> ah
10:52:24FromDiscord<uniminin> that seems to work
10:52:28FromDiscord<uniminin> thanks
10:52:39FromDiscord<Recruit_main707> np
11:02:34Araqdadada__, system.substr does that iirc but only works on strings
11:02:52dadada__Araq: ok, cool, I wanna do something that works for all containers :D
11:05:22PMunchHmm, this GC bug is really bugging me: http://ix.io/2mBn
11:05:47PMunchErr, with the actual error: http://ix.io/2mBp
11:06:31AraqPMunch, use --gc:arc/orc already
11:06:43AraqI use it for all my new code
11:08:34PMunchProject doesn't build with arc/orc unfortunately: http://ix.io/2mBr
11:09:02PMunchJust a sec, I'll build a debug compiler
11:13:01PMunchThere you go: http://ix.io/2mBs
11:14:24PMunchSame error with orc
11:14:57filcuchow can i print a typed AST?
11:15:07PMunchCompiles with --app:lib and --threads:on as well by the way
11:15:18PMunchfilcuc, what do you mean?
11:15:58filcucPMunch: given var tmp = getImpl(typedArgument) how can i show the AST of tmp
11:16:42filcucfor debugging purpose because i calling tmp.childrenOfKind(nnkPragma) return an empty list...and it shouldn't
11:17:17PMunchtreeRepr?
11:17:43PMunchAs in `echo tmp.treeRepr`
11:20:40filcucPMunch: ok it works thanks..however it seems like the getImpl(node).treeRepr is different that dumpTree:\nproc ..... {.pragrams.}
11:20:52filcucthan
11:21:42PMunchdumpTree takes an untyped version, and you're giving it a typed version probably
11:22:11dadada__Araq: curious, did you ever think about making Nim a lang that counts from 1... I'm used to counting from 0 from C++/C/go/..., yet, sometimes I think it would be more natural to read code that counts from 1, some languages seem to successful that way, of course it's too late now
11:22:15dadada__... it'
11:22:50dadada__s certainly not possible to change all Nim code to this other paradigm, even if we all agreed on it, and I'm not even sure I want it ...
11:23:12filcucPMunch: basically i would like to check a function pointer type declaration for some pragmas
11:23:57PMunchDo you have a small playground example of what you want to do?
11:24:29filcucgive a minute or two :)
11:24:34filcucgive me
11:29:11FromDiscord<Yardanico> @dadada you can make arrays count from any number fwiw
11:29:56FromDiscord<Yardanico> !eval let a: array[3..5, int] = [1, 2, 3]; echo a[3]
11:29:59NimBot1
11:30:40filcucPMunch: https://pastebin.com/veyui5Pq
11:31:44filcucPMunch: https://play.nim-lang.org/#ix=2mBx
11:31:49filcucsecond link is interactive :)
11:33:39filcucPMunch: you can see that getImpl().treeRepr doesn't contain any pragma
11:35:22FromDiscord<Clyybber> Zevv: I'm pretty sure its not undefined behaviour
11:40:43FromDiscord<Recruit_main707> !eval let a: array[3..5, int] = [1, 2, 3]; echo a[0]
11:40:45NimBotCompile failed: /usercode/in.nim(1, 43) Error: index 0 not in 3 .. 5
11:46:08*hoffentlichja quit (Remote host closed the connection)
11:47:19PMunchHmm filcuc you might need to use: https://nim-lang.org/docs/macros.html#getCustomPragmaVal.m%2Ctyped%2C
11:54:03filcucPMunch: It's dosn't seems to work with hasCustomPragma. See https://pastebin.com/8uJLPArT
11:54:10filcucPMunch: am i missing something?
12:05:13PMunchHmm, this is odd indeed
12:05:29PMunchI'm guessing it's checking if `procPtr` has the pragma attached..
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:04*pbb_ quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
12:06:31*pbb joined #nim
12:06:40*supakeen joined #nim
12:11:44filcucPMunch: should i fill a bug?
12:12:52PMunchNot sure TBH
12:13:13PMunchI mean it seems like Nim is parsing your pragma into some hidden field which isn't accessible
12:13:18PMunchAraq, any input on this?
12:13:20Araqdadada__: I like starting from 1 better
12:13:40Araqloops from 1 to x.len are better, 0 for "not found" is better
12:15:53planetis[m]what do i do if i need a hashset of Tables :P
12:16:07AraqPMunch: I don't know either
12:17:11PMunchSo bug report then?
12:17:12*konvertex quit (Quit: quit)
12:17:48Araqsure
12:21:03filcucok i'll create a bug report then
12:22:17*luis_ joined #nim
12:27:52*rockcavera joined #nim
12:31:07filcucAraq: PMunch: https://github.com/nim-lang/Nim/issues/14393
12:31:10disbotCannot obtain procDef pragmas from function pointer typed argument ; snippet at 12https://play.nim-lang.org/#ix=2mBH
12:31:11filcucthank you
12:31:43*dadada__ quit (Ping timeout: 246 seconds)
12:38:06*luis_ quit (Quit: luis_)
12:38:33*luis_ joined #nim
12:42:39*luis_ quit (Client Quit)
12:43:05*luis_ joined #nim
13:14:11*konvertex joined #nim
13:16:03*abm joined #nim
13:31:21*luis_ quit (Remote host closed the connection)
13:35:13*zacharycarter joined #nim
13:36:45PMunchHmm, markandsweep looks solid when I don't multithread it
13:50:34alehander92hey
13:50:38*bebarker quit (Read error: Connection reset by peer)
13:50:47alehander92i found https://swift.org/lldb/
13:51:06alehander92i wonder if anyone thought about that hypothetically as an experiment for nim
13:53:27alehander92hm, i am not sure if that makes sense
13:54:31*Trustable quit (Remote host closed the connection)
13:56:00*filcuc quit (Ping timeout: 272 seconds)
13:56:37FromGitter<bung87> https://v8.dev/docs/d8, node --trace two options I found so far
13:58:49*kungtotte quit (Read error: Connection reset by peer)
14:00:12*kungtotte joined #nim
14:05:25Yardanicoalehander92: well LLDB already works for nim for debugging
14:05:31Yardanicojust like GDB
14:05:39Yardanicohttps://github.com/hediet/vscode-debug-visualizer/pull/51 was done with LLDB
14:05:41disbotAdd Nim demo
14:10:06alehander92Yardanico nope
14:10:09alehander92sorry i meant
14:10:13*dadada joined #nim
14:10:13alehander92a repl based on gdb
14:10:27Yardanicowell I think this will be more work than leveraging LLVM's JIT
14:10:34alehander92maybe yeah
14:10:36*dadada is now known as Guest90403
14:10:52Yardanicoand when making the JIT for LLVM there are also other benefits like improving the llvm backend :)
14:11:01alehander92so how much work is leveraging the jit
14:11:11alehander92like, what are the odds someone would do it in a weekend
14:11:15alehander92or afternoon :P
14:11:22Yardanicosee https://github.com/nim-lang/Nim/issues/8927#issuecomment-580456200
14:11:25disbot[Grant Proposal] Make Nim suitable for interactive programming (Implement hot code-reloading, a REPL and a Jupyter kernel) ; snippet at 12https://play.nim-lang.org/#ix=2kSQ
14:11:33Yardanicohttps://github.com/arnetheduck/nlvm/pull/18
14:11:36disbotwip: jit
14:12:07Yardanico"haven't touched it for a while, but it's able to run simple nim programs using the JIT that comes with LLVM (orc) " " in terms of sophistication, it's somewhere around chapter 1 of the JIT tutorial - but it does already have access to all the code optimizers so the actual code runs pretty snappy (though compilation then takes more time)."
14:13:14*solitudesf quit (Remote host closed the connection)
14:13:35*solitudesf joined #nim
14:14:13alehander92hm
14:14:36alehander92sounds like a bit of work
14:18:05*D_ quit (Quit: No Ping reply in 180 seconds.)
14:19:11*D_ joined #nim
14:19:18*filcuc joined #nim
14:19:30alehander92in #zig we discussed patching binaries directly with some jit-like approaches or just changing the elf files / `.got` info loaded in the debugger to make it possible to reload a function somehow
14:19:46alehander92but you're right that an existing jit makes much more sense
14:21:48alehander92but it is llvm-only
14:22:32Yardanicobut lldb would be lldb only :P
14:23:04alehander92yeah, but this is adaptable to gdb
14:23:17alehander92it's just a random idea, i totally dont see it
14:40:04FromDiscord<slymilano> Good morning beautiful people! Is there a way to get package analytics info like how many people have tried my library? https://nimble.directory/pkg/filesize
14:40:52alehander92yardanico i plan on streaming a bit later
14:41:04alehander92do you guys have a common mumble setup
14:41:06Yardanicoalehander92: well I have to go to the store rn, will you go on mumble? :P
14:41:08Yardanico~stream
14:41:09disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat)
14:41:14Yardanicothis is the mumble server we use
14:41:16alehander92or does one just create a new one each time
14:41:24Yardanicoyou just join it
14:41:30Yardanicono password needed, just join with the nickname you want
14:41:35alehander92i am also going out to store and walk a bit
14:41:40alehander92yeah exactly, great
14:41:48alehander92that's what i wondered
14:51:20*bbarker joined #nim
14:55:04*liblq-dev quit (Read error: No route to host)
14:58:17*liblq-dev joined #nim
15:04:56*liblq-dev quit (Read error: Connection reset by peer)
15:05:08*liblq-dev joined #nim
15:08:29disruptek~stream
15:08:30disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek
15:08:35disruptekadding bugs to the compiler today.
15:09:08Araqfine as long as you blame me for them afterwards
15:09:59*Vladar joined #nim
15:10:28disruptekcool.
15:10:55*filcuc quit (Ping timeout: 260 seconds)
15:11:10disruptekaraq is upset that i don't support unlimited NIH.
15:13:10Araqnah, I'm fine. I'm enjoying the sun
15:17:45*abm quit (Read error: Connection reset by peer)
15:19:23shashlickNim compiler has slowed down since 1.0
15:21:18shashlick@slymilano see if you can get dom96 to provide that info if it exists
15:30:44FromGitter<zetashift> slowed down in what sense?
15:30:53disruptekspeed.
15:31:20FromGitter<zetashift> speed of compilation? speed of resulting programs? ;O
15:31:21FromDiscord<Clyybber> duh
15:31:30FromDiscord<Clyybber> none of these
15:31:39FromDiscord<Clyybber> speed of reading in nimscript config file
15:31:43FromDiscord<Clyybber> (edit) 'file' => 'files'
15:32:03FromDiscord<Clyybber> and its not even the compiler that changed
15:32:23FromDiscord<Clyybber> but simply an added import of os
15:34:34dom96what info am I supposed to provide?
15:36:39FromDiscord<Clyybber> dom96: > Good morning beautiful people! Is there a way to get package analytics info like how many people have tried my library? https://nimble.directory/pkg/filesize
15:37:59dom96nope, there is no data
15:39:19FromDiscord<Clyybber> I thought there is analytics in nimble?
15:39:33FromDiscord<Clyybber> And theres a "most queried" section?
15:40:23dom96there isn't
15:40:35dom96nimble.directory has visit stats
15:44:43FromDiscord<slymilano> thanks anyways gang
15:47:53alehander92oii
15:48:05YardanicoOiI
15:48:45alehander92disruptek, can i use the mumble
15:48:53disruptekgo nuts.
15:48:54Yardanicoalehander92: you can, we're here already
15:49:00alehander92ok
15:49:12alehander92i like eating nuts
15:49:19disrupteki can make you a separate room if you want some privacy.
15:49:19alehander92but not going
15:49:26alehander92no problem i am just going to stream about my experiments
15:49:35alehander92so i'd just bring some noise
15:49:57alehander92so maybe a separate room might make sense to not confuse you guys
15:50:07Yardanicoyeah there are rooms
15:50:29Yardanicolike "2-person private" ( ͡° ͜ʖ ͡°)
15:50:38shashlickspeed of compilation - if you compare with 1.0, it has gone up enough to be noticeable
15:50:42disruptekthere's a test room you can use for now.
15:51:00alehander92ok
15:51:26*NimBot joined #nim
15:51:36shashlickis it possible to profile compile time code?
15:51:51disruptekyou can check the vm counters.
15:51:56disruptekloops, instructions.
15:53:44shashlickhmm - any docs?
15:54:15shashlicki've sped up toast but not nimterop compile time wrappers
15:54:39alehander92`Stream output type 'rtmp_output' failed to start`
15:54:42alehander92has anyone had it :D
15:54:46Yardanico no, hm
15:57:18*Guest90403 is now known as dadada
15:57:48*dadada is now known as Guest46941
15:59:51*Vladar quit (Quit: Leaving)
16:00:19alehander92`Generic error in an external library`
16:00:21alehander92:D
16:02:40alehander92do you guys hear me :D
16:02:44Yardanicoalehander92: no
16:04:04alehander92my mic does work
16:04:29alehander92yep
16:04:35alehander92ok
16:04:40alehander92wait a sec
16:04:52alehander92i didnt turn on the stream
16:17:40alehander92https://www.twitch.tv/alehander42/
16:18:23alehander92learning about parallel / IC toy compilers
16:19:10*Guest46941 is now known as dadada
16:19:21dadadahas anyone managed to hack a top-level defer into Nim?
16:19:40*dadada is now known as Guest13589
16:19:52*Guest13589 is now known as dadada
16:20:29dadadaI would love to use it for allowing a top-level macro to clean up stuff, or start something at the end of a file
16:20:33FromDiscord<Rika> i dont see how that would work
16:20:35FromDiscord<Clyybber> I did
16:20:36Yardanicodadada: have a "block" ?
16:20:41leorizetop-level defer is evil :P
16:20:42FromDiscord<Clyybber> But I haven't upstreamed it
16:20:42Yardanicoyou can have blocks at global level
16:20:44Yardanicoand have defer in them
16:21:16dadadaYardanico: without needing to indent the whole source file? if so, this would be what I'm looking for
16:21:36Yardanico you can have a.nim with "block: include b"
16:21:37disruptek!rfc try scope
16:21:40Yardanicoand in b write your code :D
16:21:40disbothttps://github.com/nim-lang/RFCs/issues/218 -- 3try/except scope -- should it be a thing? 7& 16 more...
16:21:50FromDiscord<Clyybber> disruptek: stop :p
16:22:01disruptekjust posting a link for the stream.
16:22:08FromDiscord<Clyybber> haha, I was just kiddin
16:22:13disruptekwe're talking about defer.
16:22:20dadadaClyybber: how did you implement it
16:23:50FromDiscord<Clyybber> dadada: I did it in the compiler, so not via macros or something like that
16:24:15FromDiscord<Clyybber> I just did it because I was doing destructor injection for global variables
16:24:29FromDiscord<Clyybber> But thats done without try: finally: now
16:24:45FromDiscord<Clyybber> Also, I'm not sure defer is a good thing at top level
16:24:57dadadaClyybber: do you know if one could edit sources whilst compilation is going on, because every such hack I tried ended up with an empty source file
16:25:19FromDiscord<Clyybber> wdym?
16:25:36FromDiscord<Rika> i dont see why you couldnt edit the source file while compiling
16:25:49FromDiscord<Clyybber> dadada: Because the semantics are unclear, what about libraries?
16:26:02dadadaClyybber: well, I suppose I was naive to think this could work, but I opened the source file in a macro and inserted some lines, the result was that the sources became wiped
16:26:30leorizewell did you use fmReadWriteExisting? :p
16:27:33dadadaleorize: not sure, I felt very stupid when my sources were lost, ..., so I did something else after that
16:28:05Yardanico~astream is https://www.twitch.tv/alehander42/
16:28:06disbotastream: 11https://www.twitch.tv/alehander42/
16:28:08Yardanico~astream
16:28:09disbotastream: 11https://www.twitch.tv/alehander42/ -- Yardanico
16:28:15Yardanico^go watch guys, it's alehander92 :P
16:28:32dadadaClyybber: defer at top level would massively simplify some of my code, so it's worth it for that reason alone
16:28:37disruptekyou can add the link to mumble, too.
16:28:44Yardanicoit's the same anyway
16:39:21Araqtoplevel defers? ugh
16:39:41disruptekhorribad.
16:39:56AraqI'm about to add --nodefers to Nim and add to the compiler's config so that I don't get PRs anymore that use it
16:40:11disruptekmakes sense.
16:40:22disruptekwho is PR'ing that dogshit?
16:41:07FromDiscord<Rika> anyone mind enlightening me as to why top level defers are dumb?
16:41:13FromDiscord<Rika> im not so sure whats wrong with them
16:41:50Araqtoplevel or not, no defers in my code
16:42:10disrupteksee the link i referenced for my opinion.
16:42:27FromDiscord<Rika> the try except scope one? ok
16:44:21Prestigelight theme oh my
16:44:29Prestigealehander92: is your battery about to die
16:46:10livcd~stream
16:46:11disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat)
16:47:46livcdnobody can hear me i guess
16:48:39PrestigeNimdow is coming along: https://0x0.st/i9HI.png
16:49:04PMunchPrestige, oh cool!
16:49:06PrestigeLast night, got the code allocating screen space for "docks" i.e. status bars
16:50:08PMunchHow are you doing that by the way? IIRC there is a protocol for things like that
16:50:18dadadaPrestige: what is nimdow?
16:50:21disruptektoday i woke up and found a 6" 3mm allen key in my bed.
16:50:29disrupteki've never seen this tool before.
16:50:38disrupteki think someone planned to kill me last night.
16:51:07disruptekwhat's weird is,
16:51:16PMunchdadada, his window manager written in Nim
16:51:20disruptekthis is the exactly the tool i use to adjust air/fuel mixture on a 911.
16:52:15Prestigedadada: Still working on a beta release, aiming for June 1st
16:52:21Prestigehttps://github.com/avahe-kellenberger/nimdow
16:53:19PMunchPretige, what is "monocle" layout?
16:54:21PrestigeSort of like having sheets of paper stacked on top of each other, and you can change which is on top
16:54:34Prestigeand it would take up all available screen space, aside from docks
16:57:17livcdi g2g..have fun
16:57:25dadadaAraq: actually agree that it makes sense to set strict rules like that for a compiler, but a GUI is something very different, and I've just found a very good use-ase for it, I've a macro that is supposed to configure the GUI at the top level and automatize all the boiler plate, the only thing that is not automatized is that the dev still has to put a separate nowStartIt() macro at the end of the module... now
16:57:32dadadaif defer worked on a the top-devel I could use it in the first macro to automatically create the starting macro with defer, so it's ensured it's executed and executed at the right place, then you could have all the settings in one place, and as it's a given that where the first macro is the app also must be and of course we want to start it, there's really no point in making the dev add that extra line at the
16:57:37dadadaend of the source/module ... is it a big deal? certainly not! but I think it'd be much cooler if that stupid line wasn't needed
16:57:40dadadause-case ...
16:57:49dadadamaybe I shouldn't have written "very-good", but I think "very neat" would fit
16:58:07PMunchPrestige, ah, I see
16:58:51PrestigePMunch: Super easy to implement, I just haven't taken the time. Working on the harder issues atm
17:00:39PrestigeI think I may run into an issue using 3rd party bars since I use tags and not workspaces though, since _NET_CURRENT_DESKTOP only allows for a single integer to be set. Need to research
17:01:37FromDiscord<Recruit_main707> can nim share memory between processes?
17:01:43Yardanicouhh
17:02:20Yardanico@Recruit if it's possible with C, it's possible with Nim :P
17:05:56*Trustable joined #nim
17:06:04Araqdadada: I know this problem but I think we can do better than a toplevel defer
17:06:37AraqI'm sorry, I think I know most macro related problems and DSL designs by now ;-)
17:07:00dadadaAraq: you got my interest, how can we do better? and isn't everything you'd tell me essentially a defer, just implemented by a different method?
17:07:13disruptekAraq: what's the vm inst counter? how does shashlick access it to try to profile compilation?
17:07:45Araqdisruptek: ask Zevv or read the source code, I don't remember
17:07:48disruptekthe issue with defer isn't so much the implementation but the syntax.
17:07:56disruptekAraq: that's what i told him, too. 🤣
17:08:11FromGitter<kayabaNerve> It's not possible to see, within a macro, if a type has a function declared, right?
17:09:03FromGitter<kayabaNerve> I'm trying to think if I can use x.toProtobuf in a typed macro to get the overloads...
17:10:46FromGitter<kayabaNerve> Yep. Never mind then.
17:12:23*filcuc quit (Ping timeout: 265 seconds)
17:17:28Zevvdisruptek: zup
17:17:47alehander92Araq so
17:18:01alehander92is the nim parser threadsafe
17:25:51bbarkerWas wondering about the possibility of preventing or making exceptions somehow explicit in funcs (https://github.com/nim-lang/RFCs/issues/180#issuecomment-598797521) - in 1.2.0 it seems I can raise exceptions in funcs. Is there currently a way to track or prevent this?
17:25:53disbotIntroduce safety modes
17:26:10Yardanico{.raises: [].}
17:26:20Yardanicofunc test(a, b: int) {.raises: [].} = stuff
17:26:40Yardanicowith that the compiler will error if your code somehow can raise an exception
17:26:51Yardanicobut be aware that a lot of nim code is written with exceptions with bad, and there's nothing bad with them :)
17:27:01Yardanicos/with bad/in mind
17:27:07bbarkerah ok, cool, thanks
17:28:12Araqthere is also
17:28:21bbarkerI guess it may be too late to make that the default? e.g. instead if you want a function that can raise any exception you'd have to write: func test(a, b: int) {.raises: * .} (sorry, still very new, not sure what "*" would be)
17:28:26Araq{.push raises: [].} to make it apply for more procs
17:28:41bbarkerassuming that is something people agree is a good idea of course
17:28:42Yardanicobbarker: well, I personally don't feel exceptions are bad
17:28:52Yardanicothey are fast and easy way to do code flow and stuff
17:29:24Araqbbarker: with .push you can change the default around.
17:29:27bbarkeri don't feel they are bad, necessarily, I just like the idea of making them explicit for funcs (not necessarily for procs)
17:29:40bbarkerAraq, cool, i'll look into this more
17:29:51*abm joined #nim
17:30:59Araqpersonally I think it's the old library vs application code split. for the stdlib I want "no raises" as the default and for application code I tend to prefer implicit exceptions
17:31:32bbarkerMakes sense, I guess it is nice being able to change the default like that then
17:32:07Araqin fact, I think lib vs app might be a more useful way of thinking about these things than the prevalent "low level code vs high level code" thinking
17:32:26disruptekAraq: is this supposed to work? http://ix.io/2mDa/nim
17:32:33disruptek(currently crashes with codegen)
17:33:12disruptekwould be nice to hit a switch on the command-line to change the lib/app behavior for an import or whatever.
17:33:56Araqdisruptek: oh yeah, this should work
17:34:41alehander92hm, so
17:34:48alehander92why does gc:none call listRemove
17:35:07bbarkerAraq, yeah that is an interesting point - certainly it isn't fun to guess and worry about what might be raised in a library, but if you are writing an app, perhaps less is at stake or you don't want to worry about it
17:37:10FromGitter<kayabaNerve> Quick question. If I define toX[T: Z] in a file which then imports Y, Y can access toX simply by calling it. That said, if I try to check if toX exists using a macro(untyped, typed) called with `Z.has(toX)`, the overload isn't passed, even with a mixin/bind (bind fails to compile). Any workarounds?
17:38:46bbarkerunrelated, just want to say I'm glad I finally started looking at Nim. Super hyped it was so easy (and fast) to build on my Pinebook Pro also (also awesome that it is self-hosting).
17:40:21Araqalehander92: thread safe parser? yeah, should be. nimsuggest is multi-threaded and uses it
17:41:49alehander92huh
17:42:13alehander92hm, i run it in a parallel loop
17:42:32alehander92and i had some very strange random errors all the time
17:42:41alehander92but i guess this is a different kind of safety
17:45:29alehander92is gc:none supposed to work with -d:useMalloc
17:46:13*solitudesf- joined #nim
17:48:26*solitudesf quit (Ping timeout: 272 seconds)
17:51:36bbarkerI think this still compiles despite raising an assertion error: https://gist.github.com/bbarker/82a166f20e2a133987e637b3caf4e973
17:52:38dadadacan vscode show me all possible value/names of a an enum type?
17:53:09dadadaI created an enum, but it only shows that there's one and when I type one of the values, it shows that it's a value of that type
17:53:28*solitudesf joined #nim
17:55:47*solitudesf- quit (Ping timeout: 258 seconds)
17:59:17dadadahmm, after some experimenting it looks like it's not possible with vscode/nim
18:03:13*zacharycarter quit (Ping timeout: 264 seconds)
18:06:36bbarkeris the fact that AssertionError not included included as an exception in one instance (isn't caught by {.raises: [].}) despite being listed as an unhandled exception, intended?
18:12:36*lritter joined #nim
18:17:16FromGitter<Knaque> @dadada Workaround is to make an incomplete `case` statement. The error thrown by vscode/nim will show all the options you're missing. Example (https://gist.github.com/Knaque/dd71f0fa13a0d6fcfe460ddd41d456ba)
18:19:03FromGitter<Knaque> Alternatively, ctrl+click goes to the definition of whatever you click on (i.e. var, proc, enum, etc), but it doesn't always work properly for whatever reason, so your mileage may vary.
18:20:18*hoffentlichja joined #nim
18:22:21*Tyresc joined #nim
18:28:20*waleee-cl joined #nim
18:30:32*hoffentlichja quit (Remote host closed the connection)
18:32:08YardanicoNumber of packages in Nimble by author (with more than 10 packages) - https://gist.github.com/Yardanico/2be99a38634d4ade55ff2957fe669f40
18:32:41Yardanicocode is really simple too https://gist.github.com/Yardanico/39598168a204fb8d81aed80f5210defc
18:33:43YardanicoFull list - https://gist.github.com/Yardanico/65f25abd347271fc757c93a939d4da59
18:34:09Araqbbarker: that's not a bug and got more refined in the upcoming 1.4
18:34:40Araqcompile with --panics:on in Nim devel and see that it doesn't raise an exception ;-)
18:39:20Araqalehander92: for the || loop you need to use setupForeignThreadGc()
18:39:42alehander92ohhhhhhhhhhhhhh
18:41:10*Jesin quit (Quit: Leaving)
18:44:46*Jesin joined #nim
18:48:20FromGitter<bung87> am at 32
18:50:50*zacharycarter joined #nim
18:52:21alehander92i am so happy
18:52:32alehander92this fixed most of my issues
18:52:34alehander92thanks araq
18:53:12alehander92so now parallel parsing => 0.492
18:53:18alehander92serial => 0.865
18:55:27*leorize quit (Quit: WeeChat 2.7.1)
18:57:07PrestigeIs there some way to do this?: https://play.nim-lang.org/#ix=2mDA I'm thinking maybe I should be declaring B in some other way. Unless this is just a limitation of Nim atm
18:58:11Yardanicoprocs have static dispatch
18:58:15Yardanicostatic binding
18:58:44Prestigeah
18:59:52PrestigeI could use generics and it seems to work, just don't have type safety.. Is there some way to say something like proc findByFoobar[T extends A] ?
19:03:16bbarkerAraq, $ ../Nim/bin/nim --panics:on c -r hello.nim -- this still gives a runtime rather than compile time error: Error: unhandled exception: /home/brandon/workspace/NimPlayground/hello.nim(21, 14) `result == (result - 1)` [AssertionDefect]
19:03:22Yardanicoyes
19:03:25Yardanicothat's right
19:03:41YardanicoDefects are special kinds of errors which usually say that the program is incorrect
19:03:48Yardanicoand with panics on they're not catchable :)
19:04:14bbarkerah ok
19:04:19bbarkerI should probably be more clear just to be safe: i was looking for a way to prevent assertions being used in a func
19:04:30bbarkersince they can raise exceptions
19:04:58Yardanicowell just always compile with panics on :)
19:05:42Yardanicoand also you should know that nim's "no side effects" is not the same as "pure function" in math
19:05:54Yardanico(and nim "func" == proc with {.noSideEffects.} pragma
19:07:43bbarkerYardanico, good to know in both cases - could you elaborate a bit more on the difference between func and "pure function"?
19:08:01Yardanicoyou can have func test(a: var int) = a = 5
19:08:27Yardanicowhich will mutate the a variable outside of the func
19:08:50bbarkerah yes. I have to say as a functional-leaing programmer, var parameters are the scariest thing i've come across so far :-)
19:09:13bbarkerbut that should be relatively easy to disable based on some feedback i've had so far
19:10:07bbarkerI just coudn't recall if they worked in procs and funcs so thanks for reminding me
19:12:00bbarkerback to the --panics:on option, I'm not sure I follow still, since if I do `$ ../Nim/bin/nim --panics:on c -r hello.nim` with an `assert x == x`, it will still compile and run fine, even though the enclosing function has `{.raises: [].}`
19:12:34Yardanicowell this assert runs fine
19:12:37bbarkerof course no exception is thrown since x == x
19:12:41Yardanicoyou can disable asserts with --assertions:off btw
19:12:48bbarkeroh. :-)
19:12:54Yardanicoor short "-a"
19:12:57Yardanicohttps://nim-lang.org/docs/nimc.html
19:15:14alehander92https://github.com/alehander92/learn-compiler
19:15:46bbarkerhmm, still not what I have in mind exactly. Ideally what I'm looking for is a way to model that a func doesn't throw any exception (including assert-related exceptions, or any others that might be missed from {.raises: [].}
19:16:03Yardanicotry: body except: discard :D
19:16:06alehander92ok, i'll leave the experiment here, updating from time to time :D
19:17:00bbarkerYardanico, ah, so basically wrap a func in another safe func that catches all exceptions? hmm
19:17:10Yardanicoyeah, or modify the compiler :P
19:18:14Yardanicoor maybe there's some other way I don't know of
19:19:20bbarkerI'm not against that, though I'd like to do it in a way that is hopefully in-line with the maintainers. I think Araq said it was intentional to be this way though. To me it seems like `raises: []` should include all exceptions, but I realize that would break existing code
19:19:39Yardanicowell it is intentional
19:19:48Yardanicobecause Defects are program errors and are not supposed to be catchable
19:19:55Yardanico(that's how it works with --panics:on)
19:20:02Yardanicoand --panics:on is not the default because of backwards compat and stuff
19:20:27FromDiscord<brainproxy> any suggestions re: taking an executable built with nim and packaging it in a macOS `.app` bundled (wrapped in a `.dmg`)?
19:20:49Yardanicowell, you can do something like https://stackoverflow.com/questions/1596945/building-osx-app-bundle
19:21:23bbarkerYardanico, that makes sense - I just think it might be useful to have a compile-time way to say: this function can't have defects (or exceptions)
19:21:53bbarkerThough of course certain defects could still pop up like out of memory errors
19:22:27FromDiscord<brainproxy> @Yardanico thank you!
19:22:44bbarkerYardanico, ok, i'm gonna think about it :-)
19:22:47YardanicomacOS packages are just directories with special structure @brainproxy
19:23:08FromDiscord<brainproxy> I'm aware, but wasn't sure how tricky to get the metadata right, if there's a tool that can help you, etc.
19:23:18*JustASlacker joined #nim
19:23:30FromDiscord<brainproxy> never attempted this before
19:24:34Yardanicowell there should be some macos tool for that no?
19:25:29Yardanicoalthough I didn't do any macos development so I don't really know
19:34:33FromDiscord<brainproxy> that SO link you gave is the best thing I found after googl'ing for awhile; also, the answer just below that one has a link to a very nice looking tool for automating dylib relocation inside the bundle; and I found this too: https://github.com/sindresorhus/create-dmg#readme↵So, I'm thinking I should be good to go 🤞
19:34:46FromDiscord<brainproxy> (edit) 'I found' => 'I've seen'
19:40:22Yardaniconice, saw that this create-dmg has a spinner, found out it uses https://github.com/sindresorhus/ora
19:40:28Yardanicoand found a nim package for same thing https://github.com/molnarmark/spinny :)
19:42:32Yardanicoalthough one thing I don't like is that it uses JSON
19:44:25FromGitter<bung87> @brainproxy I 've write some script doing that
19:45:16FromGitter<bung87> https://github.com/bung87/crowngui/blob/master/src/crownguipkg/cli.nim
19:46:43FromGitter<bung87> aim for embed a web site, current only build a .app
19:49:14FromDiscord<brainproxy> thans @bung87
19:49:20FromGitter<bung87> also you may interested in https://github.com/nim-lang/niminst
19:49:21FromDiscord<brainproxy> (edit) 'thans' => 'thanks'
19:51:24FromDiscord<brainproxy> thanks again! another team member is going to be doing Windows packaging, will send the link his way in case he's unaware of it
19:52:47FromGitter<bung87> ok, do you know his process, I also want windows packaging
19:54:19Araqwindows packaging is "ship the .exe plus what it needs" to your customers
19:54:36FromGitter<bung87> I want cross compilation , but I cant find `windres` like lib
19:55:54FromGitter<bung87> my .app packaging process has build icon process, so I'd like windows packaging also have this.
19:56:42Araqsetup a CI for cross compilation, then you can also test the result, I dunno. maybe you want some testing
19:56:44dom96.app bundles can literally be built by taking an existing .app and modifying its contents btw
19:57:48FromGitter<bung87> yeah, it's a dir with plist
19:59:02Araqseriously. test the binary on the platforms you claim to support. anything else is absurdly unprofessional
19:59:18FromGitter<bung87> @Araq ok, I'll go docker solution
20:08:53Araqdocker?
20:12:06Yardanicowow I didn't know https://nim-lang.org/docs/asyncfile.html works for stdout/stdin as weill
20:12:06FromGitter<alehander92> well, still building for cross platform sounds useful
20:12:20FromGitter<alehander92> you need to just be able to run your binary on all the targets
20:12:23FromGitter<alehander92> not the whole build
20:12:58FromGitter<alehander92> cheaper
20:13:13Araqcheaper under what cost model?
20:13:36FromGitter<alehander92> well, if you need to pay for X hours of CI for Y time for Z platforms
20:14:07Araqwell, then you need to compare it to running the build matrix on your work PC
20:14:08FromGitter<alehander92> just paying for running a binary might help a bit
20:14:45FromGitter<alehander92> well, yeah
20:15:24FromGitter<alehander92> but often it *can* be cheaper + having to maintain/setup the whole build system which is usually much more complicated than running the binary itself
20:15:28FromGitter<alehander92> on each possible target
20:15:36Araqfor me in Germany it's more expensive due to the high energy costs. not to mention that the CIs don't cost me any money to begin with.
20:15:54FromGitter<alehander92> well, how do you find those free CI-s for n platforms
20:16:12Araqazure pipelines. bam, done.
20:16:21*kradnoel joined #nim
20:16:21FromGitter<alehander92> you can still run the matrix on subset with well maintained several platforrms
20:16:29FromGitter<alehander92> it doesnt have to be on your own pc
20:16:33Araqor the new github stuff (forgot the name)
20:16:45*kradnoel quit (Read error: Connection reset by peer)
20:16:59FromGitter<alehander92> yeah but there are probably still actual limits
20:17:10FromGitter<alehander92> especially for private stuff
20:17:52FromGitter<alehander92> have to look to setup a multi-gcc testing thing btw, do people just download n gcc prebuilt images for stuff like this?
20:18:11Yardanicoor just use zig XD
20:18:18*abm quit (Ping timeout: 260 seconds)
20:18:24FromGitter<bung87> with docker I can run locally
20:18:37AraqYardanico: so predictable. maybe I don't want to though because it solves a non-issue
20:19:12YardanicoAraq: well I mean I know zig cc doesn't solve anything, it's just an easier way (as in - no need to build your own GCC or download different compilers for different platforms/architectures) of cross-compiling things
20:19:40Araqyeah, well. guess what. I never build my own gcc before zig solved this problem for me.
20:19:41FromDiscord<Rika> github actions is the name
20:20:03Araqit's fairy tale stuff.
20:21:36Yardanicoyeah, I know in real development you want to actually test it on target platform so you use real compilers, but for small fun stuff it might be easier
20:22:30Araqfor small fun stuff it's simpler to simply not support Windows. Or MegaMangaLinux
20:22:43Yardanicohmm, that is true as well :P
20:23:54FromGitter<bung87> easier than using mingw?
20:25:20FromGitter<alehander92> Araq come on
20:25:28FromGitter<alehander92> both cases have pro-s and con-s
20:25:47FromGitter<alehander92> of course, often there are much more additional issues
20:26:07FromGitter<alehander92> needed to support so many targets
20:26:13FromGitter<alehander92> so its just one step
20:26:27Araqthere are pros for embedded devlopment when your target cpu cannot run a compiler.
20:26:44FromGitter<alehander92> but i dont want to setup my whole build env
20:26:46FromGitter<alehander92> for all my targets
20:26:49FromGitter<alehander92> why would i do that
20:28:23Araqno idea what you're talking about
20:28:56Araq"setup build env" seems to be what you're arguing for with cross-compiling over using a CI
20:33:04*narimiran quit (Ping timeout: 256 seconds)
20:33:23*muffindrake quit (Ping timeout: 272 seconds)
20:40:04*muffindrake joined #nim
20:41:28*muffindrake quit (Client Quit)
20:44:03FromGitter<alehander92> but i need to think for all kinds of edge cases/etc to make sure my build works on each platform
20:44:07FromGitter<alehander92> which doesnt make sense
20:44:35FromGitter<alehander92> for me its important that my binary works on X, i dont want to make sure my build works there
20:44:51FromGitter<alehander92> even if i use CI i still need to account for
20:46:33Araq*shrug* as opposed to what? so you cross-compile your binary and then it never uses any dynamic library ever?
20:47:29Araqdifferent OSes are tough to handle yes. so here is what the rest of the industry does: Only support a selected set of platforms.
20:47:48Araqyou simply cannot QA anything else.
20:48:09Araqno matter how much you simplify the non-issue of "how to invoke the compiler"
20:50:31FromDiscord<Technisha Circuit> If i wanted to use Nim types in another lang with cffi (e.g. Python) how would i define the type?
20:50:44*solitudesf quit (Remote host closed the connection)
20:51:09*solitudesf joined #nim
20:54:21*letto quit (Quit: Konversation terminated!)
20:55:46FromDiscord<Rika> depends on the ffi does it not
20:58:41FromDiscord<zetashift> @Technisha Circuit maybe this could help: https://github.com/Pebaz/nimporter/tree/master/examples
20:58:48disruptekhttp://ix.io/2mEk/nim
20:59:05*solitudesf- joined #nim
21:00:31FromDiscord<Technisha Circuit> That uses Nimpy and Nimpy doesn't have a way to expose types to Python last time i checkef
21:00:36FromDiscord<Technisha Circuit> Checked*
21:01:52Araqthere is cint, cstring, cfloat
21:02:14Araqand Python's FFI can understand these types
21:02:27*solitudesf quit (Ping timeout: 265 seconds)
21:02:50*muffindrake joined #nim
21:06:19FromDiscord<Technisha Circuit> But how about for user created types?
21:06:51Araqan object is a 'struct', a Nim array is a C array
21:07:26Araqa Nim seq is more complex, it depends on the runtime
21:08:57FromDiscord<Technisha Circuit> A sec is similar to an array but you can add and remove elements from it, right? I assume it would be a list for Python
21:09:21FromDiscord<Technisha Circuit> Since for Nimpy it gave no arguments when i used it for a Nim function and compiled it for Python
21:09:24Araqsure but Python's lists are not binary compatible to Nim's seqs
21:09:30FromDiscord<Rika> its similar, but under the hood i bet its different
21:09:33dadadaI'm using a statement list with ident: type notation and then I convert it to RecList to create objects with a macro .... so far so good ... unfortunately the modules of the types get lost in translation ... and if I use getImpl getTypeImpl in the converting proc it tells me the thing that is recognized as a Sym is not a symbol node ... even though that makes no sense
21:10:07dadadaon top of that I didn't even hope for solving this with getImple/getTypeImpl, because from what I found on playground they don't help to retrieve a symbol's module
21:10:39dadadaso what was ident: module.typename ends up as ident: typename in the final reclist
21:10:59dadadaand then the compile errors about conflicting names commence
21:11:05FromDiscord<Technisha Circuit> > sure but Python's lists are not binary compatible to Nim's seqs↵I think Nimpy handles that for me, and if not i can just use `pyBuiltinsModule().list(mySeq)`
21:14:46FromGitter<ynfle> Why does ⏎ ⏎ ```proc hello*: string = ⏎ for _ in []: ⏎ discard``` ⏎ ⏎ compile? [https://gitter.im/nim-lang/Nim?at=5ec2fac6990d343a5f378ad7]
21:15:56dadadaynfle: why not? essentially this is an empty proc
21:16:13dadadaand it'll return an empty string
21:16:16FromGitter<kaushalmodi> @ynfle Because sematically it looks alright
21:16:24FromGitter<kaushalmodi> s/sematically/semantically
21:16:38Yardanicowell there is an issue with that I see a bit
21:16:41Yardanicowhat type is []? :D
21:17:34Yardanicoah it's tyEmpty
21:17:34dadadadoes it matter? the compiler probably figures that it's not so important when the array is empty, there's nothing to iterate
21:17:44Yardanicoand you get a compiler crash if you try to do typeof([])
21:17:50Yardanico!eval echo typeof([])
21:17:52NimBotarray[0..-1, empty]
21:17:56Yardanicolol wat
21:17:59Yardanico??????
21:18:10Yardanicoah lol it works without a proc
21:18:12Yardanicodoesn't work in a proc
21:18:26Yardanico"Error: internal error: getTypeDescAux(tyEmpty)"
21:18:42Yardanicohttps://github.com/nim-lang/Nim/issues/12830
21:18:45disbotfor var in <empty_array> throws getTypeDescAux(tyEmpty) ; snippet at 12https://play.nim-lang.org/#ix=2mEo
21:19:08Yardanicoah actually it's a duplicate of https://github.com/nim-lang/Nim/issues/11684
21:19:11disbotFor loops over a hardcoded empty array crash the compiler. ; snippet at 12https://play.nim-lang.org/#ix=2mEp
21:24:09FromGitter<ynfle> ```proc hello*: string = ⏎ for _ in []: ⏎ discard``` [https://gitter.im/nim-lang/Nim?at=5ec2fcf9940fa238d6ff01eb]
21:24:23FromGitter<ynfle> ```proc hello*: string = ⏎ for _ in []: ⏎ discard ⏎ ⏎ discard hello()``` [https://gitter.im/nim-lang/Nim?at=5ec2fd07955768391869d2af]
21:24:27FromGitter<ynfle> This compiles
21:24:34Yardanicoyes, why wouldn't it?
21:24:43Yardanicoyou discard an empty string which is returned from hello proc
21:24:44FromGitter<ynfle> *doesn't sorry
21:24:46Yardanicoah lol
21:24:58Yardanicowell yeah see the issues I linked above
21:24:59FromGitter<ynfle> If the proc is called then it doesn't compile
21:25:04Yardanicohttps://github.com/nim-lang/Nim/issues/11684
21:25:06disbotFor loops over a hardcoded empty array crash the compiler. ; snippet at 12https://play.nim-lang.org/#ix=2mEp
21:25:08FromGitter<ynfle> Thanks I'll take a look
21:25:11FromGitter<ynfle> Looks interesting
21:25:26FromGitter<ynfle> Just wondering how the compiler checks return types
21:25:51FromGitter<ynfle> And what is evauluated at compile time
21:27:58*solitudesf- quit (Ping timeout: 256 seconds)
21:32:40*PMunch quit (Quit: leaving)
21:35:15*Trustable quit (Remote host closed the connection)
21:49:08FromGitter<alehander92> Araq well its always useful
21:49:10FromGitter<alehander92> to have choice
21:49:15FromGitter<alehander92> and additional tooling
21:49:31FromGitter<alehander92> sometimes it might be worth it, sometimes not
21:49:52FromGitter<alehander92> you're probably right testing is underestimated
21:50:14Araqit's the "choice" in platforms that created this mess in the first place
21:50:50AraqI don't enjoy the choice between Linux, OSX and Windows, I'd rather have only one OS that sucks.
21:50:55FromGitter<alehander92> eh
21:51:01FromGitter<alehander92> and only one language that sucks
21:51:11Araqyep.
21:51:29FromGitter<alehander92> :D called JAVA
21:51:48Araqcalled Nim.
21:52:22FromGitter<alehander92> people literally want to create functional dialects of Nim :D
21:53:09FromGitter<alehander92> it's like having only a single football team
21:53:34FromGitter<alehander92> when you can have 284721
21:54:58wgetchonly OS you need is TempleOS. only lang you need is HolyC.
21:56:17FromDiscord<Rika> nim targeting holyc when
22:00:24AraqRika: we're still busy targeting wasm. wasm is getting multi-threading anytime soon
22:00:42FromDiscord<Rika> i'm joking XD
22:00:55AraqI know. I'm joking too
22:01:54Araqand while fools refine x86's memory model ( https://www.cl.cam.ac.uk/~pes20/weakmemory/x86tso-paper.pdf ), wasm revolutionizes the web via a new way of encoding the stack pointer
22:03:17Araqbecause this time there are two stack pointers, one of which that has to be emulated with wasms load/store mechanisms
22:03:25Araqit's great
22:05:17*lritter quit (Ping timeout: 265 seconds)
22:05:29*jwm2241 joined #nim
22:06:22*jwm224 quit (Ping timeout: 260 seconds)
22:08:59*lritter joined #nim
22:10:00FromDiscord<zetashift> off-topic but I don't get how WASM is going to cure that javascript framework fatigue, as you'll know have N languages using M frameworks to write some frontend stuff
22:10:25FromDiscord<zetashift> only difference is it'll run faster, but if they use shoddy data structures and algos how is that going to change
22:10:57Yardanicobtw congrats everyone, with my last issue https://github.com/nim-lang/Nim/issues/14396 we have 1600 issues now :)
22:11:00Yardanico:D
22:11:00disbot[ARC] object is getting sinked with createThread when it shouldn't ; snippet at 12https://play.nim-lang.org/#ix=2mEL
22:12:39Yardanicoopen ones I mean
22:15:58FromDiscord<zetashift> A lot of the recent issues are ARC stuff
22:16:14Yardanicoyeah, I tried quite a lot of nim libs/apps with arc
22:16:14*liblq-dev quit (Quit: WeeChat 2.8)
22:16:22Yardanicoyou can help too
22:16:43FromDiscord<zetashift> I can for a fact say that godot-nim doesn't work because it uses some GC stuff
22:16:57Yardanicowhich GC stuff?
22:17:04YardanicoGC_ref and GC_unref work with arc
22:17:44YardanicodeepCopy isn't there for arc though (yet)
22:18:11FromDiscord<zetashift> "setStackBottom" iirc
22:18:47FromDiscord<zetashift> I'm looking into how to run stuff using ARC
22:18:53Yardanico--gc:arc :P
22:19:05Yardanicoit also sets --exceptions:goto automatically, but you better be on latest devel for recent arc bugfixes
22:19:14FromDiscord<zetashift> switching to devel
22:19:21Yardanicoand if you use stuff like async you need orc
22:20:11FromDiscord<zetashift> Yeah sometimes I read about ARC, it looks like it'll come a lot sooner than 2.0 tho?
22:23:01FromDiscord<zetashift> ``` C:\Users\Administrator\.nimble\pkgs\godot-0.7.27\nim\godotnim.nim(885, 5) Error: undeclared identifier: 'nimGC_setStackBottom' ```
22:23:03Yardanicowell already a lot of stuff works with it
22:23:10Yardanicoright now the main goal is to make the compiler work with gc:orc
22:24:40PrestigeCan I manually insert null chars into a string?
22:24:46Yardanico\0
22:25:05Prestigecan that be followed by another number somehow? like "1\02\0"
22:25:37FromDiscord<Rika> that would prolly be recognized as \2 tho
22:25:42Yardanicoyes
22:25:46Prestigedouble \\ ?
22:25:57FromDiscord<Rika> concat the strings on compile time using static:
22:25:59FromDiscord<zetashift> nimgame2 also fails for me on arc : https://play.nim-lang.org/#ix=2mES
22:26:00FromDiscord<Rika> is what i would do
22:26:09Yardanico@zetashift I know it does
22:26:12Yardanicobut you can make it work
22:26:16Yardanicoif you changel finalizers to destructors
22:26:23Yardanicoand reorder some code around
22:26:33Yardanicochange*
22:27:08YardanicoI was able to run the first example after changing some finalizers to destructors and changing code placing a bit so destructor is placed before the Obj() object construction
22:27:51FromDiscord<zetashift> I honestly don't know that much about low level memory management stuff. So something like destructors I can deduce but I wouldn't know how it all works 😛
22:28:16YardanicoAraq: about https://github.com/nim-lang/Nim/issues/6369 - it works if I do "zeroMem(addr myChannel, sizeof(myChannel))" or "spinnyChannel = default(typeof(spinnyChannel))" but is that correct? I mean should I make a PR or not?
22:28:19disbotRe-opening a channel results in a segfault when sending data to it ; snippet at 12https://play.nim-lang.org/#ix=2mET
22:28:32YardanicoI mean if I do that after closing the channel or before opening it
22:29:04FromDiscord<Technisha Circuit> Is it better to use `const` where possible or is it better to use `let` always
22:29:13Yardanicouse const when possible :)
22:29:18Yardanicoso your program has less stuff to do at runtime
22:30:16FromDiscord<Technisha Circuit> Thanks!
22:30:31FromDiscord<Technisha Circuit> @codic so it's better to use const over let
22:30:47Yardanicowell I mean generally I prefer const over let, let over var
22:30:53Yardanicoit makes easier to read the code and stuff
22:31:10FromDiscord<Technisha Circuit> Ok
22:31:23FromDiscord<Technisha Circuit> Does using const over let make the program any faster?
22:32:06Yardanicowell imagine you're calculating some stuff with let, like building a hash table or something
22:32:11FromDiscord<Technisha Circuit> Okay
22:32:12Yardanicoif you do it with let, you do it at your program's runtime
22:32:19Yardanicowith const the VM does it at compile-time
22:32:24FromDiscord<Technisha Circuit> Oh okay
22:32:27Yardanicoa lot of nim code works at compile-time
22:32:32Yardanicoeven things like json, streams, etc
22:32:37FromDiscord<Technisha Circuit> Nice
22:33:53FromDiscord<Technisha Circuit> Is osproc included in is automatically or do i need to import osproc myself?
22:34:04Yardanicowdym "in it"?
22:37:04FromDiscord<Technisha Circuit> Like, if i import os, would i be able to use `execProcess` from osproc without importing `osproc` manually?
22:37:22Yardanico!eval import os; echo execCmd("id")
22:37:22*JustASlacker quit (Ping timeout: 260 seconds)
22:37:24NimBotCompile failed: /usercode/in.nim(1, 17) Error: undeclared identifier: 'execCmd'
22:37:25Yardanicoas you can see, no
22:37:32Yardanico!eval import osproc; echo execCmd("id")
22:37:36NimBotuid=65534(nobody) gid=65534(nobody)↵0
22:39:18FromDiscord<Technisha Circuit> Thanks!
22:39:42FromDiscord<Rika> nim's VM is honestly amazing to me
22:40:06Yardanicoand it's also register-based :P
22:40:21Yardanicoso it's pretty fast and can generally compete with other non-JIT VMs
22:42:15FromDiscord<zetashift> what would be the upsides of it being JITted?
22:42:54Yardanicohonestly I don't know :P maybe it'll help with some hot paths in macros or something
22:45:57FromDiscord<Technisha Circuit> Nim is fun
22:46:40FromDiscord<dom96> JIT=speed
22:49:30FromDiscord<Technisha Circuit> How would i exit a nim program?
22:49:36FromDiscord<Technisha Circuit> Is there `exit()` or something?
22:49:38disruptekquit
22:49:48FromDiscord<Technisha Circuit> Just `quit`?
22:49:55Yardanicoquit or quit()
22:50:00FromDiscord<Technisha Circuit> Thanks!
22:50:02Yardanicoor 0.quit or quit 0 or quit(1)
22:50:06Yardanicoor qUIT(1)
22:50:16Yardanico!eval qUIT(1)
22:50:18NimBot<no output>
22:52:03FromDiscord<Technisha Circuit> If you add a number as an argument for quit, is that the return code?
22:52:07Yardanicoyes
22:52:16FromDiscord<Rika> has anyone written nim in an alternating caps style LOL
22:52:18FromDiscord<Technisha Circuit> What's the default return code? 0?
22:52:22Yardanicoyes
22:52:22FromDiscord<Rika> yes
22:52:26FromDiscord<Technisha Circuit> Thanks
22:52:29Yardanicothat means "everything went fine"
22:52:36FromDiscord<Technisha Circuit> > has anyone written nim in an alternating caps style LOL↵I can make some code to do this
22:52:41FromDiscord<Technisha Circuit> Yup, ik that from Python
22:52:49Yardanicoif you quit on some error, it'll make life of other people easier if you do it like "quit(1)"
22:58:26FromDiscord<Technisha Circuit> If i use `fmt` on a string that gets inputted by a user, and it then contains braces, does that make the code inside the braces get ran or no?
22:58:32Yardanicono
22:58:41FromDiscord<Technisha Circuit> Damn
22:58:41Yardanicostrformat parses the format string at compiletime
22:58:49FromDiscord<Technisha Circuit> Oh ok
22:59:11FromDiscord<Technisha Circuit> So no way for me to eval/exec code at all from a string?
22:59:19Yardaniconim is a native language
22:59:28FromDiscord<Technisha Circuit> So no
22:59:30FromDiscord<Technisha Circuit> ;-;
22:59:31Yardanicothe only way to execute Nim at runtime would be to embed NimScript in your app
22:59:42FromDiscord<Technisha Circuit> How does NimScript work?
22:59:50Yardanicohttps://nim-lang.org/docs/nims.html
23:02:14FromDiscord<Technisha Circuit> Is there a way i could just embed the Nim compiler in my app?
23:02:26Yardanicoyou can do that as well, yes
23:02:30FromDiscord<Technisha Circuit> I'd also want it to have access to anything i have defined in my app
23:02:35Yardanicowell
23:02:45Yardanicoyou won't be able to really interact with the code you compile with the compiler
23:02:51Yardanicobecause it'll get compiled to the binary
23:02:51FromDiscord<Technisha Circuit> Hm :/
23:03:02Yardanicothe only somewhat okay way would be to use NimScript as I said
23:03:04FromDiscord<Technisha Circuit> That's a shame
23:03:13FromDiscord<Technisha Circuit> Okay then, thanks!
23:03:20Yardanicowell it's just that sometimes people forget that Nim is fully natively compiled :P
23:03:25Yardanicomaybe because it's so good
23:03:32FromDiscord<Technisha Circuit> Yeah ;-;
23:04:25FromDiscord<Technisha Circuit> So the only disadvantages of NimScript is that it can't use anything that relies on `importc` or `importcpp`, right?
23:04:33Yardanicowell mostly yes
23:04:42FromDiscord<Technisha Circuit> Cool, seems handy then
23:08:24*mono quit (Quit: Leaving)
23:10:13FromDiscord<Technisha Circuit> NimScript seems quite OP
23:10:56FromDiscord<Technisha Circuit> Is there a way to make a standalone NimScript runner? (A tool that can run NimScript without nim being installed)
23:11:32Yardanicothere certainly is, right now PMunch does some nimscript related things (he's offline now though)
23:12:31FromDiscord<Technisha Circuit> Nice
23:12:47FromDiscord<Technisha Circuit> Could you give me a discord link to the tool?
23:13:18FromDiscord<Technisha Circuit> ~~I am probably going to mostly ditch bash scripts for NimScript~~
23:13:29YardanicoI didn't say it exists
23:13:34Yardanicobut I said it's totally possible
23:13:46Yardanicobut you understand you'll have to distribute some parts of nim stdlib anyway
23:13:47FromDiscord<Technisha Circuit> Oh okay
23:14:23FromDiscord<Technisha Circuit> I thought so because you said↵> there certainly is, right now PMunch does some nimscript related things (he's offline now though)↵But it seems like i misinterpreted
23:24:13*zacharycarter quit (Ping timeout: 264 seconds)
23:26:39*letto joined #nim
23:36:30*Tyresc quit (Quit: WeeChat 2.9-dev)
23:39:42bbarkerI guess this is the suggested way of writing nim scripts? https://nimble.directory/pkg/nimcr
23:41:28*dadada quit (Ping timeout: 265 seconds)
23:42:37*dadada joined #nim
23:43:01*dadada is now known as Guest59717
23:43:19PrestigeHaving an issue calling an xlib function. https://play.nim-lang.org/#ix=2mF7 compiles and runs, but text.value is never populated it seems. Can I not cast an array[string]'s unsafeAddr to a PPChar?
23:44:59Yardanicowell first of all you don't need unsafeAddr here
23:45:02Yardanicojust define tags as "var"
23:45:17Yardanicoand what is PPChar ?
23:45:18Yardanico**char ?
23:45:23FromDiscord<Technisha Circuit> How do i make a seed for the random module module in Nim? I can't find anything online
23:45:39Yardanicodid you try looking at the actual DOCUMENTATION
23:45:45Yardanicohttps://nim-lang.org/docs/random.html#randomize%2Cint64
23:46:10Yardanicosorry but really
23:46:33PrestigeYardanico: yeah, char **list is how the docs define it
23:46:38FromDiscord<Rika> yardanico triggered
23:46:39Prestigehttps://linux.die.net/man/3/xutf8textlisttotextproperty
23:46:42YardanicoPrestige: nim strings are not c strings
23:46:58FromDiscord<Rika> thats one long ass function name btw
23:47:00FromDiscord<Rika> jesus
23:47:10PrestigeAh so it needs to be converted. Thanks Yardanico
23:47:16Yardanicoalso a sequence can't really be casted to an array that easily I think
23:47:17Prestigeikr Rika
23:47:23Yardanicotry with [] instead of @[]
23:47:29Yardanicoah you already have an array sorry
23:47:34FromDiscord<Technisha Circuit> Oh okay
23:47:39FromDiscord<Technisha Circuit> Thanks :p
23:47:41Prestigenp thank you for taking a look
23:48:09FromDiscord<Technisha Circuit> Oh so i just use numbers
23:48:39FromDiscord<Technisha Circuit> I tried a random number generator with different numbers for the seeds but I kept getting the same output so i assumed it was wrong ;-;
23:49:17PrestigeYardanico: It's working after the conversion to cstring :) But also I am still using unsafeAddr, did you see a way to not use it here?
23:49:26YardanicoPrestige: if you declare "tag" as "var"
23:49:29Yardanicoyou don't need unsafeAddr
23:49:44Yardanico"tags" I mean
23:49:54Yardanicoah riught
23:49:57Yardanicoalso don't do that
23:50:06Yardanicodo cast[PPChar](addr tags[0])
23:50:16Yardanicoaddress to the array is address of the first element in it
23:51:05PrestigeSo it's saying tags has no address if I try that
23:51:11PrestigeThis is inside a proc btw
23:51:21Yardanicoeven if "tags" is "var"?
23:52:10PrestigeI lied, thanks. Changed it back after it hadn't worked at first, but both changes together do
23:57:03skrylar[m]hoi
23:58:05FromDiscord<Rika> hoi