00:40:05 | * | krux02 quit (Remote host closed the connection) |
00:59:47 | * | abm quit (Ping timeout: 248 seconds) |
01:11:14 | * | MyMind joined #nim |
01:14:37 | * | gearshift quit (Read error: Connection reset by peer) |
02:16:54 | FromGitter | <awr1> @mratsim where is the video version of that presentation if you don't mind me asking? |
02:18:04 | FromGitter | <awr1> nvm scrolled up |
02:20:21 | FromGitter | <awr1> @zacharycarter there needs to be a new directx binding library |
02:20:35 | FromGitter | <awr1> one with less lpVtbl verbosity |
02:26:31 | FromGitter | <awr1> i may end up doing one after i publish this vulkan library for nim. i'm kind of using it as an excuse to re-read the vk spec |
02:41:33 | * | laaron joined #nim |
02:54:35 | FromGitter | <kayabaNerve> I'm surprised you can do a direct cast. I would've thought you had to do addr ref[] |
03:04:11 | * | laaron quit (Remote host closed the connection) |
03:06:57 | * | laaron joined #nim |
03:14:13 | FromGitter | <devcat> Can object field have multiple types? |
03:27:13 | * | dddddd quit (Remote host closed the connection) |
03:31:45 | * | laaron quit (Remote host closed the connection) |
03:35:19 | * | laaron joined #nim |
03:35:37 | FromDiscord_ | <treeform> devcat, you can do this with case objects I think. I would not recommend it though. |
03:35:52 | FromDiscord_ | <treeform> why do you think you need multiple types on a field? |
03:36:30 | FromDiscord_ | <treeform> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
03:59:08 | * | laaron- joined #nim |
03:59:32 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
04:07:13 | * | a_chou joined #nim |
04:13:02 | * | a_chou quit (Quit: a_chou) |
04:15:35 | * | fjellfras joined #nim |
04:30:16 | FromGitter | <zacharycarter> awr1: that'd be nice but for now this is what we have I suppose :P |
04:31:51 | FromGitter | <zacharycarter> if you make one though - I'd gladly use it :) |
04:35:11 | * | snifftek joined #nim |
04:35:28 | * | nsf joined #nim |
04:53:57 | FromGitter | <zacharycarter> https://github.com/zacharycarter/directnimrod - should work with 0.20.2 now |
05:19:58 | * | revere quit (Ping timeout: 246 seconds) |
05:21:14 | * | altarrel_ joined #nim |
05:21:21 | * | altarrel quit (Ping timeout: 250 seconds) |
05:21:22 | * | jmiven quit (Ping timeout: 246 seconds) |
05:21:22 | * | tribly quit (Ping timeout: 246 seconds) |
05:21:43 | * | xace quit (Ping timeout: 246 seconds) |
05:22:42 | * | xace joined #nim |
05:24:56 | * | revere joined #nim |
05:31:22 | * | fjellfras quit (Ping timeout: 268 seconds) |
05:32:10 | * | fjellfras joined #nim |
05:33:24 | * | jmiven joined #nim |
05:35:09 | * | tribly joined #nim |
05:42:59 | * | solitudesf joined #nim |
05:45:31 | * | fjellfras quit (Ping timeout: 246 seconds) |
06:06:34 | * | laaron- quit (Quit: ZNC 1.7.1 - https://znc.in) |
06:07:33 | * | laaron joined #nim |
06:24:36 | * | Cthalupa quit (Ping timeout: 244 seconds) |
06:28:51 | * | fjellfras joined #nim |
06:32:02 | * | Trustable joined #nim |
06:33:41 | * | Trustable quit (Remote host closed the connection) |
06:34:35 | FromGitter | <kayabaNerve> So. Weird thing about Tables. |
06:35:01 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d4136949a02440b032dec14] |
06:35:18 | FromGitter | <kayabaNerve> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d4136a6b0bf183ea371ef21] |
06:35:30 | FromGitter | <kayabaNerve> The two table sets are saying they may throw Exceptions. |
06:37:16 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ This compiles fine. [https://gitter.im/nim-lang/Nim?at=5d41371c9a02440b032def90] |
06:38:30 | * | nif quit (Quit: ...) |
06:38:40 | * | nif_ joined #nim |
06:39:25 | FromGitter | <kayabaNerve> The specific location is char 51, which is `rpc.rpc[key]` (`[`), yet I discard it just fine two lines up. |
06:40:17 | FromGitter | <kayabaNerve> TL;DR Can discard value but getting the value to set it in another table risks an Exception. |
06:42:27 | * | nif_ quit (Client Quit) |
06:42:36 | * | nif joined #nim |
06:44:07 | FromGitter | <zacharycarter> anyone know how to handle `class##` in a C preprocessor macro that has `class` as a parameter |
06:44:18 | FromGitter | <zacharycarter> like `class##_Release |
06:44:32 | FromGitter | <zacharycarter> `template zappSafeRelease(class, obj: untyped) =` |
06:44:43 | FromGitter | <zacharycarter> I tried using backticks but that didn't work |
06:46:58 | * | dyske joined #nim |
06:48:26 | * | sagax quit (Remote host closed the connection) |
06:48:35 | * | laaron quit (Remote host closed the connection) |
06:48:57 | FromGitter | <zacharycarter> never mind - I don't need to do that anyway |
06:49:02 | FromGitter | <Riderfighter> Hello everyone! |
06:51:38 | FromGitter | <zacharycarter> hello |
06:52:00 | FromGitter | <zacharycarter> cool - have a d3d11 swapchain working now in the zapp code I posted last night |
06:52:32 | * | laaron joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:05:04 | * | gmpreussner joined #nim |
07:09:25 | FromGitter | <zacharycarter> https://github.com/zacharycarter/z |
07:09:47 | FromGitter | <alehander42> ok, i dont get |
07:10:19 | FromGitter | <alehander42> if i want to await a future but ignore its result |
07:10:19 | FromGitter | <zacharycarter> don't get what? |
07:10:27 | FromGitter | <alehander42> what exactly should i use |
07:10:37 | FromGitter | <alehander42> discard await is *forbidden* by docs |
07:10:59 | FromGitter | <alehander42> but asyncCheck doesnt actually wait afaik |
07:11:09 | FromGitter | <zacharycarter> that's correct according to - https://nim-lang.org/docs/asyncdispatch.html#discarding-futures |
07:11:20 | FromGitter | <alehander42> so in this case it is written "and you should use ⏎ ⏎ ##``waitFor`` for that purpose" |
07:11:32 | FromGitter | <zacharycarter> and that doesn't work? |
07:11:40 | FromGitter | <alehander42> but i thought i should only use that in sync function |
07:12:06 | FromGitter | <zacharycarter> yes - but the function you're waiting for is async |
07:12:08 | FromGitter | <alehander42> even we talked yesterday about making waitFor in async a compile error |
07:12:22 | FromGitter | <alehander42> so surely waitFor is also not a solution |
07:13:02 | FromGitter | <zacharycarter> well yeah - you wouldn't use it in an async proc but you'd use it for instance in a sync proc calling an async proc |
07:13:14 | FromGitter | <zacharycarter> I think anyway |
07:13:43 | FromGitter | <alehander42> yes exactly |
07:13:47 | FromGitter | <alehander42> but in the docs |
07:13:52 | FromGitter | <alehander42> its recommended to actually use it |
07:13:56 | FromGitter | <alehander42> instead of asyncCheck |
07:13:57 | FromGitter | <zacharycarter> https://github.com/dom96/jester/blob/master/tests/tester.nim#L61 |
07:14:00 | FromGitter | <alehander42> if i want to wait for completion |
07:14:39 | FromGitter | <alehander42> e.g. asyncCheck: " \## This should be used instead of ``discard`` to discard void futures, ⏎ \## or use ``waitFor`` if you need to wait for the future's completion. ⏎ " |
07:14:45 | FromGitter | <alehander42> @dom96 |
07:14:57 | FromGitter | <alehander42> do you have an idea what am i missing |
07:15:11 | FromGitter | <alehander42> @zacharycarter yeah this makes sense and thats what i thought should be right usage |
07:16:26 | FromGitter | <Riderfighter> guys new top download speed! https://dsh.re/c8726 |
07:20:07 | FromGitter | <Riderfighter> when naming types how do you guys usually name them? Do you capitalize them or leave them lowercase? |
07:20:50 | FromGitter | <alehander42> oh bad speed! |
07:20:56 | FromGitter | <alehander42> capitalize them always |
07:21:35 | FromGitter | <alehander42> https://nim-lang.org/docs/nep1.html#introduction-naming-conventions |
07:25:48 | FromGitter | <Riderfighter> ah ok welp |
07:25:54 | FromGitter | <Riderfighter> time to capitalize a few types |
07:26:16 | FromGitter | <alehander42> doesnt styleCheck support autofixing ? nari |
07:26:22 | FromGitter | <alehander42> hm our core team is on vacation |
07:26:24 | FromGitter | <alehander42> i think |
07:26:42 | FromGitter | <alehander42> @krux02 are there any autofix options in the linter/nimpretty code? |
07:36:54 | FromGitter | <Riderfighter> I have a question about nimpretty, where is it located specifically? |
07:37:15 | FromGitter | <Riderfighter> i remember vscode complaining it wasn't in my PATH so I wanted to add it but I have no clue where it is |
07:37:49 | FromGitter | <alehander42> i guess tools/ |
07:38:01 | FromGitter | <alehander42> sorry bin/ |
07:38:07 | FromGitter | <alehander42> you need to build it with koch tools |
07:38:08 | FromGitter | <alehander42> i guess |
07:38:32 | FromGitter | <Riderfighter> is it not built when choosenim gets/builds nim itself? |
07:38:39 | FromGitter | <alehander42> i am not sure about your install , but you can build koch in the main nim folder |
07:38:44 | FromGitter | <alehander42> no idea sorry |
07:38:47 | FromGitter | <Riderfighter> rip |
07:38:54 | FromGitter | <Riderfighter> its ok, time to do some invertigating |
07:42:27 | * | onionhammer1 quit (Ping timeout: 248 seconds) |
07:42:45 | FromGitter | <Riderfighter> found nimble haha |
07:44:03 | FromGitter | <Riderfighter> alrighty its time to find out how to build nimpretty |
07:46:12 | * | onionhammer1 joined #nim |
07:47:52 | FromGitter | <zacharycarter> should just be changing to the active toolchain directory and running ./koch tools |
07:49:28 | FromGitter | <Riderfighter> Ok so in theory it should be built but I have no idea where it just built to though :L |
07:49:54 | FromGitter | <zacharycarter> probably in the bin directory of the active toolchain |
07:50:32 | FromGitter | <zacharycarter> I guess it's time to start on the gfx module now |
07:50:57 | FromGitter | <alehander42> yeah it should be in nim/bin ;P |
07:51:12 | FromGitter | <Riderfighter> @zacharycarter yeah you were right :P gosh i'm such a noob when it comes to this |
07:51:28 | FromGitter | <zacharycarter> haha - no worries - we were all noobs at one point |
07:51:51 | FromGitter | <zacharycarter> I think this is year 3, maybe even 4 for me using Nim, so I've had some time to learn :) |
07:52:18 | FromGitter | <alehander42> a true veteran |
07:52:32 | * | onionhammer1 quit (Ping timeout: 245 seconds) |
07:52:57 | FromGitter | <Riderfighter> This is probably uhm year 1 ? I've been learning |
07:53:54 | FromGitter | <zacharycarter> heh well - I've also taken long breaks and abandoned almost every project I've started :P but at least I can help in some way by answering questions |
07:54:06 | FromGitter | <Riderfighter> I started learning for real about 7 months ago so not exactly a year |
07:54:16 | FromGitter | <zacharycarter> hopefully the modules I'm making for windowing / input and graphics abstraction will help someone out |
07:54:26 | FromGitter | <zacharycarter> cool! never too late to join the party :D |
07:55:11 | * | onionhammer1 joined #nim |
07:56:12 | FromGitter | <Riderfighter> I know right! I'm having a blast learning, plus people actually respond to my questions here which is really an added bonus, when I first started learning Python people were much less prone to answering a question |
07:56:56 | FromGitter | <zacharycarter> it's a fun language to learn IMO - glad you're finding that to be the case as well :) yeah we have a small but very active and helpful community I think |
07:59:54 | FromGitter | <Riderfighter> I think its a great language to learn coming from a few others, but when you start from Python and other languages where you don't really care about pointers the learning curve is basically a cliff, but it was this channel that helped me understand how to do it right |
08:02:24 | FromGitter | <zacharycarter> ah yeah - I was lucky enough to have some C/C++ knowledge, but Nim helped me improve that knowledge by quite a bit, and I still learn new things every time I write Nim code |
08:02:58 | FromGitter | <Riderfighter> This wiki helped me a lot, https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers, I read that and the tutorial for Nim before attempting to write code |
08:07:06 | FromGitter | <zacharycarter> yeah that's not a bad tutorial at all |
08:10:23 | FromGitter | <Riderfighter> gosh guys I feel so advanced right now, the way i've structured my project makes it so that I can separate incoming/outgoing packet types and data types into their own files for clarity |
08:16:44 | * | onionhammer1 quit (Read error: Connection timed out) |
08:17:08 | * | onionhammer1 joined #nim |
08:17:20 | livcd | this chan is also unusually active and that's a big plus imho |
08:19:25 | FromGitter | <alehander42> good for ya , good structure is cool |
08:20:26 | FromGitter | <Riderfighter> livcd: even if no one talked here I probably would talk in here anyways lmaooo |
08:22:28 | * | abm joined #nim |
08:24:36 | * | ng0 joined #nim |
08:30:58 | * | krux02 joined #nim |
08:40:09 | FromGitter | <Riderfighter> For NESM if I have a field that is a `seq[string]` and since both a seq and a string are both dynamic types how would one set the prefixed length of each from uint32 to int16 |
08:40:25 | FromGitter | <Riderfighter> this is too nested for my feeble mind |
08:44:31 | * | mheinz joined #nim |
08:47:48 | * | mheinz left #nim (#nim) |
08:56:19 | FromGitter | <kayabaNerve> Oh. Fun. |
08:56:24 | FromGitter | <kayabaNerve> I crashed the compiler. |
08:56:27 | FromGitter | <kayabaNerve> `Error: internal error: yield in expr not lowered` |
08:56:36 | FromGitter | <kayabaNerve> I have no idea what this means or what caused it. |
08:57:20 | * | Cthalupa joined #nim |
09:00:32 | FromGitter | <alehander42> you use a closure iterator and a `yield` inside? |
09:01:04 | * | sagax joined #nim |
09:02:04 | FromGitter | <alehander42> in a .. strange place (?), so the compiler couldn't remove it while transforming the closure |
09:02:35 | FromGitter | <kayabaNerve> I don't have any iterators, and this wasn't a closure function. |
09:02:38 | FromGitter | <kayabaNerve> It's relevant to async. |
09:02:48 | FromGitter | <alehander42> well it has a lot of closure iterators inside |
09:02:49 | FromGitter | <alehander42> afaik |
09:03:01 | FromGitter | <alehander42> do you have the code that |
09:03:05 | FromGitter | <alehander42> led to it |
09:03:05 | FromGitter | <kayabaNerve> I had a ref JSONNode and that combined with async... |
09:03:18 | FromGitter | <kayabaNerve> Uhhh a few ctrl + z away, as part of a huge project |
09:03:19 | * | Vladar joined #nim |
09:03:34 | FromGitter | <alehander42> but whats the diff |
09:03:37 | FromGitter | <alehander42> which errors |
09:05:24 | FromGitter | <kayabaNerve> 1) Get this commit. ⏎ 2) Open src/Interfaces/RPC/RPC.nim. ⏎ 3) Enter this start function. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d4159d445775115b370f4cc] |
09:05:56 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ Specifically, although I don't know how minimal I could make it. [https://gitter.im/nim-lang/Nim?at=5d4159f45367476cc983fd09] |
09:08:24 | FromGitter | <alehander42> hm, so this json + try snippet |
09:08:30 | FromGitter | <alehander42> is the only diff |
09:09:52 | FromGitter | <kayabaNerve> It's the immediate ref JSON -> JSON OR ref JSON -> ref JSON and then ref JSON -> JSON |
09:11:08 | * | floppydh joined #nim |
09:12:06 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ Successfully triggers a compile time assert, yet not a full crash. [https://gitter.im/nim-lang/Nim?at=5d415b655a72fc7ba4cc14a0] |
09:13:07 | * | alexander92 quit (Ping timeout: 248 seconds) |
09:13:16 | * | vlad1777d joined #nim |
09:13:41 | FromGitter | <kayabaNerve> Here's the full error when using koch temp: https://pastebin.com/QSdV0BVA |
09:14:12 | FromGitter | <kayabaNerve> Anyways. I don't have the time to debug the hell out of this. Let me know if anyone else takes a crack. |
09:14:35 | * | fjellfras quit (Ping timeout: 244 seconds) |
09:14:45 | * | Cthalupa quit (Ping timeout: 258 seconds) |
09:21:14 | Mister_Magister | can you release new versions less often? |
09:21:21 | Mister_Magister | i don't have time to update package ;-; |
09:26:44 | dom96 | hehe, usually people want releases more often :) |
09:26:50 | dom96 | How's everyone doing? |
09:29:00 | FromGitter | <mratsim> @Riderfighter you can find a few recipes in nim days and Nim's scripter notes as well: https://xmonader.github.io/nimdays/, https://scripter.co/notes/nim/ |
09:29:08 | FromGitter | <Riderfighter> Pretty good hbu dom96 |
09:29:37 | FromGitter | <Riderfighter> @mratsim thank you, I'm going to take a look at those asap |
09:29:39 | FromGitter | <mratsim> Nim has a release every months or so though :/ |
09:29:39 | dom96 | Good good. Got some holidays this week |
09:30:26 | FromGitter | <mratsim> 6 months* |
09:31:28 | FromGitter | <Riderfighter> dom96: extra time to code in nim :) |
09:35:17 | * | dyske quit (Ping timeout: 250 seconds) |
09:35:38 | Zevv | I feel stupid again today. I have a macro that takes a code block and builds a custom data structure from this code block Nim AST. up to now I always used this data structure as an intermediate format to generate Nim code in that macro, but now I'd like to return this data structure from the macro into my nim code. |
09:38:44 | * | alexander92 joined #nim |
09:39:19 | FromGitter | <Riderfighter> argh I'm feeling stupid too today |
09:39:57 | * | Vladar quit (Remote host closed the connection) |
09:40:24 | * | Vladar joined #nim |
09:40:59 | alexander92 | dom96 I tried to understand what to use as "discard await but raise error" |
09:41:24 | dom96 | asycnCheck |
09:41:29 | dom96 | *asyncCheck |
09:41:32 | alexander92 | It seems to me I can't make wait for in async a compile error because in asynccheck docs it's written to use it |
09:41:36 | alexander92 | But.. |
09:41:46 | alexander92 | It doesn't await for completion |
09:42:13 | alexander92 | I M |
09:42:18 | dom96 | You can do `discard await someAsyncProc()` that's fine in case it's not clear |
09:42:23 | alexander92 | Ahhhh |
09:42:30 | dom96 | `discard someAsyncProc()` is not fine |
09:42:41 | alexander92 | So the discard thing is only about direct discard |
09:42:44 | alexander92 | I see |
09:43:04 | dom96 | The thing to remember is to never discard a `Future` |
09:43:40 | alexander92 | And I guess discard await raises if there is an error |
09:43:56 | dom96 | yep |
09:44:01 | alexander92 | Yeah in this case I should improve the docs a bit |
09:44:09 | alexander92 | Because it see they suggest wait for |
09:44:15 | * | alexander92 left #nim ("Quit") |
09:44:52 | * | alexander92 joined #nim |
09:45:10 | dom96 | sure, do it |
09:47:15 | * | Cthalupa joined #nim |
09:48:28 | * | fjellfras joined #nim |
09:48:38 | alexander92 | Then I guess we can mke |
09:48:52 | alexander92 | Discard future directly a compile error |
09:48:53 | alexander92 | Toi |
09:55:25 | * | fjellfras quit (Ping timeout: 246 seconds) |
09:58:39 | FromGitter | <Riderfighter> I wish the NESM docs were a bit more clear :L |
09:59:20 | FromGitter | <Riderfighter> it doesn't address how to customize the serialization of a dynamic type(string) inside of another dynamic type(seq) |
10:00:38 | * | dyske joined #nim |
10:02:08 | FromGitter | <Riderfighter> Sorry if I'm complaining a lot, I'm just frustrated I think I've been at this for an hour or two |
10:03:25 | * | seni joined #nim |
10:08:06 | * | Avatarfighter joined #nim |
10:14:55 | * | fjellfras joined #nim |
10:16:39 | * | Avatarfighter quit (Remote host closed the connection) |
10:23:15 | FromGitter | <zacharycarter> well - strings and seqs aren't really dynamically typed |
10:23:27 | FromGitter | <zacharycarter> seqs are resizable generic containers |
10:23:35 | FromGitter | <zacharycarter> strings are implemented using sequences |
10:23:47 | FromGitter | <zacharycarter> but their type is defined at compile time |
10:24:24 | FromGitter | <zacharycarter> I doubt this helps with your question though - maybe if you post an xo.io or a gist or something someone might have an idea |
10:24:28 | FromGitter | <Riderfighter> Yeah, but its the way this library works, it serializes types and it considers strings and sequences as dynamic because their size can't be calculated by the lib at compile time, that is what I mean by dynamic haha |
10:25:21 | FromGitter | <zacharycarter> ah, yeah their size is dynamic |
10:25:56 | FromGitter | <Riderfighter> how do you do a multiline comment in nim again? |
10:26:05 | solitudesf | #[ ]# |
10:26:12 | FromGitter | <Riderfighter> perfect, thank you! |
10:26:28 | FromGitter | <zacharycarter> maybe this will help - https://github.com/xomachine/NESM/blob/master/tests/customseqsize.nim#L53 |
10:26:50 | FromGitter | <mratsim> https://xomachine.gitlab.io/NESM/#customizing-seq-and-string-serialization-schemas |
10:26:54 | FromGitter | <Riderfighter> Yeah I saw that, but the thing is xomachine is setting the length of the seq itself |
10:27:01 | FromGitter | <Riderfighter> @mratsim I saw that too :( |
10:27:24 | FromGitter | <mratsim> it seems to offer the flexibility but maybe just use nim "marshal" stdlib if you have a lot of dynamic types |
10:27:45 | FromGitter | <mratsim> implementing serialization of dynamically sized types is always a pain anyway |
10:28:21 | FromGitter | <Riderfighter> yeah, its not that the current code doesn't work, it does, its just instead of a string being prefixed by a uint32 I need it as an int16 which is where my headache is haha |
10:28:43 | FromGitter | <Riderfighter> dont worry though, I wont give up, I'll probably have to mess with nesm code |
10:30:08 | FromGitter | <Riderfighter> to be honest, I can't tell if my issue is a library limitation or I'm just doing this really badly |
10:30:43 | FromGitter | <Riderfighter> here is my code if anyone is interested, I'm having issues with the AccountList object https://dsh.re/64512 |
10:31:10 | * | dddddd joined #nim |
10:31:21 | FromGitter | <mratsim> well don't worry, for our YAML deserialization need, we monkey patch Nim's json and NimYAML types to use uint64 instead of int64 for example --> https://github.com/status-im/nim-eth2-official-tests/pull/2/files#diff-d5bc8101555d964ebe1e85c4be4990a7 |
10:32:22 | * | Avatarfighter joined #nim |
10:32:26 | FromGitter | <mratsim> but the serialization/deserialization roundtrip works well right? |
10:34:00 | FromGitter | <Riderfighter> in theory the roundtrip serialization/deserialization wont succeed for me because of the server being unable to parse the packet I send, its not a big limitation though since I can use my own binary packing lib if needed, its just that NESM is so cool haha |
10:35:02 | * | alexande1 joined #nim |
10:35:59 | FromGitter | <alehander42> hey guys |
10:36:03 | FromGitter | <Riderfighter> Hola |
10:36:05 | FromGitter | <alehander42> please help me override tags |
10:36:17 | * | alexander92 quit (Ping timeout: 245 seconds) |
10:36:18 | FromGitter | <Riderfighter> I will help to the best of my abilities ! |
10:36:18 | FromGitter | <alehander42> i am trying to force nim to ignore some |
10:36:22 | FromGitter | <alehander42> with {.tags: [].}: code |
10:36:26 | FromGitter | <alehander42> but nim cant really accept it |
10:36:48 | FromGitter | <alehander42> my goal is to make the function type with tags: [] |
10:40:27 | FromGitter | <Riderfighter> Upon further analysis, it seems that this may be a bit too advanced for me, sorry alehander42 :( |
10:42:30 | FromGitter | <alehander42> no problem |
10:48:56 | * | stefanos82 joined #nim |
10:50:02 | * | vlad1777d quit (Ping timeout: 245 seconds) |
10:55:59 | Zevv | bah, I'm kind of stuck... anyone any ideas about my macro question from 11:35? |
11:02:54 | * | Avatarfighter quit (Remote host closed the connection) |
11:03:25 | * | Avatarfighter joined #nim |
11:03:34 | * | Avatarfighter quit (Remote host closed the connection) |
11:05:42 | FromGitter | <mratsim> I'm not too sure about your specific but I have similar needs in Laser: https://github.com/numforge/laser/tree/master/laser/lux_compiler |
11:06:15 | FromGitter | <mratsim> what I'm doing is having my own AST: https://github.com/numforge/laser/blob/master/laser/lux_compiler/core/lux_types.nim |
11:06:35 | FromGitter | <mratsim> In macro, I can run symbolic execution to build this AST at compile-time |
11:06:42 | FromGitter | <mratsim> or running it at runtime |
11:07:22 | FromGitter | <mratsim> and then I have a code generation part that can translate it to either NimNode, or at runtime I plan to generate LLVM JIT code |
11:07:55 | FromGitter | <mratsim> alternatively you can store NimNodes in a {.compileTime.} data structure |
11:08:52 | Zevv | ok I'll take a peek at that, thanks |
11:12:15 | Zevv | but where do you build this AST from? |
11:13:48 | Zevv | problem is, I have the ast as a data structure inside the macro execution. but macros only do NimNodes - so I need to get this data structure out to nim in a const somehow |
11:15:06 | Zevv | sometimes I feel I got it all in my fingers, and sometimes I'm so utterly confused :/ |
11:29:25 | solitudesf | is there a standart way to get the base type from distinct type or would i need to write a macro for that? |
11:29:38 | * | laaron quit (Remote host closed the connection) |
11:32:07 | * | noonien quit (Quit: Connection closed for inactivity) |
11:34:35 | * | fjellfras quit (Ping timeout: 268 seconds) |
11:35:23 | * | laaron joined #nim |
11:38:50 | * | oculux quit (Quit: blah) |
11:39:07 | * | oculux joined #nim |
11:40:19 | * | alexande1 quit (Ping timeout: 248 seconds) |
11:41:59 | * | alexande1 joined #nim |
11:43:13 | * | JustASlacker joined #nim |
11:51:31 | * | alexande1 quit (Ping timeout: 248 seconds) |
11:52:54 | FromGitter | <mratsim> distinctBase @solitudesf in sugar or typetraits i do'nt remember |
11:53:18 | FromGitter | <mratsim> @Zevv, why don't you use quote do? |
11:53:50 | solitudesf | thanks! |
11:53:58 | FromGitter | <mratsim> also is your data structure compile-time only or runtime as well? |
11:56:58 | Zevv | its compile time only - it is later used to create nim code from in a macro. Now I have one macro taking a code block with my own syntax, which gets transformed to internal AST, which gets transformed to nim code - all within the macro. I'm now looking for a way to create reusable blocks of this internal AST which I can then put together in a different way and generate nim code in 2 steps. So kind of what I |
11:57:04 | Zevv | need is the internal AST to 'escape' the macro so I can work with it and pass it again later to another macro to convert it into NimNode |
12:13:49 | * | laaron quit (Remote host closed the connection) |
12:15:55 | * | laaron joined #nim |
12:20:23 | * | alexande1 joined #nim |
12:53:45 | FromGitter | <Riderfighter> Zevv: Any luck with your issue? It sounds like a pretty interesting |
12:55:20 | FromGitter | <alehander42> hey @kayabaNerve |
12:55:28 | FromGitter | <alehander42> i got an error in async closureiters as well |
12:55:49 | FromGitter | <alehander42> but a wrong assert n.kind == nkStmtListExpr |
12:57:08 | * | Avatarfighter joined #nim |
12:57:12 | FromGitter | <alehander42> hmm |
12:57:30 | FromGitter | <alehander42> and its because of deref : |
12:57:30 | FromGitter | <alehander42> id = (await pool.stable.addBreak(path, line)).id |
12:57:35 | FromGitter | <alehander42> i remember you had [] |
12:57:39 | FromGitter | <alehander42> maybe its the same issue |
12:57:51 | Zevv | Riderfighter: naah, doing tons of other things. I get paid to do plumbing, not to play with nim code :/ |
12:58:19 | FromGitter | <alehander42> @kayabaNerve yeah that fixed |
12:58:21 | FromGitter | <alehander42> try to use a temp |
12:58:41 | shashlick | Nim is great and all but when you have memory issues, it is a nightmare |
12:59:17 | FromGitter | <Riderfighter> Zevv: rip, I hope you get a solution to your problem soon |
12:59:23 | * | nsf quit (Quit: WeeChat 2.4) |
12:59:24 | * | laaron quit (Remote host closed the connection) |
13:01:08 | FromDiscord_ | <exelotl> hey, I have a template that gets the path of the callee using `instantiationInfo(fullPaths=true).filename` |
13:01:38 | Zevv | I have this problem where I hacked together a pretty complicated bit of code in a flow of a few days, and half a year later read back and go "how the hell did I come up with that? what does *this* do?" |
13:01:46 | FromDiscord_ | <exelotl> I was wondering if I could instead get the path of the root of the project (e.g. where is main.nim located?) |
13:02:30 | * | laaron joined #nim |
13:05:37 | * | dddddd quit (Remote host closed the connection) |
13:07:15 | * | kungtotte quit (Quit: WeeChat 2.5) |
13:09:07 | solitudesf | https://nim-lang.github.io/Nim/macros.html#getProjectPath this? |
13:12:12 | FromDiscord_ | <exelotl> ah that sounds like what I need :) |
13:12:24 | FromDiscord_ | <exelotl> thanks |
13:12:51 | FromGitter | <Riderfighter> What is the best way to access the type inside of a bracketexpression e.g. seq[*string*]? |
13:13:48 | solitudesf | generics probably |
13:13:49 | solitudesf | proc test[T](s: seq[T]) |
13:13:55 | solitudesf | your type is T |
13:14:30 | Zevv | that's smart |
13:14:30 | FromGitter | <SolitudeSF> nice one gitter |
13:14:45 | FromGitter | <SolitudeSF> `proc testT (s: seq[T]) |
13:14:50 | FromGitter | <Riderfighter> I'll try that thank you |
13:15:04 | FromGitter | <Riderfighter> yeah gitter parsed that incorrectly lol |
13:17:02 | * | zielmicha__ quit (Ping timeout: 258 seconds) |
13:17:54 | * | zielmicha__ joined #nim |
13:42:32 | * | alexande1 quit (Ping timeout: 245 seconds) |
13:50:18 | * | laaron quit (Remote host closed the connection) |
13:52:48 | * | laaron joined #nim |
13:54:53 | * | laaron quit (Remote host closed the connection) |
13:55:20 | * | laaron joined #nim |
14:03:23 | * | laaron quit (Remote host closed the connection) |
14:06:19 | * | laaron joined #nim |
14:15:29 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
14:16:12 | * | laaron joined #nim |
14:20:12 | * | nsf joined #nim |
14:31:41 | * | dyske quit (Quit: dyske) |
14:39:28 | lqdev[m] | it's not gitter, it's the IRC↔Gitter bridge. it does not escape certain characters properly |
14:42:08 | FromGitter | <Riderfighter> ah til |
14:42:12 | FromGitter | <Riderfighter> today i learned* |
14:56:30 | lqdev[m] | building a register machine is hard, I almost want to build a stack machine instead to avoid the terrible complexity |
14:57:36 | * | MyMind quit (Read error: Connection reset by peer) |
14:57:44 | krux02 | I learned a lot about that when fixing bugs for the vm in the Nim compiler |
14:57:47 | lqdev[m] | I guess I'm not ready for register machines yet |
14:58:01 | lqdev[m] | It's good I didn't build the VM yet, tho |
14:59:14 | lqdev[m] | yeah, but when I look at various register-based VMs I just can't understand why things are so different between implementations, OTOH stack machines are rather similar to each other |
15:00:30 | krux02 | yea, I would build a stack machine as well. |
15:00:56 | krux02 | might be slower, but it is not supposed to be the fasted anyway. |
15:01:04 | lqdev[m] | I blame Araq for convincing me to build a register-based VM |
15:01:10 | krux02 | much more important is: little bugs. |
15:01:17 | * | JustASlacker quit (Remote host closed the connection) |
15:01:21 | lqdev[m] | ^ indeed |
15:01:31 | krux02 | well that is what he has most experience with. |
15:01:36 | lqdev[m] | but at least I learned something new from building one |
15:01:38 | krux02 | for him it makes sense. |
15:01:46 | krux02 | But I am not a big fan of the VM in Nim. |
15:02:03 | krux02 | in my opinion it has too many problems. |
15:02:06 | lqdev[m] | yes |
15:02:20 | krux02 | the problems get fixed, one at a time. |
15:02:28 | krux02 | but it is not easy to work with it. |
15:02:57 | lqdev[m] | I'm not looking to make the fastest VM ever anyways, I'm just looking to create a simple embeddable scripting language with a straightforward implementation that is decently fast. |
15:07:40 | FromGitter | <mratsim> @krux02, I probably have a flawed view but for me most of the issues I see in the compiler are not due to the VM per se but due do stuff linked to symbol resolutions or the type system |
15:09:22 | krux02 | I am very pessimistic right now. |
15:09:30 | krux02 | I see far too bany bugs and problems in Nim. |
15:09:37 | krux02 | also in the vm. |
15:10:01 | krux02 | That is also a reason why I fighting hard against any new features. |
15:10:10 | krux02 | They all cause problems. |
15:10:17 | FromGitter | <arnetheduck> wait what? the other day when I mentioned I might rip it out and use llvm instead, you said you liked the nim vm? |
15:10:31 | krux02 | Introducing features is easy. Fixing the problems in existing features is very hard. |
15:11:04 | lqdev[m] | ^ the universal truth of software development |
15:11:05 | FromGitter | <arnetheduck> introducing features without introducing problems is easy if you take care to refactor your code to make room for the new features - that hasn't really happened in the compiler |
15:11:16 | krux02 | arnetheduck: that is not a fix, that is just a source of another family of problems. |
15:12:13 | krux02 | recent activiy is in the alias feature. No I don't want it. |
15:12:28 | krux02 | I don't care how much effort somebody put into it. |
15:12:39 | krux02 | I want the compiler to work reliable. |
15:13:16 | krux02 | Work that doesn't go into the direction of reliability is work in the wrong direction. |
15:13:31 | krux02 | sorry for my rant |
15:15:19 | * | laaron- joined #nim |
15:16:15 | FromGitter | <arnetheduck> like I said, it's not for nimc.. but imagine that the work was done to have a swappable VM - that would make sure that the whole VM part was well-defined enough that it can stand as its own layer / module / api.. that's generally how you make things more reliable, by dividing into orthogonal pieces that are each more simple to develop - it's pretty boring and simple actually |
15:16:17 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
15:17:56 | FromGitter | <brentp> @shashlick I am planning to write a full nim wrapper for bigwig. is it common to use nimgen / nimterop to generate the wrapper and then just include that in the repo to avoid extra deps? |
15:18:41 | shashlick | are you planning on leveraging the nimbigwig wrapper |
15:19:14 | shashlick | https://github.com/genotrance/nimbigwig |
15:19:30 | FromGitter | <brentp> that's sort of what I'm asking. but I wondered if I could just use that to generate the code and then include it in the repo. |
15:19:49 | FromGitter | <arnetheduck> if you want reliable, you can't really have when jungles for 20 different tools (suggest, compiler etc) that use the same code with subtly different expectations - you can't really have deep mutablility where even the cgen modifies the ast in non-trivial ways.. there's simply no way anyone can reason about that code and make sense of it.. and above all, you can't have 20 unfinished features that each make it harder |
15:19:49 | FromGitter | ... to debug and develop things without adding any value |
15:20:16 | krux02 | arnetheduck: If you make a plugin for the compiler to use the LLVM for compile time code execution, good. If you make a fork of Nim that uses the LLVM also good. |
15:20:54 | krux02 | If you rip out NimVM and replace it with a half hearted implementation for LLVM that get's hello world running but dosn't work for anything else, not good at all. |
15:22:11 | krux02 | arnetheduck: I am actively working on removing unfinished features that did not work out. |
15:22:11 | shashlick | @brentp - feel free to do that |
15:22:23 | shashlick | but the way nimgen works, it generates the wrapper for the target system at the time of install |
15:22:35 | FromGitter | <arnetheduck> well, it's not gonna happen any time soon anyway, but spending some time on removing and cleaning up stuff from the compiler, and splitting up the parts will no doubt do wonders after the initial shock - good luck :) |
15:22:57 | krux02 | just today I worked on squishing "callsite()" out of the language. |
15:23:17 | krux02 | it is still there, but only with a compilation flag. |
15:24:28 | FromGitter | <brentp> @shashlick. understood. I'll start by adding some sugar to nimbigwig. this will be my side project for next little while. |
15:24:35 | shashlick | @brentp - so that's why i don't have a cached copy in github, even though you can see it in the docs - http://nimgen.genotrance.com/nimbigwig/ |
15:24:48 | krux02 | I is just for 10 years, Nim has been a testbed for many developers with many different ideas and ideologies, and the entrance barrier for features was low. |
15:25:48 | krux02 | With me on board of the Nim development, this won't happen anymore. There will be resistence to new features. And if they get introduced, I want to be sure that they won't cause harm for people who didn't ask for those features. |
15:27:07 | shashlick | i think cruft should also get thrown out |
15:27:32 | shashlick | some renewed effort to offload more stdlib modules into nimble will be cool as well |
15:30:34 | FromDiscord_ | <treeform> @krux02, cruft like the `new` and `do` keyword? |
15:31:43 | * | sagax quit (Remote host closed the connection) |
15:32:13 | krux02 | well, the do keyword is ugly, I didn't see too many implications in the compiler yet because of it. |
15:33:25 | krux02 | What I am more worried about are the different iterator types with sometimes implicit calling of the iterator sometimes not. |
15:33:46 | krux02 | and the hard to grasp logic in overload resolution |
15:33:50 | krux02 | some things are types |
15:33:58 | krux02 | soem things are untyped |
15:34:31 | * | laaron- quit (Remote host closed the connection) |
15:35:14 | krux02 | my biggest enemy currently is ``typedesc``. |
15:35:28 | krux02 | it causes implications in the compiler everywhere. |
15:36:19 | FromDiscord_ | <treeform> For me I find that the new/default constructor is the biggest wart in nim. |
15:36:29 | krux02 | There is no specification of what it is, and there are literally hundread of lines ot just get rid of typedesc, because you never want it but constantly get it. |
15:36:33 | FromDiscord_ | <treeform> As a newbie I found new and uses of new really confusing. |
15:36:44 | FromDiscord_ | <treeform> And the solution is basically never use it. |
15:37:05 | FromDiscord_ | <treeform> And when you get `Error: attempting to call undeclared routine: ‘X’` |
15:37:09 | FromDiscord_ | <treeform> and you define X |
15:37:11 | FromDiscord_ | <treeform> and then get |
15:37:19 | FromDiscord_ | <treeform> Error: redefinition of ‘X’ |
15:37:37 | FromDiscord_ | <treeform> super confusing its all part of the new/default constructo wart |
15:37:57 | krux02 | yea I never use new, so I didn´t realize that it causes problems. |
15:38:09 | krux02 | But good point, maybe something needs to be done about it. |
15:38:17 | FromDiscord_ | <treeform> exactly we all learned not to use new |
15:38:25 | FromDiscord_ | <treeform> but it still there as a rock for new people to hit |
15:38:45 | FromDiscord_ | <treeform> because Java,C++,C#,JavaScript all use new to create things |
15:38:52 | FromDiscord_ | <treeform> people coming in want to use new, and its there and its a problem |
15:38:58 | krux02 | I also don't use new very much in C++, so it is not something that I hit. |
15:39:23 | FromDiscord_ | <treeform> I came from JavaScript so I though you supposed to use new |
15:39:24 | krux02 | treeform, can you make an issue about it? |
15:39:32 | FromDiscord_ | <treeform> Here is a blog post I was warning about it: https://blog.istrolid.com/blog/nim-things-is-new-keyword-needed.html |
15:39:34 | krux02 | probably there is an issue about it |
15:39:40 | FromGitter | <mratsim> > I am actively working on removing unfinished features that did not work out. ⏎ ⏎ Are you talking about concepts? :P |
15:39:43 | FromDiscord_ | <treeform> still draft I don't like how it comes off |
15:39:43 | krux02 | but I really do care about usability issues. |
15:39:58 | FromDiscord_ | <treeform> can you give me your thoughts on the blog post? |
15:40:13 | krux02 | mratsim: I want concepts to be gone, yes. |
15:40:47 | krux02 | but with concepts it is similar to ``new``, I don't use it, I don't see the problem. |
15:41:11 | krux02 | I pushed araq to hide concepts behind an experimental flag. |
15:41:25 | lqdev[m] | I prefer `(ref SomeType)(field1: value)` over `var obj = new(SomeType); obj.field1 = value` since it allows you to set a case object's discriminator without the compiler yelling at you. also it takes less space |
15:41:48 | krux02 | For me that is a step towards pushing them out. But they can stay in the language for now. |
15:42:25 | krux02 | as long as they don't actively cause problems and are just rotting away, I don't think it is much of a problem. Maybe for those people who care about the concepts. |
15:43:19 | FromGitter | <mratsim> They are unfinished so they are useful but not that useful |
15:43:24 | krux02 | lqdev: I don't use ref |
15:43:36 | FromDiscord_ | <treeform> I just define ref objects |
15:43:41 | FromDiscord_ | <treeform> and use them as regular objects |
15:43:58 | FromDiscord_ | <treeform> I feel like the `ref`iness is part of the type not how I use the type. |
15:44:00 | lqdev[m] | I use it only with exceptions |
15:44:14 | lqdev[m] | otherwise I do as @treeform |
15:44:49 | krux02 | I don't use the keyword ``ref`` at all in the code that I write. |
15:45:04 | FromDiscord_ | <treeform> what do you use ptr? |
15:45:04 | FromGitter | <mratsim> @lqdev, strange I switched to the second way to avoid case object errors |
15:45:52 | FromGitter | <mratsim> real men use shaders :p |
15:46:00 | lqdev[m] | @mratsim it gave me a warning when I did `var err = newException(RodError); err.kind = reSyntax` |
15:46:04 | FromGitter | <brentp> @shashlick, do you have an example opening a bigwig without a callback? I can't send nil as 2nd argument to `bwOpen` (http://nimgen.genotrance.com/nimbigwig/bigWig.html#bwOpen,cstring,proc(pointer),cstring) |
15:46:35 | FromDiscord_ | <treeform> i use `raise newException(Foo, "message")` ? |
15:47:07 | lqdev[m] | @treeform it's fine that way if you don't want to add any extra metadata to your error |
15:47:44 | shashlick | @brentp - sorry, i've not really used the lib beyond basic wrapping |
15:47:46 | lqdev[m] | but I care about customizability and extensibility so I add line info into rod errors |
15:48:00 | krux02 | If I am not working in the compiler, I define a panic somewhere that I will then call instead of exceptions. |
15:48:07 | krux02 | a panic with a message. |
15:48:25 | krux02 | I never cared about exception classes, and I think it is super annoying to deal with them. |
15:48:44 | FromGitter | <mratsim> nowarning here @lqdev: https://github.com/numforge/laser/blob/e797ca61f3f6a2dfc9f55ba57d14059e6278319f/laser/lux_compiler/core/lux_core_helpers.nim#L69-L73 |
15:49:18 | lqdev[m] | that's why I avoid making several `RodError`s and just have one with a separate `kind` field |
15:50:28 | krux02 | yea the problem of the kind is then it is not extendable. |
15:50:59 | krux02 | (I wouldn't mind if all exceptions were just "Problem") |
15:53:26 | krux02 | the problem I have with raising exceptions is the verbosity: `raise newException(StackOverflowError, "stack overflow")` |
15:53:44 | krux02 | when you call raise, you already know that it is going to pe an exception |
15:53:55 | krux02 | so whay this redundant ``newException`` |
15:54:20 | krux02 | Also the name StackOverflowError, I know it is an Error, that is why there is raise |
15:54:49 | krux02 | and then the text, in many cases just repeating the exception call, but without "Exception". |
15:55:40 | FromDiscord_ | <treeform> it should be `raise StackOverflowError("stack overflow")` |
15:55:52 | krux02 | I would be happy with this: ``rause "stack overflow"``, it has all information needed. |
15:55:54 | FromGitter | <mratsim> It's better than "StackOverflowError(msg: "stack overflow", lineinfo: "...", fieldX: 1234) |
15:55:56 | lqdev[m] | `template error(kind: untyped, msg: string) = raise newException(`kind Error`, msg)` |
15:56:17 | FromGitter | <mratsim> the object constructor syntax is quite verbose in general as well |
15:56:42 | lqdev[m] | @krux02 except any auxiliary information you may need if you want to catch the exception |
15:57:10 | krux02 | I generally don't catch exceptions. |
15:57:33 | lqdev[m] | I still catch myself writing `raise new ValueError` since I programmed in Java for quite some time |
15:57:45 | disruptek | you can just template exceptions and get rid of the noise, right? i don't do it because i think it's unnecessary obfuscation, but it's always a possibility... |
15:57:46 | lqdev[m] | fortunately I stopped |
15:58:04 | krux02 | disruptek, yes I can. |
15:58:26 | disruptek | my goal is to never raise. |
15:58:36 | krux02 | but usually I don't have such a template in scope. And then instead of doing that, I just write ``quit("problem here")`` |
15:58:37 | lqdev[m] | `template panic(msg: string) = raise newException(Exception, msg)` there you go |
15:58:39 | disruptek | too many issues with the current exceptions. |
15:59:12 | disruptek | leave the raise outside the template; otherwise, a ready cannot understand control flow. |
15:59:16 | disruptek | s/ready/reader/g |
15:59:49 | krux02 | actually I had such a template already |
15:59:52 | lqdev[m] | you can avoid using raise but then it becomes either rusty and verbose or the end user of your library can't catch potential errors at all |
15:59:54 | FromGitter | <Riderfighter> Hello disruptek and krux02 👋 |
16:00:11 | disruptek | sup 'fighter |
16:00:28 | krux02 | Riderfighter: hi |
16:00:28 | disruptek | nah, that's not true. most of the time, you can code out exceptions. |
16:01:21 | FromGitter | <Riderfighter> lqdev: how is your vm going? |
16:01:27 | krux02 | in emacs-lisp I really got used to the or operator. |
16:01:33 | lqdev[m] | I'll keep using exceptions since that's the language's primary way of signifying errors. |
16:01:43 | krux02 | (or (might-return-nil) fallback) |
16:02:09 | krux02 | for me that is nicer to read than an api that returns an exception |
16:02:23 | disruptek | it's the language's way of signifying exceptions. this should not have bearing on code which, by definition, you except to follow an "error" code path. |
16:02:42 | disruptek | s/except/expect/ |
16:02:44 | disruptek | oi |
16:03:07 | FromGitter | <mratsim> I feel like the errors vs exceptions monthly discussion got a new twist with uncatchable panics right here and there :P |
16:03:08 | lqdev[m] | @Riderfighter rewriting it to a stack-based VM since I understand them better than register-based |
16:03:29 | krux02 | In my opinion, there is very little code, where exceptions are actually the good clean solution. Most of the time they are not. |
16:03:54 | krux02 | I had once in my life a code snippet, where I thought exceptions here are actually helping me here. |
16:04:06 | disruptek | exactly. |
16:04:07 | * | Trustable joined #nim |
16:04:12 | disruptek | they are generally a sign of laziness. |
16:04:37 | FromGitter | <mratsim> I'd rather debug exception-based code with a nice call stack than dealing with bubbling errors that pollute return types |
16:05:00 | krux02 | I am lazy, I don't want to deal with try catch blocks, therefore I don't write ``raise``. |
16:05:02 | FromGitter | <mratsim> and people ignores error return value left and right |
16:05:04 | disruptek | if you think an error is pollution, that's a problem. |
16:05:42 | krux02 | mratsim: people also ignore exceptions unless they make there program crash. |
16:05:51 | FromGitter | <mratsim> if err = mylib.add(result, a, b): ⏎ ... ⏎ ⏎ is pollution compared to result = a + b [https://gitter.im/nim-lang/Nim?at=5d41bc5f1241645b16f0f717] |
16:06:00 | FromGitter | <Riderfighter> Sounds awesome lqdev, I'd be interested in checking out your implementation when its complete if that's possible |
16:06:33 | disruptek | if an error is possible, why demote its handling in such a way that hides, obfuscates, elides, or confuses that handling? |
16:06:52 | FromGitter | <mratsim> @krux02, regarding that I hope one day the effect system will allow to force checking exceptions that can be raised in the code |
16:07:04 | FromGitter | <mratsim> AFAIK the seperation between Defect and Exception was to prepare that |
16:07:34 | disruptek | the issue is with broken .raises., broken .async. exceptions, and incomplete dfa. |
16:07:46 | FromGitter | <mratsim> why obfuscate the actual result and make an error takes it's place |
16:07:57 | FromGitter | <mratsim> its* |
16:07:59 | krux02 | AFAIK, I don't know the difference between an exception and a defect. |
16:08:01 | disruptek | an error is, by definition, an actual result. |
16:08:25 | krux02 | well I do know the difference |
16:08:30 | disruptek | also c, cpp, and --noCppExceptions codegen is broken as per my issue. |
16:08:31 | krux02 | but I don't want to bother about it. |
16:09:02 | FromGitter | <mratsim> one is related to user/network input and you should be able to recover from (say FileNotFOund) the other is related to unrecoverable situation (out of memory, file handle exhausted) |
16:09:52 | FromGitter | <mratsim> anyway, I'm off from that discussion, I feel like it's really become a monthly one |
16:10:26 | krux02 | good |
16:10:39 | disruptek | yes, it's easier, safer, and (imo) better, to simply not use exceptions. |
16:11:06 | FromGitter | <zetashift> I also stumbled over treeforms problems with object initialization and using new. It's still a bit unclear but I've just accepted it as is |
16:11:36 | disruptek | i cannot afford to reread, redebug, or rewrite nim for a new exception semantic a year or two down the road. |
16:12:11 | FromDiscord_ | <treeform> zetashift, thanks, am not alone. |
16:12:55 | disruptek | what's the obj init problem? |
16:13:23 | disruptek | all i saw was the known-defect with variants, but it can be fixed in the future. |
16:15:43 | dom96 | treeform: krux02: sounds like we should remove `new` from the language |
16:17:24 | disruptek | probably should be deprecated with a switch and analyzed in stdlib, for starters. |
16:18:22 | disruptek | i can't find a single case where i've used it in anything i've written so far. |
16:20:25 | krux02 | I used ``new`` on result. |
16:20:34 | disruptek | yeah, that's the common idiom. |
16:21:11 | krux02 | but I can rewrite it with type initializers as well. |
16:21:35 | krux02 | result = typeof(result)() |
16:21:36 | krux02 | :P |
16:21:55 | krux02 | don't know if it even compiles |
16:22:53 | dom96 | disruptek, a deprecation path is a given in Nim land :) |
16:24:10 | FromDiscord_ | <treeform> dom96, your thoughts on: https://blog.istrolid.com/blog/nim-things-is-new-keyword-needed.html |
16:24:26 | disruptek | sure, but it's too pervasive not to hide it behind a switch, then a hint, then a warning, etc. |
16:25:20 | dom96 | treeform: my thoughts are: write about something positive :) |
16:25:33 | dom96 | This doesn't need a blog post, an issue/forum post is enough |
16:25:56 | * | abm quit (Quit: Leaving) |
16:26:18 | * | abm joined #nim |
16:27:31 | krux02 | treeform: I think that is a bad example, since I wrote nim glm |
16:27:43 | krux02 | the constructor is lower case and the type is upper case. |
16:27:57 | FromDiscord_ | <treeform> krux02, yeah that's what I do right now |
16:28:27 | FromDiscord_ | <treeform> https://github.com/treeform/vmath/blob/master/src/vmath.nim#L184 |
16:28:30 | FromDiscord_ | <treeform> but I don't like it. |
16:29:07 | krux02 | why don't you use glm? |
16:29:16 | FromDiscord_ | <treeform> I had problems using it when I started. |
16:29:26 | krux02 | what problems? |
16:29:32 | FromDiscord_ | <treeform> I tried using it but it would create errors I did not understand at the time. |
16:30:01 | krux02 | I put quite some effort into glm, so that everything that glsl has is alos available in nim-glm |
16:30:13 | dom96 | the convention is to use `initVec3` in that case |
16:30:58 | krux02 | dom96: but that is not the convention for glm |
16:31:26 | FromDiscord_ | <treeform> dom96, we want a basic type like int or float for vec3 |
16:31:26 | krux02 | it would be very annoying to type |
16:31:36 | FromDiscord_ | <treeform> yeah initVec3 is very annoying to type when you type it a ton |
16:32:24 | dom96 | true |
16:33:03 | krux02 | it is not just the typing, when you have it 4 times in a single line, then it also sreaches the line quite a lot. |
16:33:51 | lqdev[m] | also glsl |
16:34:10 | FromDiscord_ | <treeform> lines that contain vec code contain it multiple times |
16:36:37 | krux02 | I have a macro that compiles nim code to glsl. Therefore I had to have an accurate reimplementation of glsl builtins, so that I could compile calls to these functions to their matching glsl builtin equivalent. |
16:37:06 | krux02 | I have to go now |
16:38:57 | FromDiscord_ | <exelotl> I like the way nico does things: https://github.com/ftsf/nico/blob/master/nico/vec.nim |
16:39:38 | FromDiscord_ | <exelotl> e.g. Vec2f is the type, vec2f() is the constructor |
16:41:23 | FromDiscord_ | <treeform> yeah that works |
16:41:41 | FromDiscord_ | <treeform> I just never used the d and i variants... |
16:41:58 | dom96 | I guess I've been torturing myself with writing Point[float](x: ..., y: ...) everywhere |
16:42:07 | FromDiscord_ | <treeform> yes |
16:43:17 | FromDiscord_ | <treeform> we all like to create slightly different but mostly the same vector libraries |
16:43:26 | dom96 | I've thought about changing it, but these kinds of refactorings are always boring |
16:43:47 | FromDiscord_ | <treeform> it all stems from the fact that you can't define vec3 as a type and as a constructor. |
16:44:00 | dom96 | I did just spend the past few hours optimizing my protocol to use smaller integers instead of floats/int64s though |
16:44:07 | dom96 | also pretty boring |
16:45:07 | FromDiscord_ | <Avatarfighter> dom96: congrats I guess haha |
16:45:13 | FromDiscord_ | <treeform> I like optimizing |
16:45:31 | dom96 | What I should really be doing is figuring out why the simulation cannot handle 100+ players :( |
16:45:35 | FromDiscord_ | <treeform> Give me speed or space optimization problem and I am good. |
16:46:15 | dom96 | But the protocol optimizations are related to that |
16:46:26 | FromDiscord_ | <Avatarfighter> What are you working on dom96? |
16:46:30 | dom96 | `send` is taking a significant chunk of time |
16:46:37 | FromDiscord_ | <treeform> He is building an MMORPG. |
16:46:38 | dom96 | Avatarfighter: an agar.io-like game |
16:46:41 | FromDiscord_ | <Avatarfighter> oh dang |
16:46:44 | FromDiscord_ | <Avatarfighter> I wanna help haha |
16:47:11 | dom96 | Don't think MMORPG is the right description :P |
16:47:56 | dom96 | Avatarfighter, I can ping you when it's ready for testing if you're up for it? :) |
16:48:41 | dom96 | I think I'll need to implement better lag compensation as well |
16:48:43 | FromGitter | <Riderfighter> Sure! that would be awesome |
16:48:56 | FromGitter | <Riderfighter> I'll set up a botting framework in no time :P |
16:49:15 | dom96 | Riderfighter: that will be a good test actually, I want to be ready for bots |
16:51:09 | FromDiscord_ | <treeform> dom96, do you use websockets? |
16:51:14 | dom96 | yep |
16:51:20 | FromDiscord_ | <treeform> which one? |
16:51:42 | dom96 | I tried your library and from what I could tell it had too much bugs |
16:51:45 | * | nif quit (Quit: ...) |
16:51:54 | * | nif joined #nim |
16:52:00 | dom96 | (and some lack of features) |
16:52:08 | FromDiscord_ | <treeform> mind making a list? |
16:52:12 | dom96 | so I'm using niv's |
16:52:18 | dom96 | I created an issue IIRC |
16:52:44 | FromDiscord_ | <treeform> oh I did not see that |
16:55:31 | FromDiscord_ | <Littleli> Hello Nim people. I have some trivial experience with Golang and some nontrivial with Java. I have probably very common question. How to map some of the features from those languages to Nim. The most important to me is what's there to replace concept of interfaces, I'm pretty sure there is something but now Nim is still too new to me. |
16:55:57 | FromDiscord_ | <Littleli> Hello Nim people. I have some trivial experience with Golang and some nontrivial with Java. I have probably very common question. How to map some of the features from those languages to Nim? The most important to me is what's there to replace concept of interfaces, I'm pretty sure there is something but now Nim is still too new to me. |
16:57:09 | lqdev[m] | @Littleli you can replace interfaces using tuples with proc fields |
16:58:52 | FromGitter | <mratsim> Hello wanderer, forget all hope and embrace the absence of interface, soon your horizon will be filled with rainbows and unicorns |
17:00:05 | FromGitter | <brentp> nim concepts are closest thing to go interfaces |
17:00:06 | FromGitter | <mratsim> You use closures like lqdev said, or methods (+ inheritance) or concepts |
17:03:19 | FromDiscord_ | <Littleli> hm, I would like to take a look at some example to have better understanding what that means |
17:05:02 | FromGitter | <mratsim> Concepts: https://nim-lang.org/docs/manual_experimental.html#concepts |
17:05:41 | FromGitter | <mratsim> Methods, second half of the post: https://matthiashager.com/proc-method-nim |
17:05:53 | FromGitter | <mratsim> and this one as well: https://nim-lang.org/docs/tut2.html |
17:06:50 | FromGitter | <mratsim> and closures/callbacks: https://nim-lang.org/docs/manual.html#types-procedural-type |
17:08:42 | krux02 | brentp: nim concepts and go interfaces are pretty much a very different thing. |
17:09:29 | FromGitter | <brentp> do tell |
17:09:52 | * | gokr joined #nim |
17:11:16 | disruptek | there is almost no documentation on method or its semantics; it confused me wrt exceptions. |
17:11:50 | krux02 | Go interfaces are a reliable and stable type specification for runtime polymorphism. Concepts are an experimental Nim feature for compile time polymorphism. |
17:13:40 | krux02 | I onece wrote a macro to have go like interfaces in Nim. |
17:14:42 | FromGitter | <brentp> fair enough, though I'd say to the naive user (such as myself) they are fairly similar. |
17:18:06 | * | sagax joined #nim |
17:22:04 | * | nif quit (Quit: ...) |
17:22:46 | * | nif joined #nim |
17:25:00 | FromDiscord_ | <Littleli> Thanks a lot 😃 I'll get through the recommendations. I'm basically researching now, I want to learn language which produces binaries and have decent support for parametric polymorphism and Nim appear to be very nice candidate! I'm not afraid to try anything new and even unlearn stuff ❤ |
17:28:36 | krux02 | Littleli: what is parametric polymorphism? |
17:29:30 | FromDiscord_ | <Littleli> I'm referring to generics |
17:29:45 | krux02 | ok |
17:38:34 | FromGitter | <mratsim> iirc That's the Haskell name for generics |
17:45:28 | FromDiscord_ | <Littleli> it's more like a proper term from the type theory. so yeah, Haskell is full of it. In practice it shrinks little bit to have proper container types like generic collections and better functions that can work for multiple types |
17:46:46 | FromDiscord_ | <Littleli> using collections without generics is quite painful and depending on how they are implemented it can hurt performance (boxing) |
17:47:00 | FromDiscord_ | <Littleli> using collections without generics is quite painful and depending on how they are implemented they can hurt performance (boxing) |
17:55:15 | FromGitter | <zetashift> @dom86 I think treeform's blogpost is quite handy for newcomers, PMunch had a reddit post that clarifies a lot about doing basic stuff with Nim's type system that someone coming from C# or something wouldn't understand. |
17:55:45 | * | Avatarfighter quit (Remote host closed the connection) |
18:01:04 | * | Avatarfighter joined #nim |
18:05:01 | FromGitter | <Riderfighter> Quick clarification question, there is no way to set the default value of a field right? |
18:06:40 | shashlick | is --gc:v2 == --gc:markandsweep? |
18:11:03 | * | Avatarfighter quit (Remote host closed the connection) |
18:11:58 | krux02 | Riderfighter: default is zero right now |
18:13:49 | * | jjido joined #nim |
18:14:07 | * | dgreen joined #nim |
18:15:24 | FromDiscord_ | <treeform> @Littleli in nim I do none of that Interface stuff I did with Java. I would suggest trying to write code without classes/inheritance/interfaces. This has really opened my mind on things. The code it much simpler for me. I no longer get why we needed classes/inheritance/interfaces in the first place. |
18:15:41 | FromDiscord_ | <treeform> @Littleli in nim I do none of that Interface stuff I did with Java. I would suggest trying to write code without classes/inheritance/interfaces. This has really opened my mind on things. The code is much simpler for me. I no longer get why we needed classes/inheritance/interfaces in the first place. |
18:17:38 | krux02 | yea I also don't get it. |
18:18:11 | krux02 | There is a lot of complex technology out there that can be replaced with nothingness. |
18:19:03 | FromDiscord_ | <treeform> I agree. |
18:20:46 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:24:41 | * | floppydh quit (Quit: WeeChat 2.5) |
18:24:57 | * | floppydh joined #nim |
18:37:53 | * | ikan-keli_ quit (Ping timeout: 258 seconds) |
18:38:03 | * | ikan-keli_ joined #nim |
18:42:49 | * | nif quit (Quit: ...) |
18:43:02 | * | nif joined #nim |
18:47:12 | lqdev[m] | I'm trying to wrap soundio with nimterop but it throws a ton of linker errors once I try to compile it |
18:47:35 | lqdev[m] | all with some `__imp_` prefix |
18:47:57 | lqdev[m] | seems like all the undefined references are coming from soundio.c which I'm definitely compiling |
18:49:32 | krux02 | lqdev[m], without showing what you are actually compiling and how, I can't help you |
18:50:23 | lqdev[m] | this file fails to compile: https://github.com/liquid600pgm/rapid/blob/master/src/rapid/audio/device.nim |
18:51:09 | krux02 | and what is your error message? |
18:51:15 | lqdev[m] | worth noting is that I did `"--passL:-lole32 -lwinmm"` which currently is not present in my wrapper |
18:51:19 | lqdev[m] | give me a sec |
18:51:53 | shashlick | @krux02 - if I am loading a nim --app:lib dll into my nim program with loadLib, is it possible to get stack traces for code running in the dll? |
18:51:59 | shashlick | my main program shows stack traces just fine |
18:52:37 | krux02 | shashlick, if you run your application with gdb and your dll is build with debug information, then sure |
18:53:08 | krux02 | nim stack traces (those automatically printed without using gdb only work for nim code) |
18:53:12 | shashlick | ya i've been able to step through with gdb but seeing the stack trace would make debugging 1000 times faster |
18:53:26 | shashlick | but the dll is also nim code |
18:53:40 | krux02 | ah, |
18:53:53 | krux02 | I didn't write dll with nim yet. |
18:54:08 | shashlick | i get something like this - `terminate called after throwing an instance of 'tyObject_IndexError_K39aEGuwNdydKn2WFEpUygg'` |
18:54:46 | krux02 | looks like an index out of bounds exception |
18:54:50 | krux02 | that wasn't caught |
18:55:30 | shashlick | ya but where in the code! i just called into a big chunk of code so i just have a clue where to start stepping through |
18:56:00 | lqdev[m] | krux02: https://gist.github.com/liquid600pgm/b329c1b22a256ab5ac509e0dbbbe0246 |
18:56:21 | dom96 | krux02: treeform: interfaces are needed for exactly the use case that `streams` and `logging` shows |
18:56:50 | dom96 | both modules solve it differently (object of proc types vs. inheritance + methods) |
18:56:52 | * | floppydh quit (Quit: WeeChat 2.5) |
18:57:13 | krux02 | names that start with __ are actually illegal in C |
18:57:21 | * | lritter joined #nim |
18:57:23 | lqdev[m] | shashlick: maybe try except in your library source code and then writestacktrace? |
18:57:33 | krux02 | they are reserved for compiler internal names |
18:57:54 | lqdev[m] | yeah, it's not present in soundio source code either so I assume this is something compiler related |
18:58:01 | lqdev[m] | I did make sure I compile each file |
18:58:33 | * | jjido joined #nim |
18:58:44 | lqdev[m] | you can find the wrapper here https://github.com/liquid600pgm/rapid/blob/master/src/rapid/lib/soundio.nim |
18:59:55 | krux02 | where is the soundio.c file? |
18:59:55 | shashlick | @lqdev - you might need to link with g++ |
19:00:23 | krux02 | lqdev[m], whatever happens there is wrong |
19:00:52 | lqdev[m] | krux02: it's pulled from github https://github.com/andrewrk/libsoundio/blob/master/src/soundio.c |
19:01:37 | krux02 | the problem is, I don't know what magic niminterop does |
19:01:45 | krux02 | it is probably the source of your problems |
19:02:17 | lqdev[m] | shashlick: compiling with nim cpp does not change anything |
19:02:39 | shashlick | check this out - https://github.com/nimterop/nimterop/blob/master/config.nims |
19:02:59 | shashlick | i am not certain if this is the fix but it sounds familiar |
19:04:01 | lqdev[m] | added --gcc.linkerexe:g++ but no effect |
19:04:51 | krux02 | I also don't know what problem nimterop tries to solve, nim has builtin functionality to import c types and functions. |
19:05:04 | krux02 | {.importc: "foobar".} |
19:05:22 | krux02 | I know how to write wrappers with those pragmas, but nof with nimterop |
19:06:17 | lqdev[m] | yeah I might need to resort to wrapping like that, I don't need all the things anyway |
19:06:25 | lqdev[m] | but with nimterop it's plain convenient |
19:06:25 | shashlick | @krux02 - it is the same goal as c2nim, but uses tree-sitter to parse C source and generates nim wrappers from that |
19:08:19 | krux02 | aparently it does something wrong |
19:08:27 | krux02 | probably a wrong prefix set somewhere |
19:08:44 | shashlick | @lqdev - why -lasound -lpulse -ljack |
19:08:45 | krux02 | that is why everything get's prefixed with this __ |
19:08:46 | lqdev[m] | this `__imp_` thing seems to be mingw specific |
19:08:47 | shashlick | do you need all |
19:08:58 | lqdev[m] | shashlick: I changed it locally |
19:09:16 | lqdev[m] | just need to push the commit that fixes this |
19:09:45 | krux02 | well, when it is mingw specific, you can try to compile with clang then |
19:10:27 | lqdev[m] | another thing to download on my shitty internet, great |
19:10:28 | shashlick | lqdev - device.nim compiled just fine on ubuntu |
19:10:30 | shashlick | you on windows? |
19:10:33 | lqdev[m] | yes |
19:10:56 | lqdev[m] | also the laptop I'm testing on is not mine, so I'd prefer to not download too many things |
19:14:38 | shashlick | getting different linker errors - what windows libs need to be linked? |
19:14:49 | shashlick | `__imp_CoInitializeEx' |
19:15:10 | lqdev[m] | -lole32 -lwinmm for sure |
19:16:02 | shashlick | i added -lole32 and it compiles fine for me |
19:16:12 | lqdev[m] | huh |
19:16:18 | lqdev[m] | I wonder why it doesn't compile for me |
19:16:23 | shashlick | i'm using mingw 8.1.0 though |
19:16:35 | shashlick | x86_64-w64-mingw32 |
19:16:51 | lqdev[m] | what mingw does nim bundle? |
19:16:53 | shashlick | gcc version 8.1.0 (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) |
19:16:55 | lqdev[m] | and how can I override it? |
19:17:07 | shashlick | nim downloads an older version |
19:17:18 | shashlick | 6.3.0 or something |
19:17:24 | lqdev[m] | that's what i thought |
19:17:37 | lqdev[m] | fortunately I installed mingw separately |
19:17:44 | lqdev[m] | how can I override the version nim uses/ |
19:17:45 | lqdev[m] | ? |
19:17:46 | shashlick | https://sourceforge.net/projects/mingw-w64/files/ |
19:17:52 | lqdev[m] | yeah this one |
19:17:58 | shashlick | just change your path or edit nim.cfg |
19:19:27 | lqdev[m] | I have mingw-w64 gcc in my path, where's nim.cfg? |
19:19:33 | lqdev[m] | I can't find it |
19:20:46 | lqdev[m] | nvm I think I got it |
19:21:35 | * | nsf quit (Quit: WeeChat 2.4) |
19:22:33 | shashlick | how do you put a try/catch block around a body passed in a macro |
19:22:39 | shashlick | anyone doen that before have code handy? |
19:24:33 | lqdev[m] | changed the path, no luck |
19:26:44 | * | stefanos82 quit (Quit: Quitting for now...) |
19:26:45 | shashlick | try deleting the source and the nimcache |
19:30:07 | lqdev[m] | no luck |
19:33:06 | * | dddddd joined #nim |
19:38:00 | lqdev[m] | the version of GCC I have is `gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)` |
19:45:41 | * | Avatarfighter joined #nim |
19:49:31 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:54:43 | * | kungtotte joined #nim |
19:58:47 | FromGitter | <alehander42> guys do you use bindUnix |
19:59:04 | FromGitter | <alehander42> i get an error |
20:00:11 | Zevv | "an error" |
20:00:59 | Zevv | async or sync bindUnix? |
20:01:09 | Zevv | and what error |
20:03:04 | FromGitter | <alehander42> sorry, async |
20:03:14 | FromGitter | <alehander42> "address family not supported" |
20:03:33 | FromGitter | <alehander42> sorry, i dont know what i am doing |
20:03:38 | FromGitter | <alehander42> was trying to create a named pipe ? :D |
20:03:48 | FromGitter | <alehander42> i will try with port instead |
20:03:50 | FromGitter | <alehander42> (tcp?) |
20:05:00 | Zevv | ah I think the async unix bind is stdlib is mine |
20:05:07 | Zevv | make sure you create the right type of socket to bind on |
20:05:53 | Zevv | Domain = AF_UNIX |
20:05:56 | FromGitter | <alehander42> i was trying to do |
20:05:57 | FromGitter | <Riderfighter> ^ I was going to say that error looks more like an issue with the newSocket that you made |
20:06:06 | FromGitter | <alehander42> var socket = newAsyncSocket() ⏎ socket.setSockOpt(OptReuseAddr, true) ⏎ # socket.bindUnix("/var/run/ct_socket") didnt work ⏎ socket.bindAddr(Port(7_000)) ⏎ socket.listen() [https://gitter.im/nim-lang/Nim?at=5d41f4aebea6966fb04d1e93] |
20:06:34 | FromGitter | <alehander42> ah |
20:06:44 | disruptek | newAsyncSocket(AF_UNIX, SOCK_STREAM, IPPROTO_IP) |
20:06:45 | * | jjido joined #nim |
20:06:50 | Zevv | right-o |
20:06:56 | disruptek | sock.connectUnix("/some/socket") |
20:06:58 | Zevv | and ports make no sense on unix sockets |
20:07:25 | FromGitter | <alehander42> yes , i thought i can make a tcp socket instead |
20:07:29 | FromGitter | <alehander42> if this doesnt work |
20:08:48 | * | Avatarfighter quit (Remote host closed the connection) |
20:11:14 | * | solitudesf quit (Remote host closed the connection) |
20:13:21 | * | solitudesf joined #nim |
20:15:36 | FromGitter | <alehander42> ok now i should think of how to make node listen |
20:15:40 | FromGitter | <alehander42> without eaddruse |
20:16:00 | * | r3c joined #nim |
20:17:12 | * | ofelas joined #nim |
20:19:06 | Zevv | I got a message saying " Error: The fields ''offset'' and ''str'' cannot be initialized together, because they are from conflicting branches in the case object", but I suspect the diagnostics are wrong. Can this test be disabled? |
20:20:07 | FromGitter | <alehander42> ok i needed to use socket |
20:20:11 | FromGitter | <alehander42> not server from 'net' |
20:20:16 | FromGitter | <alehander42> in node |
20:20:28 | r3c | Hi, how to fill this, anybody knows? |
20:20:32 | r3c | var tbl = initTable[int, seq[float32]]() |
20:20:35 | FromGitter | <alehander42> no, aren't they in different branches |
20:20:54 | FromGitter | <alehander42> they would probably overlap, it uses a c union |
20:21:08 | FromGitter | <alehander42> {2: @[0.0]}.toTable() |
20:21:13 | * | solitudesf- joined #nim |
20:21:21 | * | solitudesf- quit (Remote host closed the connection) |
20:21:47 | Zevv | alehander42: they *are* in different branches, but the code triggering this is `Inst(op: opStr, str: s)`. I'm not touching the `offset` field |
20:22:22 | r3c | tbl[0][0] = 4.6 # error, key 0 doesnt exist |
20:22:26 | Zevv | `op` is the discriminator |
20:23:30 | r3c | tbl[0].add(4.6) # error |
20:24:03 | * | solitudesf quit (Ping timeout: 248 seconds) |
20:24:29 | FromGitter | <Riderfighter> r3c: you're table takes a key of int with a value that must be a sequence of float32s |
20:24:38 | FromGitter | <alehander42> r3c well you should first initialize |
20:24:39 | FromGitter | <alehander42> 0 |
20:24:50 | FromGitter | <alehander42> e.g. tbl = {} |
20:24:54 | FromGitter | <alehander42> if you do tbl[0].add |
20:24:57 | FromGitter | <Riderfighter> That too |
20:24:59 | * | Avatarfighter joined #nim |
20:25:10 | FromGitter | <alehander42> you add to tbl[0] but this is an error, as tbl doesnt have 0 |
20:25:12 | FromGitter | <alehander42> yet |
20:25:19 | FromGitter | <alehander42> so you need to e.g. tbl[0] = @[] |
20:25:25 | FromGitter | <Riderfighter> ^ |
20:25:28 | r3c | ugh |
20:25:36 | r3c | let me try |
20:25:39 | FromGitter | <Riderfighter> I feel you |
20:26:25 | FromGitter | <alehander42> one can make a method that autoinitializes it in principle |
20:27:17 | FromGitter | <alehander42> Zevv and you're sure str is in opStr |
20:27:27 | FromGitter | <alehander42> it would be a pretty big bug |
20:27:33 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:27:36 | FromGitter | <alehander42> imho if that's the error |
20:28:31 | Zevv | alehander42: yeah, 100%. Its sued in a lot of places, but this goes through a fishy macro call |
20:29:14 | r3c | alehander42 tnx |
20:29:25 | Zevv | trying to reduce |
20:31:41 | Zevv | reduced: http://ix.io/1QbZ |
20:36:51 | * | sschwarzer joined #nim |
20:40:04 | Zevv | https://github.com/nim-lang/Nim/issues/11862 |
20:41:07 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
20:43:13 | lqdev[m] | shashlick: regarding cross-compilation to windows with nimterop, can't you use `defined(unix) and defined(mingw)` to check when nimterop is being cross-compiled to windows? this is how `-d:mingw` works |
20:46:23 | * | Avatarfighter quit (Quit: Ping timeout (120 seconds)) |
20:50:32 | * | sschwarzer quit (Quit: leaving) |
21:01:40 | FromGitter | <awr1> https://blog.golang.org/why-generics |
21:01:48 | FromGitter | <awr1> remains to be seen if this proposal is successful |
21:03:44 | * | jjido joined #nim |
21:07:25 | * | Trustable quit (Remote host closed the connection) |
21:11:56 | shashlick | @lqdev - problem is that all OS procs won't work correctly |
21:12:27 | shashlick | since nim will set OS to windows and all osseps no longer work correctly for example |
21:12:31 | FromGitter | <awr1> `defined(windows)` should be correct |
21:12:37 | FromGitter | <awr1> even if cross compiling |
21:12:44 | shashlick | there's no separation of compile time vs. runtime |
21:13:27 | FromGitter | <awr1> hm |
21:13:30 | shashlick | if you do -d:mingw, defined(windows) is true, but you are still running on a linux system at compile time |
21:13:43 | shashlick | so DirSep = '\\' |
21:14:06 | FromGitter | <awr1> it seems like your problem is that `when nimvm` is not used enough in the stdlib |
21:14:30 | FromGitter | <awr1> and i guess hopefully that `when nimvm` has "actual OS" correct defines |
21:14:39 | FromGitter | <awr1> i see what you mean |
21:15:57 | * | lritter quit (Quit: Leaving) |
21:16:31 | FromGitter | <alehander42> ah zevv |
21:16:35 | FromGitter | <alehander42> probably quote do |
21:16:41 | FromGitter | <alehander42> does something like copying all the fields |
21:16:43 | FromGitter | <alehander42> of `b` |
21:17:37 | FromGitter | <mratsim> https://hackaday.com/2019/07/30/c20-is-feature-complete-heres-what-changes-are-coming/ |
21:17:46 | FromGitter | <mratsim> C++20 features finalized |
21:21:17 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:25:22 | shashlick | @awr1 - actually, if I could tell what OS i am compiling on, i could solve that issue |
21:25:43 | shashlick | cause i have my own make shift mkdir and what not since os doesn't work at compile time |
21:26:20 | shashlick | there's nothing i can key off of to tell what the OS is, just the target OS |
21:29:33 | * | batok joined #nim |
21:43:37 | * | jjido joined #nim |
21:48:09 | * | jjido quit (Client Quit) |
21:52:37 | FromGitter | <brentp> I am getting a rangeError. how can I compile my code to run as fast as possible (it takes 2.5 hours to get to the part where the bug manifests with -d:danger) but still give a reasonable stack trace? |
21:53:02 | FromGitter | <brentp> I tried `-d:release --excessiveStackTrace:on --rangeChecks:on` but get no useful info. |
21:59:04 | * | al_ joined #nim |
22:00:14 | * | al_ quit (Client Quit) |
22:03:55 | FromGitter | <brentp> trying again with `-d:release --stackTrace:on --lineTrace:on --excessiveStackTrace:on --rangeChecks:on` |
22:06:00 | FromGitter | <mratsim> excessiveStackTrace :? wow |
22:07:19 | FromGitter | <arnetheduck> afair, line/stack tracing causes something like 2-3x slowdown due to how it's implemented |
22:09:14 | * | Vladar quit (Remote host closed the connection) |
22:11:28 | * | solitudesf joined #nim |
22:17:25 | * | solitudesf quit (Ping timeout: 246 seconds) |
22:19:20 | krux02 | @brentp: -d:dange -g |
22:19:28 | krux02 | -g puts in debug information |
22:19:32 | krux02 | ( |
22:19:34 | krux02 | for gdb |
22:19:49 | krux02 | Nim won't be able to create it's own stack traces though, you have to use gdb them |
22:20:08 | krux02 | -d:danger turns on all optimizations |
22:20:17 | krux02 | and disables all runtime checks |
22:21:37 | FromGitter | <alehander42> @brentp also try to use rr like `rr <yourprogram> <args>` |
22:22:04 | krux02 | what is rr? |
22:22:14 | FromGitter | <alehander42> it will record it and you'll be able to replay it many times/go back which is pretty important for similar hard to diagnose bugs |
22:22:28 | FromGitter | <alehander42> https://github.com/mozilla/rr |
22:23:16 | FromGitter | <brentp> ok. if my current incantation does not yield anything informative, I'll try this rr and -g |
22:24:32 | * | HP-YC9 quit (Remote host closed the connection) |
22:25:25 | FromGitter | <alehander42> you need to compile with debug symbols (like `-g`) and after run under rr: usually it adds only ~1.2x slowdown, but after that you can replay it deterministically with rr replay (which exposes a gdb session) |
22:25:55 | FromGitter | <alehander42> which is generally useful for native source |
22:26:11 | FromGitter | <alehander42> but it only works on linux currently |
22:26:40 | krux02 | and intel CPU |
22:26:53 | krux02 | I am not really sold on this rr thing |
22:28:59 | FromGitter | <brentp> ok. i am on linux so i'll give it a try. |
22:29:32 | FromGitter | <alehander42> krux02: well, if it works on your platform, its great |
22:29:56 | FromGitter | <alehander42> its sad that os-es/arch-s dont always have matching primitives for this stuff |
22:30:22 | shashlick | @krux02 - what suggestions for gcasserts |
22:30:36 | krux02 | I also don't really care about this replay thing, because why would I |
22:30:48 | krux02 | what I care about is inspecting data |
22:30:59 | krux02 | and gdb allows be to call arbitrary functions |
22:31:04 | krux02 | I use that to inspect data |
22:31:13 | FromGitter | <alehander42> but its an impressive piece of engineering, i love to read some of its issues, as rocallahan is pretty good in .. well debugging complex stuff |
22:31:24 | FromGitter | <alehander42> krux02: rr also lets you call arb functions |
22:31:32 | FromGitter | <alehander42> it lets you do everything db |
22:31:35 | FromGitter | <alehander42> gdb lets you do |
22:31:44 | FromGitter | <alehander42> but also, you can go back |
22:31:58 | krux02 | I often break the compiler, and then when I want to inspect a nimNode I call a function, the default nim code renderer, to print the node |
22:32:02 | krux02 | really useful |
22:32:10 | FromGitter | <alehander42> but you can do everything you can in gdb, in rr |
22:32:18 | krux02 | in gdb you can go back as well |
22:32:24 | FromGitter | <alehander42> meeeeeeeeeeeeeeeeh |
22:32:25 | FromGitter | <alehander42> no |
22:32:25 | krux02 | I did reversable debugging in gdb |
22:32:28 | FromGitter | <alehander42> its very slow |
22:32:30 | FromGitter | <alehander42> very limited |
22:32:35 | FromGitter | <alehander42> not really usable |
22:32:40 | krux02 | it worked for what I needed. |
22:32:48 | FromGitter | <alehander42> thats why undodb exists and sells for a *lot* of money |
22:32:52 | krux02 | It works with fork() |
22:32:57 | krux02 | so it only works on linux |
22:33:27 | krux02 | so you have to know from where you want to resume, but when that point is known to you, you basically have save states of your program. |
22:33:44 | FromGitter | <alehander42> the other thing is: replay is very important when you |
22:33:52 | FromGitter | <alehander42> hit a hard to reproduce bug |
22:34:02 | krux02 | that is true |
22:34:05 | FromGitter | <alehander42> because then you can replay the right repro as many times you need |
22:34:14 | krux02 | but generally bugs in Nim are reported in a reproducable way |
22:34:27 | krux02 | so that isn't really a problem for Nim development |
22:34:30 | FromGitter | <alehander42> yeah, but the reverse thing is still pretty good |
22:34:41 | FromGitter | <alehander42> but i agree: its sad that it cant work on osx |
22:34:49 | FromGitter | <alehander42> windows do have some similar tech afaik |
22:35:02 | krux02 | does it support the nim pretty printers that I wrote? |
22:35:03 | FromGitter | <alehander42> in windbg, but i havent tried it |
22:35:12 | FromGitter | <alehander42> krux02: rr supports everything gdb supports |
22:35:15 | FromGitter | <alehander42> it runs a gdb server |
22:35:53 | disruptek | now you're talking his language. |
22:36:08 | FromGitter | <alehander42> yeah, it's basically gdb++ |
22:36:41 | FromGitter | <alehander42> i am very biased, as a project i work on is kinda based on rr, so i also wrote many python scripts for it |
22:36:50 | krux02 | then why isn't it in gdb? |
22:36:50 | FromGitter | <alehander42> but i still think its a useful tool objectively |
22:37:02 | krux02 | I mean as a PR for it |
22:37:15 | FromGitter | <alehander42> well, it uses gdb as a component iirc |
22:37:26 | FromGitter | <alehander42> it exposes a gdb server for debugging the replays |
22:38:12 | FromGitter | <alehander42> what i meant was that you can use it as gdb++ if thats what you need |
22:40:39 | FromGitter | <alehander42> but it has other functions, e.g. chaos mode, which tries to find more rare scheduling-related bugs and to record them etc |
22:40:48 | FromGitter | <alehander42> iirc they mostly started it for firefox |
22:42:09 | FromGitter | <brentp> wait, so I can compile with -d:danger as long as I have -g as well? (for gdb?) |
23:00:36 | shashlick | Is it possible to use a C leak detector with Nim |
23:04:18 | krux02 | brentp: yes |
23:04:56 | krux02 | I honestly thing these flags: dager release debug etc, they are all stupid, because what do they mean? |
23:05:03 | krux02 | differnt things for different people |
23:05:21 | krux02 | I thing gcc has actually clean flags here |
23:05:27 | krux02 | -g for debugging symbols |
23:05:49 | krux02 | and -O1 to -O3 for optimization level. |
23:06:09 | r3c | @shashlick You can use Valgrind |
23:06:59 | krux02 | I made sure that -g is a valid flag for Nim as well. Bascally that flag is forwarded for the C compiler. |
23:07:20 | shashlick | Valgrind is not known to work with Nim |
23:07:55 | disruptek | how can i properly, fully, completely `make clean` in my Nim directory? |
23:09:21 | FromGitter | <alehander42> krux02 btw i use gcc.options.debug = "-O0 -g3" |
23:09:27 | FromGitter | <alehander42> because i had some problems with -Og |
23:09:28 | FromGitter | <alehander42> iirc |
23:09:39 | FromGitter | <alehander42> it still led to some optimized out |
23:12:58 | FromGitter | <alehander42> oh yes, finally my node<->nim ipc |
23:16:55 | rayman22201 | @shashlick, I haven't kept up, but I thought valgrind worked with Nim? A (old) forum post from Araq says it does: https://forum.nim-lang.org/t/3919#24424 |
23:17:14 | rayman22201 | maybe things have changed though |
23:18:08 | FromGitter | <alehander42> hm i need to send stuff back |
23:18:13 | disruptek | i think clybber uses it with valgrind all the time. |
23:18:48 | FromGitter | <alehander42> he uses the new runtime i think |
23:19:03 | FromGitter | <alehander42> iirc with malloc ? |
23:19:15 | FromGitter | <alehander42> which helped with using it |
23:19:18 | FromGitter | <alehander42> but i might be wrong! |
23:19:35 | rayman22201 | I know 100% that newruntime or gc:none + --usemalloc will work with any C leak detector. I bet that is not what shashlick was hoping for though :-) |
23:19:52 | FromGitter | <alehander42> yea :( |
23:20:06 | FromGitter | <alehander42> whats the problem with valgrind + gc? |
23:21:17 | FromGitter | <alehander42> ok two directions |
23:21:25 | FromGitter | <alehander42> now i need to encode with json my ipc messages |
23:22:38 | rayman22201 | idk for sure, but I would guess valgrind doesn't work because it can't see inside the GC mechanisms. The GC handles the memory management internally, only occasionally mallocing or mmaping large chunks, and never frees back to the OS. |
23:23:15 | rayman22201 | valgrind and the like expect C like behavior, where you malloc and free in a C like way. |
23:33:44 | FromGitter | <awr1> @shashlick maybe an RFC could be useful? nim compiler internals already make a distinction between "host OS" and "compiled-to OS" |
23:34:30 | FromGitter | <awr1> i'm spitballing here but something like `when hostOS == windows:`, `when targetOS == windows` etc. |
23:52:36 | * | gokr quit (Ping timeout: 258 seconds) |