00:27:21 | * | jmd_ quit (Ping timeout: 250 seconds) |
00:39:06 | FromDiscord | <Raynei486> Is there a way to build just the manual when contributing documentation? |
00:39:21 | FromDiscord | <Raynei486> I don't really need to see the html output of other documentation |
00:40:54 | FromDiscord | <mrgaturus> hi, i saw about macrocache, so i want know if is better replace my compile time table of arrays of NimNode by just a CacheMacro and the array be done as a NimNode with children? |
00:41:31 | FromDiscord | <mrgaturus> (edit) "CacheMacro" => "CacheTable" |
00:41:35 | FromDiscord | <Elegantbeef> it's generally what I do |
01:02:42 | * | boxuser joined #nim |
01:26:13 | * | oldpcuser quit (Remote host closed the connection) |
01:27:36 | * | oldpcuser joined #nim |
01:31:12 | * | oldpcuser quit (Client Quit) |
01:32:19 | * | def- quit (Quit: -) |
01:32:35 | * | def- joined #nim |
01:34:41 | * | oldpcuser joined #nim |
01:47:37 | * | boxuser quit (Ping timeout: 240 seconds) |
02:27:57 | * | disso-peach joined #nim |
02:30:48 | * | disso-peach quit (Client Quit) |
02:44:43 | * | oldpcuser quit (Remote host closed the connection) |
02:45:23 | * | oldpcuser joined #nim |
02:49:42 | * | boxuser joined #nim |
03:07:18 | FromDiscord | <demotomohiro> In reply to @Raynei486 "Is there a way": Probably `nim md2html doc/manual.md`. |
03:07:20 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/blob/devel/tools/kochdocs.nim#L266 |
03:09:53 | * | boxuser quit (Ping timeout: 256 seconds) |
03:33:40 | FromDiscord | <xTrayambak> Does anyone here know how to get the bounds of a font character in pixie? |
03:36:29 | FromDiscord | <Elegantbeef> I use layout and arrangment |
03:36:55 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/fontatlaser.nim |
03:46:23 | * | boxuser joined #nim |
03:51:56 | FromDiscord | <Graveflo> nimsuggest actually core dumps about every 2 seconds during active use for me. Is this normal? |
04:03:07 | * | boxuser quit (Ping timeout: 240 seconds) |
04:04:43 | NimEventer | New thread by dwhall256: Reliably locating nimbase.h , see https://forum.nim-lang.org/t/10252 |
04:15:19 | FromDiscord | <xTrayambak> In reply to @Elegantbeef "I use layout and": Ah, so there's no good way to find out the bounds? I've heard fonts do store that data for every character, surely pixie also reads that somewhere as afaik it's necessary for typesetting. A bit of delving into pixie's code might reveal something useful. Thanks for the help, though. |
04:15:39 | FromDiscord | <Elegantbeef> Afaik the only way is layoutBounds\` sadly |
04:16:32 | FromDiscord | <xTrayambak> Aaargh this toy browser engine is gonna make me go crazy |
04:16:57 | FromDiscord | <Elegantbeef> Opengl? |
04:32:04 | FromDiscord | <xTrayambak> Yep. Using pixie and windy, and using boxie to render to OpenGL |
04:33:09 | FromDiscord | <Elegantbeef> Boxxy is based on opengl3.3 then eh? |
04:33:12 | FromDiscord | <Elegantbeef> Never looked into it |
05:06:40 | * | ntat joined #nim |
05:14:31 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xEv |
05:19:04 | FromDiscord | <mratsim> sent a long message, see http://ix.io/4xEw |
05:30:06 | * | boxuser joined #nim |
05:41:17 | * | rockcavera quit (Remote host closed the connection) |
05:43:15 | FromDiscord | <Elegantbeef> `(untyped, untyped)` makes no senseβ΅(@Graveflo) |
05:44:06 | FromDiscord | <Elegantbeef> You want `varargs[untyped]` |
05:44:09 | FromDiscord | <Graveflo> alright. Trying to get named varags but I think they dont exist |
05:44:29 | FromDiscord | <Elegantbeef> Just use a tuple? |
05:44:37 | * | cedb quit (Ping timeout: 240 seconds) |
05:44:47 | FromDiscord | <Graveflo> oh right |
05:45:54 | FromDiscord | <Graveflo> can I expand a tuple into a function call in a template? That's what I'm trying to do in a macro right now bc I couldn't get the template to work |
05:46:14 | FromDiscord | <Elegantbeef> You can make a macro that does it yea |
05:46:32 | FromDiscord | <Graveflo> okay yea no other way makes sense I suppose |
05:47:44 | FromDiscord | <Graveflo> this is doing something very similar to what your constructor does except I don't want to the module level call and I want to it bind to generics arbitrarily |
05:47:59 | FromDiscord | <Elegantbeef> What? |
05:50:11 | FromDiscord | <Graveflo> I mean I shouldn't have to call `implDefaults` or use the pragma or copy all the names |
05:50:32 | FromDiscord | <Elegantbeef> Then use the default object constructor? π |
05:50:55 | FromDiscord | <Graveflo> but I have refs that I need to set up each time and I dont want to re-implement the default constructors defaults |
05:51:14 | FromDiscord | <Graveflo> its just annoying. I would like to be able to bind and overload the default constructor |
05:51:14 | FromDiscord | <Elegantbeef> I'm so lost at what you're "solving" |
05:52:00 | * | cedb joined #nim |
05:52:31 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xEG |
05:53:37 | FromDiscord | <Graveflo> I don't want to type `(channel_num:int=0, color_config_num:int=0)` for every object and generic init that I make. I also want that part to be overridable and overloadable |
05:54:24 | FromDiscord | <Elegantbeef> Right you do not have to type that though |
05:54:28 | FromDiscord | <Elegantbeef> int's are 0 init'd π |
05:55:01 | FromDiscord | <Elegantbeef> ps that should be `vt: T` |
05:55:02 | * | boxuser quit (Read error: Connection reset by peer) |
05:55:04 | FromDiscord | <Graveflo> but init is not called automatically and I still want the ability to change them to nonzero values if i want |
05:55:06 | FromDiscord | <Elegantbeef> `vt: var T` |
05:55:18 | FromDiscord | <Graveflo> oh yea ur right I keep doing that |
05:55:43 | FromDiscord | <Graveflo> this par thasn't made it past my test bed. I have a simplified duplicate in a unit test |
05:55:55 | FromDiscord | <Graveflo> idk what I'm doing. I think it makes sense |
05:56:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/c7fQj |
06:00:57 | * | boxuser joined #nim |
06:05:22 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xEI |
06:11:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xEJ |
06:11:59 | FromDiscord | <Elegantbeef> Whoops π |
06:12:06 | FromDiscord | <Elegantbeef> anywho there you go |
06:12:17 | FromDiscord | <Elegantbeef> I got lazy with your javalong named type |
06:13:32 | FromDiscord | <Graveflo> well thers going to be a lot of those. I don't think the short way is going to work out |
06:14:46 | FromDiscord | <Graveflo> so this is the part that I don't like `proc setup(vct: var VCT, channel, colorConfig: int) =` I'm going to be writing 100s of these. I don't want to duplicate the entire struct in the params. The default constructor already has this behavior |
06:18:01 | * | boxuser quit (Ping timeout: 256 seconds) |
06:19:10 | FromDiscord | <Graveflo> LOL I just realized I was putting the params int he wrong place with the template so I can see how I've been confusing. Ah well I'll figuree it out |
06:19:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/qQibx |
06:19:56 | FromDiscord | <Graveflo> no, I mean that `channel, colorConfig: int` should not be there. That belongs at the first site of instantiation and not re-written by me |
06:20:24 | FromDiscord | <Graveflo> lets say I had a struct with 15 fields. I'm not going to sit there and re-type that LOL |
06:28:00 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xEN |
06:28:42 | FromDiscord | <Graveflo> echo statements for extra efficiency too |
06:31:35 | FromDiscord | <Graveflo> I guess I could have just make `init` return the first param and skipped all of this.. amongst several other simpler things |
06:38:43 | Amun-Ra | Elegantbeef: I asked the other day how to fix "Cannot prove that 'result' is initialized." (in a function returning an array) and you gave me the answer; I lost my notes, could you remind me what it was? |
06:39:35 | FromDiscord | <Elegantbeef> Uhh |
06:40:56 | * | PMunch joined #nim |
06:43:22 | FromDiscord | <Graveflo> were you on discord? |
06:43:57 | * | def- quit (Quit: -) |
06:44:02 | FromDiscord | <Elegantbeef> Perhaps, trying to find any record of this supposed conversation |
06:44:08 | * | def- joined #nim |
06:44:32 | FromDiscord | <Elegantbeef> I do not see any record of it π |
06:44:38 | FromDiscord | <Elegantbeef> Amun is gaslighting! |
06:44:43 | FromDiscord | <Graveflo> Couple of hits. Didn't see anything jump out as "it" |
06:44:51 | Amun-Ra | I found it! 2023-04-17 11:19:54 Β§Elegantbeef https://play.nim-lang.org/#ix=4tCk |
06:45:33 | Amun-Ra | and that wasn't easy for Elegantbeef is one of the most active memebers here ;) |
06:46:19 | FromDiscord | <Elegantbeef> You can drop the facade with "one" π |
06:46:28 | Amun-Ra | :P |
06:47:53 | PMunch | "The other day" -> Almost two months ago |
06:48:38 | Amun-Ra | isn't that another form of 'sometime ago'/etc.? |
06:48:58 | FromDiscord | <Elegantbeef> Nope |
06:49:04 | Amun-Ra | oh |
06:49:11 | FromDiscord | <Elegantbeef> The other day for most people means within like a week π |
06:49:19 | Amun-Ra | TIL :) |
06:49:47 | NimEventer | New question by IvanS: Trying to create a Nim-Nim dll, to be able to work with plugins, but tests keep crashing, see https://stackoverflow.com/questions/76420556/trying-to-create-a-nim-nim-dll-to-be-able-to-work-with-plugins-but-tests-keep |
06:50:16 | FromDiscord | <Elegantbeef> It's synonymous for "Few days ago" |
06:50:27 | FromDiscord | <Elegantbeef> One day people will stop making plugins using dlls |
06:50:52 | * | def- quit (Quit: -) |
06:52:04 | * | def- joined #nim |
06:53:21 | Amun-Ra | ;) |
06:56:51 | FromDiscord | <Arathanis> In reply to @Elegantbeef "One day people will": They are making DLLs using Nim for the purpose of using them inside Nim/ |
06:56:53 | FromDiscord | <Arathanis> (edit) "Nim/" => "Nim?" |
06:57:26 | Amun-Ra | well, that doesn't work anymore, let me update my nim 2.0pre |
07:00:04 | FromDiscord | <Rika> In reply to @Elegantbeef "One day people will": Gonna make plugin systems using Lua instead |
07:01:05 | FromDiscord | <Elegantbeef> Lol |
07:03:18 | PMunch | How easy is it to create a webassembly plugin in various language Elegantbeef? |
07:04:33 | * | def- quit (Quit: -) |
07:04:36 | FromDiscord | <Elegantbeef> Easy since all you have to do is expose the host functions you want the module to call and you're done |
07:04:55 | PMunch | What do you mean? |
07:05:31 | FromDiscord | <Elegantbeef> Well it depends on what you want to make a plugin system for |
07:06:00 | PMunch | Oh I'm not talking about the plugin system, but rather the plugin itself |
07:06:39 | FromDiscord | <Elegantbeef> Right you just import the procedures you use then use the compiler that emits wasm |
07:06:40 | * | def- joined #nim |
07:07:09 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasmsources/hooks.nim |
07:07:10 | FromDiscord | <Elegantbeef> Is an example wasm module |
07:08:01 | FromDiscord | <Elegantbeef> https://github.com/beef331/wasm3/blob/master/tests/test1.nim#L88-L127 is the host side |
07:09:55 | FromDiscord | <Elegantbeef> You of course need to be smart with the plugin import and define things the same as the host expects just like a system library |
07:11:12 | PMunch | Hmm, do you need NimRTL when compiling with --mm:orc? |
07:11:34 | FromDiscord | <Elegantbeef> I do not know |
07:11:52 | FromDiscord | <Elegantbeef> I think you do if you share resources across the DLL barrier |
07:12:03 | PMunch | Hmm, right |
07:12:07 | FromDiscord | <Elegantbeef> If you pretend that it's all one big Nim program |
07:12:13 | FromDiscord | <Elegantbeef> Which is just an odd way to live |
07:12:15 | PMunch | It's not required for ARC though right? |
07:12:38 | FromDiscord | <Elegantbeef> I think it still is |
07:12:44 | FromDiscord | <Elegantbeef> No clue though |
07:12:46 | PMunch | I was just trying to wrap my head around this StackExchange question |
07:12:52 | FromDiscord | <Elegantbeef> No one has documented this |
07:12:57 | FromDiscord | <Elegantbeef> Araq is like the only one that would know |
07:13:41 | FromDiscord | <Arathanis> Araq seems to be around, you could ask them. |
07:15:18 | Amun-Ra | Elegantbeef: I got rid of the warning via simple result[0] = value; :P |
07:15:28 | PMunch | Hmm, I'm unable to build nimrtl on 1.6.12 with ARC and ORC |
07:15:37 | PMunch | Error: system module needs: nimAddInt |
07:15:58 | PMunch | @Araq, do you have any input? |
07:16:11 | PMunch | He's not often around here in the channels though unfortunately.. |
07:16:37 | FromDiscord | <Elegantbeef> He's in #internals π |
07:16:48 | FromDiscord | <Arathanis> he was talking in #internals like 15m ago |
07:17:27 | PMunch | Ahh, that's where he went! |
07:18:27 | FromDiscord | <ringabout> In reply to @PMunch "Hmm, I'm unable to": Did you try it with devel or 1.6.10 |
07:19:16 | FromDiscord | <ringabout> Afaik, there are some changes to fix nimrtl on the devel for ARC/ORC. |
07:19:28 | FromDiscord | <ringabout> For example => https://github.com/nim-lang/Nim/pull/21814 |
07:26:04 | PMunch | Right |
07:27:18 | PMunch | Elegantbeef, could you write e.g. a plugin in Python via webassembly? |
07:28:16 | FromDiscord | <Graveflo> I apologize to the IRC gremlins for that |
07:29:31 | PMunch | Huh? |
07:29:41 | FromDiscord | <Graveflo> do edits not dupe on IRC anymore? |
07:30:09 | PMunch | I think it has gotten smarter about them |
07:30:29 | PMunch | Not quite sure what you edited though |
07:30:45 | FromDiscord | <Graveflo> oh nice π I can pretend to be a slightly smarter idiot now |
07:31:10 | FromDiscord | <Graveflo> I edited that weird macro I posted bc it didn't use nnkCall instead of nnkCreateObject when there were no params |
07:37:34 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "<@145405730571288577>, could you write": Yes if you don't mind using something to load the WASM code :p |
07:38:05 | FromDiscord | <Chronos [She/Her]> Iirc there's a Python package for loading WASM code as modules |
07:38:13 | FromDiscord | <Chronos [She/Her]> Using wasmtime or wasmer |
07:39:44 | FromDiscord | <Chronos [She/Her]> In reply to @Hourglass, When the Hour Strikes "Iirc there's a Python": Hm seems not from a quick search, but it probably wouldn't be too big of an issue to add an import hook for that using various different runtimes |
07:44:39 | * | boxuser joined #nim |
07:45:23 | PMunch | Chronos_[She/Her], well this was the other way around. Writing a plugin in Python to load into Nim |
07:46:21 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Chronos_[She/Her], well this was": Aah okay, if you don't mind running a full Python runtime then Emscripten support is being worked on for Python |
07:46:40 | PMunch | Typically I would solve this with a Nim plugin using the embedded Python interpreter which would then run the scripts |
07:46:57 | FromDiscord | <Chronos [She/Her]> Also there's Pyodide |
07:47:22 | FromDiscord | <Chronos [She/Her]> Also there's MicroPython if you don't mind having less module support |
07:47:34 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Typically I would solve": What's your usecase for this anyway? |
07:48:26 | PMunch | Nothing in particular. I'm just trying to compare your traditional dynamic library plugin system to a webassembly based plugin system |
07:49:32 | FromDiscord | <Chronos [She/Her]> Ah fair |
07:49:46 | FromDiscord | <Chronos [She/Her]> I mean, one big bonus of WASM is the sandbox really |
07:50:00 | PMunch | Yeah that's what got me really interested |
07:50:15 | FromDiscord | <Chronos [She/Her]> Also cross-platform ability too, which is p neat as long as a WASM runtime exists |
07:50:25 | PMunch | But dynamic libraries have been around forever so the knowledge on how to build them in language Y is much greater |
07:50:46 | FromDiscord | <Chronos [She/Her]> Yeah definitely can agree with that |
08:01:02 | PMunch | And for interpreted languages (Python, Lua, etc.) it would be fairly easy to write a plugin with the interpreter which in turn loads the script |
08:01:07 | * | boxuser quit (Ping timeout: 240 seconds) |
08:01:28 | PMunch | I was just wondering, and perhaps worrying, that webassembly wouldn't be as flexible in this regard |
08:03:42 | * | boxuser joined #nim |
08:08:49 | om3ga | Cronos, you may be interested also, solution was found |
08:09:56 | om3ga | I thought that java was complete utter sh** but it not relates to the lang, or exe code. It's how kernel works |
08:10:56 | om3ga | so there is system function called malloc_trim, it asks kernel to take back free portions of given ram |
08:12:24 | om3ga | while it solves the problem I personally have, I still think this should be included like some sort of option for the GC in nim |
08:12:42 | om3ga | and well documented too |
08:15:21 | * | boxuser quit (Ping timeout: 250 seconds) |
08:17:37 | * | boxuser joined #nim |
08:18:41 | FromDiscord | <Elegantbeef> pmunch if there is a wasm compiler for python of course |
08:21:03 | FromDiscord | <Elegantbeef> https://pyodide.org/en/stable/ it's cursed but it seems this is the path python takes |
08:21:21 | FromDiscord | <Elegantbeef> You compile a python runtime to wasm to run inside your wasm runtime so you can use python |
08:21:58 | FromDiscord | <Graveflo> I'm a python nut and event I hate the sound of that |
08:22:44 | FromDiscord | <Elegantbeef> Right, but since python is so dynamic it's not like you can do much better π |
08:23:19 | FromDiscord | <Graveflo> can't you more or less run javascript in that environment anyway? Python is beautiful but javascript has the same runtime hackery available |
08:23:21 | FromDiscord | <Elegantbeef> https://github.com/ysugimoto/webassembly-lua lua has a proper compiler though |
08:23:30 | FromDiscord | <Elegantbeef> No? |
08:23:35 | FromDiscord | <Elegantbeef> wasm does not mean inside the browser |
08:23:54 | FromDiscord | <Elegantbeef> wasm is it's own runtime that does not imply browser or anything related to web |
08:23:58 | FromDiscord | <Graveflo> oh I don't know anything about it. I assumed that wasm meant native apps in browser |
08:24:13 | FromDiscord | <Elegantbeef> Sadly the name is a misnomer really. It's a standardised VM that many languages target |
08:24:30 | FromDiscord | <Elegantbeef> It was originally made for the browser/web, but yea it's now just a general purpose VM |
08:24:44 | FromDiscord | <Graveflo> oh so its kinda like llvm but for modern "VM" langs |
08:24:53 | FromDiscord | <Elegantbeef> Not really |
08:25:04 | FromDiscord | <Elegantbeef> It's more like a new assembly that languages can target |
08:25:18 | FromDiscord | <Elegantbeef> LLVM for instance can generate WASM byte code |
08:28:20 | FromDiscord | <Graveflo> so its like a general purpose jit bytecode interpreter |
08:28:30 | FromDiscord | <Elegantbeef> Nope to the jit part |
08:28:33 | FromDiscord | <Elegantbeef> That's optional |
08:28:45 | FromDiscord | <Elegantbeef> It's a standardised bytecode VM |
08:28:54 | FromDiscord | <Elegantbeef> Which means languages can make backends for it and it's useful |
08:29:26 | FromDiscord | <Elegantbeef> Want to make a plugin system that has crossplatform plugins, you use wasm then anyone can compile any language to wasm and you can run it on any platform |
08:30:05 | FromDiscord | <Graveflo> interesting... I think thats prob only going to be useful for the web or maybe to lower the barrier of entry to new interpreted langs |
08:30:20 | FromDiscord | <Elegantbeef> You keep missing the point |
08:30:32 | FromDiscord | <Elegantbeef> It's an standardised VM that you can target from any language |
08:31:25 | FromDiscord | <Elegantbeef> You can write C, Lua, Rust, Nim, C# modules use them in conjunction in a sandboxed environment and only compile the modules once for all platforms |
08:32:11 | FromDiscord | <Elegantbeef> It's all the benefit of using a scripting language like lua without any of the downsides of locking to a specific language. It's all the benefits of system library plugins without the downside of having to compile for each platform you're supporting |
08:32:58 | FromDiscord | <Elegantbeef> Plus it's sandboxed by default |
08:33:42 | FromDiscord | <Graveflo> well I appreciate your enthusiasm. It does sound cool honestly. I'm not sure I'm as impressed as you are though |
08:34:02 | FromDiscord | <Elegantbeef> Well given my focus in gamedev it's a wonderful premise for scripting π |
08:34:41 | FromDiscord | <Graveflo> actually that does make sense. Compat is a big problem there for devs and users |
08:35:01 | FromDiscord | <Graveflo> I guess the idea is throw all the issues in once place and hope that makes things less nuts |
08:35:09 | FromDiscord | <Graveflo> but its still gunna be rocky |
08:36:27 | FromDiscord | <Graveflo> I sound like a downer but good thing is a good thing. I'll have to see what people make of it |
09:05:29 | PMunch | Elegantbeef, well that's my concern. If all languages need a wasm compiler in order to be able to write plugins in them then that limits the amount of usable languages. As I mentioned dynamic libraries are so old that pretty much any language with interoperability supports it (for better or worse) |
09:08:10 | PMunch | My current idea is to write a dynamic library interface, and then have the wasm interface loaded as a dynamic library |
09:08:26 | PMunch | But maybe the other way around could work as well.. |
09:09:21 | * | junaid_ joined #nim |
09:34:42 | om3ga | wat's the thing with bytecode? Isn't native machine code better to use? |
09:35:41 | om3ga | or it needs to be used for portability? |
09:35:52 | FromDiscord | <Graveflo> depends what for. By extension the bytecode is running on the hardware. It's just a different way of doing things. Unusually for portability and high abstraction reasons |
09:36:30 | om3ga | not really, bytecode gets translated to machine code anyway, it is additional layer |
09:36:46 | om3ga | itself bytecode not executed by cpu |
09:36:53 | FromDiscord | <Graveflo> thats what im saying |
09:37:09 | om3ga | while that adds extra overhead |
09:37:57 | om3ga | I like the idea of llwm |
09:38:29 | om3ga | they doing it once, to get resulting native binary |
09:39:13 | om3ga | but I can't get why for example java don't has such functionality |
09:39:33 | om3ga | or python |
09:40:16 | FromDiscord | <Graveflo> its just complexity. It's too hard to turn that language into something that is running without the interpreter propping it up |
09:40:59 | om3ga | yeah, looks like that |
09:42:55 | FromDiscord | <Graveflo> thats one of the things that not everyone seems to appreciate about statically typed languages. I hear people sing praises about how it helps you right less buggy code, but the real reason is so the compiler can actually turn the code into machine language without requiring revolutionary compiler magic |
09:43:29 | FromDiscord | <Graveflo> static code analysis is only really good for the programmer in linting |
09:45:20 | om3ga | exactly, I also will add that if programmer does weird things in his code. Nothing will help to make it less buggy |
09:46:48 | FromDiscord | <Graveflo> sometimes the right way is the least wrong way LOL |
09:49:45 | om3ga | I saw once a loop, which asks os to give the programm some ram, so developer did verification of function return inside this `while` loop, so until the process will not get the ram, it will request kernel for some |
09:50:15 | om3ga | as result cpu core was haunted by that process |
09:51:26 | om3ga | if I'm not mistaken, nim has limit for the loop iterations by default. but :) how it will make developer not to do such constructions? |
09:51:42 | om3ga | he will disable limit and go home after work to play some games |
09:52:18 | FromDiscord | <Graveflo> solves that problem |
09:52:49 | om3ga | yeah, problem was with loop limit :) |
09:55:36 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "But maybe the other": Loading dynamic libraries from WASM? Don't think that'd work unless you provide an interface for it, which kinda ruins security, no? |
09:58:50 | PMunch | Hmm, true |
10:06:45 | FromDiscord | <jmgomez> did someone considered written a backend for it? |
10:11:41 | NimEventer | New thread by jmgomez: Constructors: from C++ with love , see https://forum.nim-lang.org/t/10253 |
10:12:42 | FromDiscord | <chmod222> Probably, but isn't this practically what Nims compilation model is perfect for? If you give it `emcc` instead of `gcc` as your compiler, you automagically get wasm |
10:15:21 | FromDiscord | <jmgomez> Not sure the delay that will add on top. Im using NimScript just because of none comp speed, but if you compile in two (or even three, not sure how that works) phases. It doesnt make much sense from a scripting lang point of view |
10:15:35 | FromDiscord | <jmgomez> (edit) "speed," => "times," |
10:22:54 | * | beholders_eye joined #nim |
10:27:56 | FromDiscord | <jmgomez> Having the backend will allow for a bridge at the wasm level between c Nim and the wasm backend while only needing to recompile Nim only |
10:28:43 | FromDiscord | <jmgomez> but NimScript + FFI still beats it though |
10:34:02 | FromDiscord | <Chronos [She/Her]> In reply to @jmgomez "did someone considered written": I mean, nlvm exists, emcc exists, and clang (which also uses LLVM ofc) can compile to WASM |
10:34:14 | * | derpydoo quit (Quit: derpydoo) |
10:34:37 | FromDiscord | <Chronos [She/Her]> Implementing a backend to something that's arguably only useful in a few environments and not available everywhere is wasteful |
10:35:06 | FromDiscord | <jmgomez> nlvm compiles to wasm in one pass? |
10:35:08 | FromDiscord | <Chronos [She/Her]> While C can do LLVM which has a multitude of backends and same with GCC too |
10:35:23 | FromDiscord | <Chronos [She/Her]> In reply to @jmgomez "nlvm compiles to wasm": No, it'd be using LLVM first but it's still more like what you'd want |
10:36:01 | FromDiscord | <jmgomez> In my mind a scripting lang doesnt have 3 comp passes |
10:36:07 | FromDiscord | <Chronos [She/Her]> I'd be all for a WASM backend personally, but I lack the motivation to work on it :p |
10:36:30 | FromDiscord | <Chronos [She/Her]> May end up trying during the summer, though |
10:36:42 | FromDiscord | <Chronos [She/Her]> Unless I finally get a job which will chip into my free time lol |
10:42:38 | FromDiscord | <Chronos [She/Her]> I wonder if it'd be worth writing the NimScript backend from scratch... Probably not but hm |
10:43:03 | FromDiscord | <jmgomez> It isnt a backend but a VM |
10:43:07 | FromDiscord | <Chronos [She/Her]> Cuz rn it has a lot of speed issues, no? |
10:43:24 | FromDiscord | <Chronos [She/Her]> In reply to @jmgomez "It isnt a backend": Yeah fair enough xD |
10:43:41 | FromDiscord | <Chronos [She/Her]> Doesn't it operate directly on the nodes instead of compiling to bytecode or something? |
10:44:03 | FromDiscord | <jmgomez> In reply to @Hourglass, When the Hour Strikes "Cuz rn it has": Yes, the FFI piece would improve it |
10:44:31 | FromDiscord | <Chronos [She/Her]> FFI piece? How would it improve performance? |
10:45:28 | FromDiscord | <jmgomez> because the real code, your code on the host, is native |
10:47:04 | FromDiscord | <Chronos [She/Her]> How is it done right now then? |
10:47:57 | FromDiscord | <jmgomez> you cant do `importc` |
10:51:31 | FromDiscord | <Chronos [She/Her]> That makes sense, no? Because how it works rn is literally compiling C code, would FFI compile it and link that to the program then? |
10:51:42 | FromDiscord | <Chronos [She/Her]> Not link but... You understand probably :p |
10:53:53 | FromDiscord | <jmgomez> AFAIK when enabling FFI symbols are hook when the VM is compiled similar of how magic works. I may be wrong though |
10:57:25 | FromDiscord | <chmod222> Tell that to the javascript crowd please, they need to understand thisβ΅(@jmgomez) |
10:57:43 | FromDiscord | <chmod222> Their build toolchains rival C++ |
10:57:46 | FromDiscord | <Chronos [She/Her]> In reply to @jmgomez "AFAIK when enabling FFI": Hm |
11:05:32 | * | beholders_eye quit (Ping timeout: 265 seconds) |
11:44:12 | * | beholders_eye joined #nim |
12:03:37 | * | beholders_eye quit (Ping timeout: 240 seconds) |
12:09:10 | * | PMunch_ joined #nim |
12:11:59 | om3ga | linter reports this: template/generic instantiation of `createThread` from here |
12:12:13 | * | PMunch quit (Ping timeout: 268 seconds) |
12:12:13 | om3ga | what it can be? |
12:12:35 | om3ga | while code works just fine :) |
12:14:54 | FromDiscord | <voidwalker> I'm trying to use this https://github.com/weskerfoot/NimPath - did nimble install url@#head, edited `config.nims` to include `switch("passL", "/usr/lib/libxml2.so")` like the readme say, pasted the test code into a new nim file in the project dir, but on compilation I get `/home/sgm/.nimble/pkgs/nimpath-#head/nimpath.nim(43, 29) Error: undeclared field: 'cstringToNim'` |
12:15:50 | FromDiscord | <Nerve> In reply to @chmod222 "Tell that to the": I never understood how JS toolchains could get so complicated or how quickly each component could get cycled out for some new hotness, there's something unique about the JS sphere that probably has to do with saturation of monoglots |
12:29:11 | * | ntat quit (Ping timeout: 256 seconds) |
12:30:09 | * | ntat joined #nim |
12:59:38 | NimEventer | New thread by ploxotnuj1: Tell me the library for windows to download files with a progress bar, see https://forum.nim-lang.org/t/10254 |
12:59:38 | FromDiscord | <seatartarus> sent a code paste, see https://play.nim-lang.org/#ix=4xGf |
13:00:59 | FromDiscord | <amadan> In reply to @voidwalker "I'm trying to use": Issue is their `cstringToNim` function is expecting `cstring` but get `ptr xmlchar` instead (Since that is what libxml uses). |
13:01:09 | FromDiscord | <amadan> (edit) "uses)." => "uses).β΅Got a fix here that works for me locally https://github.com/ire4ever1190/NimPath/tree/fix/type-mismatch" |
13:01:48 | FromDiscord | <voidwalker> weird, so they have a broken version pulled |
13:03:05 | FromDiscord | <amadan> Think so? iirc libxml has been using `xmlchar` for a while |
13:03:14 | FromDiscord | <voidwalker> I'm pulling my hairs here with html parsing, there's this document template that has some random embedded html in the middle of it, and sometimes nim's xmlparser gets skewed and parses them badly.. it's true that the html is probably far from being conformant, but better xml libs liike firefox's, have no trouble with it |
13:03:26 | FromDiscord | <mratsim> In reply to @seatartarus "Hello! I have started": use a template |
13:04:14 | FromDiscord | <amadan> In reply to @voidwalker "I'm pulling my hairs": yeah I wouldn't use the stdlib xml/html parser for anything in the wildβ΅It can break in a lot of cases |
13:04:25 | FromDiscord | <mratsim> In reply to @seatartarus "Hello! I have started": templates copy-paste whatever is inside. |
13:05:06 | FromDiscord | <voidwalker> @amadan what to use then ? https://nim-lang.org/docs/parsexml.html this one looks super tedious to use |
13:05:18 | FromDiscord | <seatartarus> In reply to @mratsim "templates copy-paste whatever is": Thank you! |
13:05:39 | FromDiscord | <voidwalker> i couldn't find any serious effort done in nim, so the only hope is to use some embedded external lib |
13:07:28 | FromDiscord | <amadan> I'd stick with that libxml2 library, you might need to fork if you need extra stuff though.β΅No clue what state ferus is in atm (https://github.com/xTrayambak/ferushtml) but it plans to be a spec compliant parser |
13:07:43 | * | oldpcuser quit (Ping timeout: 256 seconds) |
13:09:03 | FromDiscord | <voidwalker> yeah same old story with most nim libs, all are toy projects, anbandoned attempts, partially implemented specs, nobody uses it and you're lost if author is afk.. |
13:10:30 | FromDiscord | <mratsim> In reply to @voidwalker "yeah same old story": Well, come on, you picked xml |
13:10:49 | FromDiscord | <voidwalker> I didn't pick xml, I need to parse real html pages |
13:10:52 | FromDiscord | <voidwalker> "wild" ones : D |
13:11:45 | * | boxuser quit (Ping timeout: 250 seconds) |
13:12:57 | FromDiscord | <mratsim> In reply to @voidwalker ""wild" ones : D": Have fun with IE6 |
13:15:42 | * | beholders_eye joined #nim |
13:31:32 | * | rockcavera joined #nim |
13:32:08 | * | xet7 quit (Quit: Leaving) |
13:38:51 | * | boxuser joined #nim |
13:40:05 | * | beholders_eye quit (Ping timeout: 240 seconds) |
13:51:27 | * | beholders_eye joined #nim |
13:52:13 | FromDiscord | <Rika> https://www.html-tidy.org/ |
13:52:23 | FromDiscord | <Rika> use this to clean your html for parsing |
13:52:49 | FromDiscord | <Rika> @voidwalker |
13:52:56 | FromDiscord | <Rika> not sure if anyone has pointed you at this yet |
13:53:05 | FromDiscord | <voidwalker> it's 160.000 htmls actually |
13:53:56 | FromDiscord | <Rika> well it'd then be just another tool in the pipeline of parsing no |
13:54:40 | FromDiscord | <voidwalker> hmm no nim wrapper for it though |
13:55:02 | * | junaid_ quit (Remote host closed the connection) |
13:55:25 | FromDiscord | <Rika> prolly can quickly put it through futhark for now |
13:55:46 | FromDiscord | <voidwalker> I don't have a week to spend on that :\ |
13:55:47 | FromDiscord | <Rika> its unlikely youd need more than literally just the "please fix this up for me" function anyway π |
13:55:53 | FromDiscord | <spotlightkid> `execCmd`? |
13:56:05 | PMunch_ | voidwalker, why would you need a week to use Futhark? |
13:56:13 | FromDiscord | <voidwalker> Cause I am noob :\ |
13:56:25 | FromDiscord | <voidwalker> And have no idea what's going on there |
14:07:28 | PMunch_ | voidwalker, well here you go, saved you a week: http://ix.io/4xGI |
14:07:46 | PMunch_ | That is a working version of the example from here: https://www.html-tidy.org/developer/ |
14:08:26 | PMunch_ | Which takes that content string and creates a proper xhtml document out of it |
14:09:10 | PMunch_ | The only Futhark stuff is the first seven lines, the rest is just a rewrite of the code from their example |
14:09:41 | PMunch_ | You of course need to install libtidy for that to work. For me I just did `pacman -S tidy` and everything was good to go |
14:09:58 | PMunch_ | Then just `nim c -r` that snippet and you're off to the races |
14:10:03 | PMunch_ | But I've gotta run |
14:11:51 | * | PMunch_ quit (Quit: Leaving) |
14:15:09 | * | boxuser quit (Ping timeout: 256 seconds) |
14:19:15 | * | beholders_eye quit (Ping timeout: 268 seconds) |
14:26:47 | * | boxuser joined #nim |
14:42:47 | * | xet7 joined #nim |
14:50:16 | FromDiscord | <voidwalker> thank you @PMunch from IRC, managed to put it into a proc that returns string, now I have to find all the offsets again, see if that gets me anywhere. |
14:55:43 | * | oldpcuser joined #nim |
14:58:42 | NimEventer | New thread by grd: I want to write a professional website. Which PL should I choose from?, see https://forum.nim-lang.org/t/10255 |
15:04:31 | * | boxuser quit (Ping timeout: 240 seconds) |
15:06:51 | * | boxuser joined #nim |
15:09:54 | FromDiscord | <Chronos [She/Her]> Oh PMunch, 'solution' for allowing access to shared libraries in a WASM sandbox, maybe need explicit permission to load a .so? |
15:10:19 | FromDiscord | <Chronos [She/Her]> This means if it's a bad .so file, then you're fucked, but it's not implicit 'trust everything' |
15:10:26 | FromDiscord | <Chronos [She/Her]> Not ideal but something that may be good |
15:10:49 | FromDiscord | <Chronos [She/Her]> But then again, might as well use a dynamic library plugin system if you are gonna use shared libraries |
15:37:02 | * | eron joined #nim |
15:46:52 | * | eron quit (Quit: Client closed) |
15:50:40 | * | junaid_ joined #nim |
15:56:54 | * | beholders_eye joined #nim |
15:58:04 | NimEventer | New thread by mantielero: FMU library - seg fault, see https://forum.nim-lang.org/t/10256 |
16:03:24 | * | junaid_ quit (Remote host closed the connection) |
16:03:32 | FromDiscord | <tea> Hello ! I am a beginner in Nim and I wanted to know If there was a mixin statement in Nim ? It looks like there was one but it got removed (I can't find it on the docs page) |
16:03:53 | FromDiscord | <that_dude> I mean there is something called mixin. What do you need it to do? |
16:04:12 | FromDiscord | <that_dude> https://nim-lang.org/docs/manual.html#generics-mixin-statement |
16:06:09 | * | disso-peach joined #nim |
16:06:21 | FromDiscord | <tea> To be fair, I just remembered that I have seen the construct mixin somewhere but I was not able to find it back π
I just got curious x) |
16:06:39 | FromDiscord | <voidwalker> @PMunch much success, all looks good and error free after I adjusted the parsing params : ) |
16:22:58 | * | junaid_ joined #nim |
16:24:24 | FromDiscord | <voidwalker> spoke too soon, `Error: call depth limit reached in a debug build (2000 function calls). You can change it with -d:nimCallDepthLimit=<int> but really try to avoid deep recursions instead.` |
16:25:09 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xHd |
16:29:01 | FromDiscord | <voidwalker> well, fortunately not a htmlparser bug, just a html with too many lines/tags |
16:45:04 | FromDiscord | <jmgomez> did you try to increase the number? |
16:49:59 | * | ntat quit (Quit: Leaving) |
16:50:15 | FromDiscord | <voidwalker> yes, works with 20.000 |
16:51:37 | FromDiscord | <voidwalker> Is there any way to check if an xmlNode referenced as `x[0][6][9]` etc is nil/valid or not ? |
17:00:12 | FromDiscord | <auxym> In reply to @voidwalker "Is there any way": isNil will check if the ref is nil, but using numerical indices like this should never return a nil node, it will raise an exception if the index is too high |
17:00:57 | FromDiscord | <voidwalker> that's what it does, but anyway bad idea to do that, I will just have to try some better html parsing strategy when I have time, maybe with that xmlib/xpath library |
17:01:42 | FromDiscord | <voidwalker> What would work is some kind of "reverse" xml parser, since the random/variable content in the middle skews it up |
17:10:07 | FromDiscord | <auxym> In reply to @voidwalker "that's what it does,": if you're doing html there's a new html parser library that publicized in the recent this month is nim: https://github.com/xTrayambak/ferushtml maybe you could give that a try |
17:10:49 | * | ntat joined #nim |
17:11:25 | FromDiscord | <auxym> other for xml in nim I usually use child and findAll to traverse the tree and find the node I want |
17:12:03 | FromDiscord | <auxym> in python/c# I tend to use xpath more |
17:12:11 | FromDiscord | <voidwalker> doesn't look too sofisticated yet, and the test example is super basic. I need something browser grade |
17:12:47 | FromDiscord | <auxym> that probably means using a browser TBH π |
17:13:29 | FromDiscord | <voidwalker> I really wish there was more effort to have good xml library integrated |
17:14:35 | FromDiscord | <Graveflo> In reply to @voidwalker "doesn't look too sofisticated": at this point I would suggest you either write your own algorithm that uses land marking or just process all the html files using python's `BeautifulSoup`package. If you really wanna use nim past that then have the python script just pre-process the data and write your nim program to pick up from there |
17:16:16 | * | beholders_eye quit (Ping timeout: 248 seconds) |
17:16:20 | FromDiscord | <voidwalker> I got pretty far using the html tidy suggestion, only 5-6 fails so far, out of a few thousand. But I mean we shouldn't have to rely on calling python code to achieve the job, we should have the tools in nim, |
17:16:48 | FromDiscord | <voidwalker> Like this is the only xpath/libxml attempt for nim: https://github.com/weskerfoot/NimPath |
17:16:53 | FromDiscord | <voidwalker> 1 star (by me) |
17:16:59 | FromDiscord | <Graveflo> I agree but someone has to build them. If you aren't willing for that to be you then you are the type of person that might have to rely on other langs |
17:17:26 | FromDiscord | <voidwalker> well, just wrap them, not build them |
17:20:37 | FromDiscord | <spotlightkid> Wrappers have to be built too. |
17:43:19 | * | xet7 quit (Quit: Leaving) |
17:49:55 | NimEventer | New question by pietroppeter: How to print Nim's AST at runtime?, see https://stackoverflow.com/questions/76425870/how-to-print-nims-ast-at-runtime |
18:04:31 | ntat | Is there such a thing as rules PEP8 for Python, but for Nim? |
18:05:24 | FromDiscord | <Kermithos> In reply to @ntat "Is there such a": https://nim-lang.org/docs/nep1.html |
18:06:51 | ntat | <Kermithos> thanks :) |
18:19:08 | * | boxuser quit (Ping timeout: 240 seconds) |
18:31:50 | * | rockcavera quit (Read error: Connection reset by peer) |
18:31:59 | * | tiorock joined #nim |
18:31:59 | * | tiorock quit (Changing host) |
18:31:59 | * | tiorock joined #nim |
18:31:59 | * | tiorock is now known as rockcavera |
18:37:17 | * | krux02_ joined #nim |
19:01:35 | * | disso-peach quit (Quit: Leaving) |
19:16:09 | ehmry | what are the opinions on proc argument ordering? I've been doing widest types first |
19:16:42 | ehmry | and something about lifetime to break ties |
19:25:01 | FromDiscord | <Graveflo> typically if there is a natural procedural direction of the arguments you put them in that order. Also the first argument can be used for "method call syntax" so keep that in mind. Lastly, the last argument can be expanded to varargs without breaking code compat so maybe there is an ever so slight reason to be choosey about that position |
19:26:59 | FromDiscord | <Graveflo> another thing is if there are other functions that use a particular order and you are wiring code near or cooperative with those procs then you probably want to keep the names similar and the ordering bunched in the same way to make it easier to read |
19:27:28 | FromDiscord | <Graveflo> (edit) "wiring" => "writing" |
19:30:10 | * | junaid_ quit (Remote host closed the connection) |
19:33:24 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xHV |
19:38:50 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xHX |
19:43:16 | FromDiscord | <emanresu3> btw do you know if nim has required named parameters, or required positional parameters? Like in python you can separate them with '\' and '/' |
19:44:47 | FromDiscord | <Graveflo> all parameters are reqired in nim. You can set defaults though |
19:45:41 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xHY |
19:46:42 | FromDiscord | <Arathanis> they are referring to how in Python you can make arguments positional only, position or keyword, or keyword only |
19:47:06 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xHZ |
19:49:22 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4xI0 |
19:49:33 | FromDiscord | <etra> (edit) "https://play.nim-lang.org/#ix=4xI0" => "https://play.nim-lang.org/#ix=4xI1" |
19:50:01 | FromDiscord | <emanresu3> yeah this, I saw it got reject a few years ago https://github.com/nim-lang/Nim/issues/8306β΅(@Arathanis) |
19:52:54 | FromDiscord | <Arathanis> In reply to @etra "huh, I have a": makes sense, `winim` defines it as an `int` so that you can make calls using nim types without using something like `cuint` while Windows.h will define it using the actual C type. |
19:53:10 | FromDiscord | <Arathanis> `NI` is "Nim Int" in the cross compiled code. |
19:53:22 | FromDiscord | <etra> I tried with `pointer` but it complains because void has to be casted, too |
19:53:29 | FromDiscord | <etra> (i'm using vcc + cpp) |
19:53:39 | FromDiscord | <guttural666> don't think default values for object fields are in Nim yet right? think this was a thing in 2.0 |
19:53:51 | FromDiscord | <Arathanis> In reply to @guttural666 "don't think default values": that is my understanding, yes |
19:54:20 | FromDiscord | <Arathanis> though with current conventions its kind of a non-issue? |
19:54:31 | FromDiscord | <guttural666> aight, gonna initThing then |
19:54:44 | FromDiscord | <Arathanis> yeah that is the current convention for value type initialization |
19:55:01 | FromDiscord | <Arathanis> `newThing` for ref types |
19:56:01 | FromDiscord | <etra> In reply to @Arathanis "`NI` is "Nim Int"": yeah I can see that. Is there anyway I can force in a reinterpret_cast |
19:56:03 | FromDiscord | <etra> (edit) "reinterpret_cast" => "reinterpret_cast?" |
19:56:43 | FromDiscord | <Arathanis> In reply to @etra "yeah I can see": I do not know. |
19:56:59 | FromDiscord | <guttural666> In reply to @Arathanis "`newThing` for ref types": newThing to return ref types and initThing to return a value? is that the convention? |
19:57:03 | FromDiscord | <etra> considering types differ between winim and `Windows.h`... |
19:57:06 | FromDiscord | <Arathanis> you might be able to split the declarations between modules and have them be defined differenting |
19:57:09 | FromDiscord | <Arathanis> In reply to @guttural666 "newThing to return ref": yes |
19:57:15 | FromDiscord | <guttural666> awesome thanks |
19:57:17 | FromDiscord | <Arathanis> n |
19:57:19 | FromDiscord | <Arathanis> (edit) "n" => "npp" |
19:57:20 | FromDiscord | <Arathanis> (edit) "npp" => "np" |
19:58:11 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xI3 |
19:58:23 | FromDiscord | <guttural666> In reply to @Arathanis "<@375727321958580228> just for posterity": got it got it, thanks! |
19:58:58 | FromDiscord | <Arathanis> (edit) "differenting" => "differently" |
20:11:15 | * | rockcavera quit (Remote host closed the connection) |
20:13:12 | * | junaid_ joined #nim |
20:27:37 | * | rockcavera joined #nim |
20:38:03 | * | ntat quit (Quit: Leaving) |
20:46:54 | FromDiscord | <fabricio> In reply to @Arathanis "<@375727321958580228> just for posterity": huh I thought it was still `new(result)` |
20:50:46 | FromDiscord | <Elegantbeef> `new T` returns a value `new result` allocates to a variable |
20:50:48 | FromDiscord | <Elegantbeef> They're the same thing |
20:52:31 | FromDiscord | <etra> sent a code paste, see https://play.nim-lang.org/#ix=4xI9 |
20:53:03 | FromDiscord | <frobnicate> Is there a one-liner for turning an iteratur into a seq? |
20:53:17 | ehmry | sequtils.toSeq ? |
20:54:23 | FromDiscord | <frobnicate> Yeah I'm stupid, thanks |
20:55:49 | * | junaid_ quit (Remote host closed the connection) |
20:56:10 | * | azimut joined #nim |
20:56:30 | ehmry | np |
21:04:55 | FromDiscord | <guttural666> is there a compile time way to print the current proc I'm in? |
21:05:12 | FromDiscord | <guttural666> (edit) "compile" => "run" |
21:05:38 | FromDiscord | <guttural666> think I've seen this before importing some C macros etc. |
21:06:26 | FromDiscord | <guttural666> (edit) "is there a ... run" added "compile time way to determine and then" | removed "to" |
21:07:01 | FromDiscord | <guttural666> import FUNC_PRETTY or what's it called in C++ |
21:07:30 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xIb |
21:07:30 | FromDiscord | <Elegantbeef> Why import C/C++ code when we have Nim code? |
21:11:19 | FromDiscord | <mratsim> In reply to @guttural666 "is there a compile": Not really directly but maybe you can subvert instantiationInfo or look into nim profiler how they collect stacktraces |
21:12:01 | FromDiscord | <mratsim> Ah @ElegantBeef trick is interesting |
21:12:09 | Amun-Ra | I'm using a slight variation, https://play.nim-lang.org/#ix=4xIf |
21:12:19 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=4xIg |
21:12:37 | FromDiscord | <Elegantbeef> Don't go disrobing yourself for basic macros |
21:13:59 | FromDiscord | <Elegantbeef> I atleast imagine that any good C/C++ compiler will not generate code for that `uint8` |
21:16:10 | FromDiscord | <Elegantbeef> This does make me wonder, are there any compiler explorers like godbolt but ran locally |
21:16:41 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xIh |
21:18:12 | FromDiscord | <Andreas> In reply to @Elegantbeef "This does make me": can on add the module-info, too ? |
21:18:53 | FromDiscord | <Elegantbeef> graveflo this isnt that resolveable |
21:18:57 | FromDiscord | <Andreas> (edit) "on" => "one" |
21:19:00 | FromDiscord | <Elegantbeef> Use `%` if you want to use the constant |
21:19:44 | FromDiscord | <Elegantbeef> https://wandbox.org/per2link/9IFpyA0pLOuWMzDe |
21:19:47 | FromDiscord | <Elegantbeef> andreas what do you mean? |
21:21:16 | FromDiscord | <Andreas> In reply to @Elegantbeef "andreas what do you": the `procName`-macro gives me the current proc. For dbg-logging it would be nice to echo the current-module.. |
21:21:24 | Amun-Ra | Andreas: https://play.nim-lang.org/#ix=4xIj |
21:22:06 | FromDiscord | <Andreas> In reply to @Amun-Ra "<@754284517316886598>: https://play.nim-lang.org/#i": got-me.. sweeeeet thx |
21:22:46 | FromDiscord | <Graveflo> In reply to @Elegantbeef "https://wandbox.org/per2link/9IFpyA0pLOuWMzDe": that 404s btw. idk what you posted it for |
21:23:56 | FromDiscord | <Elegantbeef> To show using `%` |
21:42:26 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xIp |
21:45:36 | FromDiscord | <Elegantbeef> They're both generics |
21:45:47 | FromDiscord | <Elegantbeef> `MyGenericObj` is a generic typeclass `object` is also a generic typeclass |
21:46:51 | FromDiscord | <Graveflo> but if I have something that is a concrete type from `MyGenericObj` how does `T: object` match just as well as `T: MyGenericObj` |
21:47:04 | FromDiscord | <Elegantbeef> Cause both are generic tpye classes |
21:47:35 | FromDiscord | <Elegantbeef> `MyGenericObj` is really `[Y; T: MyGenericObj[Y]]` and which is no more precise than `object` |
21:47:51 | FromDiscord | <Graveflo> but `MyGenericObj[T]` isn't because at the time that `test_proc` is instantiated `T` is concrete? |
21:48:10 | FromDiscord | <Elegantbeef> But to instantiate you have to chose a proc |
21:48:24 | FromDiscord | <Elegantbeef> How do you choose a proc if both are the same match level |
21:49:11 | FromDiscord | <Elegantbeef> `v: MyGeneric[T]` is different cause it's an instantiated generic so if the type matches it's more accurate than the `object` variation |
21:51:42 | FromDiscord | <Graveflo> I guess if you only think of it on one level it makes sense. It at least makes sense how T resolves to a concrete type when it's matching for `MyGenericObj`s generic. Still its odd to me that a concrete type of say `MyGenericObj[int]` will match just as well against `object` as it will `MyGenericObj` |
21:52:27 | FromDiscord | <Graveflo> but if thats how it works that's fine. I just didn't know what matching is only strong against concrete types |
21:54:13 | FromDiscord | <Graveflo> I would also find it surprising if it had to be this way. It makes valid looking code not work because of a strange detail |
22:05:34 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xIv |
22:15:53 | FromDiscord | <Elegantbeef> What? |
22:17:17 | FromDiscord | <Graveflo> if they were on the same level of specificity then they should bind the same. The compiler knows now to bind `s` to `T` when `T` is `MyGenericObj[Y]` but it will bind to `object`. They are different |
22:22:09 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xIE |
22:29:31 | FromDiscord | <Graveflo> like if `MyGenericObj[int]` matches to `object` and `Something` (alias for object) doesn't match `MyGenericObj` then you can say that `MyGenericObj` is more specific then `object`. The compiler says they are on the same level of specificity in the second example |
22:30:23 | FromDiscord | <Graveflo> and they both match |
22:32:32 | FromDiscord | <michaelb.eth> why is it that an instance of `object of RootObj` cannot be `const`? |
22:33:37 | FromDiscord | <Elegantbeef> Compiler is silly about inheritance |
22:34:28 | FromDiscord | <michaelb.eth> hmm |
22:34:28 | FromDiscord | <demotomohiro> It requires RTTI but Nim's VM cannot handle RTTI? |
22:36:50 | * | boxuser joined #nim |
22:45:31 | FromDiscord | <guttural666> oh, the sweet sweet RTTI that everybody covets but nobody can have easily |
22:47:30 | FromDiscord | <guttural666> ABAP has RTTI capabilities by design in btw, you should all look at ABAP, great career opportunities as well |
22:47:36 | FromDiscord | <Elegantbeef> Lol |
22:47:44 | FromDiscord | <guttural666> π€£ |
22:48:03 | FromDiscord | <guttural666> (edit) removed "in" |
22:48:35 | FromDiscord | <Andreas> is it possible to get back the size of a allocation from the allocator ? Sure i know the size since i used it with `createShared`, but is it later on possible to request the size of the chunk ? |
22:49:23 | * | boxuser quit (Ping timeout: 250 seconds) |
22:49:50 | FromDiscord | <Elegantbeef> Not without doing lowlevel hacks looking at the allocator you're using |
22:50:02 | FromDiscord | <Elegantbeef> with `-d:useMalloc` might be easier |
22:55:31 | FromDiscord | <Andreas> In reply to @Elegantbeef "with `-d:useMalloc` might be": i use `d:useMalloc` all the time.. but one more thing - when i have a object that contains a field `ptr chunk` which has been allocated via `createShared` and the ARC/ORC-twins see it, then they should not free that field ? should'nt they ? |
23:01:56 | FromDiscord | <Elegantbeef> `ptr` is umanaged |
23:02:29 | FromDiscord | <Elegantbeef> unmanaged\ |
23:02:58 | FromDiscord | <Elegantbeef> The pointer itself will be freed automatically of course but the data it points to is on you to free |
23:05:51 | FromDiscord | <Andreas> In reply to @Elegantbeef "`ptr` is umanaged": yes, thats what i assumed, but what about a `ptr smth-self-alloced` inside a object that ARC/ORC dispose ? I expected to see a error when i don't free the `ptr smth`, after the object went thru `=destroy`, but instead i got a double-free-error from `leaks`, which is my alternative to `valgrind`.. |
23:07:09 | FromDiscord | <Andreas> (edit) "`valgrind`.." => "`valgrind`..β΅so in my `free()`-proc i care for the case that `=destroy` happened before and then don't `deallocateShared on ptr smth`" |
23:07:46 | FromDiscord | <Elegantbeef> If you're sharing memory across threads you need to lock and or use the new `atomicArc` |
23:08:37 | FromDiscord | <Andreas> In reply to @Elegantbeef "If you're sharing memory": wait a sec - i'll do mini-example in the playground,, |
23:13:59 | FromDiscord | <sOkam!> Is there any `file.getExtension` or similar? cant seem to find one with a search |
23:14:35 | FromDiscord | <Graveflo> `splitFile` in `os` |
23:14:56 | FromDiscord | <sOkam!> i guess i could make a template for splitfile, true |
23:15:03 | FromDiscord | <Graveflo> or just `find` lol |
23:15:59 | FromDiscord | <Graveflo> is `file` special in nim for something? |
23:17:33 | FromDiscord | <sOkam!> not in stable. in devel they are `Path`s, but they are essentially just strings in the bg |
23:18:07 | FromDiscord | <Graveflo> oh nice I was wondering if that would be a thing. Other langs have that and it's helpful |
23:20:04 | FromDiscord | <frobnicate> sent a code paste, see https://play.nim-lang.org/#ix=4xIM |
23:20:40 | FromDiscord | <sOkam!> @frobnicate `untyped` in a template or macro |
23:21:34 | FromDiscord | <Graveflo> yea so `proc` -> `template` , `?` -> `untyped` |
23:22:21 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xIO |
23:22:38 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4xIO" => "https://play.nim-lang.org/#ix=4xIP" |
23:22:39 | FromDiscord | <Graveflo> In reply to @Graveflo "yea so `proc` ->": and you might want to return `untyped` too like `:untyped` |
23:23:24 | FromDiscord | <frobnicate> I seeeeeeee |
23:24:49 | FromDiscord | <frobnicate> thanks a bunch |
23:28:07 | * | cnx quit (Remote host closed the connection) |
23:39:37 | * | cnx joined #nim |
23:59:06 | FromDiscord | <Chronos [She/Her]> Oh yeah PMunch, whenever you can, could you show me an example of your plugin system? Especially if you go the WASM route |