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:52 | vivus | hey all |
01:29:12 | vivus | how do I echo these items from my table into a line by line display: @[(name: "Lettuce", color: "Green")] ? |
01:36:21 | vivus | so I looped through and got each item, but now its showing as: (name: "Apple", color: "Red") |
01:42:01 | leorize | vivus: you're using tables module, right? |
01:42:15 | leorize | then you can use the `pairs` iterator |
01:43:57 | vivus | leorize: 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:17 | vivus | leorize: when do I use `pairs`? on the first for check? |
01:49:31 | leorize | what exactly are you trying to do? |
01:55:46 | * | leaf__ joined #nim |
01:57:13 | Tanger | vivus: 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:20 | FromDiscord | <Shield> is there a way to catch exception and recover from internet connection loss? |
02:04:24 | FromDiscord | <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:13 | leorize | if it's just an exception then you can try-catch |
02:05:24 | leorize | after that you just need to re-establish the connection |
02:16:58 | FromDiscord | <emekoi> what library are you using for your discord bot? |
02:20:34 | FromDiscord | <Shield> this one https://github.com/hlaaftana/pkpsgpsg |
02:21:53 | FromDiscord | <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:50 | FromDiscord | <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:42 | FromDiscord | <Shield> got it to work, still crashes on some cases but it's not bad, thanks for your time |
04:11:46 | ldlework | I forget does Nim have natural currying? |
04:11:54 | ldlework | let add x y = x + y |
04:12:01 | ldlework | let add10 = add 10 |
04:12:04 | ldlework | that kind of thing |
04:14:31 | Tanger | ldlework, https://rosettacode.org/wiki/Currying#Nim |
04:20:43 | FromGitter | <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:33 | FromGitter | <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:34 | FromGitter | ... 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:06 | FromGitter | <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:59 | FromGitter | <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:45 | FromGitter | <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:27 | FromGitter | <mratsim> @codem4ster well you need to vote on that: https://github.com/nim-lang/Nim/issues/6537 ;) |
07:09:47 | FromGitter | <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:34 | TheLemonMan | Araq, what's the reason behind the different "scopes" for procs/templates/macros ? |
07:23:30 | FromGitter | <Araq> what do you mean? |
07:24:30 | TheLemonMan | mainly the fact you can have a proc and a template and a macro with the same name |
07:24:56 | FromGitter | <Araq> that's just ordinary overloading |
07:25:32 | FromGitter | <Araq> the fact that it tends to not work well is because of `untyped` limitations |
07:26:16 | TheLemonMan | a very ad-hoc kind of overloading I'd say |
07:27:35 | FromGitter | <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:22 | FromGitter | <Araq> and overloading is ad-hoc in Nim already. |
07:38:50 | FromGitter | <Araq> https://github.com/nim-lang/Nim/issues/8901 yay or nay? |
07:44:46 | * | xet7 joined #nim |
07:52:34 | FromGitter | <narimiran> in that example, `splitLines` proc would cease to exist? |
07:52:45 | FromGitter | <Araq> yeah |
07:53:24 | FromGitter | <Araq> it implies a stdlib update |
07:54:34 | FromGitter | <narimiran> ...and all other procs that have the same name as iterators (for strutils that is: split, splitWhitespace, rsplit and splitlines) |
07:54:46 | FromGitter | <narimiran> wouldn't that cause really a lot of breaking? |
07:54:59 | FromGitter | <Araq> yes, strutils seems to be the biggest offender here |
07:55:32 | FromGitter | <Araq> well the new strings break tons of stuff, there would be an ``--oldIters:on`` switch for migration |
07:55:49 | FromGitter | <Araq> just like we have ``--laxStrings:on`` and ``--nilSeqs:on`` |
07:56:01 | FromGitter | <narimiran> ok, maybe i should copy-paste this to github, just to make it more permanent/visible |
07:56:38 | FromGitter | <Araq> but ``--version=0.18`` is a good idea |
07:57:01 | FromGitter | <Araq> these ``--version`` switches would collect the feature switches |
07:57:40 | FromGitter | <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:07 | FromGitter | <Araq> yeah but that's the big elephant in the room |
07:58:43 | FromGitter | <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:12 | FromGitter | <Araq> and clang/gcc have "C++ dialect" switches, Rust got the same iirc |
08:02:16 | FromGitter | <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:40 | FromGitter | <narimiran> btw, how far away is v0.19? |
08:03:25 | * | leorize joined #nim |
08:03:33 | * | gmpreussner quit (Quit: kthxbye) |
08:03:35 | FromGitter | <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:33 | FromGitter | <mratsim> what is a super orthogonal language? |
08:25:16 | FromGitter | <Araq> Nim. |
08:25:22 | TheLemonMan | Araq, I've blindly copied the weird newStmtList assignment from asyncmacro, I think we have the same problem there |
08:25:47 | TheLemonMan | it's interesting how nobody noticed that :) |
08:25:51 | FromGitter | <mratsim> and yeah the iterator namespace change is good, I always found that confusing |
08:26:56 | FromGitter | <Araq> more seriously, it's a language where syntax and semantics are decoupled to a great extend. Lisp also qualifies |
08:32:04 | FromGitter | <bung87> does `dques` module equal to `heapq` in python? |
08:32:40 | TheLemonMan | bung87, there's heapqueue for that |
08:33:32 | FromGitter | <bung87> where to get it? |
08:33:40 | FromGitter | <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:55 | FromGitter | <mratsim> it had a poor name at first |
08:35:47 | TheLemonMan | bung87, collections/heapqueue |
08:36:11 | TheLemonMan | bung87, https://nim-lang.org/docs/heapqueue.html#HeapQueue |
08:37:00 | FromGitter | <bung87> thanks ! :) |
08:38:16 | FromGitter | <Araq> @mratsim yay |
08:51:00 | FromGitter | <Araq> @mratsim: workaround ` h = T(1e-5)` for the default param |
08:52:17 | FromGitter | <mratsim> ah it’s the defaut param that is breaking? |
08:52:28 | FromGitter | <Araq> yeah |
08:52:45 | FromGitter | <mratsim> so I can just use overloading |
08:52:47 | FromGitter | <Araq> and default parameter handling was changed by Zahary's commit |
08:52:52 | FromGitter | <mratsim> not that breaking then |
08:53:00 | FromGitter | <Araq> no, you don't have to use overloading either |
08:53:02 | FromGitter | <mratsim> yeah it was to solve static + default param issue iirc |
08:53:17 | FromGitter | <Araq> you only need to write your default parameter without the dot syntax |
08:53:23 | FromGitter | <mratsim> ok |
08:53:28 | FromGitter | <Araq> and don't ask me why :-) |
08:53:48 | FromGitter | <Araq> the stack trace mentions `tryResolvingStaticExpr`, lovely |
08:54:24 | FromGitter | <Araq> and of course this "try" doesn't require any recursion checks, code is always perfect |
08:54:40 | FromGitter | <Araq> I hate recursion :-) |
08:54:47 | FromGitter | <mratsim> I really wonder how come static had so many issues and how they do it in other languages |
08:55:15 | FromGitter | <Araq> yeah, to all you FP lovers out there, I said it, recursion sucks. |
08:55:52 | * | SenasOzys joined #nim |
08:56:04 | FromGitter | <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:52 | FromGitter | <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:45 | FromGitter | <Araq> and with far-from-obvious termination criteria and explosive runtime big-O characteristics |
08:57:49 | * | SenasOzys joined #nim |
08:58:17 | FromGitter | <Araq> recursion needs to be tamed. |
08:59:02 | FromGitter | <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:47 | FromGitter | <mratsim> deallocates* |
09:00:14 | FromGitter | <Araq> using a stack/queue instead for mutually recursive code is hard. and they do deallocate. |
09:00:22 | FromGitter | <alehander42> well it shouldn't be hard to detect mutual recursion , it's a cycle in static calltraph |
09:00:55 | FromGitter | <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:13 | FromGitter | <Araq> s/problems/features |
09:01:18 | FromGitter | <alehander42> But if you want to discard the cases where a condition prevents it , that necessary very hard indeed |
09:01:49 | TheLemonMan | it's not that easy when you take into account indirect calls |
09:01:50 | FromGitter | <Araq> @alehander42 function pointers mean you usually don't have a static callgraph |
09:03:57 | FromGitter | <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:03 | FromGitter | <alehander42> @Araq well that's why generally you need a runtime calltraph |
09:05:31 | FromGitter | <alehander42> Applied to a run with good branch coverage |
09:05:56 | FromGitter | <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:32 | FromGitter | <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:36 | FromGitter | <alehander42> that's too big of a Lang limitation I think |
09:06:40 | * | SenasOzys quit (Remote host closed the connection) |
09:08:41 | FromGitter | <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:47 | FromGitter | <alehander42> but honestly you can't go without mutual recursion, e.g. how would you analyze trees |
09:09:15 | FromGitter | <Araq> you map the tree to a string, see packedJson :-) |
09:09:32 | FromGitter | <alehander42> you can't have that visitNode calling other stuff calling visitNode |
09:09:40 | FromGitter | <mratsim> I think string should be removed from all programming languages /s |
09:10:06 | FromGitter | <Araq> @mratsim I lost the code for mine, but I used node Ids and a single IntSet |
09:10:40 | FromGitter | <Araq> there is an edge between (a, b) if (a*b) is in the set |
09:11:57 | FromGitter | <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:16 | FromGitter | <Araq> that's the standard for interpreters, Nim's VM does the same |
09:12:28 | FromGitter | <alehander42> Compared to the python VM which opened a new eval contest recursively |
09:12:39 | FromGitter | <Araq> Python calls it a "stackless" implementation, but seriously |
09:12:54 | FromGitter | <Araq> if your interpreter calls itself recursively, you throw it away. |
09:15:45 | FromGitter | <alehander42> *throws all my interpreters away* |
09:15:58 | FromGitter | <Araq> sorry :-) |
09:16:18 | FromGitter | <alehander42> *also my Englishr Grammar* |
09:16:41 | FromGitter | <alehander42> nah I think I stopped doing them a while ago |
09:17:00 | FromGitter | <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:27 | FromGitter | <mratsim> Are there interpreter without a stack? Even register VM all have a stack no? |
09:17:28 | FromGitter | <alehander42> nowadays generating code or low level ops seems simpler (for a toy language ) |
09:17:58 | FromGitter | <Araq> @mratsim yeah but they don't use the hardware/C stack for it |
09:18:15 | FromGitter | <Araq> also GPUs don't have stacks :-) |
09:18:50 | FromGitter | <Araq> I know, it's "Just like C", but braces aside, it's really completely different |
09:19:14 | FromGitter | <mratsim> actually I think they have |
09:19:24 | FromGitter | <mratsim> OpenCL uses enqueue_read_buffer |
09:19:46 | FromGitter | <mratsim> and CUDA uses for example cuda_copy_async |
09:19:57 | FromGitter | <mratsim> or maybe the queue/stack is in the driver |
09:21:03 | FromGitter | <Araq> https://computergraphics.stackexchange.com/questions/367/why-is-recursion-forbidden-in-opencl |
09:23:31 | FromGitter | <mratsim> What is newSlice? https://github.com/nim-lang/Nim/issues/8901#issuecomment-419369746, similar to toOpenArray? no-copy slicing if possible? |
09:24:26 | FromGitter | <Araq> `..` constructs the slice/iterval, but there is also an iterator named `..` |
09:27:29 | FromGitter | <Araq> you can do `let x = 4..6; for i in x: echo i` |
09:28:00 | FromGitter | <Araq> because somebody came along and screamed the C-word |
09:28:18 | * | seni joined #nim |
09:28:33 | FromGitter | <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:59 | FromGitter | <Araq> https://stackoverflow.com/questions/3644809/does-cuda-support-recursion |
09:34:47 | tzekid | Hey, I've got the following code snippet: |
09:34:51 | tzekid | proc map[T](self: seq[T], f: proc(x:T): T, temp:seq[T] = @[]): seq[T] = self |
09:34:54 | tzekid | discard ArrayToCompute.map do (x:int)->int: x*x |
09:35:17 | tzekid | Which, when trying to compile gives: `execution of an external program failed:` |
09:35:38 | leorize | it's better if you could provide a paste instead |
09:35:46 | leorize | use services like ix.io or ptpb.pw |
09:37:07 | tzekid | ok |
09:37:18 | * | stefanos82 joined #nim |
09:37:46 | tzekid | here's the paste: https://ptpb.pw/YEND |
09:38:37 | tzekid | I'm trying to learn functional paradigms by implementing them and I wanted to use nim's `do` syntax |
09:38:49 | leorize | can you provide the entire compile log? |
09:38:54 | leorize | it's working for me |
09:40:19 | tzekid | https://ptpb.pw/arS5 |
09:40:23 | FromGitter | <mratsim> why is there a self at the end? |
09:40:23 | tzekid | Hmmm |
09:40:52 | tzekid | to return the array - I've simplified the proc |
09:41:32 | FromGitter | <mratsim> there is = self and then on the following line your discard proc |
09:42:11 | leorize | tzekid: what's your Nim version? |
09:42:21 | FromGitter | <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:37 | FromGitter | <mratsim> Note that I did that when I was a Nim newbie. |
09:42:47 | tzekid | mratsim: I've simplified the example to the core. These two lines don't compile for me |
09:43:04 | tzekid | mratsim: Nim Compiler Version 0.18.0 |
09:43:13 | tzekid | on Archlinux x64 |
09:43:29 | tzekid | mratsim: Thanks for the examples :D |
09:44:23 | leorize | no problem on devel, must be a 0.18.0 bug |
09:46:57 | tzekid | leorize: Hmmm... can be. I get the same result in jdoodle @> jdoodle.com/execute-nim-online |
09:47:04 | tzekid | gonna try it out on dev |
09:47:16 | leorize | there's nim-git on AUR :) |
09:56:24 | tzekid | Thanks! It works on dev :D |
10:03:13 | FromGitter | <Araq> btw can I register a travis project that gets rebuild whenever nim-lang/Nim changes? |
10:09:57 | FromGitter | <bung87> it's default travis's behaviour,doesn't it? |
10:13:58 | FromGitter | <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:24 | FromGitter | <Clyybber> Are converters inlined automatically? |
11:30:23 | Araq | no |
11:42:36 | * | leorize quit (Quit: WeeChat 2.2) |
11:59:42 | FromGitter | <Clyybber> Is there a type that is an alias for all types? |
12:01:06 | Araq | unclear. |
12:01:14 | FromGitter | <bung87> `newHeapQueueEvent[TArg ()` ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b92688ad457a1406cb363a7] |
12:01:37 | FromGitter | <Clyybber> @Araq Ah, nevermind, what I was looking for whas `Any` |
12:02:15 | FromGitter | <bung87> `self.queue = newHeapQueueEvent[TArg ()` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9268c7cff55e5617be60d0] |
12:02:24 | FromGitter | <codenoid> hi @Araq |
12:03:01 | FromGitter | <mratsim> @bung87 seems like a bug in HeapQueue if the constructor creates a seq :? |
12:04:22 | FromGitter | <bung87> `HeapQueue[T] = distinct seq[T]` I see the type defined as this |
12:04:53 | FromGitter | <mratsim> newHeapQueue isn’t converting the seq to it’s distinct type then. |
12:05:02 | FromGitter | <mratsim> or there is a bug introduced in the library |
12:05:10 | FromGitter | <mratsim> are you on devel or stable? |
12:05:43 | FromGitter | <Araq> hi @codenoid |
12:05:57 | FromGitter | <bung87> devel , 0.18.1, git hash: 4aba2981dd47672744191bd17b39bb149f494637 |
12:08:52 | FromGitter | <bung87> Commits on Sep 4, 2018 |
12:08:59 | * | kapil___ quit (Quit: Connection closed for inactivity) |
12:10:00 | FromGitter | <mratsim> can you try on stable |
12:10:11 | FromGitter | <mratsim> there might be a regression on distinct types |
12:11:18 | FromGitter | <bung87> same error `Error: type mismatch: got <seq[Event[system.string]]> but expected 'HeapQueue[Event[system.string]]'` |
12:12:59 | FromGitter | <Clyybber> @Araq Does {.reorder.} put all `converter`s to the top? |
12:15:28 | FromGitter | <alehander42> does {.new order.} put blue Monday on repeat? |
12:16:19 | FromGitter | <mratsim> blue monday? |
12:16:31 | FromGitter | <Clyybber> https://www.youtube.com/watch?v=FYH8DsU2WCk |
12:16:44 | FromGitter | <Clyybber> @alehander42 I do :D |
12:16:58 | FromGitter | <alehander42> a legendary vinyl single |
12:17:12 | FromGitter | <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:46 | FromGitter | <mratsim> use a script to nimble develop? |
12:18:52 | FromGitter | <Grabli66> I thought about it. But maybe there is a better way? :) |
12:21:33 | FromGitter | <Grabli66> Every who will want to work with that repository have to to launch that script |
12:22:19 | FromGitter | <Clyybber> Do you have all the local nimble packages in one repo? |
12:24:30 | FromGitter | <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:01 | FromGitter | <mratsim> lolwut |
12:25:02 | FromGitter | <Grabli66> @Clyybber , yes |
12:25:15 | FromGitter | <Clyybber> @Vindaar Thats wierd |
12:25:24 | FromGitter | <mratsim> @bung87 can you raise a ticket on that, I think that’s another showstopper for @Araq |
12:25:48 | FromGitter | <Vindaar> the name change was accidental of course :D |
12:26:05 | FromGitter | <Clyybber> @Grabli66 Maybe you can use paths in `.nimble` `require`? |
12:27:36 | FromGitter | <Clyybber> @mratsim @Araq Is that normal: |
12:27:52 | FromGitter | <bung87> @Vindaar yeah , rewrites to that it passed. |
12:28:12 | FromGitter | <Clyybber> `````` |
12:28:35 | FromGitter | <Clyybber> Shouldn't `any` accept anything? |
12:28:42 | FromGitter | <bung87> @mratsim you mean open a issue on github ? I'd like to |
12:29:35 | FromGitter | <Clyybber> @bung87 If you do, could you include @Vindaar 's snippet? |
12:30:53 | FromGitter | <bung87> yeah . |
12:31:25 | FromGitter | <mratsim> @Clyybber I never managed to use Any tbh :P |
12:31:40 | FromGitter | <Clyybber> Oh ok :D |
12:32:02 | FromGitter | <mratsim> use generics with an unspecified T was always enough |
12:32:06 | FromGitter | <Clyybber> @mratsim Did you use auto, it should basically be the same AFAIK |
12:32:34 | FromGitter | <mratsim> I do use auto to cheat on nested sequences |
12:33:33 | FromGitter | <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:20 | FromGitter | <mratsim> @Clyybber here is my auto PR that got rejected: https://github.com/nim-lang/Nim/pull/6807 |
12:35:50 | FromGitter | <Clyybber> Ooh a recursive iterator, nice |
12:36:52 | FromGitter | <Clyybber> Oh, wait that isn't supported? |
12:49:49 | FromGitter | <mratsim> it is, it works |
12:50:27 | FromGitter | <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:37 | FromGitter | <Clyybber> Hmm |
13:10:37 | Araq | it's not "kind of polymorphic", it's illtyped |
13:12:25 | * | endragor quit (Remote host closed the connection) |
13:22:53 | FromGitter | <Clyybber> @Araq This snippet fails: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927badc2bd5d117a31eadf] |
13:23:32 | FromGitter | <Araq> does it work without the 'auto'? |
13:24:32 | FromGitter | <Clyybber> This works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927c10cff55e5617bee21e] |
13:25:27 | FromGitter | <Araq> well I don't think this needs to work, 'auto' is not subject to a unification type inference algorithm |
13:26:01 | FromGitter | <Clyybber> Hmm, ok. It crashes the compiler though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927c69f86b741b05222504] |
13:30:03 | FromGitter | <Clyybber> Hmm, ok. It crashes the compiler though: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b927d5b11227d711d2c227f] |
13:34:26 | TheLemonMan | do `static` blocks outside of toplevel make any sense? |
13:36:46 | FromGitter | <Clyybber> Why not? |
13:37:54 | TheLemonMan | you 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:06 | FromGitter | <Clyybber> Why not? |
13:39:10 | FromGitter | <Clyybber> :P |
13:42:01 | * | endragor joined #nim |
13:42:39 | FromGitter | <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:44 | TheLemonMan | oh they make a lot of sense with generics, I'm dumb |
13:49:56 | * | nif quit (Quit: ...) |
13:56:33 | FromGitter | <ephja> I do hope that nothing *should* crash the compiler :p |
13:57:21 | TheLemonMan | better to have it crash and burn than to have it silently produce garbage |
13:57:45 | Araq | well a real error message is not too much to ask for |
14:01:08 | TheLemonMan | bung87, can you provide a self-contained reproducer for #8905 ? |
14:03:08 | FromGitter | <bung87> @FromIRC TheLemonMan yeah, a later |
14:03:13 | FromGitter | <Vindaar> TheLemonMan: added one |
14:03:36 | * | SenasOzys quit (Ping timeout: 252 seconds) |
14:03:42 | FromGitter | <bung87> nice |
14:03:50 | TheLemonMan | nice |
14:06:11 | FromGitter | <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:18 | FromGitter | <bung87> strutils |
14:08:34 | TheLemonMan | `nim secret` is pretty damn awesome |
14:08:47 | * | SenasOzys joined #nim |
14:09:57 | FromGitter | <tim-st> @bung87 `import strutils; echo "abc%sghi" % "def"` doesnt work as pythons |
14:10:40 | Araq | import strformat |
14:10:45 | Araq | and read some docs |
14:10:48 | FromGitter | <bung87> placeholder not %s |
14:11:34 | FromGitter | <tim-st> I already tried `import strformat; echo "abc%sghi" % "def"`this gives `undeclared identifier` |
14:12:26 | Araq | https://nim-lang.org/docs/strformat.html |
14:12:45 | Araq | https://nim-lang.org/docs/strutils.html#%,string,openArray[string] |
14:13:04 | Araq | "$1 eats $2." % ["The cat", "fish"] |
14:13:41 | FromGitter | <bung87> `"$# eats $#." % ["The cat", "fish"]` |
14:14:10 | FromGitter | <tim-st> ok, thanks, that's nearly what I wanted, though `"%s eats %s." % ("The cat", "fish")` would be better imo |
14:14:49 | Araq | and once you learned Nim you will notice that it would be worse |
14:15:04 | FromGitter | <Vindaar> +1 for Nim's syntax |
14:15:46 | FromGitter | <tim-st> In python I can use int where `%s` in nim it doesnt work: `echo "$# eats $#." % ["The cat", 1]` |
14:16:22 | FromGitter | <tim-st> would be really good to have a proc like `echo` that takes all and converts to string |
14:18:08 | FromGitter | <ephja> well, did you look at strformat? there's also this https://nim-lang.org/docs/strutils.html#format,string,varargs[string,] |
14:18:43 | FromGitter | <ephja> these dang URLs with markdown |
14:19:23 | Araq | yeah, working on it... |
14:20:08 | FromGitter | <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:35 | FromGitter | <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:04 | Araq | or maybe use strformat |
14:38:41 | Araq | decoupling the placeholders from the expressions doesn't scale well anyway |
14:38:58 | Araq | that's why Python got f-strings too. |
14:39:38 | FromGitter | <tim-st> I always used pythons `%s` way and I saw many others too, I dont really like the thing with `{varName}` |
14:40:38 | FromGitter | <mratsim> import strutils and use `%` from it |
14:40:51 | FromGitter | <tim-st> look above, that doesnt work for mixed types |
14:41:07 | FromGitter | <mratsim> convert them and use an array of strings |
14:41:14 | FromGitter | <tim-st> ^^ |
14:41:17 | FromGitter | <mratsim> they would have to be converted to string anyway |
14:41:22 | FromGitter | <tim-st> sure |
14:41:49 | Araq | strutils.format("$#, $#", 34, "should work") |
14:42:12 | * | floppydh quit (Quit: WeeChat 2.2) |
14:42:47 | FromGitter | <tim-st> yes, thanks, that's ok |
14:43:27 | Araq | good thing Nim has 3 different ways to do the format then |
14:43:30 | Araq | :-/ |
14:44:11 | FromGitter | <tim-st> Even better then my current way using `&` and concatenate everything :\ |
14:46:52 | * | TheLemonMan joined #nim |
14:48:01 | TheLemonMan | bung87, give me a few mins and I'll push a fix for #8905 |
14:53:33 | FromGitter | <bung87> ok , I've done my work through @Vindaar 's solution |
14:55:55 | * | wildlander joined #nim |
14:56:09 | FromGitter | <bung87> the `withRLock(self.L):` can't break outter loop is designed behavior ? |
14:57:29 | FromGitter | <bung87> from the block inside. |
15:09:49 | TheLemonMan | Araq, where do we place tests for stdlib pieces? in the implementation file? |
15:14:10 | * | miran joined #nim |
15:21:48 | FromGitter | <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:32 | FromGitter | <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:49 | Araq | TheLemonMan, yeah or in tests/stdlib |
15:35:53 | Araq | it doesn't really matter |
15:47:47 | FromGitter | <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:06 | FromGitter | <tim-st> (threadvar when I want to access a global) |
16:01:30 | * | Trustable joined #nim |
16:02:49 | FromGitter | <ephja> why not enable threads by default? |
16:03:25 | FromGitter | <arnetheduck> what's the best way to run `nimble test` with release mode flags (optimization turned on)? @dom96 |
16:05:55 | FromGitter | <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:38 | FromGitter | <tim-st> all those "async http servers" have static string "Hello World" examples, irl people want to serv dynamic shared |
16:08:35 | TheLemonMan | of course Nim can do it just fine, the real question is: can you? :) |
16:11:53 | * | PMunch joined #nim |
16:12:25 | FromGitter | <mratsim> @arnetheduck switch(“define”, “release”) |
16:20:10 | FromGitter | <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:57 | FromGitter | <arnetheduck> @mratsim what about one-off? ie from command line |
16:27:19 | FromGitter | <mratsim> create a test_release task |
16:27:32 | FromGitter | <arnetheduck> and without a task? |
16:27:36 | FromGitter | <mratsim> I’m not sure nimble pass the flags properly |
16:28:16 | FromGitter | <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:03 | Araq | yeah, a 'task foo' is turned into a proc taskFoo iirc |
16:33:18 | Araq | so 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:27 | FromDiscord | <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:51 | FromGitter | <brentp> I am not able to use c2nim with nim@devel |
18:01:05 | FromGitter | <brentp> error is: `/home/brentp/.nimble/pkgs/compiler-#53ce58f050247/compiler/ropes.nim(78, 29) Error: type mismatch: got <nil> but expected 'string'` |
18:01:21 | FromGitter | <brentp> when running `nimble install c2nim` |
18:01:29 | leorize | brentp: you have to bump compiler version in c2nim |
18:02:37 | FromGitter | <brentp> you mean in c2nim.nimble? @leorize? |
18:07:11 | FromGitter | <brentp> seems to be working after changing requires to `"compiler#d34233b"` |
18:07:13 | FromGitter | <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:12 | FromGitter | <arnetheduck> @Araq, thanks.. `fooTask` actually |
18:51:33 | * | Notkea joined #nim |
19:11:56 | * | nsf joined #nim |
19:15:37 | FromGitter | <arnetheduck> @mratsim ok worked.. sounds like something to add to every nimble file we have |
19:21:51 | FromGitter | <brentp> anyone have or seen a nim package for doing t-tests? |
19:44:25 | * | smt` joined #nim |
19:45:22 | FromGitter | <Bennyelg> Hey All, I'm looking some package which draw csv like table to the stdout |
19:45:24 | FromGitter | <Bennyelg> anything |
19:47:19 | * | smt_ quit (Ping timeout: 244 seconds) |
19:53:40 | PMunch | stdout.write? |
19:55:25 | FromGitter | <Bennyelg> no I can do echo(row) |
19:55:33 | FromGitter | <Bennyelg> but I want to print it like table |
19:56:13 | PMunch | csv is short for Comma Separated Values |
19:56:18 | PMunch | So you want tabulation |
19:57:00 | PMunch | Have a look at align from strutils |
19:57:22 | FromGitter | <alehander42> You can just loop through the lines and align each column with its max length |
19:57:27 | PMunch | Should be simple enough to write a loop over your values that uses align to align it to a certain size |
19:58:01 | FromGitter | <Bennyelg> there is a built in align in strutils ? |
19:58:52 | PMunch | Mhm |
19:59:23 | FromGitter | <Bennyelg> there is but I need to iterate over all the rows and seek the max length inorder to align |
19:59:24 | FromGitter | <Bennyelg> :/ |
20:00:35 | FromGitter | <alehander42> well you would've written the function already in those 5 minutes |
20:00:56 | FromGitter | <Bennyelg> lol |
20:00:57 | FromGitter | <Bennyelg> maybe |
20:01:28 | PMunch | let 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:45 | PMunch | That would tabulate that data with the column widths 4, 10, 3, and 2 |
20:01:46 | FromGitter | <alehander42> Well I thought you might know the max length for your columns |
20:01:54 | PMunch | Assuming no value is longer than that |
20:02:04 | FromGitter | <alehander42> But if you want a more general solution |
20:02:15 | FromGitter | <data-man> @Bennyelg: https://github.com/unicredit/csvtools + strformat |
20:02:17 | FromGitter | <alehander42> You would need to first find the max length indeed |
20:03:13 | FromGitter | <alehander42> Nice |
20:03:34 | FromGitter | <Bennyelg> @data-man I didn't understand how this is solve my issue |
20:07:21 | FromGitter | <data-man> @Bennyelg: Do you want to display any csv file or its structure specified in your app? |
20:07:52 | FromGitter | <Bennyelg> I want to display the csv in screen like it's table |
20:08:02 | FromGitter | <Bennyelg> I can solve this but it's not efficiant |
20:09:38 | FromGitter | <data-man> Attempt #2: Any csv file? |
20:10:09 | FromGitter | <Bennyelg> yes |
20:16:01 | FromGitter | <data-man> Then without two passes you can't get a beautiful table with optimal width. :) |
20:16:20 | FromGitter | <Bennyelg> Ik know |
20:16:25 | FromGitter | <Bennyelg> Thought maybe lol |
20:18:39 | dom96 | Hey guys, what's up? |
20:18:51 | FromGitter | <Bennyelg> Supp dom |
20:19:07 | FromGitter | <Bennyelg> Didnt went up for a beer at the bar ? :D |
20:19:11 | FromGitter | <Bennyelg> its friday night |
20:21:32 | PMunch | Not much, fiddling with a project |
20:21:38 | PMunch | But heading out for a beer soon |
20:21:51 | FromGitter | <Bennyelg> Nice |
20:22:13 | FromGitter | <Bennyelg> I am babysitting my baby so beer at home today |
20:35:02 | dom96 | lol. I'm not the kind to be drinking in pubs on a Friday night :P |
20:35:19 | FromGitter | <Bennyelg> ;] |
20:35:37 | PMunch | Nooo, I got the dreaded new Reddit design :( |
20:37:25 | PMunch | By the way, fun fact: my city got awarded by TripAdvisor as the best travel location in Europe, third in the entire world |
20:44:24 | FromGitter | <zetashift> old.reddit.com isn't available anymore? |
20:44:28 | FromGitter | <zetashift> which city is it |
20:44:50 | PMunch | Oh yeah it's available, but it used to default to it |
20:44:53 | PMunch | Tromsø, Norway |
20:45:27 | FromGitter | <zetashift> never heard of it |
20:45:58 | FromGitter | <zetashift> Googling says it's famous for the northern lights |
20:46:01 | FromGitter | <zetashift> that's pretty dope |
20:46:17 | PMunch | Yup |
20:46:19 | FromGitter | <zetashift> Going on-topic: just like the northern lights Nim is also pretty dope |
20:46:29 | PMunch | Nice segue |
20:46:58 | FromGitter | <Bennyelg> var lengths: seq[int] = newSeqOfCapint (5) ⏎ not intiailize lengths to be @[0,0,0,0,0] ? |
20:47:35 | PMunch | newSeq[int](5) |
20:48:00 | FromGitter | <Bennyelg> great |
20:48:01 | FromGitter | <Bennyelg> thanks |
20:48:07 | PMunch | Cap is just used to set the backing memory to that size, it doesn't actually set the length of the sequence :) |
20:51:16 | PMunch | Oh 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:20 | zestyr | Hi, 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:22 | zestyr | than virtual memory. I've looked up documentation for the compiler and possible GC settings, but can't find anything related. |
21:10:41 | FromGitter | <Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b92e951f59e0c1555c53643] |
21:10:50 | FromGitter | <Bennyelg> looks pretty fine as a table right ? :D |
21:17:08 | zestyr | Using 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:55 | dom96 | zestyr: bug report on nim-lang/nim please |
21:28:58 | zestyr | will do |
21:34:50 | * | kapil___ quit (Quit: Connection closed for inactivity) |
21:38:54 | shashlick | Sounds similar to something I had submitted |
21:39:45 | shashlick | https://github.com/nim-lang/Nim/issues/6031 |
21:39:59 | shashlick | See Araq last comment |
21:41:26 | shashlick | What I did was to parse the file in chunks instead of loading the whole thing in memory |
21:41:41 | shashlick | Helps scale to huge files |
21:41:53 | shashlick | May 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:04 | FromGitter | <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 |