00:00:02 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:49 | * | junland joined #nim |
00:05:16 | * | disruptec joined #nim |
00:09:40 | disruptec | so we can build compile nim tests in 100mb of ram but i have a feeling we will need a little more oomph for linking. |
00:09:52 | disruptec | s/build// |
00:11:01 | * | krux02_ joined #nim |
00:14:48 | * | krux02 quit (Ping timeout: 260 seconds) |
00:16:17 | * | gangstacat quit (Quit: Ĝis!) |
00:18:27 | FromGitter | <kennymalac> hey, best practices for destructing objects you intend to use as as ref objects ? |
00:18:34 | FromGitter | <kennymalac> thinking TaskSink* = ref TaskSinkObj |
00:18:38 | FromGitter | <kennymalac> and then TaskSinkObj = object |
00:18:50 | FromGitter | <kennymalac> and all methods refer to self as var TaskSinkObj ? |
00:24:28 | * | Guest50261 quit (Ping timeout: 265 seconds) |
00:26:19 | disruptec | no, you will use the ref for most ops and then sink the obj. |
00:29:53 | * | dadada joined #nim |
00:30:17 | * | dadada is now known as Guest93348 |
00:33:35 | * | ptdel_ joined #nim |
00:34:27 | * | ptdel quit (Ping timeout: 268 seconds) |
00:36:15 | * | ptdel joined #nim |
00:36:36 | * | ptdel_ quit (Read error: Connection reset by peer) |
00:38:55 | Yardanico | disruptec: what happened to disruptek?!?! |
00:47:47 | disruptec | he aroun' |
00:50:25 | FromGitter | <kennymalac> @disruptec so what about in the destructor? in the destructor I need to call a couple of methods, should those methods refer to the obj then? |
00:50:57 | disruptec | yeah; the destructor runs on the obj. |
00:52:44 | FromGitter | <kennymalac> okay thanks |
00:53:02 | FromGitter | <kennymalac> on an unrelated note, my startup is using nim heavily in our stack, it's our secret weapon >:) |
00:53:44 | disruptec | what's the product? |
00:54:16 | * | Trustable quit (Remote host closed the connection) |
00:55:27 | FromGitter | <kennymalac> a big data visualization platform for creating dashboards with their own pages and APIs |
00:55:53 | disruptec | nice. |
01:00:47 | * | Hideki_ joined #nim |
01:03:29 | * | ng0 quit (Quit: leaving) |
01:04:47 | * | lritter quit (Ping timeout: 265 seconds) |
01:05:03 | * | lritter joined #nim |
01:09:31 | leorize | I guess we need better integration of destructors with ref objects |
01:14:16 | * | ng0 joined #nim |
01:14:16 | * | ng0 quit (Changing host) |
01:14:16 | * | ng0 joined #nim |
01:19:02 | * | theelous3 quit (Ping timeout: 268 seconds) |
01:29:43 | * | ng0 quit (Ping timeout: 265 seconds) |
01:33:34 | * | Hideki_ quit (Remote host closed the connection) |
01:33:48 | * | Hideki_ joined #nim |
01:43:00 | disruptec | i really hope this plague doesn't reach brussels. |
02:03:27 | * | couven92 quit (Quit: Client Disconnecting) |
02:04:55 | disruptek | what's wrong with our destructors and ref objects? |
02:05:40 | disruptek | kennymalac: if we can help, don't hesitate to reach out. |
02:44:28 | * | cron joined #nim |
02:45:00 | leorize | disruptek: we don't have any syntax to define destructors for ref objects |
02:46:25 | FromDiscord_ | <Kami> lol |
02:46:32 | FromDiscord_ | <Kami> how fucking unpopulated is this language |
02:52:53 | * | lritter quit (Ping timeout: 260 seconds) |
03:01:13 | * | Hideki_ quit (Remote host closed the connection) |
03:01:58 | * | Hideki_ joined #nim |
03:04:47 | FromGitter | <zetashift> what does that even mean, even the cursing seems unnecessary |
03:06:35 | * | Hideki_ quit (Ping timeout: 265 seconds) |
03:15:39 | Zevv | leorize: how do you mean? Is `=destroy(o: var obj)` not enough? |
03:15:41 | * | Hideki_ joined #nim |
03:16:04 | leorize | Zevv: type Obj = ref object |
03:16:17 | leorize | that's a valid pattern that we should support |
03:23:46 | disruptec | i think the language shouldn't abstract the fact that memory is memory. |
03:28:41 | Zevv | leorize: I dont understand your problem. It destructs ref objects fine, but you want to be able to differentiete between object destructors and ref object destructors? |
03:40:43 | * | disruptec quit (Ping timeout: 260 seconds) |
03:47:41 | * | muffindrake quit (Ping timeout: 246 seconds) |
03:50:01 | * | muffindrake joined #nim |
03:52:21 | * | a_chou joined #nim |
03:53:09 | * | a_chou quit (Remote host closed the connection) |
03:53:36 | * | a_chou joined #nim |
03:57:33 | * | a_chou quit (Remote host closed the connection) |
03:59:04 | * | Hideki_ quit (Remote host closed the connection) |
03:59:50 | * | Hideki_ joined #nim |
04:01:18 | leorize | Zevv: you can't define a destructors for a type Obj = ref object |
04:01:33 | leorize | you gotta use the old style type Obj = object; Ref = ref object |
04:04:38 | * | Hideki_ quit (Ping timeout: 260 seconds) |
04:23:53 | disruptek | but that's /what it is/. |
04:24:25 | disruptek | it's not a ref when you're operating on it in a destructor. it's a chunk of memory, not a pointer. |
04:25:02 | FromDiscord_ | <demotomohiro> @leorize you can define a destructor for ref object types like this: |
04:25:02 | FromDiscord_ | <demotomohiro> https://wandbox.org/permlink/RtqOIvY4WsKY0hxK |
04:26:14 | disruptek | madness. |
04:28:59 | * | chemist69 quit (Ping timeout: 246 seconds) |
04:31:17 | * | chemist69 joined #nim |
04:33:24 | * | gangstacat joined #nim |
04:33:45 | * | krux02_ quit (Remote host closed the connection) |
04:35:33 | * | Guest93348 quit (Ping timeout: 260 seconds) |
04:37:21 | * | dadada joined #nim |
04:37:45 | * | dadada is now known as Guest76816 |
06:16:33 | * | narimiran joined #nim |
06:37:44 | * | dddddd quit (Remote host closed the connection) |
06:38:50 | * | nsf joined #nim |
06:40:03 | * | Pqzcih5 quit (Remote host closed the connection) |
07:46:22 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
07:50:22 | * | solitudesf joined #nim |
07:59:22 | Zevv | Ah now I get your point. If you definition skips the object itself, you do not have the type available to pass to the =destruct |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:05:12 | * | gmpreussner joined #nim |
08:27:09 | * | nsf quit (Quit: WeeChat 2.7) |
08:35:52 | * | cron quit (Quit: Leaving.) |
08:41:42 | * | ng0 joined #nim |
08:41:48 | * | ng0 quit (Changing host) |
08:41:48 | * | ng0 joined #nim |
08:55:57 | * | Vladar joined #nim |
09:52:53 | * | tane joined #nim |
09:55:36 | * | nsf joined #nim |
10:00:04 | * | libercv joined #nim |
10:02:01 | FromDiscord_ | <Zachary Carter> so thinking more bout my issue - I don't think parallelism is going to help me |
10:02:20 | FromDiscord_ | <Zachary Carter> right now I have a bottleneck in my procedural level generation, where pathfinding on larger maps is taking forever |
10:02:45 | FromDiscord_ | <Zachary Carter> but I can't parallelize the pathfinding, because the next pathfinding iteration is dependent on the previous one having been completed |
10:03:10 | FromDiscord_ | <Zachary Carter> so I guess I need to either optimize the pathfinding algorithm implementation or figure out a way to not perform so many iterations |
10:03:23 | FromDiscord_ | <Zachary Carter> essentially I have a map which represents a spaceship with a bunch of rooms |
10:03:31 | FromDiscord_ | <Zachary Carter> so I iterate over all of the rooms twice and run A* between them |
10:03:44 | FromDiscord_ | <Zachary Carter> to figure out where I can place hallways / corridors between the rooms |
10:10:57 | * | liber joined #nim |
10:11:38 | * | liber quit (Client Quit) |
10:14:25 | Zevv | https://factorio.com/blog/post/fff-317 |
10:14:30 | Zevv | zachary ^ |
10:19:45 | FromDiscord_ | <Zachary Carter> thanks! I'll check this out |
10:32:44 | * | libercv quit (Quit: Leaving) |
11:15:27 | * | chemist69 quit (Ping timeout: 260 seconds) |
11:16:30 | * | chemist69 joined #nim |
11:24:19 | * | NimBot joined #nim |
11:28:17 | * | narimiran quit (Ping timeout: 265 seconds) |
11:53:50 | * | krux02 joined #nim |
12:02:39 | * | couven92 joined #nim |
12:09:50 | * | Hideki_ joined #nim |
12:24:10 | * | nsf quit (Quit: WeeChat 2.7) |
12:24:57 | * | dddddd joined #nim |
12:27:26 | * | Hideki_ quit (Remote host closed the connection) |
12:35:26 | * | dddddd_ joined #nim |
12:37:41 | * | dddddd quit (Ping timeout: 265 seconds) |
12:37:57 | * | dddddd_ is now known as dddddd |
12:54:44 | Yardanico | btw, what's the status of --gc:arc with async? should I test it or it's too early? :P |
12:54:53 | Yardanico | valgrind + -d:useMalloc --gc:arc right? |
13:17:23 | Zevv | right |
13:22:52 | Zevv | right |
13:23:54 | Yardanico | ok xd |
13:24:34 | Zevv | nah that was a mere up+enter in the wrong window :) |
13:40:43 | * | nsf joined #nim |
14:18:07 | * | Jesin joined #nim |
14:21:17 | * | couven92 quit (Read error: Connection reset by peer) |
14:21:42 | * | couven92 joined #nim |
14:35:35 | Yardanico | damn forum.nim-lang.org's main JS script is compiled by 0.18.1 lol |
14:35:37 | Yardanico | "/* Generated by the Nim Compiler v0.18.1 */" |
14:44:26 | * | Hideki_ joined #nim |
14:56:36 | * | sentreen quit (Ping timeout: 265 seconds) |
14:57:20 | FromDiscord_ | <Recruit_main_70007> parseInt() doesnt work with a cstring? |
14:57:27 | FromDiscord_ | <Recruit_main_70007> what should i use then |
14:57:54 | * | sentreen joined #nim |
14:59:10 | * | jholland__ joined #nim |
14:59:16 | FromDiscord_ | <Rika> convert it to a string i think? |
14:59:36 | FromDiscord_ | <Recruit_main_70007> how? |
15:01:05 | Zevv | $ it |
15:01:11 | Zevv | parseInt($v) |
15:02:01 | FromDiscord_ | <Recruit_main_70007> thx |
15:03:12 | * | lritter joined #nim |
15:04:48 | FromDiscord_ | <Recruit_main_70007> i dont know if this is intended, |
15:04:49 | FromDiscord_ | <Recruit_main_70007> you have to call it this way: |
15:04:49 | FromDiscord_ | <Recruit_main_70007> parseInt($currentval) |
15:04:49 | FromDiscord_ | <Recruit_main_70007> and |
15:04:49 | FromDiscord_ | <Recruit_main_70007> $currentval.parseInt() |
15:04:49 | FromDiscord_ | <Recruit_main_70007> wont work. |
15:07:17 | Yardanico | because ambiguity I think |
15:07:29 | Yardanico | does $ here relate to currentval or result of parseInt ? |
15:07:37 | Yardanico | ($currentval).parseInt will work btw |
15:09:22 | FromDiscord_ | <Recruit_main_70007> thats enough for me, i think it would be nice if those parenthesis were not neccesary though |
15:09:38 | Yardanico | well as I said it would be ambiguous |
15:10:09 | FromDiscord_ | <Recruit_main_70007> why |
15:10:35 | Yardanico | should it do $ on currentvar.parseInt() |
15:10:42 | Yardanico | or on currentvar and then parseInt? |
15:11:44 | Yardanico | well I think that it's because of this |
15:11:55 | * | theelous3 joined #nim |
15:12:15 | FromDiscord_ | <Recruit_main_70007> do you prefer to have those parenthesis, rather than using one of those two as a default way of parsing it? |
15:12:30 | Zevv | $ has lower precedence. |
15:12:33 | Yardanico | ^ |
15:12:47 | Yardanico | I think it would actually break code if you were to change that, and some other horrible things |
15:13:29 | Zevv | the precedence of $ is usually right, there is a reason why it is what it is |
15:14:23 | FromDiscord_ | <Recruit_main_70007> oh, ok, i feel like that should not be that way, but who am i to decide how it should go, thats the only syntax dislike i have of nim for know |
15:14:42 | FromDiscord_ | <Recruit_main_70007> now* |
15:14:49 | Zevv | for exmple, what would you expect from $time.now() |
15:15:41 | FromDiscord_ | <Recruit_main_70007> true, it basically depends on what are you trying to do |
15:19:17 | * | ng0_ joined #nim |
15:19:17 | * | ng0_ quit (Changing host) |
15:19:17 | * | ng0_ joined #nim |
15:22:13 | * | ng0 quit (Ping timeout: 265 seconds) |
15:28:59 | * | nsf quit (Quit: WeeChat 2.7) |
15:34:24 | * | Hideki_ quit (Remote host closed the connection) |
15:35:11 | * | Hideki_ joined #nim |
15:39:51 | FromDiscord_ | <Rika> ah, classic "importing monotimes" again |
15:40:06 | * | Hideki_ quit (Ping timeout: 265 seconds) |
15:51:16 | * | couven92 quit (Read error: Connection reset by peer) |
15:51:43 | * | couven92 joined #nim |
15:54:56 | * | Hideki_ joined #nim |
16:08:14 | * | disruptec joined #nim |
16:17:12 | * | abm joined #nim |
16:30:10 | * | ptdel joined #nim |
16:41:05 | * | cron joined #nim |
16:47:14 | * | Hideki_ quit (Remote host closed the connection) |
16:48:01 | * | Hideki_ joined #nim |
16:52:36 | * | Hideki_ quit (Ping timeout: 265 seconds) |
17:00:17 | * | Hideki_ joined #nim |
17:02:01 | * | Hideki_ quit (Remote host closed the connection) |
17:02:46 | * | Hideki_ joined #nim |
17:04:23 | * | nsf joined #nim |
17:07:23 | * | Hideki_ quit (Ping timeout: 265 seconds) |
17:15:29 | disruptek | leorize: seems like ]## isn't terminating the comment syntax. |
17:30:19 | * | Guest76816 is now known as dadada |
17:41:46 | * | Hideki_ joined #nim |
17:47:05 | * | dadada quit (Remote host closed the connection) |
17:47:46 | * | couven92 quit (Read error: Connection reset by peer) |
17:48:12 | * | couven92 joined #nim |
17:55:00 | * | seni joined #nim |
17:57:32 | Araq | I'm back. |
17:57:41 | disruptek | wb |
17:57:51 | Araq | got the binary trees benchmark down to 7.8s |
17:58:08 | disruptek | that's, like, a real performance win. |
17:58:09 | Araq | manual alloc() is still 1s faster |
17:58:25 | disruptek | within striking distance, though. |
17:58:40 | Araq | yup |
17:58:59 | disruptek | what did you change? |
17:59:14 | Araq | but with =destroy I can also implement object pooling and then I'm at 2.4s |
17:59:39 | disruptek | that always was the promise of this architecture. |
18:00:00 | disruptek | anyway, what's avoiding manual alloc worth to you? |
18:00:24 | Araq | quite a lot, MM is a hard problem |
18:00:37 | disruptek | yes. i don't mind waiting another second. |
18:01:31 | disruptek | i think we'll be able to do pools and stuff automagically. |
18:01:57 | Araq | quite. |
18:02:11 | Araq | I have some ideas how to do that, yes |
18:02:24 | Araq | but currently it's semi-manual, very nice too |
18:03:04 | disruptek | yeah, people have to look at this stuff with a longer development horizon. |
18:03:25 | disruptek | that's why i don't understand the consternation... |
18:04:39 | Araq | anyhow the pool is 30 lines of code |
18:04:45 | Araq | could put it into the stdlib |
18:05:45 | disruptek | seems like it's too early; don't want it to become day-one-debt. |
18:06:03 | disruptek | there's so much room to manuever right now. |
18:06:25 | Araq | we have std / x though and 'std' means 'experimental' |
18:06:31 | Araq | :P |
18:06:39 | disruptek | only in araqlogic. |
18:07:12 | Araq | the other logics are all defective |
18:07:17 | disruptek | my sub-3s ci is running at 15s. so far, you're right. but it is early days. |
18:07:53 | Araq | so... does nimph run with --gc:arc? |
18:08:00 | disruptek | not unless you fixed nre. |
18:08:12 | Yardanico | he did |
18:08:37 | Yardanico | and btw, why not nim-regex? it didn't work for you? |
18:08:46 | Yardanico | I mean https://github.com/nitely/nim-regex |
18:09:09 | Yardanico | "syntax is similar to PCRE but lacks a few features that can not be implemented while keeping the space/time complexity guarantees, i.e.: backreferences and look-around assertions." |
18:09:35 | disruptek | because i wanted bump to not have the extra requirement. nimph didn't exist and reqs were a pita. |
18:09:53 | * | cron quit (Quit: Leaving.) |
18:10:02 | Yardanico | but I think having a nim lib as a requirement is better than having a pcre lib as a requirement :D |
18:10:03 | * | salewski joined #nim |
18:10:19 | disruptek | bump works in arc. |
18:10:25 | * | Hideki_ quit (Ping timeout: 265 seconds) |
18:10:54 | disruptek | you're right, of course. |
18:10:59 | disruptek | nimph works in arc. |
18:11:15 | Araq | better wait for the CI results |
18:11:30 | Yardanico | just clone all nim libs/projects from github and check them all with --gc:arc XD |
18:11:50 | Yardanico | wasn't there a repo where some guy made a local distro made out of all packages in nimble |
18:11:55 | Yardanico | I can't remember the name of that repo now |
18:11:57 | disruptek | so the way my ci works is that you can use lambda layers to create "distributions". |
18:12:26 | disruptek | you mix/match up to 5 layers with the compiler of choice. |
18:12:42 | disruptek | obviously, this can all happen JIT. |
18:13:26 | FromGitter | <kennymalac> Hey all, how do I get a ptr to a C-style array? nim-zmq does this to call zmq's poll function: proc poll*(items: ptr TPollItem, nitems: cint, timeout: clong): cint{. ⏎ cdecl, importc: "zmq_poll", dynlib: zmqdll.} |
18:13:36 | disruptek | so every git tree for every package, including the compiler, is a layer. and layers can mix even if they overwrite each other. |
18:13:49 | FromGitter | <kennymalac> I have an array like so let items: array[2, TPollItem] = [TPollItem(...), ...] |
18:14:08 | FromGitter | <Yardanico> addr items[0] |
18:14:14 | FromGitter | <kennymalac> trying to do poll(addr(items), 2, -1) |
18:14:25 | FromGitter | <kennymalac> oh okay |
18:14:41 | FromGitter | <Yardanico> well I think it should work with addr items[0], basicall you get the pointer to the first element in an array |
18:14:47 | FromGitter | <kennymalac> indeed |
18:15:09 | disruptek | Araq: great work. |
18:16:25 | salewski | gcc 10 can generate really small executables! |
18:16:34 | salewski | nim c --gc:arc -d:danger --passC:-flto board.nim |
18:16:59 | Yardanico | does code compiled with LTO benefit both in binary size and performance? |
18:17:01 | salewski | Executable size is only 126k, was 154k with gcc 9.2 |
18:17:26 | Yardanico | like is it worth using it in nim programs (well, of course where most performance is needed) ? |
18:17:28 | disruptek | is it tree shaking? |
18:18:33 | salewski | Performance is generally good for LTO, but with gcc 9.2 I had a test where performance without LTO was better. |
18:18:40 | Yardanico | https://github.com/search?q=language%3Anim+--gc%3Aarc&type=Code |
18:18:51 | Yardanico | some packages already run tests with --gc:arc too :P |
18:19:32 | FromGitter | <kennymalac> @Yardanico I still get Error: expression has no address; maybe use 'unsafeAddr' |
18:19:38 | Yardanico | ah right |
18:19:38 | salewski | Will push ARC enabled gintro version tomorow, bye. |
18:19:42 | Yardanico | you should declare it as "var", not "let" |
18:19:44 | * | salewski quit (Quit: WeeChat 2.6) |
18:19:46 | FromGitter | <kennymalac> oh shit |
18:19:55 | FromGitter | <kennymalac> I shouldn't be calling it items as well XD |
18:20:09 | Yardanico | "let" is considered immutable, and you can't get it's pointer with "addr" |
18:20:15 | Yardanico | you can with unsafeAddr, but you really shouldn't xd |
18:20:33 | FromGitter | <kennymalac> ye |
18:21:04 | Yardanico | disruptek: btw, I found out cutelog, looks nice |
18:21:17 | Yardanico | although I made this little snippet for myself for simple logging https://gist.github.com/Yardanico/0bcf50c05b71ae8990529ea0913ac068 |
18:21:40 | FromGitter | <kennymalac> is one of the guys behind the nim mongodb client here? |
18:21:54 | FromGitter | <kennymalac> it's incomplete and I was thinking at some point I could sponsor the project |
18:21:58 | Yardanico | you mean SSPkrolik? |
18:22:15 | FromGitter | <Yardanico> @SSPkrolik ^ |
18:22:24 | FromGitter | <Yardanico> i'm not sure if he's active here though, never seen him really |
18:22:57 | FromGitter | <Yardanico> maybe you can try opening an issue in the repo |
18:23:17 | Yardanico | honestly as bad as it sounds I wouldn't mind it if GitHub had a private message feature |
18:23:35 | Yardanico | (of course with the ability to turn it off if you don't want to) |
18:24:52 | FromGitter | <kennymalac> indeed |
18:24:58 | FromGitter | <kennymalac> does github sponsors charge fees? |
18:25:22 | Yardanico | "GitHub will not charge fees for GitHub Sponsors. And to celebrate the launch, we’ll cover payment processing costs for the first year of the program—through May 2020! " |
18:25:34 | FromGitter | <kennymalac> nice |
18:26:15 | Yardanico | although minimal payout is $100 |
18:34:11 | FromGitter | <kennymalac> I could probably do $100/month |
18:34:21 | FromGitter | <kennymalac> well, my company :P |
18:35:18 | Yardanico | well, sadly it seems like the author didn't really do any changes himself for a very, very long time |
18:36:03 | FromGitter | <kennymalac> https://github.com/SSPkrolik/nimongo/issues/80 |
18:36:04 | disbot | ➥ Github sponsors for this repo |
18:36:09 | FromGitter | <kennymalac> added an issue |
18:36:19 | Yardanico | well, he did one code change in 2018 (to fix nim 0.19) and one change in 2016 |
18:36:22 | Araq | he switched carriers |
18:36:27 | Yardanico | all others are either doc changes or merges |
18:36:32 | Araq | he is a teacher now iirc |
18:36:44 | FromGitter | <kennymalac> carriers? |
18:36:49 | FromGitter | <kennymalac> oh careers |
18:36:49 | Yardanico | careers :P |
18:36:59 | Araq | yeah, too tired |
18:37:00 | Araq | sorry |
18:37:04 | Yardanico | I think that most people in this chat are not native english speakers anyway :) |
18:37:25 | Araq | in my defense, I knew it was wrong :P |
18:37:31 | FromGitter | <kennymalac> winners don't say sorry @Araq and you're a winner |
18:37:56 | disruptek | ~araq |
18:37:57 | disbot | araq: 11👑 the powers that He 👑 -- disruptek |
18:38:16 | FromGitter | <kennymalac> yeah we're using mongodb and nim, we probably have to use the mongo HTTP API which kind of sucks |
18:38:22 | Yardanico | I prefer not to ping important people unless there's a reason to :P |
18:38:26 | FromGitter | <kennymalac> and is slow in comparison |
18:38:33 | Yardanico | just do it like ar*q or d0m96 |
18:39:00 | FromGitter | <kennymalac> ehh I highlite people all the time on IRC just using gitter because I don't do freenode |
18:39:04 | Araq | kennymalac: please ask on Nim's forum |
18:39:09 | disruptek | kennymalac: there's no mongo adapter? |
18:39:18 | Yardanico | disruptek: there is, but it's far from being complete |
18:39:19 | FromGitter | <kennymalac> there is, but it's incomplete. so would like to sponsor |
18:39:22 | FromGitter | <kennymalac> :) |
18:39:24 | Araq | I'm sure somebody will volunteer to develop nimmongo2 for you under sponsoring |
18:39:42 | Araq | in the worst case I'll make narimiran do it :P |
18:39:44 | disruptek | sure, what's it worth to you? |
18:41:00 | FromGitter | <kennymalac> probably a lot at a certain point, if my company is successful I will try to make the nim community more successful to, as it is our secret weapon here |
18:41:09 | FromGitter | <kennymalac> well, *when* not if ;) |
18:41:14 | disruptek | sounds like you should hire me. |
18:41:19 | Yardanico | lol |
18:41:27 | disruptek | 😉 |
18:41:42 | Araq | kennymalac do you use ARC? |
18:41:46 | disruptek | but first i wanna finish this ci. i think it's gonna be killer. |
18:41:51 | Yardanico | @kennymalac if you didn't do it yet please add your company to https://github.com/nim-lang/Nim/wiki/Companies-using-Nim :) |
18:42:08 | Araq | or don't if it's your secret weapon :-) |
18:43:08 | FromGitter | <kennymalac> I haven't tried it out yet araq |
18:43:50 | FromGitter | <kennymalac> but I probably should because I was trying to copy into a closure into a separate thread and someone told me that's just not possible with the default GC. |
18:45:50 | Araq | ah yeah |
18:49:11 | FromGitter | <kennymalac> started a thread here: https://forum.nim-lang.org/t/5862#36344 |
18:50:13 | FromGitter | <kennymalac> @disruptek will poke around here a lot, will poke even more if I need nim devs. lol |
18:50:19 | FromGitter | <kennymalac> s/if/when |
18:50:50 | disruptek | nice, we'll keep our fingers crossed. |
18:55:50 | FromGitter | <kennymalac> where are you from again araq? |
18:56:06 | Yardanico | germany i guess? |
18:57:36 | Araq | yes |
18:58:38 | FromGitter | <kennymalac> nice |
19:00:52 | * | Trustable joined #nim |
19:04:51 | Araq | if you say so... ;-) |
19:07:57 | * | ptdel quit (Read error: Connection reset by peer) |
19:18:04 | * | nsf quit (Quit: WeeChat 2.7) |
19:19:10 | FromGitter | <kennymalac> oh just and I guess |
19:19:35 | chemist69 | Hi, how do I use `runnableExamples` in a module that needs to be compiledin cpp mode and needs linking to a shared library? |
19:19:57 | FromGitter | <kennymalac> nvm https://nim-lang.org/docs/bitops.html#testBit%2CT%2CBitsRange%5BT%3A+SomeInteger%5D |
19:20:54 | * | narimiran joined #nim |
19:22:14 | FromGitter | <deech> Nim docs transform comma separators between arguments in a `proc` to semicolons, is this valid syntax? |
19:22:29 | disruptek | yep, i prefer it. |
19:22:36 | FromGitter | <deech> Nice. |
19:23:16 | Yardanico | I really don't get how a guy in code-golf made so short nim code |
19:23:24 | Yardanico | like task "An odious number is a non-negative number that has an odd number of 1s in its binary expansion.Print all the odious numbers from 0 to 50 inclusive, each on their own line." |
19:23:28 | Yardanico | he did it in 37 characters in Nim |
19:24:14 | Yardanico | with countSetBits from bitops I can do it in 58 chars |
19:24:26 | FromGitter | <deech> Yeah I saw that, biggest takeaway was that Nim syntax can be made insensitive to indentation with parens and semicolons. |
19:24:41 | Yardanico | also kinda funny but "for x in..50:" works (no spaces after in and no 0) |
19:24:50 | Yardanico | @deech well yeah, but 37 still seems too low |
19:24:52 | Yardanico | to be true xd |
19:24:53 | * | marmotini_ joined #nim |
19:25:14 | * | couven92 quit (Read error: Connection reset by peer) |
19:25:41 | * | couven92 joined #nim |
19:25:53 | FromGitter | <deech> Haha yeah, I don't like Python like indentation and now I know I don't have to use it. Wonder if nimpretty can still format it. |
19:26:16 | Yardanico | pls don't use semicolons or parens for indentation in real nim code though :(( |
19:26:27 | Yardanico | nim also had syntax skins before but they were removed for obvious reasons |
19:26:32 | Yardanico | (yes, you could literally write nim with BRACES) |
19:26:42 | FromGitter | <deech> Why? It's valid syntax. |
19:27:01 | FromDiscord_ | <DeltaPHC> Whitespace indents is considered the idiomatic way |
19:27:04 | Yardanico | well proc b(x:int):int=(result=5;(if x>5:(if x<3:(if x==0:(echo x;echo x-1)))elif x==0:(echo 0;echo 5)else:return 5)) |
19:27:09 | Yardanico | that wouldn't look good even with newlines |
19:27:12 | Yardanico | nim is not lisp :D |
19:28:08 | FromGitter | <deech> Looks fine to me. Unambiguous indentation is worth a lot. By that logic all C and JS is also unreadable. But I agree it doesn't seem to be Nim culture to use it since I just found out about it. |
19:29:46 | FromDiscord_ | <DeltaPHC> The advantage of whitespace-significant syntax is that the way the code is formatted is exactly how it works. Brace-style and semicolons give you more freedom, at the cost of misleading indentation being a problem |
19:30:23 | Yardanico | hmm wait I thought you can write all nim code in one line hmm |
19:30:33 | Yardanico | seems like you still need a newline with the code I sent above |
19:30:43 | Yardanico | I can't seem to but echo b(5) on the same line after that |
19:34:10 | * | marmotini_ quit (Remote host closed the connection) |
19:37:42 | * | marmotini_ joined #nim |
19:38:47 | FromGitter | <kennymalac> crap, I have a method that is proc stop(self: var TaskSinkObj) because TaskSink is a ref object and I call stop in my destructor |
19:39:25 | FromGitter | <kennymalac> but I'm trying to call that stop method with a TaskSink, is that possible |
19:39:40 | disruptek | foo[].stop |
19:39:49 | Yardanico | why not "ref TaskSinkObj" instead of "var TaskSinkObj" ? |
19:39:58 | Yardanico | or that wouldn't work in your case? |
19:40:10 | FromGitter | <kennymalac> where TaskSink is just ref TaskSinkObj |
19:40:24 | Yardanico | proc stop(self: ref TaskSinkObj) |
19:40:26 | Yardanico | maybe |
19:41:22 | FromGitter | <kennymalac> that worked @disruptek does this just mean I can do the [] thing but in the destructor rather than anywhere I need to call those methods? |
19:41:33 | FromGitter | <kennymalac> i.e. make stop() take a TaskSink and the destructor calls self[].stop() |
19:41:44 | disruptek | [] is the deref operator. |
19:41:56 | disruptek | use it anywhere you want to deref a ref. |
19:43:00 | FromGitter | <kennymalac> nvm what I said doesn't make sense. I'll just define stop for a TaskSink and make it deref |
19:43:20 | disruptek | you could define stop for ref TaskSink and then (ref self).stop in your destructor. |
19:44:07 | FromGitter | <kennymalac> TaskSink is already ref object? so what would ref TaskSink mean |
19:44:20 | dom96 | why can't `stop` take a TaskSink? |
19:44:20 | Yardanico | reference to a reference to an object XD |
19:44:45 | FromGitter | <kennymalac> I call stop in my destructo |
19:44:50 | FromGitter | <kennymalac> destructor |
19:44:54 | disruptek | in your destructor, self is an obj. so you (ref self).stop so that you can use stop on your ref objects elsewhere. |
19:44:56 | dom96 | do destructors need a non-ref? |
19:45:01 | disruptek | yes. |
19:45:17 | FromGitter | <kennymalac> making stop an alias for self[].stop() works |
19:45:22 | dom96 | destructors + ref sounds like you're mixing things |
19:45:33 | dom96 | objects allocated on the heap already have their own finaliser mechanism |
19:45:47 | FromGitter | <kennymalac> I'm doing RAII |
19:45:57 | dom96 | https://nim-lang.org/docs/system.html#new%2Cref.T%2Cproc%28ref.T%29 |
19:46:00 | FromGitter | <kennymalac> like a C++ plebian |
19:46:24 | disruptek | you're doing fine. |
19:46:30 | disruptek | keep doing what you're doing. |
19:46:36 | FromGitter | <kennymalac> haha |
19:50:26 | * | marmotini_ quit (Ping timeout: 240 seconds) |
19:50:36 | Yardanico | from telegram: I'm trying to restart the whole program on exception with 2 async procs running https://play.nim-lang.org/#ix=28qB. currently my problem is that when first proc fails, 2nd continues. is there any way to kill 2nd proc too? |
19:51:40 | disruptek | sure, just complete it. |
19:51:56 | disruptek | chronos offers cancellation. |
19:53:47 | dom96 | Yardanico: store some state, then `while state.running` |
19:55:06 | zedeus | dom96: have you had time to look at #12982 yet? |
19:55:08 | disbot | https://github.com/nim-lang/Nim/pull/12982 -- 3Implement file streaming for httpclient's MultipartData |
19:55:35 | dom96 | nope, it's a busy few week right now for me so won't get a chance to look at this |
19:55:48 | dom96 | probably until after January ends |
19:56:05 | dom96 | *weeks |
19:56:27 | zedeus | ah, no problem |
20:05:48 | FromGitter | <kristianmandrup> What is the best way to `trim` a string from whitespace ? |
20:05:58 | Yardanico | strutils.strip |
20:06:23 | Yardanico | or you mean fully remove whitespace? |
20:06:45 | FromGitter | <kristianmandrup> Similar to https://nim-lang.org/docs/strutils.html#trimZeros%2Cstring |
20:06:55 | Yardanico | strutils.strip :) |
20:06:56 | FromGitter | <kristianmandrup> remove whitespace at beginning and end of string |
20:07:05 | FromGitter | <kristianmandrup> Thanks :) |
20:12:23 | Zevv | Anyone here who knows a bit about RTTI, repr and where this should go with arc? Is there anything repr can do that `$` could not, and does it make sense to have/keep two different implementations? |
20:12:51 | Yardanico | I sometimes use repr for debugging when I'm lazy to implement $ :P |
20:13:02 | * | Vladar quit (Quit: Leaving) |
20:13:47 | Zevv | right. The idea is that "everthing should be reprable". But why should not everything be `$`able as well? |
20:14:23 | Zevv | fieldPairs should be able to $ any object. With some simple procs like http://ix.io/28qW any ptr or ref can be walked up to the destination. What is the use of keeping repr then? |
20:14:38 | Zevv | And what does RTTI bring in? |
20:15:40 | Yardanico | well, also repr is useful to debug string contents |
20:15:43 | Yardanico | I mean raw characters |
20:15:50 | Yardanico | for example \13\10 instead of simply newlines |
20:15:56 | Yardanico | I've used it when debugging my nim-adbv |
20:15:58 | Yardanico | nim-adb* |
20:16:36 | FromGitter | <kristianmandrup> How do I join three numbers into a string (version) with `.` as separator |
20:16:50 | FromGitter | <kristianmandrup> `strutils.join`? |
20:16:53 | Yardanico | yeah |
20:16:55 | Zevv | yeah, ok, that is the *usage*. But I mean implementation. repr does magic stuff requiring run time type information. I understand --gc:arc does lack this info, and thus does not do a proper repr (yet). But if the repr can be implemneted just like $, what use is the extra RTTI then? |
20:17:02 | Yardanico | idk |
20:17:16 | Yardanico | I would use $ or some "debug" proc if it would work the same :) |
20:17:17 | Zevv | kristianmandrup: $n0 & "." & $n1 & "." & $n2 |
20:17:40 | Zevv | or if n is an array something like n.mapIt($it).join(".") |
20:18:32 | * | couven92 quit (Quit: Client Disconnecting) |
20:19:21 | Zevv | kristianmandrup: https://play.nim-lang.org/#ix=28r1 |
20:21:22 | FromGitter | <kristianmandrup> Thanks. Playing now. Can I destructure the result of a string split? |
20:21:45 | Zevv | "destructure"? |
20:21:48 | FromGitter | <kristianmandrup> ```let version = n.mapIt($it).join(".") ⏎ let m = version.split(".") ⏎ echo m``` [https://gitter.im/nim-lang/Nim?at=5e2df4dc1a883c61961402ef] |
20:22:20 | FromGitter | <Yardanico> ah, you mean unpack? |
20:22:23 | FromGitter | <kristianmandrup> I end up with `@["5", "6", "22"]` but would like it in vars `major`, `minor` and `patch` |
20:22:37 | FromGitter | <Yardanico> var (major, minor, patch) = (m[0], m[1], m[2]) |
20:22:39 | FromGitter | <kristianmandrup> I guess. I come from JS world |
20:24:25 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2df579a420263e03a44cfc] |
20:24:51 | FromGitter | <kristianmandrup> Trying to add default to minor and patch values if not present in version string |
20:26:38 | FromGitter | <kristianmandrup> type mismatch on `or` however. No idea what convention is with nim. `||` would work in JS |
20:26:57 | Zevv | nim is statically typed here, but you are trying to mix strings and numers too freely |
20:29:55 | disruptek | Zevv: yes, $ should replace repr. |
20:30:07 | disruptek | ot |
20:30:08 | FromGitter | <Yardanico> @kristianmandrup what "or" does in your case? |
20:30:16 | FromGitter | <Yardanico> or what do you want it to do? |
20:30:23 | disruptek | it's too much to ask that nim rtti just for repr. |
20:31:41 | Zevv | disruptek: right, I think I remember araq saying that. |
20:31:54 | Zevv | I can pick that up |
20:31:56 | disruptek | it's just self-evident. |
20:32:23 | Zevv | I also have some opinons about getting repr output more readable and structured |
20:32:41 | Araq | Zevv, IMHO the new repr implementation is better |
20:32:48 | Zevv | Oh is there one already? |
20:32:51 | Araq | and can be made the one implementation for all GCs |
20:32:56 | disruptek | maybe there should be a new repr operator. |
20:33:02 | Araq | and yeah you can tweak it to make it beautiful |
20:33:10 | Zevv | but does it use any magic apart from what "normal" nim can do? |
20:33:14 | disruptek | then $ doesn't have to semantically confuse the two. |
20:33:19 | Yardanico | disruptek: pls no |
20:33:26 | Araq | nope, it's currently copy-pasta |
20:33:26 | Yardanico | I still think that repr is mostly for debugging |
20:33:30 | Araq | from '$' |
20:33:37 | disruptek | it should be, yes. |
20:34:23 | disruptek | the only reason we're having this conversation is because repr != $. |
20:34:30 | Zevv | Araq: right. So what are the ideas about what `$` should do and what `repr` should do. Could they not share mos of the code, instead of copypaste? |
20:35:20 | Yardanico | well I guess $ is for "pretty" printing and "repr" for "ugly" printing :P |
20:35:38 | Zevv | that's kind of ill defined like that :) |
20:35:49 | Zevv | But why can nim not $ anything I pass it. Its trivial |
20:36:20 | Zevv | No longer these lists of complaints from the compiler if it can not convert my whatever-I-pass-it to a string. |
20:36:51 | Zevv | My guess would be that `repr` is more techincal in depth, showing addresses and all types, while `$` is more minimal showing only contents. |
20:36:54 | Zevv | is that the gist of it? |
20:37:45 | Zevv | or should repr output valid parsable nim code which "reconstructs" what you feed it? |
20:38:05 | disruptek | honestly, it needs to be renamed and then given tighter semantics, imo. |
20:38:11 | Yardanico | I think that's more related to macros:P |
20:38:24 | disruptek | you can see how it's used and abused in stdlib. |
20:38:25 | Zevv | sigh. this will be bikeshedding and rfcs again |
20:38:29 | disruptek | of course. |
20:38:38 | disruptek | so give us the shed already. |
20:38:55 | Yardanico | Zevv: cost of having 1.0 release :P |
20:39:03 | Zevv | disruptek: paint it Pantone 448 C |
20:39:20 | disruptek | do it in color. people love color. |
20:40:51 | * | ptdel joined #nim |
20:41:22 | Zevv | Hmm we should organize a few discussion topics at fosdem. Get a room somewhere and a box of doughnuts and decided stuff. Just keep out the other 98% of the community to speed things up! :) |
20:41:59 | Yardanico | maybe I should save some money to come for the next year's FOSDEM from Russia :P |
20:42:22 | FromGitter | <kristianmandrup> I'm working on a PR to add automatic `git tag` support to `nimble` ;) |
20:42:23 | FromGitter | <kristianmandrup> https://github.com/nim-lang/nimble/issues/525#issuecomment-578541084 |
20:42:24 | disbot | ➥ Implement `tag` command |
20:42:36 | FromGitter | <garuse> Hi everybody. Kindly as for you help. I am trying a simple thing and I am stuck :( I am trying to interact with a shell via osproc.startProcess (send commands and receive the output. But nothing happens. Here is what I did: https://play.nim-lang.org/#ix=28r9. |
20:42:55 | disruptek | garuse: good demo of how to do this in golden. |
20:42:57 | disruptek | !repo golden |
20:42:58 | disbot | https://github.com/disruptek/golden -- 9golden: 11a benchmark for compile-time and/or runtime Nim 🏆 15 15⭐ 0🍴 |
20:43:11 | disruptek | kristianmandrup: good demo of how to do this in nimph. |
20:43:13 | disruptek | !repo nimph |
20:43:14 | disbot | https://github.com/disruptek/nimph -- 9nimph: 11Nim package hierarchy manager from the future 🧚 15 52⭐ 2🍴 7& 1 more... |
20:43:57 | kungtotte | kristianmandrup: use scanf instead of jumping through hoops with the version splitting: https://play.nim-lang.org/#ix=28rg |
20:44:30 | FromGitter | <garuse> thank you! I will check it now. gasho /\ |
20:45:02 | kungtotte | kristianmandrup: scanf will populate the variables with anything found with the appropriate format, and leave anything else with the default value (0). |
20:49:33 | FromGitter | <kristianmandrup> okay, thanks |
20:53:08 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2dfc34e177666195d3a6d8] |
20:53:19 | FromGitter | <kristianmandrup> Not sure how to fix this |
20:56:04 | * | Trustable quit (Remote host closed the connection) |
20:56:05 | FromGitter | <kristianmandrup> Trying with seq `@` |
20:56:12 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2dfcec183449313be1ecb6] |
20:56:22 | FromGitter | <kristianmandrup> complains about return type |
20:56:44 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=28rk |
20:58:03 | FromGitter | <garuse> @kristianmandrup you need to return a seq[int]: https://play.nim-lang.org/#ix=28rl |
20:58:44 | Yardanico | I'd suggest you to read Nim tutorials at first :) and in this case it's better to use a tuple I guess |
21:00:32 | FromGitter | <kristianmandrup> I've read most of the Nim in Action book and also much of the Language Guide etc. I need real practice |
21:00:45 | FromGitter | <kristianmandrup> I tried with a `Semver` type now |
21:00:50 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2dfe02a9b30639e2f01621] |
21:02:25 | * | narimiran quit (Ping timeout: 268 seconds) |
21:02:33 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2dfe699ad22d5bd5e5ca48] |
21:05:18 | kungtotte | Kristianmandrup: https://play.nim-lang.org/#ix=28ru |
21:08:02 | FromGitter | <kristianmandrup> ah yes, now I get it :) |
21:11:17 | FromGitter | <kayabaNerve> Anyone have a clean example of crafting a Future? I'm reading over asyncdispatch and it's not helping too much :/ |
21:12:19 | FromDiscord_ | <Skaruts> is there a way to read input from the command line without committing it, so that I can make the cursor stay still if the user presses enter without entering a command? |
21:12:20 | dom96 | newFuture[T]? |
21:12:23 | FromGitter | <kayabaNerve> Eh. I'll just experiment with it. I believe it can be ultimately simplified to newFuture/complete/fail, with complete/fail called in a callback. |
21:13:04 | FromGitter | <kayabaNerve> dom96: No, I got that. I was reading over asyncdispatch's recv and it manually manipulates the ref count + uses `PCustomOverlapped` |
21:13:21 | dom96 | kayabaNerve: what are you trying to do? |
21:13:24 | FromGitter | <kayabaNerve> May just be that it's a very complex example to start with if I can simplify it |
21:13:28 | dom96 | "manually crafting a Future" is too vague |
21:13:57 | FromGitter | <kayabaNerve> Simply put? await doX() where doX doesn't use the async pragma, returns a future, and returns a string once another function registers that string in a table. |
21:14:38 | FromGitter | <kayabaNerve> Is it as simple as fut.complete() when I set the string in the table? |
21:14:43 | dom96 | yes, it is |
21:14:55 | dom96 | see how sleepAsync is implemented |
21:15:04 | dom96 | IIRC it's fairly simple |
21:15:17 | dom96 | or you can also look at `or` and `and` procs |
21:15:23 | dom96 | those are definitely simple |
21:15:24 | FromGitter | <kayabaNerve> Thanks for the confirmation. |
21:15:48 | dom96 | but my question then is, why are you using Future for what seems to be non-IO operations? |
21:16:03 | FromGitter | <kayabaNerve> My issue with `sleepAsync` is it uses the global dispatcher's timers, and those weren't documented AFAICT |
21:16:05 | FromGitter | <kayabaNerve> It's IO |
21:16:20 | FromGitter | <kayabaNerve> I'm requesting data from multiple servers and completing the future when any of them resolve |
21:16:29 | FromGitter | <kayabaNerve> *any of them respond with the data |
21:16:50 | FromGitter | <kayabaNerve> Previously I iterated over the servers, requesting from each and then the next. It was pretty bad. |
21:17:37 | FromGitter | <kayabaNerve> So now I'm trying to handle multiple requests to various servers and using the first one as servers aren't confirmed to respond at all. |
21:17:50 | FromGitter | <kayabaNerve> If they were confirmed to resolve, I'd take the performance dip for now and not craft a Future. |
21:17:55 | FromGitter | <kayabaNerve> *confirmed to respond |
21:18:00 | disruptek | sounds fine to me. |
21:18:54 | FromGitter | <kayabaNerve> I use a lot of async code. I'm really focusing on getting a MVP though and my existing async code didn't fit the V part. Having to rewrite it earlier than I wanted to. |
21:20:35 | dom96 | You can create an `any` proc that's similar to https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D |
21:20:46 | dom96 | Keep in mind that cancelling futures isn't supported though |
21:21:14 | * | a_b_m joined #nim |
21:21:56 | * | a_b_m quit (Client Quit) |
21:23:16 | * | abm quit (Ping timeout: 265 seconds) |
21:23:39 | leorize[m] | Araq: I believe I have built a reasonable amount of flags to enable fd inheritance for sockets in #13201 |
21:23:40 | disbot | https://github.com/nim-lang/Nim/pull/13201 -- 3Make file descriptors from stdlib non-inheritable by default |
21:24:41 | leorize[m] | I can add -d:nimInheritHandles, but that might encourage bad practices of not cloning fd before passing to child processes |
21:25:40 | Araq | what's more important is that every proc where it's applicable gets a 'flags: set' argument so that it remains possible to inherit |
21:26:25 | Araq | and ideally we design this properly with an RFC first |
21:26:45 | Araq | IO is both too important also too adhoc in Nim, see also |
21:26:59 | Araq | https://github.com/nim-lang/Nim/pull/13232 |
21:27:01 | disbot | ➥ fix #9634 retry c_fgets on EINTR : debugging a nim program does not crash on `execCmdEx` / `readLine` ; snippet at 12https://play.nim-lang.org/#ix=286c |
21:28:46 | Zevv | uhm, you can always disable FD_CLOEXEC on a fd later, if you still want it to be inherited? |
21:29:08 | disruptek | that was my understanding. |
21:29:13 | FromGitter | <kayabaNerve> `or` won't work thanks to the loop I have. I don't actually have individual futures. I have network messages which when parsed are what matches a pending async request. |
21:29:22 | FromGitter | <kayabaNerve> The lack of cancelling is fine. |
21:30:01 | FromGitter | <kayabaNerve> Oh. I do have a question about Peek if you have a second. Is it still not supported on Windows/will it ever? |
21:30:46 | Zevv | so why adding flags to all the API's? |
21:31:14 | disruptek | i think so existing code works. |
21:31:18 | leorize[m] | saving a syscall :p |
21:33:15 | dom96 | kayabaNerve: afaik it's not, but I very vaguely remember this feature |
21:33:40 | dom96 | leorize[m]: your PR looks like a good idea to me |
21:34:04 | Araq | the Python PEP hasn't been implemented yet |
21:34:08 | Araq | afaik |
21:34:16 | Araq | so I'm cautious |
21:34:34 | dom96 | but yeah, we should be careful and take whatever lessons Python learned |
21:34:40 | dom96 | we may also wish to delay this until 2.0 |
21:35:55 | disruptek | doesn't seem that impactful to me. |
21:40:03 | Araq | Status says the changes to ioselectors_*.nim would be harmful for them |
21:42:10 | shashlick | does nimsuggest work as expected if using vscode with remote ssh |
21:42:18 | dom96 | huh? they've forked all of async did they not? |
21:42:36 | Araq | no, they use some stuff from us. |
21:43:59 | FromGitter | <kristianmandrup> How do I correctly escape a `"` match condition in re? |
21:44:07 | FromGitter | <kristianmandrup> ```fileStr.replace(re"version\s+=\s+\"(\D+)", "1.12.0")``` |
21:44:25 | Araq | https://fraserblog.codewise.org/rust-and-file-descriptors/ |
21:44:31 | FromGitter | <kristianmandrup> ie. matching on `version = "0.11.0"` |
21:44:36 | Araq | "Rust, being a safe-by-default language, sensibly creates all file descriptors with the FD_CLOEXEC flag, which means they automatically close on an exec system call, without needing to be explicitly closed." |
21:44:41 | Araq | so Rust does the same... |
21:48:17 | disruptek | the fools. |
21:48:43 | dom96 | ahh, cool, so at least they reuse those modules |
21:49:27 | disruptek | kristianmandrup: bump has some re for version matching. |
21:49:29 | disruptek | !repo bump |
21:49:30 | disbot | https://github.com/disruptek/bump -- 9bump: 11a tiny tool to bump nimble versions 🍻 15 11⭐ 1🍴 7& 1 more... |
21:51:31 | FromGitter | <kristianmandrup> ```let expr = re"\"(\D+)\"" ``` ⏎ ⏎ Stuck on this. Terminates `re` on first `"` encountered after beginning `"` it seems, no matter the escape `\"` [https://gitter.im/nim-lang/Nim?at=5e2e09e3f85dba0aab1db305] |
21:59:58 | FromGitter | <kristianmandrup> Thanks for `bump` :) |
22:01:04 | disruptek | hope it helps. |
22:10:41 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e0e61da04a624f48b33d4] |
22:11:00 | FromGitter | <kristianmandrup> Complains: `imported and not used: 'bump' [UnusedImport]` |
22:11:18 | FromGitter | <kristianmandrup> https://github.com/disruptek/bump/blob/master/bump.nim |
22:11:26 | * | krux02 quit (Remote host closed the connection) |
22:11:45 | disruptek | syntax. |
22:11:51 | FromGitter | <kristianmandrup> https://disruptek.github.io/bump/bump.html#bump%2Cstring%2Cstring%2Cstring%2Cseq%5BT%5D%5Bstring%5D |
22:12:06 | disruptek | manual = "..." |
22:12:28 | FromGitter | <kristianmandrup> ? |
22:12:42 | disruptek | bump is a proc and not an object. |
22:12:49 | FromGitter | <kristianmandrup> I need to send all the args? |
22:13:03 | disruptek | no, you need to specify them with = and not :. |
22:13:19 | * | ng0_ quit (Quit: leaving) |
22:13:32 | FromGitter | <kristianmandrup> I've only used positional args so far |
22:13:41 | FromGitter | <kristianmandrup> ```proc writeNewVersion(newVersion: string) = ⏎ bump(manual = newVersion)``` [https://gitter.im/nim-lang/Nim?at=5e2e0f15183449313be2686c] |
22:14:01 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e0f294c3dae24f5f4b341] |
22:14:16 | disruptek | bump.bump |
22:14:46 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e0f56a420263e03a509c3] |
22:14:47 | * | rockcavera joined #nim |
22:14:56 | FromGitter | <kristianmandrup> `expression 'bump.bump(manual = newVersion)' cannot be called` |
22:15:38 | disruptek | why not? |
22:16:15 | FromGitter | <kristianmandrup> ```proc writeNewVersion(newVersion: string) = ⏎ bump.bump(manual = "1.0.2")``` [https://gitter.im/nim-lang/Nim?at=5e2e0fae183449313be26c2f] |
22:16:19 | FromGitter | <kristianmandrup> Same here |
22:16:47 | disruptek | you didn't supply a message. |
22:17:13 | FromGitter | <kristianmandrup> aha |
22:17:28 | disruptek | bump.bump(manual = "1.2.3", message = @["goats", "are", "sexy"]) |
22:17:49 | FromGitter | <dumjyl> It probably thinks both are bump, the module. |
22:18:01 | disruptek | or message = @[] if you don't like goats. |
22:18:17 | * | ng0 joined #nim |
22:18:17 | * | ng0 quit (Changing host) |
22:18:17 | * | ng0 joined #nim |
22:18:44 | FromGitter | <kristianmandrup> Works :) |
22:18:48 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e1048f85dba0aab1ddf97] |
22:19:02 | disruptek | of course. |
22:19:06 | FromGitter | <kristianmandrup> Returns an `int`. Status code? |
22:19:33 | disruptek | yes, the result passed as the return code for the tool. |
22:19:57 | disruptek | this is a cli tool and you're invoking the proc that is effectively its `main()`. |
22:20:18 | disruptek | it's also designed to be a library. |
22:20:56 | FromGitter | <kristianmandrup> ah yes |
22:21:02 | FromGitter | <kristianmandrup> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e10ce01914e3e0453aa45] |
22:21:21 | disruptek | the sad panda. 🐼 |
22:23:02 | * | tane quit (Quit: Leaving) |
22:23:25 | * | ng0_ joined #nim |
22:23:25 | * | ng0_ quit (Changing host) |
22:23:25 | * | ng0_ joined #nim |
22:23:31 | FromGitter | <kristianmandrup> Ok, thanks. Helped a lot. Still don't get how to match a `"` in a RegExp in Nim |
22:23:34 | * | ritchie__ joined #nim |
22:23:44 | disruptek | there's regexp in there that does that. |
22:24:21 | disruptek | though i would use strscans if i were to do it again. |
22:24:52 | * | ng0 quit (Ping timeout: 268 seconds) |
22:25:01 | FromGitter | <kristianmandrup> Yeah, you seem to use a more low level approach, not matching on the `"` in the version line but only on the preceding part |
22:25:21 | disruptek | what can i say? i'm a wild man. |
22:25:22 | FromGitter | <kristianmandrup> for line in lines($target): ⏎ ⏎ ``` if not line.contains(re"^version\s*="):``` [https://gitter.im/nim-lang/Nim?at=5e2e11d2cd53a80aac2f2ba1] |
22:25:34 | disruptek | keep searching. |
22:25:38 | * | ritchie_ quit (Ping timeout: 240 seconds) |
22:33:08 | * | ptdel quit (Ping timeout: 248 seconds) |
22:35:25 | * | ptdel joined #nim |
22:40:56 | * | sekao joined #nim |
22:42:03 | * | solitudesf quit (Ping timeout: 265 seconds) |
22:45:51 | sekao | is it possible for a `case` expression to return different types in each branch? i'm trying to conditionally pull values out of an object variant to store in a variable. i can see why the type checker doesn't like it, but there must be some way... |
22:46:19 | disruptek | of course. |
22:46:23 | disruptek | show us some code. |
22:46:24 | disruptek | ~paste |
22:46:25 | disbot | paste: 11a frowned-upon behavior in chat; please use a service such as https://play.nim-lang.org/ or http://ix.io/ or https://gist.github.com/ and supply us a URL instead. -- disruptek |
22:48:15 | Yardanico | sekao: well, I think you'll need an object variant for that variable too |
22:49:01 | Yardanico | The thing is that you decide on a kind of object variant at runtime so there's no way for compiler to do that I think |
22:50:30 | sekao | i tried something like this: https://play.nim-lang.org/#ix=28s2 |
22:52:32 | disruptek | ah, that won't work. |
22:57:16 | sekao | yeah it makes sense why it doesn't work now that i think about it |
23:09:12 | * | zedeus quit (Changing host) |
23:09:12 | * | zedeus joined #nim |
23:23:41 | FromGitter | <kristianmandrup> https://play.nim-lang.org/#ix=28s7 Finally got `re` working with `"` substitution :) |
23:36:35 | FromGitter | <nothratal> good evening |
23:37:32 | FromGitter | <nothratal> is there an each/eachIt template somewhere in the standard library? |
23:38:37 | FromGitter | <nothratal> something like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e2e22fda420263e03a58033] |
23:39:15 | FromGitter | <nothratal> or is there something different/equivalent? |
23:40:28 | disruptek | yeah, we have for loops. |
23:41:49 | disruptek | see sequtils module, i guess. |
23:44:06 | * | ng0_ quit (Quit: leaving) |
23:46:27 | * | disruptec quit (Ping timeout: 268 seconds) |
23:47:08 | * | disruptec joined #nim |
23:57:21 | * | muffindrake quit (Quit: muffindrake) |
23:57:40 | * | muffindrake joined #nim |