<< 07-09-2018 >>

00:08:00*vivus joined #nim
00:34:38*zachcarter quit (Ping timeout: 245 seconds)
00:55:21*dddddd quit (Remote host closed the connection)
00:58:07*Pisuke joined #nim
01:00:53*MyMind quit (Ping timeout: 245 seconds)
01:07:36*geocar quit (Quit: Connection closed for inactivity)
01:24:03*freealibi joined #nim
01:24:32*freealibi left #nim (#nim)
01:28:52vivushey all
01:29:12vivushow do I echo these items from my table into a line by line display: @[(name: "Lettuce", color: "Green")] ?
01:36:21vivusso I looped through and got each item, but now its showing as: (name: "Apple", color: "Red")
01:42:01leorizevivus: you're using tables module, right?
01:42:15leorizethen you can use the `pairs` iterator
01:43:57vivusleorize: my first loop looked like so: for key, value in mytable: if input_value == key: ...
01:45:28*a__b__m quit (Ping timeout: 245 seconds)
01:47:17vivusleorize: when do I use `pairs`? on the first for check?
01:49:31leorizewhat exactly are you trying to do?
01:55:46*leaf__ joined #nim
01:57:13Tangervivus: you would use pairs in the for definitions, like `for key, val in mytable.pairs:`
02:02:09*leaf__ quit (Ping timeout: 252 seconds)
02:02:20FromDiscord<Shield> is there a way to catch exception and recover from internet connection loss?
02:04:24FromDiscord<Shield> my discord bot keeps crashing if my internet disconnects and it seems that i can't do anything to deal with it without restarting the program
02:05:13leorizeif it's just an exception then you can try-catch
02:05:24leorizeafter that you just need to re-establish the connection
02:16:58FromDiscord<emekoi> what library are you using for your discord bot?
02:20:34FromDiscord<Shield> this one https://github.com/hlaaftana/pkpsgpsg
02:21:53FromDiscord<Shield> i think asyncdispatch manages to crash the program without catching the error but i'm not sure
02:25:24*vivus quit (Remote host closed the connection)
02:26:50FromDiscord<emekoi> yeah i would put where you init and run the event loop in a try-catch blokc in a while loop, then in the catch sleep for a little while and maybe echo a message to give time for the internet to be re-established.
02:56:41*onionhammer joined #nim
02:58:27*onionhammer1 quit (Ping timeout: 240 seconds)
03:17:15*Yardanico quit (Ping timeout: 252 seconds)
03:22:41*endragor joined #nim
03:22:58*Yardanico joined #nim
03:27:55*leorize quit (Quit: WeeChat 2.2)
04:06:42FromDiscord<Shield> got it to work, still crashes on some cases but it's not bad, thanks for your time
04:11:46ldleworkI forget does Nim have natural currying?
04:11:54ldleworklet add x y = x + y
04:12:01ldleworklet add10 = add 10
04:12:04ldleworkthat kind of thing
04:14:31Tangerldlework, https://rosettacode.org/wiki/Currying#Nim
04:20:43FromGitter<bung87> https://github.com/zero-functional/zero-functional
05:37:35*nsf joined #nim
06:04:56*cspar quit (Read error: Connection reset by peer)
06:10:16*cspar joined #nim
06:26:33FromGitter<codem4ster> > @codem4ster congrats =), now you can write a blog post :P ⏎ ⏎ @mratsim :D after 5min of that post my script stopped without giving a reason it said "exited with null". There was no leak, no out of memory. And another thing I discovered was; my code hanged at the beginning if I compile it with -d:release --opt:speed but it works without these parameters. All these happens in my Manjaro Linux. And I had some
06:26:34FromGitter... issues when code running also, at a 30sec - 1min period of time httpclient suddenly gives connection problems and it backs to normal again after that period, works a while and then making this again periodically. I couldn't understand is this a network issue or a memory issue. At the end if I would write a blog post abou ... [https://gitter.im/nim-lang/Nim?at=5b921a19d457a1406cb19b55]
06:35:06FromGitter<Araq> sure, you need to look at how e.g. `httpbeast` uses async+threading, it's not as easy with thread local heaps
06:35:59FromGitter<Araq> good news though is that you can also use multiprocessing and you need to do that anyway for a half-decent reliable deployment
06:37:45FromGitter<Araq> "I have this one process that handles every request and must never fail" is not a good way of doing things. The next thing you then ask for is "continue after every bug that comes up"
06:59:32*zachcarter joined #nim
06:59:55*kapil___ joined #nim
07:09:27FromGitter<mratsim> @codem4ster well you need to vote on that: https://github.com/nim-lang/Nim/issues/6537 ;)
07:09:47FromGitter<mratsim> and maybe describe what you tried, because if it almost worked we can maybe add a minimal stuff
07:14:44*geocar joined #nim
07:21:49*TheLemonMan joined #nim
07:22:34TheLemonManAraq, what's the reason behind the different "scopes" for procs/templates/macros ?
07:23:30FromGitter<Araq> what do you mean?
07:24:30TheLemonManmainly the fact you can have a proc and a template and a macro with the same name
07:24:56FromGitter<Araq> that's just ordinary overloading
07:25:32FromGitter<Araq> the fact that it tends to not work well is because of `untyped` limitations
07:26:16TheLemonMana very ad-hoc kind of overloading I'd say
07:27:35FromGitter<Araq> ignoring `untyped`, it's very useful that templates can be operators and have types just like procs, makes the whole language super orthogonal
07:28:22FromGitter<Araq> and overloading is ad-hoc in Nim already.
07:38:50FromGitter<Araq> https://github.com/nim-lang/Nim/issues/8901 yay or nay?
07:44:46*xet7 joined #nim
07:52:34FromGitter<narimiran> in that example, `splitLines` proc would cease to exist?
07:52:45FromGitter<Araq> yeah
07:53:24FromGitter<Araq> it implies a stdlib update
07:54:34FromGitter<narimiran> ...and all other procs that have the same name as iterators (for strutils that is: split, splitWhitespace, rsplit and splitlines)
07:54:46FromGitter<narimiran> wouldn't that cause really a lot of breaking?
07:54:59FromGitter<Araq> yes, strutils seems to be the biggest offender here
07:55:32FromGitter<Araq> well the new strings break tons of stuff, there would be an ``--oldIters:on`` switch for migration
07:55:49FromGitter<Araq> just like we have ``--laxStrings:on`` and ``--nilSeqs:on``
07:56:01FromGitter<narimiran> ok, maybe i should copy-paste this to github, just to make it more permanent/visible
07:56:38FromGitter<Araq> but ``--version=0.18`` is a good idea
07:57:01FromGitter<Araq> these ``--version`` switches would collect the feature switches
07:57:40FromGitter<narimiran> as i said before, i personally don't mind breaking stuff before v1.0, if that means better language and/or less breaking later
07:58:07FromGitter<Araq> yeah but that's the big elephant in the room
07:58:43FromGitter<Araq> "less breaking later" ... languages evolve constantly and you can always design things better in hindsight if you're allowed to break things
07:59:12FromGitter<Araq> and clang/gcc have "C++ dialect" switches, Rust got the same iirc
08:02:16FromGitter<narimiran> well, if you break things now, this switches/deprecation warnings can exist in v0.19, and we could/should clean all that up for v1.0, no?
08:02:40FromGitter<narimiran> btw, how far away is v0.19?
08:03:25*leorize joined #nim
08:03:33*gmpreussner quit (Quit: kthxbye)
08:03:35FromGitter<Araq> I'm finishing my docgen improvements and there is at least one serious regression
08:03:48*gmpreussner joined #nim
08:24:00*Vladar joined #nim
08:24:06*a__b__m joined #nim
08:24:33FromGitter<mratsim> what is a super orthogonal language?
08:25:16FromGitter<Araq> Nim.
08:25:22TheLemonManAraq, I've blindly copied the weird newStmtList assignment from asyncmacro, I think we have the same problem there
08:25:47TheLemonManit's interesting how nobody noticed that :)
08:25:51FromGitter<mratsim> and yeah the iterator namespace change is good, I always found that confusing
08:26:56FromGitter<Araq> more seriously, it's a language where syntax and semantics are decoupled to a great extend. Lisp also qualifies
08:32:04FromGitter<bung87> does `dques` module equal to `heapq` in python?
08:32:40TheLemonManbung87, there's heapqueue for that
08:33:32FromGitter<bung87> where to get it?
08:33:40FromGitter<mratsim> btw @Araq not sure if you saw that but I think it’s pretty serious: https://github.com/nim-lang/Nim/issues/8432, didn’t test but async + generics might be completely broken
08:33:55FromGitter<mratsim> it had a poor name at first
08:35:47TheLemonManbung87, collections/heapqueue
08:36:11TheLemonManbung87, https://nim-lang.org/docs/heapqueue.html#HeapQueue
08:37:00FromGitter<bung87> thanks ! :)
08:38:16FromGitter<Araq> @mratsim yay
08:51:00FromGitter<Araq> @mratsim: workaround ` h = T(1e-5)` for the default param
08:52:17FromGitter<mratsim> ah it’s the defaut param that is breaking?
08:52:28FromGitter<Araq> yeah
08:52:45FromGitter<mratsim> so I can just use overloading
08:52:47FromGitter<Araq> and default parameter handling was changed by Zahary's commit
08:52:52FromGitter<mratsim> not that breaking then
08:53:00FromGitter<Araq> no, you don't have to use overloading either
08:53:02FromGitter<mratsim> yeah it was to solve static + default param issue iirc
08:53:17FromGitter<Araq> you only need to write your default parameter without the dot syntax
08:53:23FromGitter<mratsim> ok
08:53:28FromGitter<Araq> and don't ask me why :-)
08:53:48FromGitter<Araq> the stack trace mentions `tryResolvingStaticExpr`, lovely
08:54:24FromGitter<Araq> and of course this "try" doesn't require any recursion checks, code is always perfect
08:54:40FromGitter<Araq> I hate recursion :-)
08:54:47FromGitter<mratsim> I really wonder how come static had so many issues and how they do it in other languages
08:55:15FromGitter<Araq> yeah, to all you FP lovers out there, I said it, recursion sucks.
08:55:52*SenasOzys joined #nim
08:56:04FromGitter<mratsim> Well recursion is not always used in FP, tree data structures often require recursion.
08:56:43*SenasOzys quit (Remote host closed the connection)
08:56:52FromGitter<Araq> well "ordinary" recursion is fine, but allowing recursion without an annotation is bad. you can get mutually recursive code without noticing it
08:57:45FromGitter<Araq> and with far-from-obvious termination criteria and explosive runtime big-O characteristics
08:57:49*SenasOzys joined #nim
08:58:17FromGitter<Araq> recursion needs to be tamed.
08:59:02FromGitter<mratsim> You can use queues or stack for that, but does deques memory use always grow, I don’t think it ever deallocated removed items right?
08:59:47FromGitter<mratsim> deallocates*
09:00:14FromGitter<Araq> using a stack/queue instead for mutually recursive code is hard. and they do deallocate.
09:00:22FromGitter<alehander42> well it shouldn't be hard to detect mutual recursion , it's a cycle in static calltraph
09:00:55FromGitter<Araq> about `static-T`, it was hacked into the compiler, conflates two separate, but maybe related problems and the compiler never was designed for it
09:01:13FromGitter<Araq> s/problems/features
09:01:18FromGitter<alehander42> But if you want to discard the cases where a condition prevents it , that necessary very hard indeed
09:01:49TheLemonManit's not that easy when you take into account indirect calls
09:01:50FromGitter<Araq> @alehander42 function pointers mean you usually don't have a static callgraph
09:03:57FromGitter<mratsim> I use co-recursion with Static + Generics here: https://github.com/status-im/nim-stint/blob/master/stint/private/uint_div.nim#L90-L129
09:04:35*SenasOzys quit (Ping timeout: 244 seconds)
09:05:03FromGitter<alehander42> @Araq well that's why generally you need a runtime calltraph
09:05:31FromGitter<alehander42> Applied to a run with good branch coverage
09:05:56FromGitter<Araq> maybe, or maybe Ada 83 got it right, it banned function pointers and was statically provable
09:06:07*SenasOzys joined #nim
09:06:32FromGitter<mratsim> Graphs are all the rage: blockchain uses a DAG, Deep Learning uses a DAG. And btw, is there a Graph lib in Nim? I need one for network simulations.
09:06:36FromGitter<alehander42> that's too big of a Lang limitation I think
09:06:40*SenasOzys quit (Remote host closed the connection)
09:08:41FromGitter<Araq> I like it, it also got provable constant memory usage right. contrast that with the never ending OOM issues in "memory-safe Java"
09:08:47FromGitter<alehander42> but honestly you can't go without mutual recursion, e.g. how would you analyze trees
09:09:15FromGitter<Araq> you map the tree to a string, see packedJson :-)
09:09:32FromGitter<alehander42> you can't have that visitNode calling other stuff calling visitNode
09:09:40FromGitter<mratsim> I think string should be removed from all programming languages /s
09:10:06FromGitter<Araq> @mratsim I lost the code for mine, but I used node Ids and a single IntSet
09:10:40FromGitter<Araq> there is an edge between (a, b) if (a*b) is in the set
09:11:57FromGitter<alehander42> actually I remember the c code in ruby VM worked like that, it never recursed, just iterated while maintaining its own frame abstraction
09:12:16FromGitter<Araq> that's the standard for interpreters, Nim's VM does the same
09:12:28FromGitter<alehander42> Compared to the python VM which opened a new eval contest recursively
09:12:39FromGitter<Araq> Python calls it a "stackless" implementation, but seriously
09:12:54FromGitter<Araq> if your interpreter calls itself recursively, you throw it away.
09:15:45FromGitter<alehander42> *throws all my interpreters away*
09:15:58FromGitter<Araq> sorry :-)
09:16:18FromGitter<alehander42> *also my Englishr Grammar*
09:16:41FromGitter<alehander42> nah I think I stopped doing them a while ago
09:17:00FromGitter<Araq> things are much better with an explicit stack in an interpreter, you can then walk it when an exception is thrown
09:17:00*norok2 quit (Remote host closed the connection)
09:17:21*norok2 joined #nim
09:17:27FromGitter<mratsim> Are there interpreter without a stack? Even register VM all have a stack no?
09:17:28FromGitter<alehander42> nowadays generating code or low level ops seems simpler (for a toy language )
09:17:58FromGitter<Araq> @mratsim yeah but they don't use the hardware/C stack for it
09:18:15FromGitter<Araq> also GPUs don't have stacks :-)
09:18:50FromGitter<Araq> I know, it's "Just like C", but braces aside, it's really completely different
09:19:14FromGitter<mratsim> actually I think they have
09:19:24FromGitter<mratsim> OpenCL uses enqueue_read_buffer
09:19:46FromGitter<mratsim> and CUDA uses for example cuda_copy_async
09:19:57FromGitter<mratsim> or maybe the queue/stack is in the driver
09:21:03FromGitter<Araq> https://computergraphics.stackexchange.com/questions/367/why-is-recursion-forbidden-in-opencl
09:23:31FromGitter<mratsim> What is newSlice? https://github.com/nim-lang/Nim/issues/8901#issuecomment-419369746, similar to toOpenArray? no-copy slicing if possible?
09:24:26FromGitter<Araq> `..` constructs the slice/iterval, but there is also an iterator named `..`
09:27:29FromGitter<Araq> you can do `let x = 4..6; for i in x: echo i`
09:28:00FromGitter<Araq> because somebody came along and screamed the C-word
09:28:18*seni joined #nim
09:28:33FromGitter<Araq> and the C-word is always right
09:30:18*SenasOzys joined #nim
09:32:58*tzekid_ joined #nim
09:32:58*tzekid_ quit (Client Quit)
09:32:58*tzekid joined #nim
09:32:59FromGitter<Araq> https://stackoverflow.com/questions/3644809/does-cuda-support-recursion
09:34:47tzekidHey, I've got the following code snippet:
09:34:51tzekidproc map[T](self: seq[T], f: proc(x:T): T, temp:seq[T] = @[]): seq[T] = self
09:34:54tzekiddiscard ArrayToCompute.map do (x:int)->int: x*x
09:35:17tzekidWhich, when trying to compile gives: `execution of an external program failed:`
09:35:38leorizeit's better if you could provide a paste instead
09:35:46leorizeuse services like ix.io or ptpb.pw
09:37:07tzekidok
09:37:18*stefanos82 joined #nim
09:37:46tzekidhere's the paste: https://ptpb.pw/YEND
09:38:37tzekidI'm trying to learn functional paradigms by implementing them and I wanted to use nim's `do` syntax
09:38:49leorizecan you provide the entire compile log?
09:38:54leorizeit's working for me
09:40:19tzekidhttps://ptpb.pw/arS5
09:40:23FromGitter<mratsim> why is there a self at the end?
09:40:23tzekidHmmm
09:40:52tzekidto return the array - I've simplified the proc
09:41:32FromGitter<mratsim> there is = self and then on the following line your discard proc
09:42:11leorizetzekid: what's your Nim version?
09:42:21FromGitter<mratsim> if you’re interested in FP in Nim you can use my project euler programs as reference: https://github.com/mratsim/nim-projecteuler/tree/master/src
09:42:37FromGitter<mratsim> Note that I did that when I was a Nim newbie.
09:42:47tzekidmratsim: I've simplified the example to the core. These two lines don't compile for me
09:43:04tzekidmratsim: Nim Compiler Version 0.18.0
09:43:13tzekidon Archlinux x64
09:43:29tzekidmratsim: Thanks for the examples :D
09:44:23leorizeno problem on devel, must be a 0.18.0 bug
09:46:57tzekidleorize: Hmmm... can be. I get the same result in jdoodle @> jdoodle.com/execute-nim-online
09:47:04tzekidgonna try it out on dev
09:47:16leorizethere's nim-git on AUR :)
09:56:24tzekidThanks! It works on dev :D
10:03:13FromGitter<Araq> btw can I register a travis project that gets rebuild whenever nim-lang/Nim changes?
10:09:57FromGitter<bung87> it's default travis's behaviour,doesn't it?
10:13:58FromGitter<Araq> not for unrelated projects
10:28:15*dddddd joined #nim
10:47:58*noonien joined #nim
11:09:57*a__b__m quit (Read error: Connection reset by peer)
11:10:34*tzekid quit (Remote host closed the connection)
11:15:24FromGitter<Clyybber> Are converters inlined automatically?
11:30:23Araqno
11:42:36*leorize quit (Quit: WeeChat 2.2)
11:59:42FromGitter<Clyybber> Is there a type that is an alias for all types?
12:01:06Araqunclear.
12:01:14FromGitter<bung87> `newHeapQueueEvent[TArg ()` ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b92688ad457a1406cb363a7]
12:01:37FromGitter<Clyybber> @Araq Ah, nevermind, what I was looking for whas `Any`
12:02:15FromGitter<bung87> `self.queue = newHeapQueueEvent[TArg ()` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9268c7cff55e5617be60d0]
12:02:24FromGitter<codenoid> hi @Araq
12:03:01FromGitter<mratsim> @bung87 seems like a bug in HeapQueue if the constructor creates a seq :?
12:04:22FromGitter<bung87> `HeapQueue[T] = distinct seq[T]` I see the type defined as this
12:04:53FromGitter<mratsim> newHeapQueue isn’t converting the seq to it’s distinct type then.
12:05:02FromGitter<mratsim> or there is a bug introduced in the library
12:05:10FromGitter<mratsim> are you on devel or stable?
12:05:43FromGitter<Araq> hi @codenoid
12:05:57FromGitter<bung87> devel , 0.18.1, git hash: 4aba2981dd47672744191bd17b39bb149f494637
12:08:52FromGitter<bung87> Commits on Sep 4, 2018
12:08:59*kapil___ quit (Quit: Connection closed for inactivity)
12:10:00FromGitter<mratsim> can you try on stable
12:10:11FromGitter<mratsim> there might be a regression on distinct types
12:11:18FromGitter<bung87> same error `Error: type mismatch: got <seq[Event[system.string]]> but expected 'HeapQueue[Event[system.string]]'`
12:12:59FromGitter<Clyybber> @Araq Does {.reorder.} put all `converter`s to the top?
12:15:28FromGitter<alehander42> does {.new order.} put blue Monday on repeat?
12:16:19FromGitter<mratsim> blue monday?
12:16:31FromGitter<Clyybber> https://www.youtube.com/watch?v=FYH8DsU2WCk
12:16:44FromGitter<Clyybber> @alehander42 I do :D
12:16:58FromGitter<alehander42> a legendary vinyl single
12:17:12FromGitter<Grabli66> Hi! Is it possible to set a path to a local nimble package in nimble file? I will have a many local packages and don't want to do "nimble develop" in each package directory.
12:17:46FromGitter<mratsim> use a script to nimble develop?
12:18:52FromGitter<Grabli66> I thought about it. But maybe there is a better way? :)
12:21:33FromGitter<Grabli66> Every who will want to work with that repository have to to launch that script
12:22:19FromGitter<Clyybber> Do you have all the local nimble packages in one repo?
12:24:30FromGitter<Vindaar> @bung87 @mratsim seems to be another generic / typedesc issue (maybe related to the typedesc changes?). The implementation of `newHeapQueue` is: ⏎ ⏎ ```proc newHeap*[T](): HeapQueue[T] {.inline.} = newSeq[T]().HeapQueue``` ⏎ ⏎ it works fine [https://gitter.im/nim-lang/Nim?at=5b926dfe4be56c5918f61a4d]
12:25:01FromGitter<mratsim> lolwut
12:25:02FromGitter<Grabli66> @Clyybber , yes
12:25:15FromGitter<Clyybber> @Vindaar Thats wierd
12:25:24FromGitter<mratsim> @bung87 can you raise a ticket on that, I think that’s another showstopper for @Araq
12:25:48FromGitter<Vindaar> the name change was accidental of course :D
12:26:05FromGitter<Clyybber> @Grabli66 Maybe you can use paths in `.nimble` `require`?
12:27:36FromGitter<Clyybber> @mratsim @Araq Is that normal:
12:27:52FromGitter<bung87> @Vindaar yeah , rewrites to that it passed.
12:28:12FromGitter<Clyybber> ``````
12:28:35FromGitter<Clyybber> Shouldn't `any` accept anything?
12:28:42FromGitter<bung87> @mratsim you mean open a issue on github ? I'd like to
12:29:35FromGitter<Clyybber> @bung87 If you do, could you include @Vindaar 's snippet?
12:30:53FromGitter<bung87> yeah .
12:31:25FromGitter<mratsim> @Clyybber I never managed to use Any tbh :P
12:31:40FromGitter<Clyybber> Oh ok :D
12:32:02FromGitter<mratsim> use generics with an unspecified T was always enough
12:32:06FromGitter<Clyybber> @mratsim Did you use auto, it should basically be the same AFAIK
12:32:34FromGitter<mratsim> I do use auto to cheat on nested sequences
12:33:33FromGitter<Clyybber> Well if I change any to auto i get ```Error: unhandled exception: /home/clyybber/builds/nim/compiler/ccgtypes.nim(180, 17) `false` mapType [AssertionError] ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b92701dc2bd5d117a31a5e6]
12:34:20FromGitter<mratsim> @Clyybber here is my auto PR that got rejected: https://github.com/nim-lang/Nim/pull/6807
12:35:50FromGitter<Clyybber> Ooh a recursive iterator, nice
12:36:52FromGitter<Clyybber> Oh, wait that isn't supported?
12:49:49FromGitter<mratsim> it is, it works
12:50:27FromGitter<mratsim> but Araq doesn’t like the type signature because it’s kind of polymorphic so not in standard lib
12:51:00*zachcarter quit (Ping timeout: 252 seconds)
12:51:36*Vladar quit (Remote host closed the connection)
12:55:10*Vladar joined #nim
13:01:37FromGitter<Clyybber> Hmm
13:10:37Araqit's not "kind of polymorphic", it's illtyped
13:12:25*endragor quit (Remote host closed the connection)
13:22:53FromGitter<Clyybber> @Araq This snippet fails: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927badc2bd5d117a31eadf]
13:23:32FromGitter<Araq> does it work without the 'auto'?
13:24:32FromGitter<Clyybber> This works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927c10cff55e5617bee21e]
13:25:27FromGitter<Araq> well I don't think this needs to work, 'auto' is not subject to a unification type inference algorithm
13:26:01FromGitter<Clyybber> Hmm, ok. It crashes the compiler though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927c69f86b741b05222504]
13:30:03FromGitter<Clyybber> Hmm, ok. It crashes the compiler though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927d5b11227d711d2c227f]
13:34:26TheLemonMando `static` blocks outside of toplevel make any sense?
13:36:46FromGitter<Clyybber> Why not?
13:37:54TheLemonManyou can't answer a question with another question!
13:38:28*Vladar quit (Remote host closed the connection)
13:38:54*Vladar joined #nim
13:39:06FromGitter<Clyybber> Why not?
13:39:10FromGitter<Clyybber> :P
13:42:01*endragor joined #nim
13:42:39FromGitter<Clyybber> @Araq And this works: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ which makes the first snippet pretty useless. Still I think it shouldn't crash the compiler [https://gitter.im/nim-lang/Nim?at=5b92804f11227d711d2c3723]
13:46:44TheLemonManoh they make a lot of sense with generics, I'm dumb
13:49:56*nif quit (Quit: ...)
13:56:33FromGitter<ephja> I do hope that nothing *should* crash the compiler :p
13:57:21TheLemonManbetter to have it crash and burn than to have it silently produce garbage
13:57:45Araqwell a real error message is not too much to ask for
14:01:08TheLemonManbung87, can you provide a self-contained reproducer for #8905 ?
14:03:08FromGitter<bung87> @FromIRC TheLemonMan yeah, a later
14:03:13FromGitter<Vindaar> TheLemonMan: added one
14:03:36*SenasOzys quit (Ping timeout: 252 seconds)
14:03:42FromGitter<bung87> nice
14:03:50TheLemonMannice
14:06:11FromGitter<tim-st> is there a way to use pythons str format using `%` like `echo "abc%s" % "def"` or `echo "abc%s: %s" % ("def", 123)` ?
14:07:32*nsf quit (Quit: WeeChat 2.2)
14:08:18FromGitter<bung87> strutils
14:08:34TheLemonMan`nim secret` is pretty damn awesome
14:08:47*SenasOzys joined #nim
14:09:57FromGitter<tim-st> @bung87 `import strutils; echo "abc%sghi" % "def"` doesnt work as pythons
14:10:40Araqimport strformat
14:10:45Araqand read some docs
14:10:48FromGitter<bung87> placeholder not %s
14:11:34FromGitter<tim-st> I already tried `import strformat; echo "abc%sghi" % "def"`this gives `undeclared identifier`
14:12:26Araqhttps://nim-lang.org/docs/strformat.html
14:12:45Araqhttps://nim-lang.org/docs/strutils.html#%,string,openArray[string]
14:13:04Araq"$1 eats $2." % ["The cat", "fish"]
14:13:41FromGitter<bung87> `"$# eats $#." % ["The cat", "fish"]`
14:14:10FromGitter<tim-st> ok, thanks, that's nearly what I wanted, though `"%s eats %s." % ("The cat", "fish")` would be better imo
14:14:49Araqand once you learned Nim you will notice that it would be worse
14:15:04FromGitter<Vindaar> +1 for Nim's syntax
14:15:46FromGitter<tim-st> In python I can use int where `%s` in nim it doesnt work: `echo "$# eats $#." % ["The cat", 1]`
14:16:22FromGitter<tim-st> would be really good to have a proc like `echo` that takes all and converts to string
14:18:08FromGitter<ephja> well, did you look at strformat? there's also this https://nim-lang.org/docs/strutils.html#format,string,varargs[string,]
14:18:43FromGitter<ephja> these dang URLs with markdown
14:19:23Araqyeah, working on it...
14:20:08FromGitter<tim-st> @ephja the problem is that array cant take mixed type, so tuple would be needed
14:35:34*TheLemonMan quit (Ping timeout: 246 seconds)
14:37:35FromGitter<tim-st> Maybe a proc taking a Concept (static tuple of var length with check: every T in tuple has `$` proc ) and then creates an array of string and calls overloaded `%`would solve this
14:38:04Araqor maybe use strformat
14:38:41Araqdecoupling the placeholders from the expressions doesn't scale well anyway
14:38:58Araqthat's why Python got f-strings too.
14:39:38FromGitter<tim-st> I always used pythons `%s` way and I saw many others too, I dont really like the thing with `{varName}`
14:40:38FromGitter<mratsim> import strutils and use `%` from it
14:40:51FromGitter<tim-st> look above, that doesnt work for mixed types
14:41:07FromGitter<mratsim> convert them and use an array of strings
14:41:14FromGitter<tim-st> ^^
14:41:17FromGitter<mratsim> they would have to be converted to string anyway
14:41:22FromGitter<tim-st> sure
14:41:49Araqstrutils.format("$#, $#", 34, "should work")
14:42:12*floppydh quit (Quit: WeeChat 2.2)
14:42:47FromGitter<tim-st> yes, thanks, that's ok
14:43:27Araqgood thing Nim has 3 different ways to do the format then
14:43:30Araq:-/
14:44:11FromGitter<tim-st> Even better then my current way using `&` and concatenate everything :\
14:46:52*TheLemonMan joined #nim
14:48:01TheLemonManbung87, give me a few mins and I'll push a fix for #8905
14:53:33FromGitter<bung87> ok , I've done my work through @Vindaar 's solution
14:55:55*wildlander joined #nim
14:56:09FromGitter<bung87> the `withRLock(self.L):` can't break outter loop is designed behavior ?
14:57:29FromGitter<bung87> from the block inside.
15:09:49TheLemonManAraq, where do we place tests for stdlib pieces? in the implementation file?
15:14:10*miran joined #nim
15:21:48FromGitter<tim-st> Why does some code require `--threads:on` and others like this does not: https://nim-lang.org/docs/asynchttpserver.html#examples
15:24:32FromGitter<tim-st> The example from the url only works with `threadvar` so I assume it's related to threads somehow
15:25:46*kapil___ joined #nim
15:35:49AraqTheLemonMan, yeah or in tests/stdlib
15:35:53Araqit doesn't really matter
15:47:47FromGitter<tim-st> Araq: do you know the answer to my question? does the code above use threads and if not why does it need `threadvar` and if it does why does it not need `--threads:on`?
15:48:06FromGitter<tim-st> (threadvar when I want to access a global)
16:01:30*Trustable joined #nim
16:02:49FromGitter<ephja> why not enable threads by default?
16:03:25FromGitter<arnetheduck> what's the best way to run `nimble test` with release mode flags (optimization turned on)? @dom96
16:05:55FromGitter<tim-st> @ephja I want to understand how this works, one dependency says it is "single threaded non blocking", I'm not sure if I need locking or not there is no deep information how `threadvar` works (what is copied, what is safe what not), I like nim, but now when it comes to create a http server I'm not sure if nim can do this
16:07:38FromGitter<tim-st> all those "async http servers" have static string "Hello World" examples, irl people want to serv dynamic shared
16:08:35TheLemonManof course Nim can do it just fine, the real question is: can you? :)
16:11:53*PMunch joined #nim
16:12:25FromGitter<mratsim> @arnetheduck switch(“define”, “release”)
16:20:10FromGitter<tim-st> TheLemonMan: I read that every single http server implementation in nim is leaking memory, I think my question is appropriate
16:25:27*NimBot joined #nim
16:26:57FromGitter<arnetheduck> @mratsim what about one-off? ie from command line
16:27:19FromGitter<mratsim> create a test_release task
16:27:32FromGitter<arnetheduck> and without a task?
16:27:36FromGitter<mratsim> I’m not sure nimble pass the flags properly
16:28:16FromGitter<arnetheduck> and... can a task call another? ie there's a "standard" test task that looks for files starting with `t` - can that be called from another task?
16:33:03Araqyeah, a 'task foo' is turned into a proc taskFoo iirc
16:33:18Araqso you can call it as it's just a proc
16:40:28*endragor quit (Ping timeout: 245 seconds)
16:55:28*leorize joined #nim
17:01:27FromDiscord<treeform> I been fighting with this JS string bug for half a day now. Looks a bit embracing to my pears because this is production code. Stupid unicode 🔊 emojii why are you such a pain in the butt! /rand over
17:03:18*Notkea quit (Remote host closed the connection)
17:06:25*Jesin quit (Quit: Leaving)
17:12:42*Jessin joined #nim
18:00:51FromGitter<brentp> I am not able to use c2nim with nim@devel
18:01:05FromGitter<brentp> error is: `/home/brentp/.nimble/pkgs/compiler-#53ce58f050247/compiler/ropes.nim(78, 29) Error: type mismatch: got <nil> but expected 'string'`
18:01:21FromGitter<brentp> when running `nimble install c2nim`
18:01:29leorizebrentp: you have to bump compiler version in c2nim
18:02:37FromGitter<brentp> you mean in c2nim.nimble? @leorize?
18:07:11FromGitter<brentp> seems to be working after changing requires to `"compiler#d34233b"`
18:07:13FromGitter<brentp> thanks.
18:12:13*couven92 quit (Read error: Connection reset by peer)
18:23:42*Jessin is now known as Jesin
18:36:55*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
18:44:12FromGitter<arnetheduck> @Araq, thanks.. `fooTask` actually
18:51:33*Notkea joined #nim
19:11:56*nsf joined #nim
19:15:37FromGitter<arnetheduck> @mratsim ok worked.. sounds like something to add to every nimble file we have
19:21:51FromGitter<brentp> anyone have or seen a nim package for doing t-tests?
19:44:25*smt` joined #nim
19:45:22FromGitter<Bennyelg> Hey All, I'm looking some package which draw csv like table to the stdout
19:45:24FromGitter<Bennyelg> anything
19:47:19*smt_ quit (Ping timeout: 244 seconds)
19:53:40PMunchstdout.write?
19:55:25FromGitter<Bennyelg> no I can do echo(row)
19:55:33FromGitter<Bennyelg> but I want to print it like table
19:56:13PMunchcsv is short for Comma Separated Values
19:56:18PMunchSo you want tabulation
19:57:00PMunchHave a look at align from strutils
19:57:22FromGitter<alehander42> You can just loop through the lines and align each column with its max length
19:57:27PMunchShould be simple enough to write a loop over your values that uses align to align it to a certain size
19:58:01FromGitter<Bennyelg> there is a built in align in strutils ?
19:58:52PMunchMhm
19:59:23FromGitter<Bennyelg> there is but I need to iterate over all the rows and seek the max length inorder to align
19:59:24FromGitter<Bennyelg> :/
20:00:35FromGitter<alehander42> well you would've written the function already in those 5 minutes
20:00:56FromGitter<Bennyelg> lol
20:00:57FromGitter<Bennyelg> maybe
20:01:28PMunchlet columns = [4,10,3,2]; for r in data: for i, c in r: stdout.write c.align(columns[i]); stdout.write("\n")
20:01:45PMunchThat would tabulate that data with the column widths 4, 10, 3, and 2
20:01:46FromGitter<alehander42> Well I thought you might know the max length for your columns
20:01:54PMunchAssuming no value is longer than that
20:02:04FromGitter<alehander42> But if you want a more general solution
20:02:15FromGitter<data-man> @Bennyelg: https://github.com/unicredit/csvtools + strformat
20:02:17FromGitter<alehander42> You would need to first find the max length indeed
20:03:13FromGitter<alehander42> Nice
20:03:34FromGitter<Bennyelg> @data-man I didn't understand how this is solve my issue
20:07:21FromGitter<data-man> @Bennyelg: Do you want to display any csv file or its structure specified in your app?
20:07:52FromGitter<Bennyelg> I want to display the csv in screen like it's table
20:08:02FromGitter<Bennyelg> I can solve this but it's not efficiant
20:09:38FromGitter<data-man> Attempt #2: Any csv file?
20:10:09FromGitter<Bennyelg> yes
20:16:01FromGitter<data-man> Then without two passes you can't get a beautiful table with optimal width. :)
20:16:20FromGitter<Bennyelg> Ik know
20:16:25FromGitter<Bennyelg> Thought maybe lol
20:18:39dom96Hey guys, what's up?
20:18:51FromGitter<Bennyelg> Supp dom
20:19:07FromGitter<Bennyelg> Didnt went up for a beer at the bar ? :D
20:19:11FromGitter<Bennyelg> its friday night
20:21:32PMunchNot much, fiddling with a project
20:21:38PMunchBut heading out for a beer soon
20:21:51FromGitter<Bennyelg> Nice
20:22:13FromGitter<Bennyelg> I am babysitting my baby so beer at home today
20:35:02dom96lol. I'm not the kind to be drinking in pubs on a Friday night :P
20:35:19FromGitter<Bennyelg> ;]
20:35:37PMunchNooo, I got the dreaded new Reddit design :(
20:37:25PMunchBy the way, fun fact: my city got awarded by TripAdvisor as the best travel location in Europe, third in the entire world
20:44:24FromGitter<zetashift> old.reddit.com isn't available anymore?
20:44:28FromGitter<zetashift> which city is it
20:44:50PMunchOh yeah it's available, but it used to default to it
20:44:53PMunchTromsø, Norway
20:45:27FromGitter<zetashift> never heard of it
20:45:58FromGitter<zetashift> Googling says it's famous for the northern lights
20:46:01FromGitter<zetashift> that's pretty dope
20:46:17PMunchYup
20:46:19FromGitter<zetashift> Going on-topic: just like the northern lights Nim is also pretty dope
20:46:29PMunchNice segue
20:46:58FromGitter<Bennyelg> var lengths: seq[int] = newSeqOfCapint (5) ⏎ not intiailize lengths to be @[0,0,0,0,0] ?
20:47:35PMunchnewSeq[int](5)
20:48:00FromGitter<Bennyelg> great
20:48:01FromGitter<Bennyelg> thanks
20:48:07PMunchCap is just used to set the backing memory to that size, it doesn't actually set the length of the sequence :)
20:51:16PMunchOh well, I'm off. Have fun
20:51:19*PMunch quit (Remote host closed the connection)
20:56:55*stefanos82 quit (Quit: Quitting for now...)
21:04:42*zachcarter joined #nim
21:04:45*zestyr joined #nim
21:06:25*seni quit (Quit: Leaving)
21:10:20zestyrHi, I've been using the telebot.nim library and noticed some weird memory/GC behavior. When sending a file of size 4MB, the memory usage quickly increases by 40-80 MB, and the GC frees about 20-30, leaving a bunch still occupied. That's not a huge issue in itself, but I can't seem to find a way to make the GC actually free the system memory. It may be marked as free, but the OS sees it as resident memory rather
21:10:22zestyrthan virtual memory. I've looked up documentation for the compiler and possible GC settings, but can't find anything related.
21:10:41FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b92e951f59e0c1555c53643]
21:10:50FromGitter<Bennyelg> looks pretty fine as a table right ? :D
21:17:08zestyrUsing 80MB of memory isn't too bad, but sending larger files of, say 30MB, can easily increase the res memory by an extra 3-400MB, which is shame since the bot uses around 8MB before sending large files.
21:24:42*miran quit (Ping timeout: 252 seconds)
21:24:55dom96zestyr: bug report on nim-lang/nim please
21:28:58zestyrwill do
21:34:50*kapil___ quit (Quit: Connection closed for inactivity)
21:38:54shashlickSounds similar to something I had submitted
21:39:45shashlickhttps://github.com/nim-lang/Nim/issues/6031
21:39:59shashlickSee Araq last comment
21:41:26shashlickWhat I did was to parse the file in chunks instead of loading the whole thing in memory
21:41:41shashlickHelps scale to huge files
21:41:53shashlickMay not apply to your use case but all the same
21:41:59*kadin joined #nim
21:47:55*Vladar quit (Remote host closed the connection)
21:50:00*cspar quit (Ping timeout: 252 seconds)
21:52:49*cspar joined #nim
21:57:04FromGitter<tim-st> zestyr: telebot uses `async`, async seems to leak: https://github.com/nim-lang/Nim/issues/5589
22:10:44*xet7 quit (Quit: Leaving)
22:42:02*Trustable quit (Remote host closed the connection)
22:51:04*cspar quit (Ping timeout: 240 seconds)
22:52:23*cspar joined #nim
22:58:34*nsf quit (Quit: WeeChat 2.2)
23:08:43*wildlander quit (Quit: Konversation terminated!)
23:41:18*cspar quit (Ping timeout: 252 seconds)
23:45:47*arecaceae quit (Remote host closed the connection)
23:46:05*arecaceae joined #nim