<< 27-05-2018 >>

00:07:50*nsf quit (Quit: WeeChat 2.1)
00:17:47FromGitter<kayabaNerve> Just got the IMath lib to work :D
00:18:35FromGitter<kayabaNerve> @mratsim it works on stable, has a ton of operations built in, and is fast
00:19:28FromGitter<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:32FromGitter<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:15FromGitter<kayabaNerve> NVM. Found a solution
00:50:11FromGitter<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:04cmk_zzzis the old forum still up and running somewhere?
00:56:32*sz0 joined #nim
00:58:44skrylari 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:01FromGitter<kayabaNerve> I'm using threads with read only memory
01:00:04FromGitter<kayabaNerve> And locks on the writes
01:04:51*Electrux joined #nim
01:05:31FromGitter<kayabaNerve> Whatever. I'll just remove threaded mining
01:06:49jhorwitzIs 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:09FromGitter<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:48FromGitter<kayabaNerve> I can personally recommend Nim in Action
01:51:04FromGitter<kayabaNerve> However, I think the tutorial may just be best since it's free
01:51:13FromGitter<kayabaNerve> https://nim-lang.org/docs/tut1.html
01:51:17FromGitter<kayabaNerve> Very nice...
01:53:30*yglukhov[i] quit (Ping timeout: 260 seconds)
02:05:51*athenot joined #nim
02:26:08jhorwitzI already have purchased Nim in Action!
02:26:21jhorwitzI 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:46FromGitter<kayabaNerve> I read it during my HS classes
03:59:52FromGitter<kayabaNerve> Seemed the better use of my time
04:04:44jhorwitzI'm sure it was
04:04:47jhorwitzlol
04:17:37*FuntDobra quit (Ping timeout: 248 seconds)
04:23:23skrylarwell, 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:16FromGitter<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:42skrylarmratsim: any thoughts on arrayfire :p
04:44:27skrylaralso it seems the openmp wrappers have disappeared
04:46:42FromGitter<kayabaNerve> Don't let your arrays catch on fire
04:46:47FromGitter<kayabaNerve> Irresponsible
04:47:03skrylareh it looked like a tensor library
04:47:21FromGitter<kayabaNerve> So that means the arrays are worth less?
04:47:25FromGitter<kayabaNerve> Arrayist
04:47:30skrylaralthough arraymancer has thus far put up with my bullshit, so it stays
04:47:37FromGitter<kayabaNerve> *I'll stop* gn people
04:47:44skrylarnow having to actually face parallelism in nim :x
04:47:47skrylaralright gn kayaba
05:00:47skrylarhrm. 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:08FromGitter<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:25FromGitter<7sDream> I found a thread in forum, https://forum.nim-lang.org/t/184, But it seems not yet been implemented
05:24:37FromGitter<data-man> @7sDream: Something like ```names.join(",")``` (join from strutils)
05:28:03FromGitter<7sDream> @data-man Any security issues when using it this way?
05:31:39FromGitter<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:22FromGitter<data-man> Make PR :)
05:35:26FromGitter<7sDream> :P will try after I finish my work
05:36:15FromGitter<data-man> Is ```join``` works?
05:39:06FromGitter<7sDream> I'm testing the forum's way, will test join after that
05:42:52FromGitter<data-man> Maybe the ```names```must be quoted.
05:43:46FromGitter<data-man> Entries in the ```names```.
05:47:32FromGitter<data-man> What DB you use?
05:48:31FromGitter<7sDream> sqlite
05:48:47FromGitter<7sDream> just for test
05:49:54FromGitter<7sDream> http://ix.io/1bvQ/nim
05:50:29FromGitter<7sDream> forum's way works, it seem varargs accept a seq, but can't follow by any other items
05:51:14miranvarargs unpacks a seq?
05:52:05FromGitter<data-man> Then I recommend use https://github.com/sqlitebrowser/sqlitebrowser for debugging SQL queries.
05:55:38FromGitter<7sDream> @miran yes, varargs accept a seq: https://glot.io/snippets/f1f23io11n
05:56:18FromGitter<7sDream> I'm using sqlitestudio, sqlitebrowser is great too
05:56:50miranbut is this how varargs should be used?
05:57:08miranbecause you only have one arg - a seq
05:57:20miranand you could do `a: seq[int]`
05:58:01FromGitter<7sDream> yes, that's way I want a way to unpack args like Python `some_method(*args1, *args2, 123)`
05:58:07FromGitter<7sDream> s/way/why
05:58:09miranthis is how to use varargs, IMO: https://glot.io/snippets/f1f26jlsna
05:58:52miranIIRC you cannot do that in python. the order of arguments is wrong and you cannot have two unpackings
05:58:57FromGitter<7sDream> I know it, but if I got args in two different seq, how can I pass them to a varargs?
05:59:27miran`a, b: seq[int]`?
05:59:50miranthen you need something like python's itertools.chain
05:59:58FromGitter<7sDream> But the method is not written by myself...
06:00:33FromGitter<7sDream> If I can control the params list, I wil use `varargs seq[int]`
06:01:07mirancan you show me/us the method?
06:01:38FromGitter<7sDream> this thread: https://forum.nim-lang.org/t/184
06:02:47FromGitter<7sDream> and it's not yet been implemented, so I try myself: http://ix.io/1bvQ/nim
06:03:07miranhere is the version that takes multiple seqs: https://glot.io/snippets/f1f2bigkxe
06:04:43FromGitter<7sDream> yes, but `db_sqlite.getAllRows` (which in stdlib) 's params list is `varargs[string]`
06:06:39miranoh, so you have seqs, but you need to have strings?
06:07:39FromGitter<7sDream> yes
06:07:50FromGitter<7sDream> BTW, Python do support multi `*args`
06:08:03miranhere you go, you concat the seqs: https://glot.io/snippets/f1f2ge4itg
06:08:41FromGitter<7sDream> yes, that's what I'm doing……http://ix.io/1bvQ/nim, line 4
06:09:07FromGitter<7sDream> just wonder is there any better way/syntax
06:13:22FromGitter<data-man> Oh, SQLiteStudio was migrated to GitHub. Great, I didn't know. :)
06:20:24FromGitter<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:12skrylari 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:47Electruxif i don't use import sequtils ( or even if i do ) can i use sequtils.<function>?
07:47:52Electruxinstead of just <function>
07:49:33FromGitter<7sDream> if you import, you can
07:58:37miranElectrux: you can do `from sequtils import <function>`
07:58:44FromGitter<data-man> You can use ```from sequtils import <function>```
07:58:49FromGitter<data-man> :)
07:58:58miran:)
07:59:39Electruxno i meant for what 7sDream said... how do i use the, say, repeat function from both strutils and sequtils without causing ambiguity
08:00:16miranfrom sequtils import function as seqfunction; from strutils import function as strfunction?
08:00:33FromGitter<7sDream> do we has `as`?
08:01:16FromGitter<7sDream> identifier expected, but found 'repeat as seqRepeat'
08:01:22FromGitter<7sDream> :/
08:01:37FromGitter<data-man> ```as``` what is it, casting?
08:01:48FromGitter<7sDream> alias
08:01:49miranoh, i thought this worked, sorry
08:01:51Araq'as' only introduces module aliases
08:01:56Araqfrom sequtils import nil
08:02:01Araqfrom strutils import nil
08:02:11Araqsequtils.repeat() vs strutils.repeat()
08:02:16Araqimport sequtils
08:02:21Araqimport strutils except repeat
08:02:34Araqso many ways to do what you need :-)
08:02:35*gmpreussner_ quit (Ping timeout: 240 seconds)
08:02:52FromGitter<7sDream> emmm, when I want use both of them...
08:02:57Electruxso... <module>.<function> works when i import nil from them?
08:03:01Electruxthat's cool!! :D
08:03:03miranbtw Electrux, usually if the functions have the same name, but the different signature - this is not the problem
08:03:27Araqyou can use both of them
08:03:31Araqwhen you use
08:03:35Araqimport x except y
08:03:41Araqx.y is still available
08:03:44Araqwhen you use
08:03:47FromGitter<7sDream> oh, great
08:03:49Araqfrom x import nil
08:03:55Araqx.y is still available
08:03:58FromGitter<7sDream> that's helpful
08:04:00Electruxoh wait... i literally forgot about the overloading concept lol sorry
08:04:08Electruxthat's awesome thanks Araq :D
08:05:41*gmpreussner_ joined #nim
08:24:45miranbtw, 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:42Araqseems flawed since Nim has no overhead
08:36:01Araqnor does Rust have any
08:37:40Araqor D.
08:37:54Araqwhatever he is measuring, it's not the "FFI overhead"
08:38:00miran:)
08:39:25*Shivelight quit (Quit: Connection closed for inactivity)
08:40:08Araqmaybe it's "cache effects under how the linker arranged functions in memory"
08:40:34FromGitter<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:09YardanicoHmm, is there a way to check if /dev/urandom exists?
09:32:55Araqdon't use it, it can be corrupted anyway
09:33:03Araqand always return 0.
09:33:17Araqfiles 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:45FromGitter<data-man> https://gitter.im/NimCompression/Lobby :)
10:38:06federico3Yardanico: other than existsFile? There's also the getentropy() syscall and OS-independent libraries like libsodium that do the right thing
10:39:54Yardanicofederico3 existsFile doesn't work :D
10:40:07Yardanico(i'm on macOS and existsFIle("/dev/urandom") returns false)
10:40:15Yardanico!eval existsFile("/dev/urandom")
10:40:16NimBotCompile failed: in.nim(1, 1) Error: undeclared identifier: 'existsFile'
10:40:23Yardanico!eval import os; echo existsFile("/dev/urandom")
10:40:27NimBotfalse
10:42:47FromGitter<data-man> !eval var file: File; echo file.open("/dev/urandom"); file.close
10:42:49NimBottrue
10:44:10federico3ah, existsFile check only for real files like python's isfile but the documentation is incorrect
10:55:51federico3Yardanico: updated doc in #7888
10:55:58Yardanicofederico3 thanks!
11:00:46*sz0 quit (Quit: Connection closed for inactivity)
11:01:06Electruxhow do i split a string based on multiple symbols?
11:01:51Electruxwhen i split a string by calling split with a char list of symbols, the result ends up containing empty strings
11:01:55miranElectrux: https://nim-lang.org/docs/strutils.html#split,string,set[char],int
11:02:42Electruxfor 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:08miranuse https://nim-lang.org/docs/strutils.html#splitWhitespace,string,int ?
11:03:32arecaceaewasn't there something where I can add small tests to comments and something parses/runs them?
11:03:58miranarecaceae: runnableExamples
11:04:05miranhttps://nim-lang.org/docs/system.html#runnableExamples,untyped
11:04:13arecaceaemiran: thanks
11:04:19Electruxoh 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:47Electruxsay... "a+b" => { "a", "+", "b" }
11:05:01arecaceaemiran: 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:26miranarecaceae: 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:51Electruxhow do i convert a single char to string?
11:15:17FromGitter<7sDream> !eval echo $'c'
11:15:20NimBotc
11:16:15Electrux! eval echo ($'c').type.name
11:16:18Electrux!eval echo ($'c').type.name
11:16:19NimBotCompile failed: in.nim(1, 17) Error: undeclared field: 'name'
11:16:31FromGitter<7sDream> !eval echo ($'c').repr
11:16:33NimBot0x421900"c"
11:16:41YardanicoElectrux $ch
11:16:51Electruxoh oops ok thanks a lot :)
11:16:51Yardanico!eval let a = '1'; let b: string = $a; echo b
11:16:53NimBot1
11:17:08Electruxi literally read this yesterday and forgot completely today...
11:17:24Yardanico$ is generally used for converting types to string in Nim
11:17:31Yardanicoin stdlib and in third-party libraries
11:18:35*FuntDobra quit (Ping timeout: 240 seconds)
11:20:06Electruxoh woot made the split part :D
11:20:26Electruxthanks a lot Yardanico and 7sDream
11:20:28Electrux:D
11:34:53federico3how can I loop through the fields of a type inside a macro?
11:37:35federico3e.g. https://forum.nim-lang.org/t/1696
11:38:39*SenasOzys joined #nim
11:39:13FromGitter<data-man> @Electrux ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b0a98e1ba1a351a68c9ae20]
11:41:05FromGitter<Yardanico> wow, that's a big long :D
11:41:10FromGitter<Yardanico> *a bit
11:42:13FromGitter<data-man> Efficient, expressive and elegant. :)
11:42:58Electruxtokenize works on single characters?
11:45:54Yardanico@data-man are you sure tokenize is better than just items(string) ?
11:55:17arecaceaetrying 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:35arecaceaecounting heap-allocs as what I'm trying to do
11:56:22Araqwhy would you count rawAllocs?
12:00:20*Trustable joined #nim
12:00:52*Gnjurac joined #nim
12:01:03Gnjuracnim can compile on rpi3 right
12:01:05Gnjurac?
12:01:16federico3yep
12:02:06Gnjuracok ty
12:02:20arecaceaeAraq: trying to count my heap-allocs
12:02:41Araqand then what?
12:03:09arecaceaeAraq: trying around with small code snippets and check if my intuition serves me right how often they alloc
12:03:39arecaceaeAraq: and if they do more then what I figured, I'll see how I can reduce them, because of performance and stuff
12:03:45FromGitter<arnetheduck> prefix `?` for `Result` early return seems to work :) https://github.com/arnetheduck/nim-result/pull/1/files#diff-9699f66aef17b3032dbf48af66a259f7R389
12:03:58arecaceaeAraq: not about whole programs, just small snippets and stuff
12:04:50*elrood joined #nim
12:06:16arecaceaeAraq: 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:03Araqarnetheduck: I'd rather give you {.experimental: "strict".} ...
12:07:24Araqreinventing exceptions is pretty bad.
12:08:10Electrux@data-man that's amazing solution! thanks a lot :D
12:09:09Electruxbtw... is returning a result preferrable or setting the "result" variable to the result, in a function?
12:10:21arecaceaeif I do newStringOfCap and grow it beyond capacity, will it regrow the string or throw me an exception?
12:10:33arecaceaecould've just tried I guess ...
12:11:06Electruxor 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:33YardanicoElectrux result variable is implicit
12:13:43Yardanicoit's returned automatically and available in every proc which returns something
12:14:16Yardanicomost 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:36Yardanicoif you don't need to exit from the proc early, you don't have to use "return" at all
12:15:00FromGitter<Vindaar> @arecaceae it should just regrow it
12:15:39Gnjuracwhat extenion shoud nim files have, nim right? testme.nim ?
12:15:41arecaceaeVindaar yeah, thanks
12:15:44YardanicoGnjurac yes
12:15:55Gnjuracok
12:15:58FromGitter<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:58FromGitter... 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:02Gnjuracsorry i wasnt shoure
12:16:11Yardanico.nimble for nimble project files, .cfg for compiler configuration
12:16:20Gnjuracty
12:16:36FromGitter<arnetheduck> then there's a matter of taste: should `IndexError` on a seq be checked or not?
12:17:43Electruxso do i set the expression to result? there are basically 3 possible options written below:
12:17:47Araqalso 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:12Electrux"return a + b", "a + b", "result = a + b"
12:18:36YardanicoElectrux well, second option is mostly used when your proc is short
12:18:43*CodeVance joined #nim
12:18:46Electruxwhat should i do? better for performance? if not, just which one is more used
12:18:49Araq'result = a + b' is the preferred variant, a + b for short procs
12:19:03arecaceaecan I "reset strings" / set a strings length to 0 after its been filled with content?
12:19:03Araqperformance is equal
12:19:08FromGitter<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:51Araqwell JS/Webassembly has no process concept.
12:20:29Araqand assuming you have an OS is a pretty wild assumption for embedded
12:20:36FromGitter<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:15FromGitter<Vindaar> @arecaceae use the `setLen` proc
12:21:28arecaceaeVindaar: thanks
12:22:05Araqwell no, you can implement a supervisor as a library (though it might be a shitty one) when you have 'raise'
12:22:05Araqand you can't when you lack 'raise'.
12:23:53Araqthis whole notion of "Let it crash" translates into "let it raise an exception" for me.
12:24:21Electruxok thanks @Araq :D so return is just for when i need result to be returned without executing further statements right?
12:24:40AraqElectrux: yes, 'return' is control flow.
12:25:32YardanicoElectrux also, fyi - you don't have to use @ in IRC :) nickname without any symbols is enough
12:28:15Electruxand 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:36Electruxoh ok thanks Yardanico :D
12:28:54YardanicoElectrux well, it depends
12:29:46Electruxon?
12:30:07Electruxm sorry for asking too many questions and troubling u all btw....
12:30:09YardanicoE.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:13YardanicoElectrux don't worry, it's fine
12:33:04FromGitter<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:26FromGitter<arnetheduck> so `strict` will enforce annotations on overflowerrors?
12:36:53Araqno. :-)
12:38:19Electruxthank u all very much <3 :D
12:38:49*Trustable quit (Remote host closed the connection)
12:39:00FromGitter<arnetheduck> oh well. sounds pretty useless then - what's it useful for?
12:40:04Araqso that the other exceptions are explicitly acknowledged for when you export the proc
12:41:26FromGitter<arnetheduck> so the docs will be: `strict` mode makes the compiler bug you about a random subset of all possible raises
12:42:12Araqnot "random subset", the things that would end up in your return *types*
12:42:39AraqI mean, what you would encode in the return type if you lacked exceptions
12:43:13FromGitter<zah> Araq is trying to say "the recoverable errors"
12:43:21FromGitter<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:46Araqit'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:59Araqnor do you have to lift every operations to work on Eithers.
12:44:19Araqand whether your coworkers follow your style guide or not is not in Nim's responsibility.
12:44:24FromGitter<arnetheduck> that's true and nice - but it makes unrecoverable errors recoverable in an unsafe way
12:44:53FromGitter<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:16Araq'except:' is frown upon in Python, it is always 'except ConcreteError'
12:45:43FromGitter<arnetheduck> just like using unchecked exceptions in Java is
12:46:05Araqpure conjecture.
12:46:27AraqJava's mistakes are that callbacks default to "throws nothing"
12:47:03Araqso people were forced into turning checked exceptions into unchecked ones.
12:48:00*CodeVance1 joined #nim
12:48:03FromGitter<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:33dom96ooh, are we arguing about exceptions?
12:48:41Araqdom96: always...
12:49:00FromGitter<arnetheduck> @zah one way to make that happen actually is to make `strict` prohibit catching unrecoverable ones blindly
12:49:19FromGitter<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:20dom96Araq: Regarding those C FFI benchmarks, maybe you should post your opinions about them on HN? https://news.ycombinator.com/item?id=17161168 :)
12:49:34FromGitter<zah> This problem can plague Nim as well, but this is life
12:50:23Araqwe can map unchecked exceptoins to 'quit' but I want people to write supervisors in pure Nim as a library ...
12:50:39FromGitter<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:15dom96Are we planning on changing how exceptions work in Nim?
12:51:21FromGitter<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:58FromGitter<arnetheduck> that's not conjecture even :)
12:52:21*Vladar joined #nim
12:52:31Araqit's going to be the *only* solution for Webassembly.
12:52:36Araqalso not a conjecture.
12:53:10Araqalso, hey, Nim is a systems programming language, system programming languages should run without an OS.
12:54:03FromGitter<arnetheduck> webassembly? you know there are no exceptions in wasm, right?
12:54:03Araqand "broken, poorly implemented" is just a misguided way of putting "we moved from 80% reliability to 95%"
12:54:26FromGitter<ephja> is that the old, correct definition of "systems PL"? :p
12:54:32Araqotherwise why would Erlang even have supervisiors...
12:55:04AraqI'm sure you can use Erlang's FFI to create socket handles that will leak.
12:55:18FromGitter<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:35Araqwell, webassembly will get exceptions, but replace it with JS for the time being.
12:56:40Electruxi dont wanna intrude in the talk... but i literally dont understand mostly a word of what u guys say lol
12:58:07FromGitter<arnetheduck> so how about `strict` disables catching of the exceptions it fails to be strict about?
12:59:16FromGitter<arnetheduck> then you can build your shitty library in non-strict mode, and strict mode remains a bubble of sanity
12:59:30Araqnow that's a very good idea.
12:59:41Araqand should be part of strict.
13:00:44FromGitter<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:11federico3and nimble could complain if someone tries to publish a library in non-strict mode
13:05:16dom96so what would this strict mode do?
13:05:22Araqah ok, we're dreaming now...
13:05:22dom96I'm not 100% sure even after reading the logs
13:06:02miranhow about polishing current features and releasing v1.0? no? ok, i'll show myself out....
13:06:17FromGitter<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:39Araqyou will always be able to say this.
13:06:46FromGitter<arnetheduck> dom96,
13:09:09arecaceaeis 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:11FromGitter<arnetheduck> which exceptions that will be is a matter of taste - overflows most likely, indexerrors maybe, regex-parse-errors I hope not
13:09:46dom96arnetheduck: just so you know, edits on Gitter are not propagated to IRC :)
13:10:52dom96okay, so now I get where the "unrecoverable" keyword comes from
13:11:03dom96So which exceptions do you consider "unrecoverable"?
13:11:40FromGitter<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:56miranarecaceae: you mean annonymous function or something else?
13:12:12arecaceaemiran: anon is fine, doesnt have to be a closure
13:12:17dom96arecaceae: => in future module
13:12:25arecaceaedom96: thanks I'll check it out
13:12:30dom96https://nim-lang.org/docs/future.html#=%3E.m,untyped,untyped
13:12:46mirannow in future, sugar in future :D :D
13:12:58arecaceaedom96: awwww arrow syntax <3 love it
13:17:25FromGitter<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:17dom96So 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:22AraqIMO exceptions are all recoverable
13:20:28*dddddd joined #nim
13:21:07FromGitter<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:24FromGitter<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:10FromGitter<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:54FromGitter<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:54FromGitter... 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:55Araqexceptions 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:21Araqthe 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:24FromGitter<arnetheduck> huh? that's for mathematical functions - things that only depend on their inputs and no other state...
13:29:48FromGitter<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:59FromGitter<zah> The exception safety nomenclature in C++ tries to capture that: basic vs strong, etc: https://en.wikipedia.org/wiki/Exception_safety
13:31:30Araqarnetheduck, well in some hand-wavy sense. :-)
13:31:36arecaceaedom96: 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:38FromGitter<zah> With a non-recoverable error (a detect bug), you'll be right to be suspect that something might be wrong now
13:32:16dom96arecaceae: :/
13:32:16arecaceaedom96: so I think `->` needs to have a nimcall variant
13:32:33FromGitter<arnetheduck> @Araq yeah so stop trying to sound smart by throwing random terms and buzzwords around :)
13:32:51arecaceaedom96: I assume allowing {.nimcall.} behind the `->` doesn't work as part of the macro? `(x) -> void {.nimcall.}`
13:32:59dom96doubt it
13:33:09dom96Not sure what we can do here
13:33:40FromGitter<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:52arecaceaedom96: could default `=>` also to closure?
13:34:02arecaceaedom96: because it defaults to nimcall apparently
13:34:17Araqwell 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:51FromGitter<zah> Araq, what do you propose instead of crashing?
13:35:15*SenasOzys joined #nim
13:35:32arecaceaedom96: 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:39FromGitter<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:39dom96arecaceae: It defaults to whatever nim defaults to IIRC
13:35:46FromGitter<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:53dom96arecaceae: So if you use a variable outside its scope it will become a closure
13:36:02arecaceaedom96: I see, mb have two different arrow variants then :D
13:36:47arecaceaedom96: =>/-> closure arrows, =P> -P> nimcall/proc arrows >.<
13:37:18dom96arecaceae: Make an RFC :)
13:37:19Araqzah: 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:36FromGitter<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:40arecaceaedom96: >.<
13:38:17dom96zah: Why don't you just leave the unrecoverable exceptions unhandled and let the program crash?
13:38:24FromGitter<zah> so in some limited sense, stack unwinding is a bit orthogonal to handling the errors
13:39:35Araqit'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:41FromGitter<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:21Araqthe question is, can you map bugs to recoverable errors.
13:40:30FromGitter<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:37Araqand you'll be surprised of how often that would work. :P
13:41:34Araqwell that's my conjecture, anyway.
13:41:54FromGitter<arnetheduck> for some pretty weak definition of "works" :)
13:42:14FromGitter<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:28Electruxwait... i cannot create multiple variables on a single line?
13:43:27YardanicoElectrux you can
13:43:30Yardanicolet (a, b) = (1, 2)
13:43:53Araqarnetheduck: 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:56Electruxoh so the tuple form is a must? ok then :D
13:44:07Electruxthanks :D
13:44:18YardanicoElectrux nim is not python, it's similar sometimes, but still :)
13:44:28Yardanico(similar in syntax I mean)
13:44:28Electruxwait... what if i don't wanna assign the values initially?
13:44:37miranvar a: int
13:44:39Electruxas in var v1: string, v2: string
13:44:56Electruxi meant for multiple variables miran
13:45:13YardanicoElectrux well, why do you want to do it in one line? :)
13:45:24Yardanicoif you REALLY want (but it's generally bad to do that), you can use ;
13:45:28Yardanicoah, sorry
13:45:30miranlots of these questions are answered here: https://nim-lang.org/docs/tut1.html
13:45:31FromGitter<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:33YardanicoElectrux var v1, v2: string
13:46:21Electruxoh 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:35Electruxoh... my apologies... thanks miran :)
13:46:39arecaceaedom96: can I open a new multi-line block in => ?
13:46:47YardanicoElectrux as I said, just use var v1, v2: string , that's fine
13:46:47Araqarnetheduck: that means the "OS runs under a pretty weak definition of works".
13:47:16Electruxand yes that works! Yardanico thanks a lot :D
13:47:30dom96arecaceae: no, just write a `proc` for that
13:47:49dom96arecaceae: well, I guess you can by writing (foo; blah; baz) over multiple lines
13:47:54dom96with the ; but that sucks
13:48:24arecaceaedom96: ye :/ well, I guess I can't use neither ->/=>, but thanks for the info
13:48:38FromGitter<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:09miranarecaceae: IMO =>/-> should be used for simple "oneliners", anything more than that - write a proc
13:49:10Araqtbh 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:39arecaceaemiran: that seems to be the case ye
13:49:58Araqin fact, it recovers from them in the same shitty way that a Nim supervisor-as-a-library would.
13:50:40Araqsee you later.
13:51:02FromGitter<arnetheduck> so to make it simple, a nim supervisor (except a green-threaded one) cannot manage threads - there, broken!
13:51:33FromGitter<arnetheduck> an OS can - because it owns the resources
13:52:48FromGitter<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:24FromGitter<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:12Electruxok 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:34FromGitter<ephja> I'm not sure I'm mostly storing runes. doesn't work with parseutils :p
14:36:58*Trustable joined #nim
14:39:43FromGitter<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:05federico3any take on https://forum.nim-lang.org/t/1696 ?
14:59:38*FuntDobra joined #nim
15:04:25FromGitter<7sDream> Why `actors` module is deprecated, does it bring any problems?
15:14:09dom96It's inefficient IIRC
15:15:28Electruxare u the sole developer of this language dom?
15:16:52YardanicoElectrux he's not lol :)
15:17:32Electruxwell he is the only person with an '@' in irc so i thought he was... haha... my bad... who else is? :D
15:17:43FromGitter<7sDream> @dom96 any reference about IIRC? thx
15:18:00YardanicoElectrux 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:13YardanicoYou can check biggest contributors (except it's not always correct) here - https://github.com/nim-lang/Nim/graphs/contributors
15:19:43Electruxoh... wow that is cool! :O 960k lines of code... that is ridiculous... just wow :O
15:20:30Electruxsorry... don't wanna come off as a 12 year old ( no offense ) but it is really astounding and awesome to me :)
15:21:06YardanicoElectrux well, it also has -930k (count of deleted lines)
15:21:12YardanicoI mean github stats
15:22:16Electruxbut still... writing 960k lines alone is awesome imo :)
15:25:23FromDiscord<citycide> Araq's been doing this a long time, at least 10 years
15:27:05YardanicoWikipedia says that development of Nim started in 2004
15:27:13Yardanicoand github repo doesn't have all commits
15:27:18Yardanico(afaik only from 2011)
15:28:27FromDiscord<citycide> The first github commit to Nim was by Araq on Aug 23, 2008
15:29:12FromDiscord<citycide> Araq: what kind of cake you like 🤣
15:29:17Yardanicoyeah, sorry
15:29:24dom96Copyright (c) 2006-2018 by Andreas Rumpf
15:29:29dom96'nim -v'
15:29:31FromGitter<data-man> A few days ago, Nim-Lang had 12 members. Why now only 6? :(
15:29:42Yardanico405b86068e6a3d39970b9129ceec0a9108464b28 is the first commit in the repo
15:29:44Electruxwoooooow :O
15:29:54Yardanicohttps://github.com/nim-lang/nim/commit/405b86068e6a3d39970b9129ceec0a9108464b28
15:29:59dom96because I made their visibility private
15:30:03Electruxhow and why was this language invented btw? :D
15:30:38Electruxlike the thought which went into Araq's mind that got him to create this?
15:31:44FromDiscord<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:59Electruxrofl :P
15:31:59FromDiscord<citycide> but then decided he'd rather make a programming language
15:32:09Electruxhahaha +1
15:36:24Electruxok 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:42YardanicoElectrux what do you mean "you don't need"? You need
15:36:51YardanicoLike let mydata = newSeq[int]()
15:37:05Yardanicoor var a: seq[int]
15:37:21Electruxwhat is seq[ int ]? is it not a constructor?
15:37:33YardanicoNo
15:37:35Yardanicoit's a type
15:37:40YardaniconewSeq is a constructor
15:38:05Electruxoh... it is a reference of sequence...
15:38:18Electruxok... 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:42dom96Electrux: Don't put spaces like that btw :)
15:41:48dom96seq[int], not seq[ int ]
15:42:31Electruxoh... 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:53YardanicoElectrux worth reading - https://nim-lang.org/docs/nep1.html
15:46:02*SenasOzys quit (Ping timeout: 245 seconds)
15:49:28Yardanicodom96 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:47YardanicoI removed it already
15:51:04*jhorwitz joined #nim
15:52:40dom96Argh, can we not overload macros at all? :(
15:53:29Electruxshould 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:58FromGitter<Vindaar> @federico3 at least reg. the type of the Time field, you can do: https://gist.github.com/Vindaar/b9cef31428cfb2f26fbb5e70d9ba394c
15:53:59Electruxand thanks Yardanico i went through that... quite nice... lol i noticed the # too :P
15:54:34YardanicoElectrux no
15:54:46Yardanicouse "ref" only when you need it :)
15:55:13livcdDid anyone try to extend Powershell with Nim ?
15:55:19*SenasOzys__ joined #nim
15:55:48Electruxso 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:40dom96Araq: 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:13Gnjurachmm any good gui lib , i dont really need anything special just need 5 text buttons and img and text display
16:26:24Gnjuracand fullscreen
16:26:48Gnjuraci loking this nim nuklear but last commit in 2017
16:26:58federico3thanks Vindaar!
16:28:20dom96Gnjurac: ui package
16:28:31dom96or nimx
16:28:59FromGitter<7sDream> stdlib has a iup wrapper
16:29:05Gnjuracwill try that ui
16:29:16Gnjuracas i see on github nimx is marked failling
16:30:59dom96try 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:52FromDiscord<citycide> I still can't get nim-lang/ui to work for me. I'm not sure what I'm missing there
17:06:25kobiyou may find NiGui easier, citycide
17:06:49*yglukhov[i] quit (Remote host closed the connection)
17:06:53FromDiscord<citycide> I've used nigui, even contributed to it, but it doesn't have nearly as many components
17:07:08FromDiscord<citycide> also not very active so it's hard to contribute to
17:07:36*nsf joined #nim
17:20:57FromGitter<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:59FromGitter<brentp> ``````
17:21:08FromGitter<brentp> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b0ae904b6eece791db90b87]
17:22:04FromGitter<brentp> the code at mosfun.nim(267) is `... newSeqint8 (chrom_len+1)`
17:30:19FromGitter<brentp> ... and the machine where this fails has more than enough memory to handle this.
17:32:39dom96citycide: why not?
17:32:49dom96citycide: what's the problem with ui for you?
17:34:48*Electrux quit (Read error: Connection reset by peer)
17:39:00Gnjurachttps://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:14Gnjuracso we can write in more then 1 row
17:40:14Yardanicomore than 1 line
17:40:24Yardanicoor if you want to use " in your string without escaping
17:40:35Yardanico!eval echo """ lol look - " is here without escaping!"""
17:40:37NimBot lol look - " is here without escaping!
17:42:29*Vladar quit (Quit: Leaving)
17:45:19*Vladar joined #nim
17:49:26FromGitter<ibutra> Hi, can I set not nil on a ref object of RootObj?
17:49:30*craigger quit (Quit: bye)
17:49:42FromGitter<ibutra> I tried " a = ref object of RootObj not nil"
17:49:56FromGitter<ibutra> as well as "a = ref object not nil of RootObj"
17:50:00FromGitter<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:21kobihey everyone thanks for the help yesterday, i found the bug and all tests are passing now
18:05:43kobi:-)
18:06:22kobiseq is apparently magic
18:06:37kobiis it implemented as dynamic array?
18:07:01*SenasOzys__ quit (Remote host closed the connection)
18:07:16*SenasOzys__ joined #nim
18:07:34kobiI see all kinds of copying when adding an item (with &)
18:08:08*FuntDobra joined #nim
18:08:17kobihowever, there are more efficient ways, if a list contains a large array but only exposes part of it, and grows as needed.
18:08:38kobianother way is to have an array of array with an easy calculation to figure out where to put the item.
18:09:04kobior a linked list of arrays, so growing is fast
18:09:25kobimaybe 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:57kobi*better data structures
18:10:18*ldlework joined #nim
18:12:45*Electrux joined #nim
18:13:06FromGitter<kayabaNerve> I'm using a Doublypinked
18:13:53*Snircle quit (Ping timeout: 260 seconds)
18:13:54FromGitter<kayabaNerve> *DoublyLinkedList to represent blocks. Should I change that to a seq? 🤔
18:14:22*Snircle joined #nim
18:14:24kobidepends on what operations you're using it for
18:14:33FromGitter<kayabaNerve> I only need the head, tail, and iterator for now. Not the index
18:15:10FromGitter<kayabaNerve> But I will eventually need the index... So I guess what offers better performance for appending elements and retrieving elements?
18:15:25kobiso 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:00kobiif 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:43kobiyou can also have trees like a btree
18:18:35kobib+tree, trie, there are many types
18:19:15kobibut really it also depends on the scale. with small ones, it's negligible
18:20:22kobiif 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:03kobi7I usually don't do performance tweaking except design well and choose data structures
18:22:06kobi7with today's computers... usually not worth the effort or complexity that is introduced
18:22:17*FuntDobra quit (Ping timeout: 260 seconds)
18:22:34kobi7but nim provides the third way. templates or macros keep the code clean, but may speed up things
18:23:09kobi7someone made an simd library IIRC, and it didn't feel low level at all
18:25:51kobi7a 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:17kobi7or is it like an ffi?
18:27:22Yardanicokobi7 if it's compiled - only via C ffi
18:27:25kobi7In dot net you can use dlls like that, but they are not entirely compiled (IL)
18:27:28Yardanicowell, I mean via dynlib
18:27:37Yardanicobecause everything is fully compiled to machine code
18:27:47FromGitter<kayabaNerve> http://i0.kym-cdn.com/photos/images/original/001/272/773/6dd.jpg
18:28:00Yardanicothat's more for #nim-offtopic, but ok :D
18:28:54kobi7Yardanico: what about the new Nim namespace.. because don't the compiled procs have mangled names?
18:29:06Yardanicothey do
18:29:12Yardanicobut if you exportc them, they won't
18:29:37kobi7thanks, i haven't tried that part of nim yet
18:29:58kobi7is that a pragma for every proc I write?
18:30:18kobi7exportc is pragma or a general -define
18:30:21FromGitter<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:30Yardanicokobi7 pragma :)
18:31:10*FuntDobra joined #nim
18:33:28kobi7Yardanico: so I just do importc, with all the usual stuff? what about cstring etc?
18:33:39YardanicoI don't really know honestly :)
18:33:58FromGitter<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:30kobi7ok, 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:24kobi7actors deprecated??
18:35:37kobi7Yardanico: thanks mate
18:35:57Yardanico@7sDream IIRC = If i remember correctly
18:36:21FromGitter<7sDream> h
18:36:26Yardanicoor recall
18:36:27Yardanicohttps://www.urbandictionary.com/define.php?term=iirc
18:37:03FromGitter<7sDream> oh, I think it's a technology term, ROFL
18:37:39kobi7sorry man, wasn't entirely sure it was simd on nim, but i think so
18:38:11kobi7https://github.com/jackmott/nim_simd
18:38:38Yardanicokobi7 yeah, I know about this one, very cool project
18:40:16FromGitter<ephja> yeah that's what IIRC means IIRC
18:43:14YardanicoAFAIK IIRC means IIRC
18:44:20kobi7yep unless you're jk
18:44:29Yardanicodom96 did you report any pirated Nim in Action copies to Manning? Will they do something about that?
18:44:45kobi7what? I actually bought it!!
18:44:54kobi7:)
18:45:03dom96Yardanico: I didn't see any
18:45:37Yardanicodom96 I PM'd you
18:46:05kobi7nim has a pretty fast compilation. i like that.
18:46:12kobi7well, see you guys
18:46:14*kobi7 quit (Quit: Leaving)
18:46:29dom96haha awesome
18:46:39Yardanicodom96 and it was uploaded in the november :P
18:47:02dom96pirates are pretty quick
18:49:09dom96Yardanico: But yeah, send the link to Manning
18:49:18dom96doubt they'll do much though
18:49:31dom96but 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:30FromGitter<ephja> let's put sugar in his salt shaker
18:56:49*SenasOzys__ quit (Ping timeout: 260 seconds)
18:56:50Yardanicowell, at least pirates are required to buy a product to pirate it xD
18:57:26federico3dom96: images might be watermarked
18:57:51FromGitter<kayabaNerve> First pirate has to
18:58:41FromGitter<ephja> nah he just has to download it from dom96 using an exploit
18:59:19Yardanicolol
19:00:20dom96would be quite something if my publisher sues me for copyright infringement
19:01:21*FuntDobra quit (Ping timeout: 248 seconds)
19:07:00FromGitter<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:27federico3Vindaar: 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:09FromGitter<Vindaar> @federico3 I updated the gist
19:21:44FromGitter<Vindaar> the table in the other object is currently not returned as `Table[string, int]` however :)
19:27:19federico3thanks again!
19:29:58FromGitter<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:58FromGitter<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:53FromGitter<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:07Yardanicodom96 do you want to add https://t.me/nim_lang to list of the communities?
20:02:19dom96sure, do it
20:02:20Yardanicooh, you're the admin xD
20:05:34Yardanicodom96 do we want to also relay messages from telegram ? :D
20:06:01federico3Vindaar: thanks - me too - sort of
20:07:02FromGitter<Vindaar> @federico3 what does sort of mean? :D
20:07:37federico3that I'm fiddling with macros instead of taking the time to understand them :D
20:07:43dom96Yardanico: nah
20:07:46*Electrux joined #nim
20:07:55Yardanicodom96 ok :)
20:08:50FromGitter<Vindaar> @federico3 Oh, but I guess that's normal and healthy while learning sometimes
20:08:58FromGitter<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:28federico3what'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:22PenguiniumHey, 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:13PenguiniumSay 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:48FromGitter<kayabaNerve> Compiled not transpiled
20:55:10dom96Penguinium: Hello and welcome :)
20:55:25dom96Penguinium: For a simple hello world app you don't even need Nimble
20:55:32dom96just a hello.nim file
20:55:51federico3[transpiler rant triggered]
20:55:52dom96if you want to learn how to use Nimble then all you need is `hello.nim` + `hello.nimble`
20:55:55FromGitter<kayabaNerve> And idk about nimble, but my folder structure is src/ src/c and my Nim in src/
20:55:59PenguiniumYeah, im aware, but im trying to understand how the nimble structure looks like.
20:56:12FromGitter<kayabaNerve> I put git/readme/license stuff in the root
20:56:18federico3Penguinium: 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:56dom96Penguinium: Is Nimble giving your package structure errors?
20:57:20dom96*you
20:57:38FromGitter<kayabaNerve> @FedericoCeratto that is fricking amazing
20:57:52FromGitter<kayabaNerve> I can't use nimble on my laptop but I'm definitely looking over that
20:58:02Penguiniumyeah, 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:04FromGitter<kayabaNerve> Service file and hardened config? Top
20:58:10federico3oh thank you!
20:58:24FromGitter<kayabaNerve> Only thing you're missing is Nake support
20:59:10dom96Penguinium: src/projectName/ folder is what you need
20:59:31dom96also, 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:10Penguiniumah alright, i'll test.
21:00:45dom96You can gist your structure here if you'd like. I'll be able to help out better then
21:00:51federico3kayabaNerve: what's Nake for? Looks like nimble <task name>
21:01:08dom96Indeed, nake is obsolete. Use Nimble.
21:01:36Penguiniumok, but it generates the cache inside the src file, is there a build output options?
21:03:32dom96why is that a problem?
21:03:49Penguiniumso it cannot be solved?
21:04:05*endragor quit (Ping timeout: 240 seconds)
21:06:36dom96you can specify options in a nim.cfg file
21:07:38dom96--nimcache:path
21:07:47FromGitter<kayabaNerve> Nake is Nim Make files
21:08:08FromGitter<kayabaNerve> dom96 was it integrated or replaced by?
21:08:20dom96replaced
21:09:16FromGitter<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:22Penguiniumalrighty, 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:49FromDiscord<citycide> dom96: I have an open issue on nim-lang/ui, I've never been able to get it to compile
22:53:53FromDiscord<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:03FromDiscord<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:54FromGitter<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:54FromGitter... [https://gitter.im/nim-lang/Nim?at=5b0b3995a45f930a65dcf875]
23:05:15FromGitter<data-man> :)
23:07:03FromGitter<data-man> @Araq @dom96 ⏎ I made many aaditions/replacements in new unicode module. ⏎ Maybe before PR to create an RFC?
23:08:29FromGitter<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:44FromGitter<data-man> @7sDream I added the comment, thanks.
23:31:44FromGitter<Varriount> @data-man Wow! You're on fire! 🔥
23:33:25FromGitter<data-man> @Varriount Just tiny optimizations for some cases.
23:53:31*find0x90 quit (Quit: find0x90)
23:55:31*Electrux joined #nim