00:07:50 | * | nsf quit (Quit: WeeChat 2.1) |
00:17:47 | FromGitter | <kayabaNerve> Just got the IMath lib to work :D |
00:18:35 | FromGitter | <kayabaNerve> @mratsim it works on stable, has a ton of operations built in, and is fast |
00:19:28 | FromGitter | <kayabaNerve> (it's a big number library that is signed, not unsigned, for clarification) |
00:23:46 | * | Electrux quit (Ping timeout: 264 seconds) |
00:34:53 | * | Electrux joined #nim |
00:39:00 | * | Electrux quit (Ping timeout: 245 seconds) |
00:45:45 | * | Electrux joined #nim |
00:46:32 | FromGitter | <kayabaNerve> I have a function that 'isn't' GCSafe. Can I silence that warning without disabling the GC? It's stopping my program from compiling |
00:48:15 | FromGitter | <kayabaNerve> NVM. Found a solution |
00:50:11 | FromGitter | <kayabaNerve> And NVM that NVM. My solution didn't work. Premature text. Sorry. |
00:50:15 | * | Electrux quit (Ping timeout: 245 seconds) |
00:50:47 | * | jhorwitz joined #nim |
00:52:04 | cmk_zzz | is the old forum still up and running somewhere? |
00:56:32 | * | sz0 joined #nim |
00:58:44 | skrylar | i have had that gcsafe error as well but haven't really grokked it yet. i think it's there to stop you from calling out to unsafe code in the middle of weird tricks like closure iterators |
01:00:01 | FromGitter | <kayabaNerve> I'm using threads with read only memory |
01:00:04 | FromGitter | <kayabaNerve> And locks on the writes |
01:04:51 | * | Electrux joined #nim |
01:05:31 | FromGitter | <kayabaNerve> Whatever. I'll just remove threaded mining |
01:06:49 | jhorwitz | Is the best way to learn Nim still with Nim in Action? |
01:09:33 | * | Electrux quit (Ping timeout: 260 seconds) |
01:14:17 | * | dddddd quit (Remote host closed the connection) |
01:16:09 | FromGitter | <data-man> @jhorwitz: https://github.com/VPashkov/awesome-nim#websites |
01:17:59 | * | jhorwitz quit (Quit: leaving) |
01:18:31 | * | jhorwitz joined #nim |
01:35:49 | * | Electrux joined #nim |
01:40:39 | * | Electrux quit (Ping timeout: 256 seconds) |
01:48:51 | * | yglukhov[i] joined #nim |
01:50:48 | FromGitter | <kayabaNerve> I can personally recommend Nim in Action |
01:51:04 | FromGitter | <kayabaNerve> However, I think the tutorial may just be best since it's free |
01:51:13 | FromGitter | <kayabaNerve> https://nim-lang.org/docs/tut1.html |
01:51:17 | FromGitter | <kayabaNerve> Very nice... |
01:53:30 | * | yglukhov[i] quit (Ping timeout: 260 seconds) |
02:05:51 | * | athenot joined #nim |
02:26:08 | jhorwitz | I already have purchased Nim in Action! |
02:26:21 | jhorwitz | I went through it a while ago, but want to get back into it |
02:42:42 | * | Snircle joined #nim |
03:00:03 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:00:46 | * | sz0 quit (Quit: Connection closed for inactivity) |
03:05:48 | * | Electrux joined #nim |
03:07:56 | * | Electrux quit (Client Quit) |
03:08:08 | * | arecaceae quit (Remote host closed the connection) |
03:08:20 | * | Electrux joined #nim |
03:08:34 | * | arecaceae joined #nim |
03:08:37 | * | xkapastel joined #nim |
03:25:24 | * | rauss quit (Read error: Connection reset by peer) |
03:27:18 | * | rauss joined #nim |
03:32:56 | * | FuntDobra joined #nim |
03:55:47 | * | sz0 joined #nim |
03:59:46 | FromGitter | <kayabaNerve> I read it during my HS classes |
03:59:52 | FromGitter | <kayabaNerve> Seemed the better use of my time |
04:04:44 | jhorwitz | I'm sure it was |
04:04:47 | jhorwitz | lol |
04:17:37 | * | FuntDobra quit (Ping timeout: 248 seconds) |
04:23:23 | skrylar | well, the wrapper for WORLD works. took a while but figured out how to analyze sounds and then re-synthesize the same one with it |
04:26:36 | * | eizua joined #nim |
04:27:59 | * | eizua quit (Client Quit) |
04:30:16 | FromGitter | <kayabaNerve> jhorwitz: it was. I'm not going to college so now I'm just coding |
04:33:30 | * | SenasOzys quit (Ping timeout: 252 seconds) |
04:40:42 | skrylar | mratsim: any thoughts on arrayfire :p |
04:44:27 | skrylar | also it seems the openmp wrappers have disappeared |
04:46:42 | FromGitter | <kayabaNerve> Don't let your arrays catch on fire |
04:46:47 | FromGitter | <kayabaNerve> Irresponsible |
04:47:03 | skrylar | eh it looked like a tensor library |
04:47:21 | FromGitter | <kayabaNerve> So that means the arrays are worth less? |
04:47:25 | FromGitter | <kayabaNerve> Arrayist |
04:47:30 | skrylar | although arraymancer has thus far put up with my bullshit, so it stays |
04:47:37 | FromGitter | <kayabaNerve> *I'll stop* gn people |
04:47:44 | skrylar | now having to actually face parallelism in nim :x |
04:47:47 | skrylar | alright gn kayaba |
05:00:47 | skrylar | hrm. wonder if there's an easy way to just spin up a dozen parallel jobs in nim or if i should bother going the beanstalk/task server route |
05:13:55 | * | miran joined #nim |
05:17:08 | FromGitter | <7sDream> how can I use `in ("a", "b", "c")` statements with Nim's sql query template? ⏎ i.e. `getRow(sql"select * from table where name in (?)", names)` when name is a `seq[string]` |
05:17:18 | * | gangstacat quit (Quit: Ĝis!) |
05:18:06 | * | xkapastel quit (Quit: Connection closed for inactivity) |
05:18:25 | FromGitter | <7sDream> I found a thread in forum, https://forum.nim-lang.org/t/184, But it seems not yet been implemented |
05:24:37 | FromGitter | <data-man> @7sDream: Something like ```names.join(",")``` (join from strutils) |
05:28:03 | FromGitter | <7sDream> @data-man Any security issues when using it this way? |
05:31:39 | FromGitter | <7sDream> I think the approach discussed in the post looks better, but can we pass a `seq[string]` to `varargs string`? like Python's `some_method(*args)` |
05:33:22 | FromGitter | <data-man> Make PR :) |
05:35:26 | FromGitter | <7sDream> :P will try after I finish my work |
05:36:15 | FromGitter | <data-man> Is ```join``` works? |
05:39:06 | FromGitter | <7sDream> I'm testing the forum's way, will test join after that |
05:42:52 | FromGitter | <data-man> Maybe the ```names```must be quoted. |
05:43:46 | FromGitter | <data-man> Entries in the ```names```. |
05:47:32 | FromGitter | <data-man> What DB you use? |
05:48:31 | FromGitter | <7sDream> sqlite |
05:48:47 | FromGitter | <7sDream> just for test |
05:49:54 | FromGitter | <7sDream> http://ix.io/1bvQ/nim |
05:50:29 | FromGitter | <7sDream> forum's way works, it seem varargs accept a seq, but can't follow by any other items |
05:51:14 | miran | varargs unpacks a seq? |
05:52:05 | FromGitter | <data-man> Then I recommend use https://github.com/sqlitebrowser/sqlitebrowser for debugging SQL queries. |
05:55:38 | FromGitter | <7sDream> @miran yes, varargs accept a seq: https://glot.io/snippets/f1f23io11n |
05:56:18 | FromGitter | <7sDream> I'm using sqlitestudio, sqlitebrowser is great too |
05:56:50 | miran | but is this how varargs should be used? |
05:57:08 | miran | because you only have one arg - a seq |
05:57:20 | miran | and you could do `a: seq[int]` |
05:58:01 | FromGitter | <7sDream> yes, that's way I want a way to unpack args like Python `some_method(*args1, *args2, 123)` |
05:58:07 | FromGitter | <7sDream> s/way/why |
05:58:09 | miran | this is how to use varargs, IMO: https://glot.io/snippets/f1f26jlsna |
05:58:52 | miran | IIRC you cannot do that in python. the order of arguments is wrong and you cannot have two unpackings |
05:58:57 | FromGitter | <7sDream> I know it, but if I got args in two different seq, how can I pass them to a varargs? |
05:59:27 | miran | `a, b: seq[int]`? |
05:59:50 | miran | then you need something like python's itertools.chain |
05:59:58 | FromGitter | <7sDream> But the method is not written by myself... |
06:00:33 | FromGitter | <7sDream> If I can control the params list, I wil use `varargs seq[int]` |
06:01:07 | miran | can you show me/us the method? |
06:01:38 | FromGitter | <7sDream> this thread: https://forum.nim-lang.org/t/184 |
06:02:47 | FromGitter | <7sDream> and it's not yet been implemented, so I try myself: http://ix.io/1bvQ/nim |
06:03:07 | miran | here is the version that takes multiple seqs: https://glot.io/snippets/f1f2bigkxe |
06:04:43 | FromGitter | <7sDream> yes, but `db_sqlite.getAllRows` (which in stdlib) 's params list is `varargs[string]` |
06:06:39 | miran | oh, so you have seqs, but you need to have strings? |
06:07:39 | FromGitter | <7sDream> yes |
06:07:50 | FromGitter | <7sDream> BTW, Python do support multi `*args` |
06:08:03 | miran | here you go, you concat the seqs: https://glot.io/snippets/f1f2ge4itg |
06:08:41 | FromGitter | <7sDream> yes, that's what I'm doing……http://ix.io/1bvQ/nim, line 4 |
06:09:07 | FromGitter | <7sDream> just wonder is there any better way/syntax |
06:13:22 | FromGitter | <data-man> Oh, SQLiteStudio was migrated to GitHub. Great, I didn't know. :) |
06:20:24 | FromGitter | <7sDream> `import sequtils` then `"1".repeat(2) == ["1", "1"]` ⏎ `import strurtils` then `"1".repeat(2) == "11"` ⏎ a bit confusing/hard when import and use both of them……+_+ ⏎ https://glot.io/snippets/f1f2pepxhx [https://gitter.im/nim-lang/Nim?at=5b0a4e2846e4f37b86fc8e25] |
06:22:12 | skrylar | i kinda wish flowvars were better documented in threadpool, but at least sync works. o/ |
07:07:02 | * | gangstacat joined #nim |
07:16:32 | * | nsf joined #nim |
07:47:47 | Electrux | if i don't use import sequtils ( or even if i do ) can i use sequtils.<function>? |
07:47:52 | Electrux | instead of just <function> |
07:49:33 | FromGitter | <7sDream> if you import, you can |
07:58:37 | miran | Electrux: you can do `from sequtils import <function>` |
07:58:44 | FromGitter | <data-man> You can use ```from sequtils import <function>``` |
07:58:49 | FromGitter | <data-man> :) |
07:58:58 | miran | :) |
07:59:39 | Electrux | no i meant for what 7sDream said... how do i use the, say, repeat function from both strutils and sequtils without causing ambiguity |
08:00:16 | miran | from sequtils import function as seqfunction; from strutils import function as strfunction? |
08:00:33 | FromGitter | <7sDream> do we has `as`? |
08:01:16 | FromGitter | <7sDream> identifier expected, but found 'repeat as seqRepeat' |
08:01:22 | FromGitter | <7sDream> :/ |
08:01:37 | FromGitter | <data-man> ```as``` what is it, casting? |
08:01:48 | FromGitter | <7sDream> alias |
08:01:49 | miran | oh, i thought this worked, sorry |
08:01:51 | Araq | 'as' only introduces module aliases |
08:01:56 | Araq | from sequtils import nil |
08:02:01 | Araq | from strutils import nil |
08:02:11 | Araq | sequtils.repeat() vs strutils.repeat() |
08:02:16 | Araq | import sequtils |
08:02:21 | Araq | import strutils except repeat |
08:02:34 | Araq | so many ways to do what you need :-) |
08:02:35 | * | gmpreussner_ quit (Ping timeout: 240 seconds) |
08:02:52 | FromGitter | <7sDream> emmm, when I want use both of them... |
08:02:57 | Electrux | so... <module>.<function> works when i import nil from them? |
08:03:01 | Electrux | that's cool!! :D |
08:03:03 | miran | btw Electrux, usually if the functions have the same name, but the different signature - this is not the problem |
08:03:27 | Araq | you can use both of them |
08:03:31 | Araq | when you use |
08:03:35 | Araq | import x except y |
08:03:41 | Araq | x.y is still available |
08:03:44 | Araq | when you use |
08:03:47 | FromGitter | <7sDream> oh, great |
08:03:49 | Araq | from x import nil |
08:03:55 | Araq | x.y is still available |
08:03:58 | FromGitter | <7sDream> that's helpful |
08:04:00 | Electrux | oh wait... i literally forgot about the overloading concept lol sorry |
08:04:08 | Electrux | that's awesome thanks Araq :D |
08:05:41 | * | gmpreussner_ joined #nim |
08:24:45 | miran | btw, another benchmark (this time comparing C FFI across different languages) including nim: https://github.com/dyu/ffi-overhead |
08:30:41 | * | FuntDobra joined #nim |
08:35:42 | Araq | seems flawed since Nim has no overhead |
08:36:01 | Araq | nor does Rust have any |
08:37:40 | Araq | or D. |
08:37:54 | Araq | whatever he is measuring, it's not the "FFI overhead" |
08:38:00 | miran | :) |
08:39:25 | * | Shivelight quit (Quit: Connection closed for inactivity) |
08:40:08 | Araq | maybe it's "cache effects under how the linker arranged functions in memory" |
08:40:34 | FromGitter | <data-man> btw, tup is great :) |
08:45:57 | * | FuntDobra quit (Ping timeout: 240 seconds) |
08:58:27 | * | miran quit (Ping timeout: 240 seconds) |
08:58:27 | * | miran_ joined #nim |
08:58:48 | * | miran_ is now known as miran |
09:01:21 | * | rauss quit (Read error: Connection reset by peer) |
09:04:03 | * | rauss joined #nim |
09:30:09 | Yardanico | Hmm, is there a way to check if /dev/urandom exists? |
09:32:55 | Araq | don't use it, it can be corrupted anyway |
09:33:03 | Araq | and always return 0. |
09:33:17 | Araq | files are not APIs, files are much worse. |
09:42:12 | * | FuntDobra joined #nim |
09:44:05 | * | Electrux quit (Ping timeout: 252 seconds) |
09:47:26 | * | Electrux joined #nim |
10:01:30 | * | Electrux quit (Ping timeout: 245 seconds) |
10:03:07 | * | Electrux joined #nim |
10:11:48 | * | nsf quit (Quit: WeeChat 2.1) |
10:31:45 | FromGitter | <data-man> https://gitter.im/NimCompression/Lobby :) |
10:38:06 | federico3 | Yardanico: other than existsFile? There's also the getentropy() syscall and OS-independent libraries like libsodium that do the right thing |
10:39:54 | Yardanico | federico3 existsFile doesn't work :D |
10:40:07 | Yardanico | (i'm on macOS and existsFIle("/dev/urandom") returns false) |
10:40:15 | Yardanico | !eval existsFile("/dev/urandom") |
10:40:16 | NimBot | Compile failed: in.nim(1, 1) Error: undeclared identifier: 'existsFile' |
10:40:23 | Yardanico | !eval import os; echo existsFile("/dev/urandom") |
10:40:27 | NimBot | false |
10:42:47 | FromGitter | <data-man> !eval var file: File; echo file.open("/dev/urandom"); file.close |
10:42:49 | NimBot | true |
10:44:10 | federico3 | ah, existsFile check only for real files like python's isfile but the documentation is incorrect |
10:55:51 | federico3 | Yardanico: updated doc in #7888 |
10:55:58 | Yardanico | federico3 thanks! |
11:00:46 | * | sz0 quit (Quit: Connection closed for inactivity) |
11:01:06 | Electrux | how do i split a string based on multiple symbols? |
11:01:51 | Electrux | when i split a string by calling split with a char list of symbols, the result ends up containing empty strings |
11:01:55 | miran | Electrux: https://nim-lang.org/docs/strutils.html#split,string,set[char],int |
11:02:42 | Electrux | for example, if i call split by ' ' on a string containing double space like "hello world", there is an empty string in the result |
11:03:08 | miran | use https://nim-lang.org/docs/strutils.html#splitWhitespace,string,int ? |
11:03:32 | arecaceae | wasn't there something where I can add small tests to comments and something parses/runs them? |
11:03:58 | miran | arecaceae: runnableExamples |
11:04:05 | miran | https://nim-lang.org/docs/system.html#runnableExamples,untyped |
11:04:13 | arecaceae | miran: thanks |
11:04:19 | Electrux | oh wow that's cool... one last thing... what if i wanna have the string split by a sequence of symbols but not remove the symbols from the resulting sequence of strings? |
11:04:47 | Electrux | say... "a+b" => { "a", "+", "b" } |
11:05:01 | arecaceae | miran: oh, not quite for unittests tho? |
11:09:00 | * | yglukhov[i] joined #nim |
11:12:02 | * | FuntDobra quit (Remote host closed the connection) |
11:12:29 | * | FuntDobra joined #nim |
11:14:26 | miran | arecaceae: this is the only time i've used runnableExamples: https://github.com/narimiran/itertools/blob/master/src/itertools.nim somebody more experience might give you better information |
11:14:51 | Electrux | how do i convert a single char to string? |
11:15:17 | FromGitter | <7sDream> !eval echo $'c' |
11:15:20 | NimBot | c |
11:16:15 | Electrux | ! eval echo ($'c').type.name |
11:16:18 | Electrux | !eval echo ($'c').type.name |
11:16:19 | NimBot | Compile failed: in.nim(1, 17) Error: undeclared field: 'name' |
11:16:31 | FromGitter | <7sDream> !eval echo ($'c').repr |
11:16:33 | NimBot | 0x421900"c" |
11:16:41 | Yardanico | Electrux $ch |
11:16:51 | Electrux | oh oops ok thanks a lot :) |
11:16:51 | Yardanico | !eval let a = '1'; let b: string = $a; echo b |
11:16:53 | NimBot | 1 |
11:17:08 | Electrux | i literally read this yesterday and forgot completely today... |
11:17:24 | Yardanico | $ is generally used for converting types to string in Nim |
11:17:31 | Yardanico | in stdlib and in third-party libraries |
11:18:35 | * | FuntDobra quit (Ping timeout: 240 seconds) |
11:20:06 | Electrux | oh woot made the split part :D |
11:20:26 | Electrux | thanks a lot Yardanico and 7sDream |
11:20:28 | Electrux | :D |
11:34:53 | federico3 | how can I loop through the fields of a type inside a macro? |
11:37:35 | federico3 | e.g. https://forum.nim-lang.org/t/1696 |
11:38:39 | * | SenasOzys joined #nim |
11:39:13 | FromGitter | <data-man> @Electrux ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b0a98e1ba1a351a68c9ae20] |
11:41:05 | FromGitter | <Yardanico> wow, that's a big long :D |
11:41:10 | FromGitter | <Yardanico> *a bit |
11:42:13 | FromGitter | <data-man> Efficient, expressive and elegant. :) |
11:42:58 | Electrux | tokenize works on single characters? |
11:45:54 | Yardanico | @data-man are you sure tokenize is better than just items(string) ? |
11:55:17 | arecaceae | trying to profile and check how often my nim program allocs memory - I'm down to suspecting that counting `rawAlloc`-calls is actually a good idea, is it? |
11:55:35 | arecaceae | counting heap-allocs as what I'm trying to do |
11:56:22 | Araq | why would you count rawAllocs? |
12:00:20 | * | Trustable joined #nim |
12:00:52 | * | Gnjurac joined #nim |
12:01:03 | Gnjurac | nim can compile on rpi3 right |
12:01:05 | Gnjurac | ? |
12:01:16 | federico3 | yep |
12:02:06 | Gnjurac | ok ty |
12:02:20 | arecaceae | Araq: trying to count my heap-allocs |
12:02:41 | Araq | and then what? |
12:03:09 | arecaceae | Araq: trying around with small code snippets and check if my intuition serves me right how often they alloc |
12:03:39 | arecaceae | Araq: and if they do more then what I figured, I'll see how I can reduce them, because of performance and stuff |
12:03:45 | FromGitter | <arnetheduck> prefix `?` for `Result` early return seems to work :) https://github.com/arnetheduck/nim-result/pull/1/files#diff-9699f66aef17b3032dbf48af66a259f7R389 |
12:03:58 | arecaceae | Araq: not about whole programs, just small snippets and stuff |
12:04:50 | * | elrood joined #nim |
12:06:16 | arecaceae | Araq: atm primarily care about dealing/composing/concatenating/preallocing strings in a bunch of matters and trying to find out how far nims default string handling can carry me |
12:07:01 | * | yglukhov[i] quit (Remote host closed the connection) |
12:07:03 | Araq | arnetheduck: I'd rather give you {.experimental: "strict".} ... |
12:07:24 | Araq | reinventing exceptions is pretty bad. |
12:08:10 | Electrux | @data-man that's amazing solution! thanks a lot :D |
12:09:09 | Electrux | btw... is returning a result preferrable or setting the "result" variable to the result, in a function? |
12:10:21 | arecaceae | if I do newStringOfCap and grow it beyond capacity, will it regrow the string or throw me an exception? |
12:10:33 | arecaceae | could've just tried I guess ... |
12:11:06 | Electrux | or even not returning or setting the result ( i guess last statement's result is set as the return value )? |
12:12:15 | * | nsf joined #nim |
12:13:33 | Yardanico | Electrux result variable is implicit |
12:13:43 | Yardanico | it's returned automatically and available in every proc which returns something |
12:14:16 | Yardanico | most idiomatic way is to set "result" variable to the result you want, and just use "return" when you need to exit from the proc |
12:14:36 | Yardanico | if you don't need to exit from the proc early, you don't have to use "return" at all |
12:15:00 | FromGitter | <Vindaar> @arecaceae it should just regrow it |
12:15:39 | Gnjurac | what extenion shoud nim files have, nim right? testme.nim ? |
12:15:41 | arecaceae | Vindaar yeah, thanks |
12:15:44 | Yardanico | Gnjurac yes |
12:15:55 | Gnjurac | ok |
12:15:58 | FromGitter | <arnetheduck> @Araq, well, there's another reason for `quit` on certain errors: if you end up doing strict with checked and unchecked exceptions, the checked ones will end up not being used (aka Java) and you can't really do strict for all little overflows etc .. as far as ints and the like go, if I want overflow checking I'd probably prefer having a string of computations done and checking for overflow only at the end.. ie `a + |
12:15:58 | FromGitter | ... b + c` can do both adds and only have an overflow check at the end, catching the carry bit at each step in an overflow bool |
12:16:02 | Gnjurac | sorry i wasnt shoure |
12:16:11 | Yardanico | .nimble for nimble project files, .cfg for compiler configuration |
12:16:20 | Gnjurac | ty |
12:16:36 | FromGitter | <arnetheduck> then there's a matter of taste: should `IndexError` on a seq be checked or not? |
12:17:43 | Electrux | so do i set the expression to result? there are basically 3 possible options written below: |
12:17:47 | Araq | also I read this article about Midori again and think its analysis misses the point that 'quit' as an error handling strategy only works when you have processes. but lacking processes, these quits naturally become 'raise' |
12:18:12 | Electrux | "return a + b", "a + b", "result = a + b" |
12:18:36 | Yardanico | Electrux well, second option is mostly used when your proc is short |
12:18:43 | * | CodeVance joined #nim |
12:18:46 | Electrux | what should i do? better for performance? if not, just which one is more used |
12:18:49 | Araq | 'result = a + b' is the preferred variant, a + b for short procs |
12:19:03 | arecaceae | can I "reset strings" / set a strings length to 0 after its been filled with content? |
12:19:03 | Araq | performance is equal |
12:19:08 | FromGitter | <arnetheduck> well, it sort of presupposes that there's a manager outside the process.. in erlang, that's the evm, in linux that's `systemd` and elsewhere it can be `systemctl` - ie for those cases that you have a service that needs automatic restarting |
12:19:51 | Araq | well JS/Webassembly has no process concept. |
12:20:29 | Araq | and assuming you have an OS is a pretty wild assumption for embedded |
12:20:36 | FromGitter | <arnetheduck> you can configure each of those to restart your process, for the cases where that's needed.. you *cannot* do that with a top-level catch and a random raise - within the process, there are not enough tools to do so in a safe way (open files, locks held, etc) |
12:21:15 | FromGitter | <Vindaar> @arecaceae use the `setLen` proc |
12:21:28 | arecaceae | Vindaar: thanks |
12:22:05 | Araq | well no, you can implement a supervisor as a library (though it might be a shitty one) when you have 'raise' |
12:22:05 | Araq | and you can't when you lack 'raise'. |
12:23:53 | Araq | this whole notion of "Let it crash" translates into "let it raise an exception" for me. |
12:24:21 | Electrux | ok thanks @Araq :D so return is just for when i need result to be returned without executing further statements right? |
12:24:40 | Araq | Electrux: yes, 'return' is control flow. |
12:25:32 | Yardanico | Electrux also, fyi - you don't have to use @ in IRC :) nickname without any symbols is enough |
12:28:15 | Electrux | and what about performance impacts between the 3 of them? i imagine, say, setting the result variable will cost some performance reduction instead of directly returning? or does the compiler automatically optimize all the 3 of them? |
12:28:36 | Electrux | oh ok thanks Yardanico :D |
12:28:54 | Yardanico | Electrux well, it depends |
12:29:46 | Electrux | on? |
12:30:07 | Electrux | m sorry for asking too many questions and troubling u all btw.... |
12:30:09 | Yardanico | E.g. if your proc returns a string, and in the proc you create new string and return it instead of using "result" variable - it'll cost *a bit* of performance. But I may be wrong with these things, maybe compiler optimizes it away :) |
12:30:13 | Yardanico | Electrux don't worry, it's fine |
12:33:04 | FromGitter | <arnetheduck> the only reason to have a supervisor is that you want reliable restarts - the only way to build such a supervisor is to manage *all* resources of the process and reinit them on failure - that's either an OS or a full-blown VM.. anything else will be a maze of halfbaked attempts that sometimes work and most of the time generate unactionable bug reports |
12:35:26 | FromGitter | <arnetheduck> so `strict` will enforce annotations on overflowerrors? |
12:36:53 | Araq | no. :-) |
12:38:19 | Electrux | thank u all very much <3 :D |
12:38:49 | * | Trustable quit (Remote host closed the connection) |
12:39:00 | FromGitter | <arnetheduck> oh well. sounds pretty useless then - what's it useful for? |
12:40:04 | Araq | so that the other exceptions are explicitly acknowledged for when you export the proc |
12:41:26 | FromGitter | <arnetheduck> so the docs will be: `strict` mode makes the compiler bug you about a random subset of all possible raises |
12:42:12 | Araq | not "random subset", the things that would end up in your return *types* |
12:42:39 | Araq | I mean, what you would encode in the return type if you lacked exceptions |
12:43:13 | FromGitter | <zah> Araq is trying to say "the recoverable errors" |
12:43:21 | FromGitter | <arnetheduck> and since the docs basically recommend catching exceptions blindly (without specifying types), we'll end up with a style guide like python's, that no one actually follows |
12:43:46 | Araq | it's exactly as "useless" as your Either type, but you don't have to invent ever more syntax sugar to make that style bearable |
12:43:59 | Araq | nor do you have to lift every operations to work on Eithers. |
12:44:19 | Araq | and whether your coworkers follow your style guide or not is not in Nim's responsibility. |
12:44:24 | FromGitter | <arnetheduck> that's true and nice - but it makes unrecoverable errors recoverable in an unsafe way |
12:44:53 | FromGitter | <arnetheduck> the default and easiest thing in the language becomes the wrong thing to do, with an option to improve when you know what you're doing |
12:45:16 | Araq | 'except:' is frown upon in Python, it is always 'except ConcreteError' |
12:45:43 | FromGitter | <arnetheduck> just like using unchecked exceptions in Java is |
12:46:05 | Araq | pure conjecture. |
12:46:27 | Araq | Java's mistakes are that callbacks default to "throws nothing" |
12:47:03 | Araq | so people were forced into turning checked exceptions into unchecked ones. |
12:48:00 | * | CodeVance1 joined #nim |
12:48:03 | FromGitter | <zah> By default, there shouldn't be a handler for non-recoverable errors anywhere in the user code. The developer can decide to add such a handler in rare cases (when treating a certain subsystem a non-critical "whose bugs can be ignored") |
12:48:06 | * | CodeVance1 quit (Client Quit) |
12:48:33 | dom96 | ooh, are we arguing about exceptions? |
12:48:41 | Araq | dom96: always... |
12:49:00 | FromGitter | <arnetheduck> @zah one way to make that happen actually is to make `strict` prohibit catching unrecoverable ones blindly |
12:49:19 | FromGitter | <zah> As far as I can tell, one of Java's problems was that people were not educated about the recoverable vs non-recoverable distinction and they frequently used checked exceptions for non-recoverable issues - people ended up hating them in practice |
12:49:20 | dom96 | Araq: Regarding those C FFI benchmarks, maybe you should post your opinions about them on HN? https://news.ycombinator.com/item?id=17161168 :) |
12:49:34 | FromGitter | <zah> This problem can plague Nim as well, but this is life |
12:50:23 | Araq | we can map unchecked exceptoins to 'quit' but I want people to write supervisors in pure Nim as a library ... |
12:50:39 | FromGitter | <arnetheduck> I wonder if they should be called different things, which might put people in the right frame of mind - `exceptions` for unrecoverable things, `errors` for recoverable ones |
12:50:40 | * | CodeVance quit (Ping timeout: 245 seconds) |
12:51:15 | dom96 | Are we planning on changing how exceptions work in Nim? |
12:51:21 | FromGitter | <arnetheduck> @Araq, you can want that all you like, but it's going to be a broken and poorly implemented library, right from the very beginning to the very end |
12:51:58 | FromGitter | <arnetheduck> that's not conjecture even :) |
12:52:21 | * | Vladar joined #nim |
12:52:31 | Araq | it's going to be the *only* solution for Webassembly. |
12:52:36 | Araq | also not a conjecture. |
12:53:10 | Araq | also, hey, Nim is a systems programming language, system programming languages should run without an OS. |
12:54:03 | FromGitter | <arnetheduck> webassembly? you know there are no exceptions in wasm, right? |
12:54:03 | Araq | and "broken, poorly implemented" is just a misguided way of putting "we moved from 80% reliability to 95%" |
12:54:26 | FromGitter | <ephja> is that the old, correct definition of "systems PL"? :p |
12:54:32 | Araq | otherwise why would Erlang even have supervisiors... |
12:55:04 | Araq | I'm sure you can use Erlang's FFI to create socket handles that will leak. |
12:55:18 | FromGitter | <arnetheduck> that's the point, erlang built a vm that could do these things - it's no longer a library but a shell around the process |
12:55:35 | Araq | well, webassembly will get exceptions, but replace it with JS for the time being. |
12:56:40 | Electrux | i dont wanna intrude in the talk... but i literally dont understand mostly a word of what u guys say lol |
12:58:07 | FromGitter | <arnetheduck> so how about `strict` disables catching of the exceptions it fails to be strict about? |
12:59:16 | FromGitter | <arnetheduck> then you can build your shitty library in non-strict mode, and strict mode remains a bubble of sanity |
12:59:30 | Araq | now that's a very good idea. |
12:59:41 | Araq | and should be part of strict. |
13:00:44 | FromGitter | <arnetheduck> the next thing I'm gonna say is going to take some time to sink in however: strict should be default, with an option to disable it :) |
13:01:11 | federico3 | and nimble could complain if someone tries to publish a library in non-strict mode |
13:05:16 | dom96 | so what would this strict mode do? |
13:05:22 | Araq | ah ok, we're dreaming now... |
13:05:22 | dom96 | I'm not 100% sure even after reading the logs |
13:06:02 | miran | how about polishing current features and releasing v1.0? no? ok, i'll show myself out.... |
13:06:17 | FromGitter | <arnetheduck> yeah, well, I just wanted to put it in print, so I can "told you so" when the discussion about breaking changes for 2.0 begins... |
13:06:39 | Araq | you will always be able to say this. |
13:06:46 | FromGitter | <arnetheduck> dom96, |
13:09:09 | arecaceae | is there a lambda-syntax where I can construct a lambda inplace and pass it to a function as an argument - and have it lambda-lifted? |
13:09:11 | FromGitter | <arnetheduck> which exceptions that will be is a matter of taste - overflows most likely, indexerrors maybe, regex-parse-errors I hope not |
13:09:46 | dom96 | arnetheduck: just so you know, edits on Gitter are not propagated to IRC :) |
13:10:52 | dom96 | okay, so now I get where the "unrecoverable" keyword comes from |
13:11:03 | dom96 | So which exceptions do you consider "unrecoverable"? |
13:11:40 | FromGitter | <arnetheduck> @dom96 yeah I know - this way at least some people see a sane message - I sometimes type on an ISO and sometimes on an ANSI layout keyboard which sucks because the enter key has different shapes.. |
13:11:56 | miran | arecaceae: you mean annonymous function or something else? |
13:12:12 | arecaceae | miran: anon is fine, doesnt have to be a closure |
13:12:17 | dom96 | arecaceae: => in future module |
13:12:25 | arecaceae | dom96: thanks I'll check it out |
13:12:30 | dom96 | https://nim-lang.org/docs/future.html#=%3E.m,untyped,untyped |
13:12:46 | miran | now in future, sugar in future :D :D |
13:12:58 | arecaceae | dom96: awwww arrow syntax <3 love it |
13:17:25 | FromGitter | <arnetheduck> @dom96 that's a question that can't be answered without context (the errors you care about in one application are uninteresting/unlikely for another), but if I had to choose one, most would recoverable, specially when writing library code - the question I'd ask myself in tricky situations would perhaps be: would I issue a bugfix if it actually happened? |
13:18:17 | dom96 | So if it's so context specific, wouldn't we need a way to specify whether an exception is recoverable when defining that exception? |
13:20:22 | Araq | IMO exceptions are all recoverable |
13:20:28 | * | dddddd joined #nim |
13:21:07 | FromGitter | <arnetheduck> that also, but above all, it would put something like `IndexError` in doubt - depending on what you're doing, it would be recoverable or not - ie if you envision that most indices are user-input then of course it's recoverable.. if instead you're using the out-of-bounds as a safety feature that should never happen, of course they're not |
13:21:24 | FromGitter | <zah> The key distinction is that the recoverable errors are expected, while the developer hopes that the non-recoverable errors will never happen |
13:22:10 | FromGitter | <zah> You can find a longer and more detailed explanation in the article linked at the top of my error handling proposal: https://gist.github.com/zah/d2d729b39d95a1dfedf8183ca35043b3 |
13:23:54 | FromGitter | <arnetheduck> if all exceptions are recoverable, you need to write (reliable) unwinding code for both recoverable and unrecoverable errors - that means that there's no point distinguishing the two.. if instead unrecoverable errors are really unrecoverable, you can skip all that stuff for them and hope that there's an all-knowing oracle that will clean up whatever mess you left behind... either the shitty library that sometimes |
13:23:54 | FromGitter | ... does that or an OS or a VM - the whole point is that in your program code, you don't care any more / try to handle it sanely |
13:27:55 | Araq | exceptions turn partial functions into total functions. You can continue after a total function invocation. Hence exceptions are recoverable. |
13:28:28 | * | SenasOzys quit (Ping timeout: 252 seconds) |
13:29:21 | Araq | the problems start when you handle some exception in the wrong scope. If 'parse' produces ValueError but so does 'doAssert' then you'll be unhappy. |
13:29:24 | FromGitter | <arnetheduck> huh? that's for mathematical functions - things that only depend on their inputs and no other state... |
13:29:48 | FromGitter | <zah> In practice, it's difficult to ensure that stack unwinding didn't leave some partially committed transaction in the state of the memory |
13:30:59 | FromGitter | <zah> The exception safety nomenclature in C++ tries to capture that: basic vs strong, etc: https://en.wikipedia.org/wiki/Exception_safety |
13:31:30 | Araq | arnetheduck, well in some hand-wavy sense. :-) |
13:31:36 | arecaceae | dom96: issue with slim-arrow from future is that it defaults to {.closure.} in a nested-type - when I want it to be {.nimcall.} :/ |
13:31:38 | FromGitter | <zah> With a non-recoverable error (a detect bug), you'll be right to be suspect that something might be wrong now |
13:32:16 | dom96 | arecaceae: :/ |
13:32:16 | arecaceae | dom96: so I think `->` needs to have a nimcall variant |
13:32:33 | FromGitter | <arnetheduck> @Araq yeah so stop trying to sound smart by throwing random terms and buzzwords around :) |
13:32:51 | arecaceae | dom96: I assume allowing {.nimcall.} behind the `->` doesn't work as part of the macro? `(x) -> void {.nimcall.}` |
13:32:59 | dom96 | doubt it |
13:33:09 | dom96 | Not sure what we can do here |
13:33:40 | FromGitter | <zah> I don't think Jacek is right when claiming there is no point of distinguishing the two. My proposal points out that you need to treat the two differently in error signatures, at call-sites (i.e. handleErrors), etc |
13:33:52 | arecaceae | dom96: could default `=>` also to closure? |
13:34:02 | arecaceae | dom96: because it defaults to nimcall apparently |
13:34:17 | Araq | well but I'm serious, a 'fac' computation overflowing is not really all that different from "IO Error: hard disk is full", why assume you have to crash the entire application because of this |
13:34:49 | * | xkapastel joined #nim |
13:34:51 | FromGitter | <zah> Araq, what do you propose instead of crashing? |
13:35:15 | * | SenasOzys joined #nim |
13:35:32 | arecaceae | dom96: apparently this is no problem if you use -> in a proc as argument and then => inside it, but when I use -> in a type-block and then => somewhere else, I'm running into this issue |
13:35:39 | FromGitter | <zah> It all depends how important for your application was computing this factorial - you can chose to recover from the problem in several ways with varying levels of risk |
13:35:39 | dom96 | arecaceae: It defaults to whatever nim defaults to IIRC |
13:35:46 | FromGitter | <arnetheduck> well, @zah, you kind of say that you're distinguishing the two because for unrecoverable ones, it's too onerous to write proper unwinding / transactional stuff, so you'd rather not have them visible |
13:35:53 | dom96 | arecaceae: So if you use a variable outside its scope it will become a closure |
13:36:02 | arecaceae | dom96: I see, mb have two different arrow variants then :D |
13:36:47 | arecaceae | dom96: =>/-> closure arrows, =P> -P> nimcall/proc arrows >.< |
13:37:18 | dom96 | arecaceae: Make an RFC :) |
13:37:19 | Araq | zah: continue running, you have subsystems in your application, you make the subsystem die, but not more than that. you argue that you need to map subsystems to a process concept to make this safe, but that's not been proven and even Erlang VM's doesn't roll back IO effects anyway |
13:37:36 | FromGitter | <zah> proper stack unwinding is not crucial only for exceptions. RAII ensures that early returns don't lead to resource leaks as well |
13:37:40 | arecaceae | dom96: >.< |
13:38:17 | dom96 | zah: Why don't you just leave the unrecoverable exceptions unhandled and let the program crash? |
13:38:24 | FromGitter | <zah> so in some limited sense, stack unwinding is a bit orthogonal to handling the errors |
13:39:35 | Araq | it's yglukhov's point really, "ok, so the subsystem failed because of a bug, not because of a real error, but here is the point: I don't have to care, this entire operation was optional" |
13:39:41 | FromGitter | <zah> Araq, I've suggested that mapping the subsystem to a process increases the safety, but obviously it's up to the developer to make these decisions |
13:40:21 | Araq | the question is, can you map bugs to recoverable errors. |
13:40:30 | FromGitter | <zah> what I'm certain is that the code within the subsystem doesn't care about the non-recoverable errors (it never tries to handle them, they propagate only up) |
13:40:37 | Araq | and you'll be surprised of how often that would work. :P |
13:41:34 | Araq | well that's my conjecture, anyway. |
13:41:54 | FromGitter | <arnetheduck> for some pretty weak definition of "works" :) |
13:42:14 | FromGitter | <zah> so, the language should acknowledge this in the two places I've suggested (.errors:. implies the list of non-recoverable errors; handleErrors implicitly propagates them up) |
13:42:28 | Electrux | wait... i cannot create multiple variables on a single line? |
13:43:27 | Yardanico | Electrux you can |
13:43:30 | Yardanico | let (a, b) = (1, 2) |
13:43:53 | Araq | arnetheduck: every time a process dies but the OS doesn't you can argue "it's not correct, the OS **needs** to undo the hard disk effects", but ... you don't. |
13:43:56 | Electrux | oh so the tuple form is a must? ok then :D |
13:44:07 | Electrux | thanks :D |
13:44:18 | Yardanico | Electrux nim is not python, it's similar sometimes, but still :) |
13:44:28 | Yardanico | (similar in syntax I mean) |
13:44:28 | Electrux | wait... what if i don't wanna assign the values initially? |
13:44:37 | miran | var a: int |
13:44:39 | Electrux | as in var v1: string, v2: string |
13:44:56 | Electrux | i meant for multiple variables miran |
13:45:13 | Yardanico | Electrux well, why do you want to do it in one line? :) |
13:45:24 | Yardanico | if you REALLY want (but it's generally bad to do that), you can use ; |
13:45:28 | Yardanico | ah, sorry |
13:45:30 | miran | lots of these questions are answered here: https://nim-lang.org/docs/tut1.html |
13:45:31 | FromGitter | <arnetheduck> @Araq, no but every sane/reliable application that reads from the disk assumes that there's garbage in it on startup and goes from there.. |
13:45:33 | Yardanico | Electrux var v1, v2: string |
13:46:21 | Electrux | oh i don't want to... i was just curious about this language's decision... sorry i m fine with the decisions this language made ( the language is really cool btw ) but i just like to know the whole story... :) |
13:46:35 | Electrux | oh... my apologies... thanks miran :) |
13:46:39 | arecaceae | dom96: can I open a new multi-line block in => ? |
13:46:47 | Yardanico | Electrux as I said, just use var v1, v2: string , that's fine |
13:46:47 | Araq | arnetheduck: that means the "OS runs under a pretty weak definition of works". |
13:47:16 | Electrux | and yes that works! Yardanico thanks a lot :D |
13:47:30 | dom96 | arecaceae: no, just write a `proc` for that |
13:47:49 | dom96 | arecaceae: well, I guess you can by writing (foo; blah; baz) over multiple lines |
13:47:54 | dom96 | with the ; but that sucks |
13:48:24 | arecaceae | dom96: ye :/ well, I guess I can't use neither ->/=>, but thanks for the info |
13:48:38 | FromGitter | <arnetheduck> well, code typically makes assumptions that are not as rigorous - ie that there are no file handles open except 0,1,2 on first entry.. that your thread locals are inited once, that there's only one thread running etc.. all the little things that your library cannot really take care of and your code certainly doesn't... |
13:49:09 | miran | arecaceae: IMO =>/-> should be used for simple "oneliners", anything more than that - write a proc |
13:49:10 | Araq | tbh this whole thing smells like a black-white fallacy to me. So yeah, you have "unrecoverable" errors, but they are actually pretty recoverable, the OS recovers from them all the time. |
13:49:39 | arecaceae | miran: that seems to be the case ye |
13:49:58 | Araq | in fact, it recovers from them in the same shitty way that a Nim supervisor-as-a-library would. |
13:50:40 | Araq | see you later. |
13:51:02 | FromGitter | <arnetheduck> so to make it simple, a nim supervisor (except a green-threaded one) cannot manage threads - there, broken! |
13:51:33 | FromGitter | <arnetheduck> an OS can - because it owns the resources |
13:52:48 | FromGitter | <zah> I think you are missing one point - of course these errors are recoverable on a technical level, but as a designer of the software library, I don't want to force myself to handle these errors - I've put them voluntarily in a separate category of errors that my code should not try to address (because there is no suitable run-time policy) |
13:54:24 | FromGitter | <zah> so, the distinction is just a tool I use to make my life easier (given that I have the goals of 1) handling all recoverable errors and 2) reporting in a graceful way the detected bugs without too much boilerplate in the code) |
14:07:35 | * | yglukhov[i] joined #nim |
14:08:30 | * | Gnjurac quit (Remote host closed the connection) |
14:08:32 | * | Snircle joined #nim |
14:08:38 | * | nsf quit (Quit: WeeChat 2.1) |
14:09:12 | Electrux | ok so... i am trying to implement a stack... i wanna handle the out of bounds case and just return the default value of the type ( int, char, etc ) when it occurs... how can i do that? i will probably just raise an exception in the future which seems to be more proper... but just for understanding... how to do this? |
14:11:55 | * | yglukhov[i] quit (Ping timeout: 245 seconds) |
14:21:34 | FromGitter | <ephja> I'm not sure I'm mostly storing runes. doesn't work with parseutils :p |
14:36:58 | * | Trustable joined #nim |
14:39:43 | FromGitter | <ephja> my text editor is operating on seq[Rune] gap buffers. the biggest issues might be library support and memory usage |
14:42:57 | * | miran quit (Ping timeout: 240 seconds) |
14:55:05 | federico3 | any take on https://forum.nim-lang.org/t/1696 ? |
14:59:38 | * | FuntDobra joined #nim |
15:04:25 | FromGitter | <7sDream> Why `actors` module is deprecated, does it bring any problems? |
15:14:09 | dom96 | It's inefficient IIRC |
15:15:28 | Electrux | are u the sole developer of this language dom? |
15:16:52 | Yardanico | Electrux he's not lol :) |
15:17:32 | Electrux | well he is the only person with an '@' in irc so i thought he was... haha... my bad... who else is? :D |
15:17:43 | FromGitter | <7sDream> @dom96 any reference about IIRC? thx |
15:18:00 | Yardanico | Electrux Araq is the creator and main developer (compiler, stdlib). dom96 is one of the core maintainers, but he's about stdlib stuff (not compiler stuff) |
15:18:13 | Yardanico | You can check biggest contributors (except it's not always correct) here - https://github.com/nim-lang/Nim/graphs/contributors |
15:19:43 | Electrux | oh... wow that is cool! :O 960k lines of code... that is ridiculous... just wow :O |
15:20:30 | Electrux | sorry... don't wanna come off as a 12 year old ( no offense ) but it is really astounding and awesome to me :) |
15:21:06 | Yardanico | Electrux well, it also has -930k (count of deleted lines) |
15:21:12 | Yardanico | I mean github stats |
15:22:16 | Electrux | but still... writing 960k lines alone is awesome imo :) |
15:25:23 | FromDiscord | <citycide> Araq's been doing this a long time, at least 10 years |
15:27:05 | Yardanico | Wikipedia says that development of Nim started in 2004 |
15:27:13 | Yardanico | and github repo doesn't have all commits |
15:27:18 | Yardanico | (afaik only from 2011) |
15:28:27 | FromDiscord | <citycide> The first github commit to Nim was by Araq on Aug 23, 2008 |
15:29:12 | FromDiscord | <citycide> Araq: what kind of cake you like 🤣 |
15:29:17 | Yardanico | yeah, sorry |
15:29:24 | dom96 | Copyright (c) 2006-2018 by Andreas Rumpf |
15:29:29 | dom96 | 'nim -v' |
15:29:31 | FromGitter | <data-man> A few days ago, Nim-Lang had 12 members. Why now only 6? :( |
15:29:42 | Yardanico | 405b86068e6a3d39970b9129ceec0a9108464b28 is the first commit in the repo |
15:29:44 | Electrux | woooooow :O |
15:29:54 | Yardanico | https://github.com/nim-lang/nim/commit/405b86068e6a3d39970b9129ceec0a9108464b28 |
15:29:59 | dom96 | because I made their visibility private |
15:30:03 | Electrux | how and why was this language invented btw? :D |
15:30:38 | Electrux | like the thought which went into Araq's mind that got him to create this? |
15:31:44 | FromDiscord | <citycide> he was hanging a clock in his bathroom, slipped and when he hit his head he got the idea for the flux capacitor |
15:31:59 | Electrux | rofl :P |
15:31:59 | FromDiscord | <citycide> but then decided he'd rather make a programming language |
15:32:09 | Electrux | hahaha +1 |
15:36:24 | Electrux | ok why do i not need to use seq[ type ]()? when i create a constructor for my type, i need to use constructor[ type ](). Why is that? |
15:36:42 | Yardanico | Electrux what do you mean "you don't need"? You need |
15:36:51 | Yardanico | Like let mydata = newSeq[int]() |
15:37:05 | Yardanico | or var a: seq[int] |
15:37:21 | Electrux | what is seq[ int ]? is it not a constructor? |
15:37:33 | Yardanico | No |
15:37:35 | Yardanico | it's a type |
15:37:40 | Yardanico | newSeq is a constructor |
15:38:05 | Electrux | oh... it is a reference of sequence... |
15:38:18 | Electrux | ok... thanks :) |
15:38:32 | * | SenasOzys quit (Ping timeout: 245 seconds) |
15:40:02 | * | edcragg quit (Quit: ZNC - http://znc.in) |
15:41:05 | * | edcragg joined #nim |
15:41:30 | * | jhorwitz quit (Quit: Lost terminal) |
15:41:36 | * | SenasOzys joined #nim |
15:41:42 | dom96 | Electrux: Don't put spaces like that btw :) |
15:41:48 | dom96 | seq[int], not seq[ int ] |
15:42:31 | Electrux | oh... ok i have just been used to that... i just find it much easier to read ( especially in C++ ), i will not use it here :) |
15:44:53 | Yardanico | Electrux worth reading - https://nim-lang.org/docs/nep1.html |
15:46:02 | * | SenasOzys quit (Ping timeout: 245 seconds) |
15:49:28 | Yardanico | dom96 lol, on https://nim-lang.org/docs/nep1.html "Similarly, any procedure and procedure type declarations that are longer#" # appeared out of nowhere :) |
15:50:31 | * | SenasOzys joined #nim |
15:50:47 | Yardanico | I removed it already |
15:51:04 | * | jhorwitz joined #nim |
15:52:40 | dom96 | Argh, can we not overload macros at all? :( |
15:53:29 | Electrux | should i always make my own type as a reference type? i just created a stack type so reading the tutorial and how the library seems to be implemented, it seems like every type ( sequence, etc ) is a reference type |
15:53:36 | * | Trustable quit (Remote host closed the connection) |
15:53:58 | FromGitter | <Vindaar> @federico3 at least reg. the type of the Time field, you can do: https://gist.github.com/Vindaar/b9cef31428cfb2f26fbb5e70d9ba394c |
15:53:59 | Electrux | and thanks Yardanico i went through that... quite nice... lol i noticed the # too :P |
15:54:34 | Yardanico | Electrux no |
15:54:46 | Yardanico | use "ref" only when you need it :) |
15:55:13 | livcd | Did anyone try to extend Powershell with Nim ? |
15:55:19 | * | SenasOzys__ joined #nim |
15:55:48 | Electrux | so i do not need it for my custom type? wouldn't it cause copies if used in other functions? unless function call by default uses references? |
15:55:54 | * | SenasOzys quit (Read error: Connection reset by peer) |
16:00:40 | dom96 | Araq: Are you sure this is documented? https://forum.nim-lang.org/t/2740#16979 |
16:16:47 | * | yglukhov[i] joined #nim |
16:21:10 | * | yglukhov[i] quit (Ping timeout: 252 seconds) |
16:25:47 | * | Gnjurac joined #nim |
16:26:13 | Gnjurac | hmm any good gui lib , i dont really need anything special just need 5 text buttons and img and text display |
16:26:24 | Gnjurac | and fullscreen |
16:26:48 | Gnjurac | i loking this nim nuklear but last commit in 2017 |
16:26:58 | federico3 | thanks Vindaar! |
16:28:20 | dom96 | Gnjurac: ui package |
16:28:31 | dom96 | or nimx |
16:28:59 | FromGitter | <7sDream> stdlib has a iup wrapper |
16:29:05 | Gnjurac | will try that ui |
16:29:16 | Gnjurac | as i see on github nimx is marked failling |
16:30:59 | dom96 | try it anyway |
16:31:55 | * | yglukhov[i] joined #nim |
16:34:18 | * | xkapastel quit (Quit: Connection closed for inactivity) |
16:43:10 | * | FuntDobra quit (Ping timeout: 245 seconds) |
17:05:45 | * | kobi joined #nim |
17:05:52 | FromDiscord | <citycide> I still can't get nim-lang/ui to work for me. I'm not sure what I'm missing there |
17:06:25 | kobi | you may find NiGui easier, citycide |
17:06:49 | * | yglukhov[i] quit (Remote host closed the connection) |
17:06:53 | FromDiscord | <citycide> I've used nigui, even contributed to it, but it doesn't have nearly as many components |
17:07:08 | FromDiscord | <citycide> also not very active so it's hard to contribute to |
17:07:36 | * | nsf joined #nim |
17:20:57 | FromGitter | <brentp> is there a limit to how much memory can be allocated in nim? I can allocate 20 int8 `seq` s of length ~250 million, but when I try to allocate 32, I get the following traceback: |
17:20:59 | FromGitter | <brentp> `````` |
17:21:08 | FromGitter | <brentp> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b0ae904b6eece791db90b87] |
17:22:04 | FromGitter | <brentp> the code at mosfun.nim(267) is `... newSeqint8 (chrom_len+1)` |
17:30:19 | FromGitter | <brentp> ... and the machine where this fails has more than enough memory to handle this. |
17:32:39 | dom96 | citycide: why not? |
17:32:49 | dom96 | citycide: what's the problem with ui for you? |
17:34:48 | * | Electrux quit (Read error: Connection reset by peer) |
17:39:00 | Gnjurac | https://nim-lang.org/docs/db_sqlite.html , in Creating a table part , """ why are there 3 , are they just used to spred string like whit discard |
17:39:14 | Gnjurac | so we can write in more then 1 row |
17:40:14 | Yardanico | more than 1 line |
17:40:24 | Yardanico | or if you want to use " in your string without escaping |
17:40:35 | Yardanico | !eval echo """ lol look - " is here without escaping!""" |
17:40:37 | NimBot | lol look - " is here without escaping! |
17:42:29 | * | Vladar quit (Quit: Leaving) |
17:45:19 | * | Vladar joined #nim |
17:49:26 | FromGitter | <ibutra> Hi, can I set not nil on a ref object of RootObj? |
17:49:30 | * | craigger quit (Quit: bye) |
17:49:42 | FromGitter | <ibutra> I tried " a = ref object of RootObj not nil" |
17:49:56 | FromGitter | <ibutra> as well as "a = ref object not nil of RootObj" |
17:50:00 | FromGitter | <ibutra> both is not liked by the compiler |
17:57:35 | * | ldlework quit (Quit: ZNC 1.6.5 - http://znc.in) |
18:03:08 | * | ldlework joined #nim |
18:05:21 | kobi | hey everyone thanks for the help yesterday, i found the bug and all tests are passing now |
18:05:43 | kobi | :-) |
18:06:22 | kobi | seq is apparently magic |
18:06:37 | kobi | is it implemented as dynamic array? |
18:07:01 | * | SenasOzys__ quit (Remote host closed the connection) |
18:07:16 | * | SenasOzys__ joined #nim |
18:07:34 | kobi | I see all kinds of copying when adding an item (with &) |
18:08:08 | * | FuntDobra joined #nim |
18:08:17 | kobi | however, there are more efficient ways, if a list contains a large array but only exposes part of it, and grows as needed. |
18:08:38 | kobi | another way is to have an array of array with an easy calculation to figure out where to put the item. |
18:09:04 | kobi | or a linked list of arrays, so growing is fast |
18:09:25 | kobi | maybe there are better ways, these are just off the top of my head |
18:09:56 | * | ldlework quit (Quit: ZNC 1.6.5 - http://znc.in) |
18:09:57 | kobi | *better data structures |
18:10:18 | * | ldlework joined #nim |
18:12:45 | * | Electrux joined #nim |
18:13:06 | FromGitter | <kayabaNerve> I'm using a Doublypinked |
18:13:53 | * | Snircle quit (Ping timeout: 260 seconds) |
18:13:54 | FromGitter | <kayabaNerve> *DoublyLinkedList to represent blocks. Should I change that to a seq? 🤔 |
18:14:22 | * | Snircle joined #nim |
18:14:24 | kobi | depends on what operations you're using it for |
18:14:33 | FromGitter | <kayabaNerve> I only need the head, tail, and iterator for now. Not the index |
18:15:10 | FromGitter | <kayabaNerve> But I will eventually need the index... So I guess what offers better performance for appending elements and retrieving elements? |
18:15:25 | kobi | so it's fine. arrays and seq are concise in memory and their main advantage is index (random access) |
18:16:55 | * | beatmox quit (Remote host closed the connection) |
18:17:00 | kobi | if you need to retrieve doubly linked list is O(n) -- that is, it iterates until it finds your index. seq or array have it in o(1) but to append to array may need to create a new one. so doubly linked list is o(1) in that case (just adds a cell and points to) |
18:17:25 | * | beatmox joined #nim |
18:17:43 | kobi | you can also have trees like a btree |
18:18:35 | kobi | b+tree, trie, there are many types |
18:19:15 | kobi | but really it also depends on the scale. with small ones, it's negligible |
18:20:22 | kobi | if you're doing things on a large scale, you must choose the appropriate data structures if you care about performance. |
18:20:34 | * | kobi is now known as kobi7 |
18:21:03 | kobi7 | I usually don't do performance tweaking except design well and choose data structures |
18:22:06 | kobi7 | with today's computers... usually not worth the effort or complexity that is introduced |
18:22:17 | * | FuntDobra quit (Ping timeout: 260 seconds) |
18:22:34 | kobi7 | but nim provides the third way. templates or macros keep the code clean, but may speed up things |
18:23:09 | kobi7 | someone made an simd library IIRC, and it didn't feel low level at all |
18:25:51 | kobi7 | a little question: when I make a compiled library in nim, can I link against it, and import in my code? (think proprietary library) |
18:26:17 | kobi7 | or is it like an ffi? |
18:27:22 | Yardanico | kobi7 if it's compiled - only via C ffi |
18:27:25 | kobi7 | In dot net you can use dlls like that, but they are not entirely compiled (IL) |
18:27:28 | Yardanico | well, I mean via dynlib |
18:27:37 | Yardanico | because everything is fully compiled to machine code |
18:27:47 | FromGitter | <kayabaNerve> http://i0.kym-cdn.com/photos/images/original/001/272/773/6dd.jpg |
18:28:00 | Yardanico | that's more for #nim-offtopic, but ok :D |
18:28:54 | kobi7 | Yardanico: what about the new Nim namespace.. because don't the compiled procs have mangled names? |
18:29:06 | Yardanico | they do |
18:29:12 | Yardanico | but if you exportc them, they won't |
18:29:37 | kobi7 | thanks, i haven't tried that part of nim yet |
18:29:58 | kobi7 | is that a pragma for every proc I write? |
18:30:18 | kobi7 | exportc is pragma or a general -define |
18:30:21 | FromGitter | <7sDream> Finally, finish reading the *Nim in Action*, it's about 2:30am now(in my tz) ⏎ @dom96 thanks for the awesome book, Interesting and practical! |
18:30:30 | Yardanico | kobi7 pragma :) |
18:31:10 | * | FuntDobra joined #nim |
18:33:28 | kobi7 | Yardanico: so I just do importc, with all the usual stuff? what about cstring etc? |
18:33:39 | Yardanico | I don't really know honestly :) |
18:33:58 | FromGitter | <7sDream> @dom96 And I search the web for `IIRC` (which makes `actors` deprecated), but found nothing, could you give me some reference about it? |
18:34:29 | * | Gnjurac quit (Remote host closed the connection) |
18:34:30 | kobi7 | ok, i'll experiment when i get there. see if nim retains the inner semantics/data structure or converts them to the target language idioms |
18:35:24 | kobi7 | actors deprecated?? |
18:35:37 | kobi7 | Yardanico: thanks mate |
18:35:57 | Yardanico | @7sDream IIRC = If i remember correctly |
18:36:21 | FromGitter | <7sDream> h |
18:36:26 | Yardanico | or recall |
18:36:27 | Yardanico | https://www.urbandictionary.com/define.php?term=iirc |
18:37:03 | FromGitter | <7sDream> oh, I think it's a technology term, ROFL |
18:37:39 | kobi7 | sorry man, wasn't entirely sure it was simd on nim, but i think so |
18:38:11 | kobi7 | https://github.com/jackmott/nim_simd |
18:38:38 | Yardanico | kobi7 yeah, I know about this one, very cool project |
18:40:16 | FromGitter | <ephja> yeah that's what IIRC means IIRC |
18:43:14 | Yardanico | AFAIK IIRC means IIRC |
18:44:20 | kobi7 | yep unless you're jk |
18:44:29 | Yardanico | dom96 did you report any pirated Nim in Action copies to Manning? Will they do something about that? |
18:44:45 | kobi7 | what? I actually bought it!! |
18:44:54 | kobi7 | :) |
18:45:03 | dom96 | Yardanico: I didn't see any |
18:45:37 | Yardanico | dom96 I PM'd you |
18:46:05 | kobi7 | nim has a pretty fast compilation. i like that. |
18:46:12 | kobi7 | well, see you guys |
18:46:14 | * | kobi7 quit (Quit: Leaving) |
18:46:29 | dom96 | haha awesome |
18:46:39 | Yardanico | dom96 and it was uploaded in the november :P |
18:47:02 | dom96 | pirates are pretty quick |
18:49:09 | dom96 | Yardanico: But yeah, send the link to Manning |
18:49:18 | dom96 | doubt they'll do much though |
18:49:31 | dom96 | but maybe there is a secret place the pirate forgot to remove their name from |
18:52:57 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
18:54:30 | FromGitter | <ephja> let's put sugar in his salt shaker |
18:56:49 | * | SenasOzys__ quit (Ping timeout: 260 seconds) |
18:56:50 | Yardanico | well, at least pirates are required to buy a product to pirate it xD |
18:57:26 | federico3 | dom96: images might be watermarked |
18:57:51 | FromGitter | <kayabaNerve> First pirate has to |
18:58:41 | FromGitter | <ephja> nah he just has to download it from dom96 using an exploit |
18:59:19 | Yardanico | lol |
19:00:20 | dom96 | would be quite something if my publisher sues me for copyright infringement |
19:01:21 | * | FuntDobra quit (Ping timeout: 248 seconds) |
19:07:00 | FromGitter | <ephja> it would be nice to have the ability to specify output buffers in addition to returning new ones which is a common pattern. maybe even for stringifying |
19:07:56 | * | SenasOzys__ joined #nim |
19:08:26 | * | jhorwitz quit (Ping timeout: 276 seconds) |
19:08:27 | federico3 | Vindaar: any way to pass an arbitrary type to https://gist.github.com/Vindaar/b9cef31428cfb2f26fbb5e70d9ba394c#file-get_field_names-nim-L18 ? |
19:17:07 | * | find0x90 joined #nim |
19:21:09 | FromGitter | <Vindaar> @federico3 I updated the gist |
19:21:44 | FromGitter | <Vindaar> the table in the other object is currently not returned as `Table[string, int]` however :) |
19:27:19 | federico3 | thanks again! |
19:29:58 | FromGitter | <Varriount> Ephja: My AWS code uses that pattern quite often to avoid copying string data |
19:30:09 | * | craigger joined #nim |
19:39:00 | * | miran joined #nim |
19:43:44 | * | miran_ joined #nim |
19:43:55 | * | miran quit (Ping timeout: 260 seconds) |
19:43:58 | FromGitter | <7sDream> @data-man Some updates on #7869, could you review it when you have time |
19:57:06 | * | xet7 quit (Read error: Connection reset by peer) |
19:59:53 | FromGitter | <Vindaar> @federico3 updated the gist again to also parse `Table` and `seq`. Feels kinda hacky, haha, but it works for this. I'm just learning macros too, so this can probably be done way better :) |
20:00:15 | * | Electrux quit (Ping timeout: 260 seconds) |
20:00:24 | * | xet7 joined #nim |
20:02:07 | Yardanico | dom96 do you want to add https://t.me/nim_lang to list of the communities? |
20:02:19 | dom96 | sure, do it |
20:02:20 | Yardanico | oh, you're the admin xD |
20:05:34 | Yardanico | dom96 do we want to also relay messages from telegram ? :D |
20:06:01 | federico3 | Vindaar: thanks - me too - sort of |
20:07:02 | FromGitter | <Vindaar> @federico3 what does sort of mean? :D |
20:07:37 | federico3 | that I'm fiddling with macros instead of taking the time to understand them :D |
20:07:43 | dom96 | Yardanico: nah |
20:07:46 | * | Electrux joined #nim |
20:07:55 | Yardanico | dom96 ok :) |
20:08:50 | FromGitter | <Vindaar> @federico3 Oh, but I guess that's normal and healthy while learning sometimes |
20:08:58 | FromGitter | <Vindaar> I do the same too, often enough, hehe |
20:12:10 | * | Electrux quit (Ping timeout: 252 seconds) |
20:14:12 | * | SenasOzys__ quit (Remote host closed the connection) |
20:18:32 | * | dddddd quit (Read error: Connection reset by peer) |
20:22:28 | federico3 | what's the fastest way to concatenate strings and value? & or strutils.% ? |
20:28:24 | * | Electrux joined #nim |
20:32:35 | * | Electrux quit (Ping timeout: 240 seconds) |
20:40:07 | * | find0x90 quit (Quit: find0x90) |
20:48:01 | * | Penguinium joined #nim |
20:49:22 | Penguinium | Hey, trying to get started with nim, but im getting confused to how the folder structure for just a simple project should look like? |
20:50:13 | Penguinium | Say i just want to make a simple C-transpiled hello world app, but using nimble or a project. how would that look like? |
20:51:30 | * | xkapastel joined #nim |
20:53:48 | FromGitter | <kayabaNerve> Compiled not transpiled |
20:55:10 | dom96 | Penguinium: Hello and welcome :) |
20:55:25 | dom96 | Penguinium: For a simple hello world app you don't even need Nimble |
20:55:32 | dom96 | just a hello.nim file |
20:55:51 | federico3 | [transpiler rant triggered] |
20:55:52 | dom96 | if you want to learn how to use Nimble then all you need is `hello.nim` + `hello.nimble` |
20:55:55 | FromGitter | <kayabaNerve> And idk about nimble, but my folder structure is src/ src/c and my Nim in src/ |
20:55:59 | Penguinium | Yeah, im aware, but im trying to understand how the nimble structure looks like. |
20:56:12 | FromGitter | <kayabaNerve> I put git/readme/license stuff in the root |
20:56:18 | federico3 | Penguinium: nimble init would help - for something more complex there's https://github.com/FedericoCeratto/nim_project_maker |
20:56:37 | * | miran_ quit (Quit: Konversation terminated!) |
20:56:56 | dom96 | Penguinium: Is Nimble giving your package structure errors? |
20:57:20 | dom96 | *you |
20:57:38 | FromGitter | <kayabaNerve> @FedericoCeratto that is fricking amazing |
20:57:52 | FromGitter | <kayabaNerve> I can't use nimble on my laptop but I'm definitely looking over that |
20:58:02 | Penguinium | yeah, i was trying to place it in a src, folder, but then prompted me to put it in a folder (project)pkg folder instead. but that didn't really work. |
20:58:04 | FromGitter | <kayabaNerve> Service file and hardened config? Top |
20:58:10 | federico3 | oh thank you! |
20:58:24 | FromGitter | <kayabaNerve> Only thing you're missing is Nake support |
20:59:10 | dom96 | Penguinium: src/projectName/ folder is what you need |
20:59:31 | dom96 | also, be sure to put 'srcDir = "src"' in your .nimble file if you're using a 'src' dir |
20:59:51 | * | endragor joined #nim |
21:00:10 | Penguinium | ah alright, i'll test. |
21:00:45 | dom96 | You can gist your structure here if you'd like. I'll be able to help out better then |
21:00:51 | federico3 | kayabaNerve: what's Nake for? Looks like nimble <task name> |
21:01:08 | dom96 | Indeed, nake is obsolete. Use Nimble. |
21:01:36 | Penguinium | ok, but it generates the cache inside the src file, is there a build output options? |
21:03:32 | dom96 | why is that a problem? |
21:03:49 | Penguinium | so it cannot be solved? |
21:04:05 | * | endragor quit (Ping timeout: 240 seconds) |
21:06:36 | dom96 | you can specify options in a nim.cfg file |
21:07:38 | dom96 | --nimcache:path |
21:07:47 | FromGitter | <kayabaNerve> Nake is Nim Make files |
21:08:08 | FromGitter | <kayabaNerve> dom96 was it integrated or replaced by? |
21:08:20 | dom96 | replaced |
21:09:16 | FromGitter | <kayabaNerve> I'll have to compare the two. I really liked the functionality and programming abilities of nake since it was a Nim program, not script |
21:11:22 | Penguinium | alrighty, seems to work fine, thanks alot guys! |
21:19:33 | * | Penguinium quit (Quit: Page closed) |
21:28:30 | * | isaac92 joined #nim |
21:30:00 | * | isaac92 quit (Client Quit) |
21:31:05 | * | nsf quit (Quit: WeeChat 2.1) |
21:34:11 | * | Vladar quit (Quit: Leaving) |
21:47:50 | * | CodeVance joined #nim |
21:49:26 | * | Electrux joined #nim |
21:53:45 | * | Electrux quit (Ping timeout: 252 seconds) |
22:00:42 | * | elrood quit (Quit: Leaving) |
22:28:25 | * | Electrux joined #nim |
22:31:14 | * | athenot quit (Ping timeout: 276 seconds) |
22:32:35 | * | Electrux quit (Ping timeout: 240 seconds) |
22:52:49 | FromDiscord | <citycide> dom96: I have an open issue on nim-lang/ui, I've never been able to get it to compile |
22:53:53 | FromDiscord | <citycide> looks like someone commented with a potential fix a couple hours ago, I'll have to try that |
22:54:53 | * | xet7 quit (Quit: Leaving) |
22:55:03 | FromDiscord | <citycide> but that's even after I have to remove that `link` pragma like you suggested |
23:01:25 | * | nuxdie quit (Quit: WeeChat 2.1) |
23:04:54 | FromGitter | <data-man> GlobalBenchmark | | 5.25ns | 190.54M| ⏎ ------------------------------------|-----|---------|-------------------------- ⏎ bench.nim | relative | time/iter | iters/s| ⏎ unicodeStdLibisAlpha | | 10.74us | 93.10K| ⏎ unicodePlusisAlpha | 257.13% | 4.18us | 239.40K| ... |
23:04:54 | FromGitter | ... [https://gitter.im/nim-lang/Nim?at=5b0b3995a45f930a65dcf875] |
23:05:15 | FromGitter | <data-man> :) |
23:07:03 | FromGitter | <data-man> @Araq @dom96 ⏎ I made many aaditions/replacements in new unicode module. ⏎ Maybe before PR to create an RFC? |
23:08:29 | FromGitter | <data-man> Now I write unittests. ⏎ And the docs. :( |
23:08:48 | * | find0x90 joined #nim |
23:15:20 | * | endragor joined #nim |
23:19:50 | * | endragor quit (Ping timeout: 245 seconds) |
23:26:17 | * | CodeVance quit (Quit: Leaving.) |
23:27:44 | FromGitter | <data-man> @7sDream I added the comment, thanks. |
23:31:44 | FromGitter | <Varriount> @data-man Wow! You're on fire! 🔥 |
23:33:25 | FromGitter | <data-man> @Varriount Just tiny optimizations for some cases. |
23:53:31 | * | find0x90 quit (Quit: find0x90) |
23:55:31 | * | Electrux joined #nim |