00:00:20 | FromDiscord | <Elegant Beef> Then the latter is the method you'd want to use, but idk how well it'd work |
00:01:05 | FromDiscord | <Elegant Beef> Since the return type is a PPuChar iirc |
00:01:41 | Prestige | Yeah, trying to deref it and convert it to the correct type |
00:02:12 | * | krux02 quit (Ping timeout: 260 seconds) |
00:03:52 | Prestige | I 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:32 | skrylar[m] | var X is basically ptr X |
00:05:19 | Prestige | I have var propReturn = ptr T, just not super familiar with working with memory in Nim |
00:05:54 | Prestige | trying to convert propReturn into array[numElement, T] |
00:06:18 | Prestige | or seq |
00:06:52 | skrylar[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:12 | skrylar[m] | i believe its possible for fixed sizes to cast something to an unchecked array, sometimes |
00:07:32 | skrylar[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:12 | FromDiscord | <slymilano> Nice, I'm back to coding Nim! 😄 It's been two months. |
01:15:42 | FromDiscord | <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:38 | FromGitter | <kayabaNerve> I just found a fun bug |
01:50:48 | FromGitter | <kayabaNerve> Anyone here have experience with Nim codegen bugs? |
01:51:50 | * | Guest64773 quit (Ping timeout: 260 seconds) |
01:52:54 | FromGitter | <kayabaNerve> As in, I'm looking for a workaround for https://github.com/nim-lang/Nim/issues/14387 |
01:55:48 | FromGitter | <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:58 | FromGitter | <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:35 | leorize | @slymilano: see fusion CI |
02:27:37 | leorize | !repo fusion |
02:27:56 | leorize | https://github.com/nim-lang/fusion/blob/master/.github/workflows/ci.yml |
02:27:56 | * | dadada is now known as Guest97048 |
02:28:39 | leorize | Prestige: 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:53 | FromGitter | <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:21 | Prestige | Interesting |
02:56:26 | leorize | it'd be: toOpenArray(cast[ptr UncheckedArray[T]](ptr T), size) |
02:56:37 | leorize | ^ that's enough for you to pass it around as parameters |
02:56:48 | leorize | if 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:54 | FromDiscord | <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:31 | shashlick | How do I get ram usage of a short running program on Linux |
03:57:35 | * | dadada__ joined #nim |
04:01:00 | disruptek | shashlick: 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:00 | shashlick | yep, that worked |
04:11:12 | shashlick | is there a proc in stdlib to reduce n spaces to 1 |
04:14:46 | * | narimiran joined #nim |
04:19:36 | disruptek | multireplace should work. |
04:21:19 | * | dadada__ quit (Ping timeout: 260 seconds) |
04:21:30 | disruptek | ~nimconf |
04:21:31 | disbot | nimconf: 11missing a landing page for advertisement. -- disruptek |
04:25:52 | disruptek | shashlick: sorry, it's not multireplace i'm thinking of. |
04:26:17 | disruptek | i 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:38 | disruptek | a while loop is probably faster, sadly. |
04:39:19 | shashlick | went with splitWhitespace().join(" ") |
04:39:34 | shashlick | improving nimterop performance - already sped up toast 50% |
04:39:50 | shashlick | regex is the worst |
04:40:57 | shashlick | thinking 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:26 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> Anyone use SSL/TLS socket stuff with Visual Studio? |
04:55:51 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> 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:34 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> *sigh* never mind, the Nim plugin for VSC completely ignores changes to `nim.buildCommand` |
05:08:22 | FromDiscord | <slymilano> @𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭 try to put a nim.cfg file in your project root |
05:08:30 | FromDiscord | <slymilano> vsc maybe sniffs it out from there |
05:08:49 | FromDiscord | <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:11 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> I'm actually reading through the code right now trying to figure out what on earth it's doing |
05:09:57 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> yep, dammit, the check aspect doesn't actually pass any compiler flags |
05:10:26 | leorize | use configuration files |
05:10:48 | leorize | @slymilan: did you see my message above regarding github actions? |
05:10:55 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> Yes I know I will, but it should work in VSC as well |
05:11:10 | FromDiscord | <𝓑𝓮𝓷𝓾𝓶𝓫𝓮𝓭> may have to figure out how to fix this and submit a PR |
05:11:30 | FromDiscord | <slymilano> @leorize nice that sounds like it'll fit in nicely |
05:11:37 | FromDiscord | <slymilano> next weekend project: cross-platform builds |
05:11:40 | FromDiscord | <slymilano> (edit) 'next weekend project: cross-platform builds ... ' => 'next weekend project: cross-platform buildsin github actions' |
05:11:56 | FromDiscord | <slymilano> if I edit in discord, do you guys see that edit, in irc? probably not... |
05:12:17 | FromDiscord | <Elegant Beef> Yep as a new message |
05:12:32 | FromDiscord | <Elegant Beef> Atleast that's how the old bot did it |
05:14:49 | leorize | now it's a diff |
05:15:09 | leorize | would be better if it has colors, but this is already really good compared to the old bot |
05:17:07 | leorize | @slymilan: you can query me for help regarding CI with Nim :) it's something that I'm also working on improving |
05:24:01 | FromDiscord | <slymilano> i appreciate that, one of Nim's biggest selling points imho |
05:24:05 | FromDiscord | <slymilano> ease of distribution |
05:25:12 | FromDiscord | <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:52 | FromDiscord | <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:38 | leorize | I see spawn, I see bugs :P |
05:35:50 | FromDiscord | <Elegant Beef> I also dont like the recursive function calls |
05:35:56 | FromDiscord | <Elegant Beef> but im just being nit picky 😄 |
05:36:29 | leorize | recursive is fine once you go to the C level (they can optimize them) |
05:36:33 | leorize | we can't yet though :P |
05:37:18 | FromDiscord | <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:17 | leorize | @slymilano: you're creating many httpclients and you're not freeing them |
05:38:30 | FromDiscord | <Elegant Beef> Oh so that is the issue |
05:39:55 | FromDiscord | <Elegant Beef> I dont really see why you'd even need to make it more than once |
05:40:01 | leorize | also you might wanna try "ormin", would help with the amount of sqls :p |
05:42:26 | leorize | @Elegant Beef: http/1.1 is not a thing everywhere |
05:42:46 | FromDiscord | <Elegant Beef> Huh? |
05:42:50 | leorize | http/1.1 pipelining* |
05:43:26 | leorize | and pipelining is really buggy, though I'd expect modern servers to have this sorted out by now |
05:43:53 | leorize | but modern browsers don't even enable pipelining by default anymore |
05:44:10 | FromDiscord | <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:47 | leorize | I just told you why reusing is not always an option :P |
05:44:56 | FromDiscord | <Elegant Beef> Ah |
05:45:09 | FromDiscord | <Elegant Beef> I just assumed what i said wasnt clear cause of the explanation 😄 |
05:45:58 | FromDiscord | <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:09 | FromDiscord | <slymilano> @leorize how do I "free" the httpclient 🤔 |
06:31:22 | FromDiscord | <slymilano> nim-lang.org/docs/httpclient.html doesn't have any clues |
06:31:29 | leorize | close() |
06:31:58 | FromDiscord | <slymilano> thanks will try that 😄 |
06:32:33 | FromDiscord | <Rika> arc when |
06:34:23 | leorize | when it's done |
06:49:10 | Araq | Rika: next milestone is 'koch boot --gc:arc' has to work |
06:54:40 | FromDiscord | <Rika> oh nice |
06:57:02 | FromDiscord | <slymilano> Hm... ram still growing steadily with new .close calls for my httpclients |
06:57:03 | FromDiscord | <slymilano> https://github.com/sergiotapia/torrentinim/commit/9647eb865f3d21dbc9e76fa8d8fe0a753560d33e |
06:57:52 | FromDiscord | <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:22 | FromDiscord | <uniminin> where can i ask for help |
07:25:44 | FromDiscord | <Rika> here |
07:25:46 | FromDiscord | <Rika> @uniminin |
07:25:57 | FromDiscord | <Rika> oh that was a recent message oops lmao |
07:26:16 | * | filcuc joined #nim |
07:26:25 | FromDiscord | <uniminin> how can i capture output from a system command |
07:27:07 | FromDiscord | <Rika> look into the `osproc` module or something |
07:27:27 | FromDiscord | <uniminin> already doing |
07:29:15 | FromDiscord | <Rika> ? then `outputHandle`? |
07:29:23 | FromDiscord | <uniminin> ahh. found it nvm |
07:29:45 | FromDiscord | <Rika> https://nim-lang.org/docs/io.html#open%2CFile%2CFileHandle%2CFileMode use this for the handle after |
07:30:04 | FromDiscord | <uniminin> thanks |
07:36:06 | * | dadada__ quit (Ping timeout: 256 seconds) |
07:37:28 | FromDiscord | <Elegant Beef> @slymilano why are you even using threads? |
07:37:44 | FromDiscord | <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:23 | alehander92 | bung87 ohhh |
07:43:37 | alehander92 | i should've told you |
07:44:08 | FromDiscord | <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:25 | alehander92 | about int/float: i think easy is to just make a option for compilation: usually |
07:44:36 | alehander92 | i think a lib uses mostly one or the other for numbers |
07:44:57 | alehander92 | so if you can just tell beforehand "this code uses mostly ints" and fix manually the edge cases |
07:44:59 | alehander92 | its ok |
07:45:31 | alehander92 | otherwise i think you need to trace yeah similarly to python-deduckt or ruby-deduckt |
07:45:40 | alehander92 | https://github.com/metacraft-labs/ruby-deduckt |
07:46:56 | alehander92 | there were many other tools for that in python, probably ruby: so probably there must be some tool like that for JS |
07:47:11 | alehander92 | but this is probably far more complicated |
07:53:36 | FromDiscord | <uniminin> sent a code paste, see https://discordapp.com/channels/371759389889003530/371759389889003532/711848952395464784 |
07:53:52 | FromDiscord | <uniminin> what's wrong here? |
07:54:13 | FromDiscord | <uniminin> (edit) |
07:57:49 | * | gangstacat quit (Ping timeout: 272 seconds) |
07:58:24 | * | gangstacat joined #nim |
07:59:28 | FromDiscord | <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:14 | FromGitter | <bung87> @alehander92 https://github.com/bung87/ts2nim/blob/master/__tests__/bridge-spec.ts I can translate .d.ts automaticlly now. |
08:23:09 | alehander92 | awesone! |
08:23:12 | alehander92 | whats next |
08:23:27 | FromGitter | <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:14 | FromGitter | <bung87> in size,width,height etc, using float is wired. |
08:25:39 | FromGitter | <bung87> basiclly "Modules for JS backend" can using my tool for tranlation. by translate @types/* |
08:26:25 | FromGitter | <bung87> is embed a js engine a good idea for this task? |
08:29:14 | FromGitter | <bung87> or just go directly check how deduckt lib implemented? |
08:34:39 | alehander92 | bung87 well, we instrument |
08:34:49 | alehander92 | and other tools also do that |
08:34:59 | alehander92 | using `tracing` hooks from python/ruby's stdlib |
08:35:14 | alehander92 | so first one has to check if javascript/javascript egnines expose |
08:35:16 | alehander92 | stuff like that |
08:35:36 | FromGitter | <Willyboar> Hello guys |
08:35:40 | alehander92 | if 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:08 | alehander92 | and just record the runtime types of an argument and in the end check the statistic: e.g. 28 int 4 float cases |
08:36:15 | alehander92 | and export this in e.g. json |
08:36:27 | alehander92 | it sounds fun in principle |
08:37:20 | alehander92 | you need to run e.g. tests for that goal tho: e.g. `yourtracetool <somescriptusinglib.js> # => types.json` |
08:37:25 | alehander92 | but as i said |
08:37:38 | alehander92 | think about that: usually a lib for logic might use mostly ints |
08:37:47 | alehander92 | another for shapes/games mostly floats |
08:37:53 | alehander92 | so an easy workaround |
08:38:10 | alehander92 | might be to just provide a flag/config for the user to type out |
08:38:29 | alehander92 | e.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:10 | FromGitter | <bung87> awesome tips , flat may not need, default behaviour seem enough, in the end developer only need changes few types |
08:46:44 | alehander92 | yeah |
08:46:50 | alehander92 | well, still add |
08:46:53 | alehander92 | a flag for int/float i think |
08:46:56 | FromGitter | <bung87> and if I can get tool do `tracing ` and can embed it, I can just do all in nim |
08:47:06 | alehander92 | because it can still be many types once |
08:47:17 | alehander92 | but yeah tracing can be optional |
08:47:30 | FromGitter | <bung87> ok, an optional flag |
08:48:10 | FromGitter | <bung87> going well so far :P |
08:50:51 | alehander92 | yeahhp |
08:50:53 | alehander92 | i am glad |
08:50:55 | alehander92 | to 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:56 | Zevv | bwha I wanted to approach Lua coroutines in Nim, but now I reinvented async and futures |
09:18:44 | alehander92 | Araq |
09:18:57 | alehander92 | cool stuff! the c optimizer |
09:19:11 | Zevv | alehander92: what's that? |
09:19:23 | alehander92 | https://github.com/nim-lang/Nim/pull/14382/files |
09:19:24 | disbot | ➥ wip; don't merge, experiments only |
09:19:26 | alehander92 | i am not sure |
09:19:28 | alehander92 | what's the plan |
09:19:46 | alehander92 | but seems as an interesting approach |
09:20:06 | alehander92 | zevv yeah whats different about lua's coroutines |
09:20:16 | alehander92 | do they specify explicitly yield target ! |
09:20:46 | Zevv | You can go into an ordinary proc from a coroutine and yield from there |
09:20:54 | Zevv | when you're running inside a coroutine context |
09:21:12 | Zevv | also the yield() returns what is passed by resume() and vice versa |
09:21:37 | Zevv | it's nice for making filter-like stuff for example, and commonly used to do async in lua. |
09:22:05 | Zevv | for 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:07 | FromDiscord | <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:21 | FromDiscord | <mratsim> (oh and of course making those threadsafe) |
09:26:33 | Zevv | wait what - is this a optimization step that reparses Nim's generated C to optimize on that?! |
09:26:56 | Araq | yes, but before you laugh. |
09:27:01 | Zevv | I don't laugh |
09:27:03 | Araq | it's also a study on linear IRs |
09:27:16 | Zevv | I know linear IRs :) |
09:27:22 | Araq | and how fast you can make a compiler go if you abandon the old ways |
09:28:12 | alehander92 | Araq i respect that i did it for sourcemaps :D :D :D |
09:28:48 | alehander92 | hm, but do you mean you can make a compiler without ast |
09:28:59 | Zevv | sure you can. |
09:29:04 | alehander92 | yeah, but is it sensible |
09:29:19 | alehander92 | btw guys |
09:29:31 | alehander92 | what do you think about the idea about "superfastrecompile" |
09:29:44 | Araq | fwiw it does function deduplication on a 2MB .c file in 0.2s on my laptop |
09:30:26 | alehander92 | e.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:31 | alehander92 | and you directly replace them |
09:30:58 | Araq | alehander92, that's a fairy tale and operates on the wrong abstraction level |
09:31:26 | alehander92 | it's very niche probably |
09:31:31 | Araq | known systems (including Smalltak environments) that do it this way: zero |
09:32:05 | Zevv | linear IR is nice and all, but doing at the C level is monstrous |
09:32:26 | alehander92 | but why? it doesn't seem insane for some cases |
09:32:30 | alehander92 | i admit zig's idea of incremental linking got me the "change n bytes in final binary directly" thing, but |
09:33:28 | Araq | here 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:56 | dadada__ | any way to get the actual type that was used for the GenericParam here? https://play.nim-lang.org/#ix=2mB3 |
09:34:02 | alehander92 | i agree, but it just sounds cool in principle :D :D |
09:34:31 | alehander92 | otherwise changing the c backend is much more work right? |
09:35:26 | Araq | Zevv, I know but I was to curious not to do it |
09:35:30 | Zevv | dadada__: no, you lost that when you went untyped |
09:35:50 | Zevv | Araq: Its pretty brave anyway :) |
09:36:02 | FromDiscord | <él liquido> Zevv: but closure iterators are basically Lua coroutines |
09:36:06 | alehander92 | actually almost yes: you can generate code that does `when` etc |
09:36:14 | alehander92 | but yeah, indirectly |
09:36:19 | alehander92 | ^dadada_ |
09:37:10 | dadada__ | Zevv: I changed to varargs[typed], and this isn't helping, so you must mean something else? |
09:37:18 | alehander92 | Araq btw i am running the parser in a `||` `openmp` loop and it segfaults, has anyone tried that until now |
09:37:48 | alehander92 | (its absolutely my code false somewhere :D) |
09:38:11 | Zevv | dadada__: with untyped you can't do `asdfasdf` in your code block, right? |
09:38:51 | dadada__ | 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:05 | Zevv | dadada__: lemme check |
09:39:30 | * | madpata joined #nim |
09:39:35 | Araq | oh spoiler: sending files via /tmp to nimsuggest is lost in the noise |
09:40:45 | Zevv | Araq: that is not really surprising, is it |
09:41:14 | Zevv | dadada__: oh wait you are trying to do typed macros |
09:41:15 | Zevv | ha |
09:41:26 | Zevv | I always get told not to do that when I run into problems |
09:41:43 | Araq | Zevv, apparently it is for many, see also LSP's protocol |
09:42:20 | Zevv | dadada__: this is what mratsim always answers when I have similar questions: https://github.com/nim-lang/RFCs/issues/44 |
09:42:22 | disbot | ➥ [RFC] Working with types in macro is difficult. |
09:43:18 | Araq | Zevv, I also tested it on Windows on a not SSD which was the worst setup I could think of :-) |
09:43:40 | Zevv | dadada__: 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:55 | alehander92 | this works |
09:43:59 | alehander92 | but you can still generate code |
09:44:10 | alehander92 | which checks the type or invokes another typed macro |
09:44:21 | * | dddddd joined #nim |
09:44:22 | Zevv | Araq: stuff will barely touch your platters anyway when you do this kind of thing |
09:44:25 | alehander92 | it is an useful pattern: imho |
09:44:45 | Zevv | it boils down to some memcpys and your kernel making a note "I should write this to disk one day, probably" |
09:45:09 | dadada__ | 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:27 | alehander92 | Araq what i wonder about the linear IR is if one can do a very high lines/second compilation speed |
09:45:55 | Zevv | dadada__: I don't know, but I gave up on that. |
09:46:09 | madpata | Based 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:00 | dadada__ | madpata: good question! |
09:47:56 | Araq | alehander92, well yes, it's super fast and enables further optimization. for example, you can do alpha conversion without recursions |
09:50:30 | alehander92 | Araq TIL about alpha conversion |
09:50:51 | * | Zevv was also reading up because he didn't want to ask the obvious :) |
09:52:23 | FromDiscord | <uniminin> hello? |
09:52:28 | Zevv | hello! |
09:52:36 | FromDiscord | <uniminin> sent a code paste, see http://ix.io/2mB7 |
09:52:42 | FromDiscord | <uniminin> how can i print arguments if there more? |
09:53:07 | FromDiscord | <uniminin> sent a code paste, see http://ix.io/2mB8 |
09:53:17 | * | liblq-dev joined #nim |
09:53:21 | Araq | madpata, to expand the node use a 'typed' macro argument |
09:53:22 | FromDiscord | <Recruit_main707> not sure, but maybe arguments[0..^1] |
09:53:34 | FromDiscord | <uniminin> how? |
09:53:39 | FromDiscord | <uniminin> can you show me an example |
09:53:45 | FromDiscord | <él liquido> @uniminin maybe loop through them? `for arg in arguments: echo arg` |
09:54:02 | FromDiscord | <él liquido> or use `strutils.join`: `import strutils; echo arguments.join()` |
09:54:28 | FromDiscord | <uniminin> for loop for this case is kinda sucks |
09:54:41 | FromDiscord | <uniminin> for example i want to echo args after index 2 or 3 |
09:54:48 | FromDiscord | <uniminin> i dont want to echo all |
09:54:58 | FromDiscord | <él liquido> then use `for arg in arguments[2..^1]` |
09:55:12 | FromDiscord | <él liquido> `^1` means last element |
09:55:17 | FromDiscord | <uniminin> what is `..` |
09:55:18 | FromDiscord | <él liquido> (edit) 'element' => 'index' |
09:55:21 | FromDiscord | <él liquido> range |
09:55:26 | FromDiscord | <uniminin> ah |
09:55:26 | FromDiscord | <uniminin> thanks |
09:55:29 | Zevv | uniminin: your question is not really clear. You can just do `echo argumetns` |
09:55:31 | Zevv | and you get the mall |
09:55:35 | Zevv | /them all/ |
09:55:42 | Zevv | but that's probably not what you're looking for, right |
09:55:47 | FromDiscord | <uniminin> yes |
09:55:50 | FromDiscord | <uniminin> i've got the idea |
09:56:16 | Zevv | you can also import strutils and do `echo arguments.join(" ")` |
09:56:42 | madpata | beware of rangeerrors. You better check the number of arguments you get before doing stuff like arguments[2..^1] |
09:56:50 | FromDiscord | <Recruit_main707> @uniminin are u gonna be active around RLBot any time? :P |
09:56:55 | madpata | Araq: thanks! |
09:57:00 | FromDiscord | <uniminin> i guess |
09:57:14 | FromDiscord | <Recruit_main707> cool |
09:58:14 | FromDiscord | <uniminin> what's so cool about it |
10:05:30 | FromDiscord | <Recruit_main707> about RLBot? |
10:06:30 | FromDiscord | <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:33 | FromDiscord | <uniminin> nim is cool |
10:08:35 | FromDiscord | <uniminin> i like it |
10:24:26 | Zevv | oh btw ar4q, can you say something about https://forum.nim-lang.org/t/6349? |
10:25:36 | PMunch | Zevv, why wouldn't that be safe? |
10:26:02 | PMunch | Oh, iterator arguments.. |
10:26:03 | PMunch | Hmm |
10:29:12 | dadada__ | 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:20 | dadada__ | not I tried to define one in a proc on playground and it worked |
10:29:41 | dadada__ | 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:00 | dadada__ | s/not I/now I |
10:30:31 | liblq-dev | Zevv: I think it would work fine |
10:30:54 | liblq-dev | but then I'm not into x86_64 low level details |
10:35:00 | Zevv | liblq-dev: well it seems to work, but I wonder if if that is a bobrossian happy little accident, or by design |
10:35:26 | filcuc | what'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:40 | liblq-dev | Zevv: well I'd say it's by design, otherwise it wouldn't be a feature |
10:35:58 | filcuc | furthermore i would need to check the function pointer pragmas |
10:36:21 | filcuc | should i use a template or a macro? |
10:36:58 | liblq-dev | only macros can introspect that sort of thing |
10:37:36 | liblq-dev | you can write a macro that uses getImpl() to get the implementation of a proc symbol |
10:37:56 | liblq-dev | keep in mind that the parameter to which you pass the proc must be `typed` |
10:38:29 | liblq-dev | otherwise you'll get nnkIdent instead of nnkSym, and nnkIdent nodes cannot be used with getImpl() etc. |
10:40:14 | filcuc | ok thanks |
10:41:06 | FromDiscord | <Recruit_main707> why are some people getting quoted in #news when they talk in chat??? |
10:41:54 | FromDiscord | <uniminin> how do i properly execute system commands in nim? |
10:42:25 | dadada__ | 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:37 | dadada__ | if you want to know why, it's simply for convenience |
10:42:50 | FromDiscord | <Recruit_main707> uniminin: https://forum.nim-lang.org/t/3990 maybe you find this useful |
10:44:18 | liblq-dev | @Recruit_main707 it's because Yardanico's bot just mirrors whatever disbot says :P |
10:45:00 | PMunch | Isn't it because disbot grabs links from here to post in #news but it's a bit too aggressive? |
10:46:22 | FromDiscord | <uniminin> @Recruit_main707 it stucks in interactive? doesnt shows output when taking input?? https://media.discordapp.net/attachments/371759389889003532/711892428923207721/unknown.png |
10:47:30 | FromDiscord | <Recruit_main707> try to compile it and run it separately |
10:47:44 | FromDiscord | <uniminin> did |
10:47:45 | FromDiscord | <uniminin> same |
10:48:03 | FromDiscord | <uniminin> https://media.discordapp.net/attachments/371759389889003532/711892851952320592/unknown.png |
10:48:32 | FromDiscord | <uniminin> sent a code paste, see http://ix.io/2mBj |
10:48:53 | FromDiscord | <Recruit_main707> it seems to be waiting for an input? |
10:48:58 | FromDiscord | <uniminin> yes |
10:49:05 | FromDiscord | <uniminin> without any ouput |
10:49:31 | FromDiscord | <uniminin> i.e https://media.discordapp.net/attachments/371759389889003532/711893221122506842/unknown.png |
10:50:23 | FromDiscord | <Recruit_main707> what happens if you use `execShellCmd` intead? |
10:51:29 | FromDiscord | <uniminin> where is it from |
10:51:38 | FromDiscord | <Recruit_main707> os |
10:51:43 | FromDiscord | <uniminin> ah |
10:52:24 | FromDiscord | <uniminin> that seems to work |
10:52:28 | FromDiscord | <uniminin> thanks |
10:52:39 | FromDiscord | <Recruit_main707> np |
11:02:34 | Araq | dadada__, system.substr does that iirc but only works on strings |
11:02:52 | dadada__ | Araq: ok, cool, I wanna do something that works for all containers :D |
11:05:22 | PMunch | Hmm, this GC bug is really bugging me: http://ix.io/2mBn |
11:05:47 | PMunch | Err, with the actual error: http://ix.io/2mBp |
11:06:31 | Araq | PMunch, use --gc:arc/orc already |
11:06:43 | Araq | I use it for all my new code |
11:08:34 | PMunch | Project doesn't build with arc/orc unfortunately: http://ix.io/2mBr |
11:09:02 | PMunch | Just a sec, I'll build a debug compiler |
11:13:01 | PMunch | There you go: http://ix.io/2mBs |
11:14:24 | PMunch | Same error with orc |
11:14:57 | filcuc | how can i print a typed AST? |
11:15:07 | PMunch | Compiles with --app:lib and --threads:on as well by the way |
11:15:18 | PMunch | filcuc, what do you mean? |
11:15:58 | filcuc | PMunch: given var tmp = getImpl(typedArgument) how can i show the AST of tmp |
11:16:42 | filcuc | for debugging purpose because i calling tmp.childrenOfKind(nnkPragma) return an empty list...and it shouldn't |
11:17:17 | PMunch | treeRepr? |
11:17:43 | PMunch | As in `echo tmp.treeRepr` |
11:20:40 | filcuc | PMunch: ok it works thanks..however it seems like the getImpl(node).treeRepr is different that dumpTree:\nproc ..... {.pragrams.} |
11:20:52 | filcuc | than |
11:21:42 | PMunch | dumpTree takes an untyped version, and you're giving it a typed version probably |
11:22:11 | dadada__ | 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:15 | dadada__ | ... it' |
11:22:50 | dadada__ | 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:12 | filcuc | PMunch: basically i would like to check a function pointer type declaration for some pragmas |
11:23:57 | PMunch | Do you have a small playground example of what you want to do? |
11:24:29 | filcuc | give a minute or two :) |
11:24:34 | filcuc | give me |
11:29:11 | FromDiscord | <Yardanico> @dadada you can make arrays count from any number fwiw |
11:29:56 | FromDiscord | <Yardanico> !eval let a: array[3..5, int] = [1, 2, 3]; echo a[3] |
11:29:59 | NimBot | 1 |
11:30:40 | filcuc | PMunch: https://pastebin.com/veyui5Pq |
11:31:44 | filcuc | PMunch: https://play.nim-lang.org/#ix=2mBx |
11:31:49 | filcuc | second link is interactive :) |
11:33:39 | filcuc | PMunch: you can see that getImpl().treeRepr doesn't contain any pragma |
11:35:22 | FromDiscord | <Clyybber> Zevv: I'm pretty sure its not undefined behaviour |
11:40:43 | FromDiscord | <Recruit_main707> !eval let a: array[3..5, int] = [1, 2, 3]; echo a[0] |
11:40:45 | NimBot | Compile 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:19 | PMunch | Hmm filcuc you might need to use: https://nim-lang.org/docs/macros.html#getCustomPragmaVal.m%2Ctyped%2C |
11:54:03 | filcuc | PMunch: It's dosn't seems to work with hasCustomPragma. See https://pastebin.com/8uJLPArT |
11:54:10 | filcuc | PMunch: am i missing something? |
12:05:13 | PMunch | Hmm, this is odd indeed |
12:05:29 | PMunch | I'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:44 | filcuc | PMunch: should i fill a bug? |
12:12:52 | PMunch | Not sure TBH |
12:13:13 | PMunch | I mean it seems like Nim is parsing your pragma into some hidden field which isn't accessible |
12:13:18 | PMunch | Araq, any input on this? |
12:13:20 | Araq | dadada__: I like starting from 1 better |
12:13:40 | Araq | loops from 1 to x.len are better, 0 for "not found" is better |
12:15:53 | planetis[m] | what do i do if i need a hashset of Tables :P |
12:16:07 | Araq | PMunch: I don't know either |
12:17:11 | PMunch | So bug report then? |
12:17:12 | * | konvertex quit (Quit: quit) |
12:17:48 | Araq | sure |
12:21:03 | filcuc | ok i'll create a bug report then |
12:22:17 | * | luis_ joined #nim |
12:27:52 | * | rockcavera joined #nim |
12:31:07 | filcuc | Araq: PMunch: https://github.com/nim-lang/Nim/issues/14393 |
12:31:10 | disbot | ➥ Cannot obtain procDef pragmas from function pointer typed argument ; snippet at 12https://play.nim-lang.org/#ix=2mBH |
12:31:11 | filcuc | thank 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:45 | PMunch | Hmm, markandsweep looks solid when I don't multithread it |
13:50:34 | alehander92 | hey |
13:50:38 | * | bebarker quit (Read error: Connection reset by peer) |
13:50:47 | alehander92 | i found https://swift.org/lldb/ |
13:51:06 | alehander92 | i wonder if anyone thought about that hypothetically as an experiment for nim |
13:53:27 | alehander92 | hm, 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:37 | FromGitter | <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:25 | Yardanico | alehander92: well LLDB already works for nim for debugging |
14:05:31 | Yardanico | just like GDB |
14:05:39 | Yardanico | https://github.com/hediet/vscode-debug-visualizer/pull/51 was done with LLDB |
14:05:41 | disbot | ➥ Add Nim demo |
14:10:06 | alehander92 | Yardanico nope |
14:10:09 | alehander92 | sorry i meant |
14:10:13 | * | dadada joined #nim |
14:10:13 | alehander92 | a repl based on gdb |
14:10:27 | Yardanico | well I think this will be more work than leveraging LLVM's JIT |
14:10:34 | alehander92 | maybe yeah |
14:10:36 | * | dadada is now known as Guest90403 |
14:10:52 | Yardanico | and when making the JIT for LLVM there are also other benefits like improving the llvm backend :) |
14:11:01 | alehander92 | so how much work is leveraging the jit |
14:11:11 | alehander92 | like, what are the odds someone would do it in a weekend |
14:11:15 | alehander92 | or afternoon :P |
14:11:22 | Yardanico | see https://github.com/nim-lang/Nim/issues/8927#issuecomment-580456200 |
14:11:25 | disbot | ➥ [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:33 | Yardanico | https://github.com/arnetheduck/nlvm/pull/18 |
14:11:36 | disbot | ➥ wip: jit |
14:12:07 | Yardanico | "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:13 | alehander92 | hm |
14:14:36 | alehander92 | sounds 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:30 | alehander92 | in #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:46 | alehander92 | but you're right that an existing jit makes much more sense |
14:21:48 | alehander92 | but it is llvm-only |
14:22:32 | Yardanico | but lldb would be lldb only :P |
14:23:04 | alehander92 | yeah, but this is adaptable to gdb |
14:23:17 | alehander92 | it's just a random idea, i totally dont see it |
14:40:04 | FromDiscord | <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:52 | alehander92 | yardanico i plan on streaming a bit later |
14:41:04 | alehander92 | do you guys have a common mumble setup |
14:41:06 | Yardanico | alehander92: well I have to go to the store rn, will you go on mumble? :P |
14:41:08 | Yardanico | ~stream |
14:41:09 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) |
14:41:14 | Yardanico | this is the mumble server we use |
14:41:16 | alehander92 | or does one just create a new one each time |
14:41:24 | Yardanico | you just join it |
14:41:30 | Yardanico | no password needed, just join with the nickname you want |
14:41:35 | alehander92 | i am also going out to store and walk a bit |
14:41:40 | alehander92 | yeah exactly, great |
14:41:48 | alehander92 | that'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:29 | disruptek | ~stream |
15:08:30 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) -- disruptek |
15:08:35 | disruptek | adding bugs to the compiler today. |
15:09:08 | Araq | fine as long as you blame me for them afterwards |
15:09:59 | * | Vladar joined #nim |
15:10:28 | disruptek | cool. |
15:10:55 | * | filcuc quit (Ping timeout: 260 seconds) |
15:11:10 | disruptek | araq is upset that i don't support unlimited NIH. |
15:13:10 | Araq | nah, I'm fine. I'm enjoying the sun |
15:17:45 | * | abm quit (Read error: Connection reset by peer) |
15:19:23 | shashlick | Nim compiler has slowed down since 1.0 |
15:21:18 | shashlick | @slymilano see if you can get dom96 to provide that info if it exists |
15:30:44 | FromGitter | <zetashift> slowed down in what sense? |
15:30:53 | disruptek | speed. |
15:31:20 | FromGitter | <zetashift> speed of compilation? speed of resulting programs? ;O |
15:31:21 | FromDiscord | <Clyybber> duh |
15:31:30 | FromDiscord | <Clyybber> none of these |
15:31:39 | FromDiscord | <Clyybber> speed of reading in nimscript config file |
15:31:43 | FromDiscord | <Clyybber> (edit) 'file' => 'files' |
15:32:03 | FromDiscord | <Clyybber> and its not even the compiler that changed |
15:32:23 | FromDiscord | <Clyybber> but simply an added import of os |
15:34:34 | dom96 | what info am I supposed to provide? |
15:36:39 | FromDiscord | <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:59 | dom96 | nope, there is no data |
15:39:19 | FromDiscord | <Clyybber> I thought there is analytics in nimble? |
15:39:33 | FromDiscord | <Clyybber> And theres a "most queried" section? |
15:40:23 | dom96 | there isn't |
15:40:35 | dom96 | nimble.directory has visit stats |
15:44:43 | FromDiscord | <slymilano> thanks anyways gang |
15:47:53 | alehander92 | oii |
15:48:05 | Yardanico | OiI |
15:48:45 | alehander92 | disruptek, can i use the mumble |
15:48:53 | disruptek | go nuts. |
15:48:54 | Yardanico | alehander92: you can, we're here already |
15:49:00 | alehander92 | ok |
15:49:12 | alehander92 | i like eating nuts |
15:49:19 | disruptek | i can make you a separate room if you want some privacy. |
15:49:19 | alehander92 | but not going |
15:49:26 | alehander92 | no problem i am just going to stream about my experiments |
15:49:35 | alehander92 | so i'd just bring some noise |
15:49:57 | alehander92 | so maybe a separate room might make sense to not confuse you guys |
15:50:07 | Yardanico | yeah there are rooms |
15:50:29 | Yardanico | like "2-person private" ( ͡° ͜ʖ ͡°) |
15:50:38 | shashlick | speed of compilation - if you compare with 1.0, it has gone up enough to be noticeable |
15:50:42 | disruptek | there's a test room you can use for now. |
15:51:00 | alehander92 | ok |
15:51:26 | * | NimBot joined #nim |
15:51:36 | shashlick | is it possible to profile compile time code? |
15:51:51 | disruptek | you can check the vm counters. |
15:51:56 | disruptek | loops, instructions. |
15:53:44 | shashlick | hmm - any docs? |
15:54:15 | shashlick | i've sped up toast but not nimterop compile time wrappers |
15:54:39 | alehander92 | `Stream output type 'rtmp_output' failed to start` |
15:54:42 | alehander92 | has anyone had it :D |
15:54:46 | Yardanico | 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:19 | alehander92 | `Generic error in an external library` |
16:00:21 | alehander92 | :D |
16:02:40 | alehander92 | do you guys hear me :D |
16:02:44 | Yardanico | alehander92: no |
16:04:04 | alehander92 | my mic does work |
16:04:29 | alehander92 | yep |
16:04:35 | alehander92 | ok |
16:04:40 | alehander92 | wait a sec |
16:04:52 | alehander92 | i didnt turn on the stream |
16:17:40 | alehander92 | https://www.twitch.tv/alehander42/ |
16:18:23 | alehander92 | learning about parallel / IC toy compilers |
16:19:10 | * | Guest46941 is now known as dadada |
16:19:21 | dadada | has 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:29 | dadada | I 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:33 | FromDiscord | <Rika> i dont see how that would work |
16:20:35 | FromDiscord | <Clyybber> I did |
16:20:36 | Yardanico | dadada: have a "block" ? |
16:20:41 | leorize | top-level defer is evil :P |
16:20:42 | FromDiscord | <Clyybber> But I haven't upstreamed it |
16:20:42 | Yardanico | you can have blocks at global level |
16:20:44 | Yardanico | and have defer in them |
16:21:16 | dadada | Yardanico: without needing to indent the whole source file? if so, this would be what I'm looking for |
16:21:36 | Yardanico | you can have a.nim with "block: include b" |
16:21:37 | disruptek | !rfc try scope |
16:21:40 | Yardanico | and in b write your code :D |
16:21:40 | disbot | https://github.com/nim-lang/RFCs/issues/218 -- 3try/except scope -- should it be a thing? 7& 16 more... |
16:21:50 | FromDiscord | <Clyybber> disruptek: stop :p |
16:22:01 | disruptek | just posting a link for the stream. |
16:22:08 | FromDiscord | <Clyybber> haha, I was just kiddin |
16:22:13 | disruptek | we're talking about defer. |
16:22:20 | dadada | Clyybber: how did you implement it |
16:23:50 | FromDiscord | <Clyybber> dadada: I did it in the compiler, so not via macros or something like that |
16:24:15 | FromDiscord | <Clyybber> I just did it because I was doing destructor injection for global variables |
16:24:29 | FromDiscord | <Clyybber> But thats done without try: finally: now |
16:24:45 | FromDiscord | <Clyybber> Also, I'm not sure defer is a good thing at top level |
16:24:57 | dadada | Clyybber: 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:19 | FromDiscord | <Clyybber> wdym? |
16:25:36 | FromDiscord | <Rika> i dont see why you couldnt edit the source file while compiling |
16:25:49 | FromDiscord | <Clyybber> dadada: Because the semantics are unclear, what about libraries? |
16:26:02 | dadada | Clyybber: 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:30 | leorize | well did you use fmReadWriteExisting? :p |
16:27:33 | dadada | leorize: not sure, I felt very stupid when my sources were lost, ..., so I did something else after that |
16:28:05 | Yardanico | ~astream is https://www.twitch.tv/alehander42/ |
16:28:06 | disbot | astream: 11https://www.twitch.tv/alehander42/ |
16:28:08 | Yardanico | ~astream |
16:28:09 | disbot | astream: 11https://www.twitch.tv/alehander42/ -- Yardanico |
16:28:15 | Yardanico | ^go watch guys, it's alehander92 :P |
16:28:32 | dadada | Clyybber: defer at top level would massively simplify some of my code, so it's worth it for that reason alone |
16:28:37 | disruptek | you can add the link to mumble, too. |
16:28:44 | Yardanico | it's the same anyway |
16:39:21 | Araq | toplevel defers? ugh |
16:39:41 | disruptek | horribad. |
16:39:56 | Araq | I'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:11 | disruptek | makes sense. |
16:40:22 | disruptek | who is PR'ing that dogshit? |
16:41:07 | FromDiscord | <Rika> anyone mind enlightening me as to why top level defers are dumb? |
16:41:13 | FromDiscord | <Rika> im not so sure whats wrong with them |
16:41:50 | Araq | toplevel or not, no defers in my code |
16:42:10 | disruptek | see the link i referenced for my opinion. |
16:42:27 | FromDiscord | <Rika> the try except scope one? ok |
16:44:21 | Prestige | light theme oh my |
16:44:29 | Prestige | alehander92: is your battery about to die |
16:46:10 | livcd | ~stream |
16:46:11 | disbot | stream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat) |
16:47:46 | livcd | nobody can hear me i guess |
16:48:39 | Prestige | Nimdow is coming along: https://0x0.st/i9HI.png |
16:49:04 | PMunch | Prestige, oh cool! |
16:49:06 | Prestige | Last night, got the code allocating screen space for "docks" i.e. status bars |
16:50:08 | PMunch | How are you doing that by the way? IIRC there is a protocol for things like that |
16:50:18 | dadada | Prestige: what is nimdow? |
16:50:21 | disruptek | today i woke up and found a 6" 3mm allen key in my bed. |
16:50:29 | disruptek | i've never seen this tool before. |
16:50:38 | disruptek | i think someone planned to kill me last night. |
16:51:07 | disruptek | what's weird is, |
16:51:16 | PMunch | dadada, his window manager written in Nim |
16:51:20 | disruptek | this is the exactly the tool i use to adjust air/fuel mixture on a 911. |
16:52:15 | Prestige | dadada: Still working on a beta release, aiming for June 1st |
16:52:21 | Prestige | https://github.com/avahe-kellenberger/nimdow |
16:53:19 | PMunch | Pretige, what is "monocle" layout? |
16:54:21 | Prestige | Sort of like having sheets of paper stacked on top of each other, and you can change which is on top |
16:54:34 | Prestige | and it would take up all available screen space, aside from docks |
16:57:17 | livcd | i g2g..have fun |
16:57:25 | dadada | Araq: 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:32 | dadada | if 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:37 | dadada | end 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:40 | dadada | use-case ... |
16:57:49 | dadada | maybe I shouldn't have written "very-good", but I think "very neat" would fit |
16:58:07 | PMunch | Prestige, ah, I see |
16:58:51 | Prestige | PMunch: Super easy to implement, I just haven't taken the time. Working on the harder issues atm |
17:00:39 | Prestige | I 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:37 | FromDiscord | <Recruit_main707> can nim share memory between processes? |
17:01:43 | Yardanico | uhh |
17:02:20 | Yardanico | @Recruit if it's possible with C, it's possible with Nim :P |
17:05:56 | * | Trustable joined #nim |
17:06:04 | Araq | dadada: I know this problem but I think we can do better than a toplevel defer |
17:06:37 | Araq | I'm sorry, I think I know most macro related problems and DSL designs by now ;-) |
17:07:00 | dadada | Araq: 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:13 | disruptek | Araq: what's the vm inst counter? how does shashlick access it to try to profile compilation? |
17:07:45 | Araq | disruptek: ask Zevv or read the source code, I don't remember |
17:07:48 | disruptek | the issue with defer isn't so much the implementation but the syntax. |
17:07:56 | disruptek | Araq: that's what i told him, too. 🤣 |
17:08:11 | FromGitter | <kayabaNerve> It's not possible to see, within a macro, if a type has a function declared, right? |
17:09:03 | FromGitter | <kayabaNerve> I'm trying to think if I can use x.toProtobuf in a typed macro to get the overloads... |
17:10:46 | FromGitter | <kayabaNerve> Yep. Never mind then. |
17:12:23 | * | filcuc quit (Ping timeout: 265 seconds) |
17:17:28 | Zevv | disruptek: zup |
17:17:47 | alehander92 | Araq so |
17:18:01 | alehander92 | is the nim parser threadsafe |
17:25:51 | bbarker | Was 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:53 | disbot | ➥ Introduce safety modes |
17:26:10 | Yardanico | {.raises: [].} |
17:26:20 | Yardanico | func test(a, b: int) {.raises: [].} = stuff |
17:26:40 | Yardanico | with that the compiler will error if your code somehow can raise an exception |
17:26:51 | Yardanico | but be aware that a lot of nim code is written with exceptions with bad, and there's nothing bad with them :) |
17:27:01 | Yardanico | s/with bad/in mind |
17:27:07 | bbarker | ah ok, cool, thanks |
17:28:12 | Araq | there is also |
17:28:21 | bbarker | I 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:26 | Araq | {.push raises: [].} to make it apply for more procs |
17:28:41 | bbarker | assuming that is something people agree is a good idea of course |
17:28:42 | Yardanico | bbarker: well, I personally don't feel exceptions are bad |
17:28:52 | Yardanico | they are fast and easy way to do code flow and stuff |
17:29:24 | Araq | bbarker: with .push you can change the default around. |
17:29:27 | bbarker | i don't feel they are bad, necessarily, I just like the idea of making them explicit for funcs (not necessarily for procs) |
17:29:40 | bbarker | Araq, cool, i'll look into this more |
17:29:51 | * | abm joined #nim |
17:30:59 | Araq | personally 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:32 | bbarker | Makes sense, I guess it is nice being able to change the default like that then |
17:32:07 | Araq | in 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:26 | disruptek | Araq: is this supposed to work? http://ix.io/2mDa/nim |
17:32:33 | disruptek | (currently crashes with codegen) |
17:33:12 | disruptek | would be nice to hit a switch on the command-line to change the lib/app behavior for an import or whatever. |
17:33:56 | Araq | disruptek: oh yeah, this should work |
17:34:41 | alehander92 | hm, so |
17:34:48 | alehander92 | why does gc:none call listRemove |
17:35:07 | bbarker | Araq, 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:10 | FromGitter | <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:46 | bbarker | unrelated, 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:21 | Araq | alehander92: thread safe parser? yeah, should be. nimsuggest is multi-threaded and uses it |
17:41:49 | alehander92 | huh |
17:42:13 | alehander92 | hm, i run it in a parallel loop |
17:42:32 | alehander92 | and i had some very strange random errors all the time |
17:42:41 | alehander92 | but i guess this is a different kind of safety |
17:45:29 | alehander92 | is 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:36 | bbarker | I think this still compiles despite raising an assertion error: https://gist.github.com/bbarker/82a166f20e2a133987e637b3caf4e973 |
17:52:38 | dadada | can vscode show me all possible value/names of a an enum type? |
17:53:09 | dadada | I 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:17 | dadada | hmm, after some experimenting it looks like it's not possible with vscode/nim |
18:03:13 | * | zacharycarter quit (Ping timeout: 264 seconds) |
18:06:36 | bbarker | is 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:16 | FromGitter | <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:03 | FromGitter | <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:08 | Yardanico | Number of packages in Nimble by author (with more than 10 packages) - https://gist.github.com/Yardanico/2be99a38634d4ade55ff2957fe669f40 |
18:32:41 | Yardanico | code is really simple too https://gist.github.com/Yardanico/39598168a204fb8d81aed80f5210defc |
18:33:43 | Yardanico | Full list - https://gist.github.com/Yardanico/65f25abd347271fc757c93a939d4da59 |
18:34:09 | Araq | bbarker: that's not a bug and got more refined in the upcoming 1.4 |
18:34:40 | Araq | compile with --panics:on in Nim devel and see that it doesn't raise an exception ;-) |
18:39:20 | Araq | alehander92: for the || loop you need to use setupForeignThreadGc() |
18:39:42 | alehander92 | ohhhhhhhhhhhhhh |
18:41:10 | * | Jesin quit (Quit: Leaving) |
18:44:46 | * | Jesin joined #nim |
18:48:20 | FromGitter | <bung87> am at 32 |
18:50:50 | * | zacharycarter joined #nim |
18:52:21 | alehander92 | i am so happy |
18:52:32 | alehander92 | this fixed most of my issues |
18:52:34 | alehander92 | thanks araq |
18:53:12 | alehander92 | so now parallel parsing => 0.492 |
18:53:18 | alehander92 | serial => 0.865 |
18:55:27 | * | leorize quit (Quit: WeeChat 2.7.1) |
18:57:07 | Prestige | Is 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:11 | Yardanico | procs have static dispatch |
18:58:15 | Yardanico | static binding |
18:58:44 | Prestige | ah |
18:59:52 | Prestige | I 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:16 | bbarker | Araq, $ ../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:22 | Yardanico | yes |
19:03:25 | Yardanico | that's right |
19:03:41 | Yardanico | Defects are special kinds of errors which usually say that the program is incorrect |
19:03:48 | Yardanico | and with panics on they're not catchable :) |
19:04:14 | bbarker | ah ok |
19:04:19 | bbarker | I 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:30 | bbarker | since they can raise exceptions |
19:04:58 | Yardanico | well just always compile with panics on :) |
19:05:42 | Yardanico | and also you should know that nim's "no side effects" is not the same as "pure function" in math |
19:05:54 | Yardanico | (and nim "func" == proc with {.noSideEffects.} pragma |
19:07:43 | bbarker | Yardanico, good to know in both cases - could you elaborate a bit more on the difference between func and "pure function"? |
19:08:01 | Yardanico | you can have func test(a: var int) = a = 5 |
19:08:27 | Yardanico | which will mutate the a variable outside of the func |
19:08:50 | bbarker | ah yes. I have to say as a functional-leaing programmer, var parameters are the scariest thing i've come across so far :-) |
19:09:13 | bbarker | but that should be relatively easy to disable based on some feedback i've had so far |
19:10:07 | bbarker | I just coudn't recall if they worked in procs and funcs so thanks for reminding me |
19:12:00 | bbarker | back 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:34 | Yardanico | well this assert runs fine |
19:12:37 | bbarker | of course no exception is thrown since x == x |
19:12:41 | Yardanico | you can disable asserts with --assertions:off btw |
19:12:48 | bbarker | oh. :-) |
19:12:54 | Yardanico | or short "-a" |
19:12:57 | Yardanico | https://nim-lang.org/docs/nimc.html |
19:15:14 | alehander92 | https://github.com/alehander92/learn-compiler |
19:15:46 | bbarker | hmm, 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:03 | Yardanico | try: body except: discard :D |
19:16:06 | alehander92 | ok, i'll leave the experiment here, updating from time to time :D |
19:17:00 | bbarker | Yardanico, ah, so basically wrap a func in another safe func that catches all exceptions? hmm |
19:17:10 | Yardanico | yeah, or modify the compiler :P |
19:18:14 | Yardanico | or maybe there's some other way I don't know of |
19:19:20 | bbarker | I'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:39 | Yardanico | well it is intentional |
19:19:48 | Yardanico | because Defects are program errors and are not supposed to be catchable |
19:19:55 | Yardanico | (that's how it works with --panics:on) |
19:20:02 | Yardanico | and --panics:on is not the default because of backwards compat and stuff |
19:20:27 | FromDiscord | <brainproxy> any suggestions re: taking an executable built with nim and packaging it in a macOS `.app` bundled (wrapped in a `.dmg`)? |
19:20:49 | Yardanico | well, you can do something like https://stackoverflow.com/questions/1596945/building-osx-app-bundle |
19:21:23 | bbarker | Yardanico, 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:53 | bbarker | Though of course certain defects could still pop up like out of memory errors |
19:22:27 | FromDiscord | <brainproxy> @Yardanico thank you! |
19:22:44 | bbarker | Yardanico, ok, i'm gonna think about it :-) |
19:22:47 | Yardanico | macOS packages are just directories with special structure @brainproxy |
19:23:08 | FromDiscord | <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:30 | FromDiscord | <brainproxy> never attempted this before |
19:24:34 | Yardanico | well there should be some macos tool for that no? |
19:25:29 | Yardanico | although I didn't do any macos development so I don't really know |
19:34:33 | FromDiscord | <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:46 | FromDiscord | <brainproxy> (edit) 'I found' => 'I've seen' |
19:40:22 | Yardanico | nice, saw that this create-dmg has a spinner, found out it uses https://github.com/sindresorhus/ora |
19:40:28 | Yardanico | and found a nim package for same thing https://github.com/molnarmark/spinny :) |
19:42:32 | Yardanico | although one thing I don't like is that it uses JSON |
19:44:25 | FromGitter | <bung87> @brainproxy I 've write some script doing that |
19:45:16 | FromGitter | <bung87> https://github.com/bung87/crowngui/blob/master/src/crownguipkg/cli.nim |
19:46:43 | FromGitter | <bung87> aim for embed a web site, current only build a .app |
19:49:14 | FromDiscord | <brainproxy> thans @bung87 |
19:49:20 | FromGitter | <bung87> also you may interested in https://github.com/nim-lang/niminst |
19:49:21 | FromDiscord | <brainproxy> (edit) 'thans' => 'thanks' |
19:51:24 | FromDiscord | <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:47 | FromGitter | <bung87> ok, do you know his process, I also want windows packaging |
19:54:19 | Araq | windows packaging is "ship the .exe plus what it needs" to your customers |
19:54:36 | FromGitter | <bung87> I want cross compilation , but I cant find `windres` like lib |
19:55:54 | FromGitter | <bung87> my .app packaging process has build icon process, so I'd like windows packaging also have this. |
19:56:42 | Araq | setup a CI for cross compilation, then you can also test the result, I dunno. maybe you want some testing |
19:56:44 | dom96 | .app bundles can literally be built by taking an existing .app and modifying its contents btw |
19:57:48 | FromGitter | <bung87> yeah, it's a dir with plist |
19:59:02 | Araq | seriously. test the binary on the platforms you claim to support. anything else is absurdly unprofessional |
19:59:18 | FromGitter | <bung87> @Araq ok, I'll go docker solution |
20:08:53 | Araq | docker? |
20:12:06 | Yardanico | wow I didn't know https://nim-lang.org/docs/asyncfile.html works for stdout/stdin as weill |
20:12:06 | FromGitter | <alehander92> well, still building for cross platform sounds useful |
20:12:20 | FromGitter | <alehander92> you need to just be able to run your binary on all the targets |
20:12:23 | FromGitter | <alehander92> not the whole build |
20:12:58 | FromGitter | <alehander92> cheaper |
20:13:13 | Araq | cheaper under what cost model? |
20:13:36 | FromGitter | <alehander92> well, if you need to pay for X hours of CI for Y time for Z platforms |
20:14:07 | Araq | well, then you need to compare it to running the build matrix on your work PC |
20:14:08 | FromGitter | <alehander92> just paying for running a binary might help a bit |
20:14:45 | FromGitter | <alehander92> well, yeah |
20:15:24 | FromGitter | <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:28 | FromGitter | <alehander92> on each possible target |
20:15:36 | Araq | for 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:54 | FromGitter | <alehander92> well, how do you find those free CI-s for n platforms |
20:16:12 | Araq | azure pipelines. bam, done. |
20:16:21 | * | kradnoel joined #nim |
20:16:21 | FromGitter | <alehander92> you can still run the matrix on subset with well maintained several platforrms |
20:16:29 | FromGitter | <alehander92> it doesnt have to be on your own pc |
20:16:33 | Araq | or the new github stuff (forgot the name) |
20:16:45 | * | kradnoel quit (Read error: Connection reset by peer) |
20:16:59 | FromGitter | <alehander92> yeah but there are probably still actual limits |
20:17:10 | FromGitter | <alehander92> especially for private stuff |
20:17:52 | FromGitter | <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:11 | Yardanico | or just use zig XD |
20:18:18 | * | abm quit (Ping timeout: 260 seconds) |
20:18:24 | FromGitter | <bung87> with docker I can run locally |
20:18:37 | Araq | Yardanico: so predictable. maybe I don't want to though because it solves a non-issue |
20:19:12 | Yardanico | Araq: 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:40 | Araq | yeah, well. guess what. I never build my own gcc before zig solved this problem for me. |
20:19:41 | FromDiscord | <Rika> github actions is the name |
20:20:03 | Araq | it's fairy tale stuff. |
20:21:36 | Yardanico | yeah, 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:30 | Araq | for small fun stuff it's simpler to simply not support Windows. Or MegaMangaLinux |
20:22:43 | Yardanico | hmm, that is true as well :P |
20:23:54 | FromGitter | <bung87> easier than using mingw? |
20:25:20 | FromGitter | <alehander92> Araq come on |
20:25:28 | FromGitter | <alehander92> both cases have pro-s and con-s |
20:25:47 | FromGitter | <alehander92> of course, often there are much more additional issues |
20:26:07 | FromGitter | <alehander92> needed to support so many targets |
20:26:13 | FromGitter | <alehander92> so its just one step |
20:26:27 | Araq | there are pros for embedded devlopment when your target cpu cannot run a compiler. |
20:26:44 | FromGitter | <alehander92> but i dont want to setup my whole build env |
20:26:46 | FromGitter | <alehander92> for all my targets |
20:26:49 | FromGitter | <alehander92> why would i do that |
20:28:23 | Araq | no idea what you're talking about |
20:28:56 | Araq | "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:03 | FromGitter | <alehander92> but i need to think for all kinds of edge cases/etc to make sure my build works on each platform |
20:44:07 | FromGitter | <alehander92> which doesnt make sense |
20:44:35 | FromGitter | <alehander92> for me its important that my binary works on X, i dont want to make sure my build works there |
20:44:51 | FromGitter | <alehander92> even if i use CI i still need to account for |
20:46:33 | Araq | *shrug* as opposed to what? so you cross-compile your binary and then it never uses any dynamic library ever? |
20:47:29 | Araq | different 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:48 | Araq | you simply cannot QA anything else. |
20:48:09 | Araq | no matter how much you simplify the non-issue of "how to invoke the compiler" |
20:50:31 | FromDiscord | <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:46 | FromDiscord | <Rika> depends on the ffi does it not |
20:58:41 | FromDiscord | <zetashift> @Technisha Circuit maybe this could help: https://github.com/Pebaz/nimporter/tree/master/examples |
20:58:48 | disruptek | http://ix.io/2mEk/nim |
20:59:05 | * | solitudesf- joined #nim |
21:00:31 | FromDiscord | <Technisha Circuit> That uses Nimpy and Nimpy doesn't have a way to expose types to Python last time i checkef |
21:00:36 | FromDiscord | <Technisha Circuit> Checked* |
21:01:52 | Araq | there is cint, cstring, cfloat |
21:02:14 | Araq | and Python's FFI can understand these types |
21:02:27 | * | solitudesf quit (Ping timeout: 265 seconds) |
21:02:50 | * | muffindrake joined #nim |
21:06:19 | FromDiscord | <Technisha Circuit> But how about for user created types? |
21:06:51 | Araq | an object is a 'struct', a Nim array is a C array |
21:07:26 | Araq | a Nim seq is more complex, it depends on the runtime |
21:08:57 | FromDiscord | <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:21 | FromDiscord | <Technisha Circuit> Since for Nimpy it gave no arguments when i used it for a Nim function and compiled it for Python |
21:09:24 | Araq | sure but Python's lists are not binary compatible to Nim's seqs |
21:09:30 | FromDiscord | <Rika> its similar, but under the hood i bet its different |
21:09:33 | dadada | I'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:07 | dadada | on 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:39 | dadada | so what was ident: module.typename ends up as ident: typename in the final reclist |
21:10:59 | dadada | and then the compile errors about conflicting names commence |
21:11:05 | FromDiscord | <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:46 | FromGitter | <ynfle> Why does ⏎ ⏎ ```proc hello*: string = ⏎ for _ in []: ⏎ discard``` ⏎ ⏎ compile? [https://gitter.im/nim-lang/Nim?at=5ec2fac6990d343a5f378ad7] |
21:15:56 | dadada | ynfle: why not? essentially this is an empty proc |
21:16:13 | dadada | and it'll return an empty string |
21:16:16 | FromGitter | <kaushalmodi> @ynfle Because sematically it looks alright |
21:16:24 | FromGitter | <kaushalmodi> s/sematically/semantically |
21:16:38 | Yardanico | well there is an issue with that I see a bit |
21:16:41 | Yardanico | what type is []? :D |
21:17:34 | Yardanico | ah it's tyEmpty |
21:17:34 | dadada | does it matter? the compiler probably figures that it's not so important when the array is empty, there's nothing to iterate |
21:17:44 | Yardanico | and you get a compiler crash if you try to do typeof([]) |
21:17:50 | Yardanico | !eval echo typeof([]) |
21:17:52 | NimBot | array[0..-1, empty] |
21:17:56 | Yardanico | lol wat |
21:17:59 | Yardanico | ?????? |
21:18:10 | Yardanico | ah lol it works without a proc |
21:18:12 | Yardanico | doesn't work in a proc |
21:18:26 | Yardanico | "Error: internal error: getTypeDescAux(tyEmpty)" |
21:18:42 | Yardanico | https://github.com/nim-lang/Nim/issues/12830 |
21:18:45 | disbot | ➥ for var in <empty_array> throws getTypeDescAux(tyEmpty) ; snippet at 12https://play.nim-lang.org/#ix=2mEo |
21:19:08 | Yardanico | ah actually it's a duplicate of https://github.com/nim-lang/Nim/issues/11684 |
21:19:11 | disbot | ➥ For loops over a hardcoded empty array crash the compiler. ; snippet at 12https://play.nim-lang.org/#ix=2mEp |
21:24:09 | FromGitter | <ynfle> ```proc hello*: string = ⏎ for _ in []: ⏎ discard``` [https://gitter.im/nim-lang/Nim?at=5ec2fcf9940fa238d6ff01eb] |
21:24:23 | FromGitter | <ynfle> ```proc hello*: string = ⏎ for _ in []: ⏎ discard ⏎ ⏎ discard hello()``` [https://gitter.im/nim-lang/Nim?at=5ec2fd07955768391869d2af] |
21:24:27 | FromGitter | <ynfle> This compiles |
21:24:34 | Yardanico | yes, why wouldn't it? |
21:24:43 | Yardanico | you discard an empty string which is returned from hello proc |
21:24:44 | FromGitter | <ynfle> *doesn't sorry |
21:24:46 | Yardanico | ah lol |
21:24:58 | Yardanico | well yeah see the issues I linked above |
21:24:59 | FromGitter | <ynfle> If the proc is called then it doesn't compile |
21:25:04 | Yardanico | https://github.com/nim-lang/Nim/issues/11684 |
21:25:06 | disbot | ➥ For loops over a hardcoded empty array crash the compiler. ; snippet at 12https://play.nim-lang.org/#ix=2mEp |
21:25:08 | FromGitter | <ynfle> Thanks I'll take a look |
21:25:11 | FromGitter | <ynfle> Looks interesting |
21:25:26 | FromGitter | <ynfle> Just wondering how the compiler checks return types |
21:25:51 | FromGitter | <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:08 | FromGitter | <alehander92> Araq well its always useful |
21:49:10 | FromGitter | <alehander92> to have choice |
21:49:15 | FromGitter | <alehander92> and additional tooling |
21:49:31 | FromGitter | <alehander92> sometimes it might be worth it, sometimes not |
21:49:52 | FromGitter | <alehander92> you're probably right testing is underestimated |
21:50:14 | Araq | it's the "choice" in platforms that created this mess in the first place |
21:50:50 | Araq | I don't enjoy the choice between Linux, OSX and Windows, I'd rather have only one OS that sucks. |
21:50:55 | FromGitter | <alehander92> eh |
21:51:01 | FromGitter | <alehander92> and only one language that sucks |
21:51:11 | Araq | yep. |
21:51:29 | FromGitter | <alehander92> :D called JAVA |
21:51:48 | Araq | called Nim. |
21:52:22 | FromGitter | <alehander92> people literally want to create functional dialects of Nim :D |
21:53:09 | FromGitter | <alehander92> it's like having only a single football team |
21:53:34 | FromGitter | <alehander92> when you can have 284721 |
21:54:58 | wgetch | only OS you need is TempleOS. only lang you need is HolyC. |
21:56:17 | FromDiscord | <Rika> nim targeting holyc when |
22:00:24 | Araq | Rika: we're still busy targeting wasm. wasm is getting multi-threading anytime soon |
22:00:42 | FromDiscord | <Rika> i'm joking XD |
22:00:55 | Araq | I know. I'm joking too |
22:01:54 | Araq | and 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:17 | Araq | because this time there are two stack pointers, one of which that has to be emulated with wasms load/store mechanisms |
22:03:25 | Araq | it'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:00 | FromDiscord | <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:25 | FromDiscord | <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:57 | Yardanico | btw congrats everyone, with my last issue https://github.com/nim-lang/Nim/issues/14396 we have 1600 issues now :) |
22:11:00 | Yardanico | :D |
22:11:00 | disbot | ➥ [ARC] object is getting sinked with createThread when it shouldn't ; snippet at 12https://play.nim-lang.org/#ix=2mEL |
22:12:39 | Yardanico | open ones I mean |
22:15:58 | FromDiscord | <zetashift> A lot of the recent issues are ARC stuff |
22:16:14 | Yardanico | yeah, I tried quite a lot of nim libs/apps with arc |
22:16:14 | * | liblq-dev quit (Quit: WeeChat 2.8) |
22:16:22 | Yardanico | you can help too |
22:16:43 | FromDiscord | <zetashift> I can for a fact say that godot-nim doesn't work because it uses some GC stuff |
22:16:57 | Yardanico | which GC stuff? |
22:17:04 | Yardanico | GC_ref and GC_unref work with arc |
22:17:44 | Yardanico | deepCopy isn't there for arc though (yet) |
22:18:11 | FromDiscord | <zetashift> "setStackBottom" iirc |
22:18:47 | FromDiscord | <zetashift> I'm looking into how to run stuff using ARC |
22:18:53 | Yardanico | --gc:arc :P |
22:19:05 | Yardanico | it also sets --exceptions:goto automatically, but you better be on latest devel for recent arc bugfixes |
22:19:14 | FromDiscord | <zetashift> switching to devel |
22:19:21 | Yardanico | and if you use stuff like async you need orc |
22:20:11 | FromDiscord | <zetashift> Yeah sometimes I read about ARC, it looks like it'll come a lot sooner than 2.0 tho? |
22:23:01 | FromDiscord | <zetashift> ``` C:\Users\Administrator\.nimble\pkgs\godot-0.7.27\nim\godotnim.nim(885, 5) Error: undeclared identifier: 'nimGC_setStackBottom' ``` |
22:23:03 | Yardanico | well already a lot of stuff works with it |
22:23:10 | Yardanico | right now the main goal is to make the compiler work with gc:orc |
22:24:40 | Prestige | Can I manually insert null chars into a string? |
22:24:46 | Yardanico | \0 |
22:25:05 | Prestige | can that be followed by another number somehow? like "1\02\0" |
22:25:37 | FromDiscord | <Rika> that would prolly be recognized as \2 tho |
22:25:42 | Yardanico | yes |
22:25:46 | Prestige | double \\ ? |
22:25:57 | FromDiscord | <Rika> concat the strings on compile time using static: |
22:25:59 | FromDiscord | <zetashift> nimgame2 also fails for me on arc : https://play.nim-lang.org/#ix=2mES |
22:26:00 | FromDiscord | <Rika> is what i would do |
22:26:09 | Yardanico | @zetashift I know it does |
22:26:12 | Yardanico | but you can make it work |
22:26:16 | Yardanico | if you changel finalizers to destructors |
22:26:23 | Yardanico | and reorder some code around |
22:26:33 | Yardanico | change* |
22:27:08 | Yardanico | I 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:51 | FromDiscord | <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:16 | Yardanico | Araq: 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:19 | disbot | ➥ Re-opening a channel results in a segfault when sending data to it ; snippet at 12https://play.nim-lang.org/#ix=2mET |
22:28:32 | Yardanico | I mean if I do that after closing the channel or before opening it |
22:29:04 | FromDiscord | <Technisha Circuit> Is it better to use `const` where possible or is it better to use `let` always |
22:29:13 | Yardanico | use const when possible :) |
22:29:18 | Yardanico | so your program has less stuff to do at runtime |
22:30:16 | FromDiscord | <Technisha Circuit> Thanks! |
22:30:31 | FromDiscord | <Technisha Circuit> @codic so it's better to use const over let |
22:30:47 | Yardanico | well I mean generally I prefer const over let, let over var |
22:30:53 | Yardanico | it makes easier to read the code and stuff |
22:31:10 | FromDiscord | <Technisha Circuit> Ok |
22:31:23 | FromDiscord | <Technisha Circuit> Does using const over let make the program any faster? |
22:32:06 | Yardanico | well imagine you're calculating some stuff with let, like building a hash table or something |
22:32:11 | FromDiscord | <Technisha Circuit> Okay |
22:32:12 | Yardanico | if you do it with let, you do it at your program's runtime |
22:32:19 | Yardanico | with const the VM does it at compile-time |
22:32:24 | FromDiscord | <Technisha Circuit> Oh okay |
22:32:27 | Yardanico | a lot of nim code works at compile-time |
22:32:32 | Yardanico | even things like json, streams, etc |
22:32:37 | FromDiscord | <Technisha Circuit> Nice |
22:33:53 | FromDiscord | <Technisha Circuit> Is osproc included in is automatically or do i need to import osproc myself? |
22:34:04 | Yardanico | wdym "in it"? |
22:37:04 | FromDiscord | <Technisha Circuit> Like, if i import os, would i be able to use `execProcess` from osproc without importing `osproc` manually? |
22:37:22 | Yardanico | !eval import os; echo execCmd("id") |
22:37:22 | * | JustASlacker quit (Ping timeout: 260 seconds) |
22:37:24 | NimBot | Compile failed: /usercode/in.nim(1, 17) Error: undeclared identifier: 'execCmd' |
22:37:25 | Yardanico | as you can see, no |
22:37:32 | Yardanico | !eval import osproc; echo execCmd("id") |
22:37:36 | NimBot | uid=65534(nobody) gid=65534(nobody)↵0 |
22:39:18 | FromDiscord | <Technisha Circuit> Thanks! |
22:39:42 | FromDiscord | <Rika> nim's VM is honestly amazing to me |
22:40:06 | Yardanico | and it's also register-based :P |
22:40:21 | Yardanico | so it's pretty fast and can generally compete with other non-JIT VMs |
22:42:15 | FromDiscord | <zetashift> what would be the upsides of it being JITted? |
22:42:54 | Yardanico | honestly I don't know :P maybe it'll help with some hot paths in macros or something |
22:45:57 | FromDiscord | <Technisha Circuit> Nim is fun |
22:46:40 | FromDiscord | <dom96> JIT=speed |
22:49:30 | FromDiscord | <Technisha Circuit> How would i exit a nim program? |
22:49:36 | FromDiscord | <Technisha Circuit> Is there `exit()` or something? |
22:49:38 | disruptek | quit |
22:49:48 | FromDiscord | <Technisha Circuit> Just `quit`? |
22:49:55 | Yardanico | quit or quit() |
22:50:00 | FromDiscord | <Technisha Circuit> Thanks! |
22:50:02 | Yardanico | or 0.quit or quit 0 or quit(1) |
22:50:06 | Yardanico | or qUIT(1) |
22:50:16 | Yardanico | !eval qUIT(1) |
22:50:18 | NimBot | <no output> |
22:52:03 | FromDiscord | <Technisha Circuit> If you add a number as an argument for quit, is that the return code? |
22:52:07 | Yardanico | yes |
22:52:16 | FromDiscord | <Rika> has anyone written nim in an alternating caps style LOL |
22:52:18 | FromDiscord | <Technisha Circuit> What's the default return code? 0? |
22:52:22 | Yardanico | yes |
22:52:22 | FromDiscord | <Rika> yes |
22:52:26 | FromDiscord | <Technisha Circuit> Thanks |
22:52:29 | Yardanico | that means "everything went fine" |
22:52:36 | FromDiscord | <Technisha Circuit> > has anyone written nim in an alternating caps style LOL↵I can make some code to do this |
22:52:41 | FromDiscord | <Technisha Circuit> Yup, ik that from Python |
22:52:49 | Yardanico | if you quit on some error, it'll make life of other people easier if you do it like "quit(1)" |
22:58:26 | FromDiscord | <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:32 | Yardanico | no |
22:58:41 | FromDiscord | <Technisha Circuit> Damn |
22:58:41 | Yardanico | strformat parses the format string at compiletime |
22:58:49 | FromDiscord | <Technisha Circuit> Oh ok |
22:59:11 | FromDiscord | <Technisha Circuit> So no way for me to eval/exec code at all from a string? |
22:59:19 | Yardanico | nim is a native language |
22:59:28 | FromDiscord | <Technisha Circuit> So no |
22:59:30 | FromDiscord | <Technisha Circuit> ;-; |
22:59:31 | Yardanico | the only way to execute Nim at runtime would be to embed NimScript in your app |
22:59:42 | FromDiscord | <Technisha Circuit> How does NimScript work? |
22:59:50 | Yardanico | https://nim-lang.org/docs/nims.html |
23:02:14 | FromDiscord | <Technisha Circuit> Is there a way i could just embed the Nim compiler in my app? |
23:02:26 | Yardanico | you can do that as well, yes |
23:02:30 | FromDiscord | <Technisha Circuit> I'd also want it to have access to anything i have defined in my app |
23:02:35 | Yardanico | well |
23:02:45 | Yardanico | you won't be able to really interact with the code you compile with the compiler |
23:02:51 | Yardanico | because it'll get compiled to the binary |
23:02:51 | FromDiscord | <Technisha Circuit> Hm :/ |
23:03:02 | Yardanico | the only somewhat okay way would be to use NimScript as I said |
23:03:04 | FromDiscord | <Technisha Circuit> That's a shame |
23:03:13 | FromDiscord | <Technisha Circuit> Okay then, thanks! |
23:03:20 | Yardanico | well it's just that sometimes people forget that Nim is fully natively compiled :P |
23:03:25 | Yardanico | maybe because it's so good |
23:03:32 | FromDiscord | <Technisha Circuit> Yeah ;-; |
23:04:25 | FromDiscord | <Technisha Circuit> So the only disadvantages of NimScript is that it can't use anything that relies on `importc` or `importcpp`, right? |
23:04:33 | Yardanico | well mostly yes |
23:04:42 | FromDiscord | <Technisha Circuit> Cool, seems handy then |
23:08:24 | * | mono quit (Quit: Leaving) |
23:10:13 | FromDiscord | <Technisha Circuit> NimScript seems quite OP |
23:10:56 | FromDiscord | <Technisha Circuit> Is there a way to make a standalone NimScript runner? (A tool that can run NimScript without nim being installed) |
23:11:32 | Yardanico | there certainly is, right now PMunch does some nimscript related things (he's offline now though) |
23:12:31 | FromDiscord | <Technisha Circuit> Nice |
23:12:47 | FromDiscord | <Technisha Circuit> Could you give me a discord link to the tool? |
23:13:18 | FromDiscord | <Technisha Circuit> ~~I am probably going to mostly ditch bash scripts for NimScript~~ |
23:13:29 | Yardanico | I didn't say it exists |
23:13:34 | Yardanico | but I said it's totally possible |
23:13:46 | Yardanico | but you understand you'll have to distribute some parts of nim stdlib anyway |
23:13:47 | FromDiscord | <Technisha Circuit> Oh okay |
23:14:23 | FromDiscord | <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:42 | bbarker | I 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:19 | Prestige | Having 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:59 | Yardanico | well first of all you don't need unsafeAddr here |
23:45:02 | Yardanico | just define tags as "var" |
23:45:17 | Yardanico | and what is PPChar ? |
23:45:18 | Yardanico | **char ? |
23:45:23 | FromDiscord | <Technisha Circuit> How do i make a seed for the random module module in Nim? I can't find anything online |
23:45:39 | Yardanico | did you try looking at the actual DOCUMENTATION |
23:45:45 | Yardanico | https://nim-lang.org/docs/random.html#randomize%2Cint64 |
23:46:10 | Yardanico | sorry but really |
23:46:33 | Prestige | Yardanico: yeah, char **list is how the docs define it |
23:46:38 | FromDiscord | <Rika> yardanico triggered |
23:46:39 | Prestige | https://linux.die.net/man/3/xutf8textlisttotextproperty |
23:46:42 | Yardanico | Prestige: nim strings are not c strings |
23:46:58 | FromDiscord | <Rika> thats one long ass function name btw |
23:47:00 | FromDiscord | <Rika> jesus |
23:47:10 | Prestige | Ah so it needs to be converted. Thanks Yardanico |
23:47:16 | Yardanico | also a sequence can't really be casted to an array that easily I think |
23:47:17 | Prestige | ikr Rika |
23:47:23 | Yardanico | try with [] instead of @[] |
23:47:29 | Yardanico | ah you already have an array sorry |
23:47:34 | FromDiscord | <Technisha Circuit> Oh okay |
23:47:39 | FromDiscord | <Technisha Circuit> Thanks :p |
23:47:41 | Prestige | np thank you for taking a look |
23:48:09 | FromDiscord | <Technisha Circuit> Oh so i just use numbers |
23:48:39 | FromDiscord | <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:17 | Prestige | Yardanico: 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:26 | Yardanico | Prestige: if you declare "tag" as "var" |
23:49:29 | Yardanico | you don't need unsafeAddr |
23:49:44 | Yardanico | "tags" I mean |
23:49:54 | Yardanico | ah riught |
23:49:57 | Yardanico | also don't do that |
23:50:06 | Yardanico | do cast[PPChar](addr tags[0]) |
23:50:16 | Yardanico | address to the array is address of the first element in it |
23:51:05 | Prestige | So it's saying tags has no address if I try that |
23:51:11 | Prestige | This is inside a proc btw |
23:51:21 | Yardanico | even if "tags" is "var"? |
23:52:10 | Prestige | I lied, thanks. Changed it back after it hadn't worked at first, but both changes together do |
23:57:03 | skrylar[m] | hoi |
23:58:05 | FromDiscord | <Rika> hoi |