00:27:18 | * | rockcavera joined #nim |
01:12:18 | * | SchweinDeBurg quit (Quit: WeeChat 4.7.0-dev) |
01:35:30 | * | rockcavera quit (Remote host closed the connection) |
02:15:22 | * | skippy8 quit (Quit: WeeChat 4.5.2) |
02:54:18 | FromDiscord | <lainlaylie> salewski's nim book purports to teach programming from scratch with nim |
02:55:17 | FromDiscord | <lainlaylie> the choice of first language doesnt really matter as long as the language is simple and well documented enough, the goal is just to familiarize yourself with the basic programming concepts: variables, functions, etc |
04:16:51 | * | SchweinDeBurg joined #nim |
04:45:19 | * | amadaluzia joined #nim |
05:53:46 | * | amadaluzia quit (Ping timeout: 252 seconds) |
06:10:58 | * | ntat joined #nim |
07:11:29 | * | ntat quit (Read error: Connection reset by peer) |
07:11:50 | * | ntat joined #nim |
07:21:54 | * | ntat quit (Quit: leaving) |
07:23:08 | * | jjido joined #nim |
07:28:20 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
07:37:01 | * | skippy8 joined #nim |
08:20:56 | * | beholders_eye joined #nim |
10:07:21 | * | PMunch joined #nim |
10:24:35 | FromDiscord | <pmunch> Is there an easy way to check whether block returns something or not? |
10:25:02 | FromDiscord | <pmunch> I want to create a template or macro that allows me to easily retry things which can fail |
10:25:34 | FromDiscord | <pmunch> Something like `retry(myFunc(), 5)`, that will try to run `myFunc` until it completes okay with a maximum of five times |
10:25:57 | FromDiscord | <pmunch> But I need to collect and pass on the result if `myFunc()` would return something |
11:10:36 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#pasty=iwiPUbQy |
11:40:42 | * | ntat joined #nim |
12:01:12 | * | ntat quit (Read error: Connection reset by peer) |
13:46:44 | FromDiscord | <jseb> should i use this https://nim-lang.org/docs/syncio.html#File , for file operations ? |
13:47:40 | * | PMunch_ joined #nim |
13:50:06 | FromDiscord | <jseb> ok, i was confused because i had read about os file module too, but this last one is tied to directory management |
13:50:44 | * | PMunch quit (Ping timeout: 265 seconds) |
13:51:18 | FromDiscord | <jseb> and reading `File = ptr CFile` at the very beginning was a bit strange (i was thinking it could be for wrapping C) |
13:55:25 | FromDiscord | <janakali> it is wrapping C (libc specifically), as almost everything os-related in Nim stdlib |
14:01:29 | FromDiscord | <aintea> I have an option type, when I try to print the `option.isSome` it prints true, but when I `option.get` just after I get a segfault |
14:01:33 | FromDiscord | <aintea> Love i |
14:01:35 | FromDiscord | <aintea> (edit) "i" => "it" |
14:04:36 | * | przmk quit (Remote host closed the connection) |
14:06:28 | * | przmk joined #nim |
14:10:26 | FromDiscord | <jseb> @aintea : try `option.get(-1)` , it will return -1 if there is no value to get |
14:10:43 | FromDiscord | <aintea> yeah but isSome is returning true |
14:11:12 | FromDiscord | <jseb> can i see the whole part ? |
14:11:39 | FromDiscord | <aintea> it's a thousand lines long file |
14:11:50 | FromDiscord | <aintea> but it seems like the problem came from strformat, not `.get` |
14:13:31 | FromDiscord | <aintea> still there |
14:13:36 | FromDiscord | <aintea> let me push the code |
14:15:00 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=uZLRvynW |
14:17:58 | FromDiscord | <jseb> yes,it's a big one. « illegal storage access » |
14:22:28 | FromDiscord | <jseb> but when i was saying « the whole code » , i was more thinking of a working subset |
14:23:00 | FromDiscord | <aintea> everything works together |
14:23:08 | FromDiscord | <aintea> you can't take one part without another |
14:23:42 | FromDiscord | <aintea> but basically I have a list, I get the first item, i do operations on it, it outputs a string, I do other operations on it it gives me a Argument type and I wrap it into an option |
14:28:24 | FromDiscord | <tapeda> In reply to @pmunch "But I need to": Iterate ast and check for a return statement? Wdym that's easy, no? Implicit results definitely makes it trickier, but they're still always at the end of a branch ig.😬 |
14:29:31 | FromDiscord | <tapeda> In reply to @tapeda "Iterate ast and check": But if the return is a result tuple that makes it easier again, depends on how generically you need the macro to work. |
14:29:52 | * | skippy8 quit (Quit: WeeChat 4.5.2) |
14:38:46 | FromDiscord | <pmunch> In reply to @tapeda "Iterate ast and check": Any answer starting with "iterate the AST" is an incorrect answer 😅 |
14:39:09 | FromDiscord | <pmunch> Unless you want to completely reimplement a lot of the compiler |
14:39:35 | FromDiscord | <pmunch> I ended up with `if typeof(x) != void` |
14:47:08 | FromDiscord | <tapeda> In reply to @pmunch "Unless you want to": yes well Þetta is the fun of plugins |
14:49:45 | FromDiscord | <tapeda> In reply to @pmunch "I ended up with": doesn't that work in a template? So just like `when typeof x != void;var tries: int; if tries < 5 and success == false: body` |
14:50:22 | FromDiscord | <tapeda> (edit) "In reply to @pmunch "I ended up with": doesn't that work in a template? So just like `when typeof x != void;var tries: int; if tries < 5 and success == false: ... body`" added "tries++;" |
14:50:43 | FromDiscord | <tapeda> (edit) "success == false:" => "not success:" |
15:01:36 | FromDiscord | <lainlaylie> https://media.discordapp.net/attachments/371759389889003532/1374039291293864036/voice-message.ogg?ex=682c994f&is=682b47cf&hm=c05b48b5e9f4976a3207e4fbb8c0e58fcef39ca70f9a7341e44cf940e9405097& |
15:02:08 | FromDiscord | <pmunch> Not sure if I'm following. I have a `when typeof` check to see if I need to create a return value. Then my retry logic, then a new check to see if I need to return anything |
15:02:46 | FromDiscord | <pmunch> And what does plugins have to do with anything? |
15:03:48 | FromDiscord | <tapeda> ah you make a return value too :D |
15:37:45 | * | ntat joined #nim |
15:39:49 | FromDiscord | <janakali> sent a code paste, see https://play.nim-lang.org/#pasty=nFZWIYbk |
15:40:14 | FromDiscord | <aintea> Yes I forgot to say I solved it |
15:40:28 | FromDiscord | <aintea> it looks like wrongly ORC generated code |
15:41:24 | FromDiscord | <aintea> the error is that I'm trying to access a field that is not existing in the variant |
15:41:41 | FromDiscord | <aintea> the error only shows up when compiling with refcell as you said |
15:43:47 | * | SchweinDeBurg quit (Quit: WeeChat 4.7.0-dev) |
15:58:08 | FromDiscord | <0xfab_10> nanopass for nim would go hard ngl |
16:35:44 | * | jjido joined #nim |
16:38:32 | FromDiscord | <tapeda> In reply to @fabric.input_output "nanopass for nim would": maybe sometime you could use nanopass with compcert.org and diff till it terminates |
16:51:32 | * | xet7 quit (Ping timeout: 272 seconds) |
17:03:20 | * | xet7 joined #nim |
17:12:55 | FromDiscord | <jseb> `proc open(filename: string; mode: FileMode = fmRead; bufSize: int = -1): File {. ... .}` (in the doc)↵Why do we have to pass a buffer size at this step ? |
17:15:10 | Amun-Ra | you don't have to pass buffer size |
17:15:34 | Amun-Ra | you may pass the size to increase internal cache |
17:16:17 | Amun-Ra | the* |
17:17:28 | FromDiscord | <jseb> i see a function for reading file, which use « pointer ». Is it for C interfacing, as pointer in not traced ? |
17:18:23 | Amun-Ra | if you want to use something higher level use std/streams |
17:18:38 | FromDiscord | <jseb> (edit) "i see ... a?↵I" added "`readBuffer` " | "?" => "?↵I think , if i want to read a whole file, i should use either `readBytes` or `realAll` (for text files)" |
17:18:58 | Amun-Ra | jseb: it's because underlying function uses pointers |
17:20:07 | FromDiscord | <jseb> ok, as it's for reading a json file i think `readAll` will be perfect . String are allocated on the heap, aren't they ? |
17:20:33 | FromDiscord | <jseb> (edit) "ok, as it's for reading a json file i think `readAll` will be perfect . String are allocated on the heap, aren't they ? ... " added "(so no need to worry if the stack is going to explode with big files)" |
17:20:50 | Amun-Ra | yes |
17:21:03 | FromDiscord | <jseb> noted, thank you |
17:21:31 | Amun-Ra | strings are memory managed |
17:30:55 | * | nils` quit (Ping timeout: 276 seconds) |
17:37:30 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
18:08:59 | * | beholders_eye quit (Ping timeout: 252 seconds) |
18:21:23 | FromDiscord | <lainlaylie> std/json supports parsing from Stream |
18:37:18 | * | xet7 quit (Ping timeout: 272 seconds) |
18:44:56 | * | nils` joined #nim |
18:49:23 | * | xet7 joined #nim |
18:59:33 | * | xet7 quit (Ping timeout: 248 seconds) |
19:12:02 | * | xet7 joined #nim |
19:18:39 | * | jjido joined #nim |
19:50:15 | * | skippy8 joined #nim |
20:11:32 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
20:49:09 | * | bcksl quit (Ping timeout: 245 seconds) |
20:50:19 | * | end quit (Ping timeout: 272 seconds) |
21:03:38 | * | beholders_eye joined #nim |
21:18:20 | * | jjido joined #nim |
21:24:56 | * | bcksl joined #nim |
21:29:32 | * | end joined #nim |
21:49:00 | * | bcksl quit (Ping timeout: 260 seconds) |
21:49:35 | * | end quit (Ping timeout: 260 seconds) |
21:51:39 | * | PMunch__ joined #nim |
21:53:53 | * | PMunch_ quit (Ping timeout: 248 seconds) |
21:56:24 | * | ntat quit (Quit: leaving) |
22:20:06 | * | beholders_eye quit (Quit: WeeChat 4.5.1) |
22:23:50 | * | bcksl joined #nim |
22:25:47 | * | rockcavera joined #nim |
22:28:29 | * | end joined #nim |
23:04:41 | FromDiscord | <aintea> LMAO I have another problem with ORC, it segfaults with ORC but compiles and runs fine with refcell |
23:47:17 | * | SchweinDeBurg joined #nim |