<< 08-07-2020 >>

00:04:09*Senketsu quit (Ping timeout: 272 seconds)
00:04:10FromGitter<Knaque> Ah, I see now. Thanks.
00:06:14FromDiscord<Recruit_main707> Is the guy of raylib forever in the server?
00:24:29FromDiscord<Zachary Carter> who is the guy of raylib
00:29:43FromDiscord<Zed> https://github.com/Guevara-chan/Raylib-Forever
00:29:48FromDiscord<Zed> this @Recruit_main707 ?
00:36:53FromDiscord<Zachary Carter> ah
00:40:37*audiophile quit (Quit: Default Quit Message)
00:49:34dadadaanything in stdnim that executes a process and calls a afterProc as soon as the process is done?
00:51:29FromDiscord<Elegant Beef> The execProcesses does if you mean system procs
00:51:52FromDiscord<Elegant Beef> But with a single process it waits no?
01:01:12*endragor joined #nim
01:04:54*thomasross quit (Ping timeout: 240 seconds)
01:32:22*oddp quit (Ping timeout: 256 seconds)
01:37:05*Tlanger joined #nim
01:39:49*Tongir quit (Ping timeout: 264 seconds)
01:40:25*chemist69 quit (Ping timeout: 272 seconds)
01:41:58*chemist69 joined #nim
02:12:31FromDiscord<Varriount> @Zachary Carter How would you recommend using NPeg with binary data?
02:13:09FromDiscord<Varriount> I'm wondering if it's feasible to parse exe/DLLs with it.
02:14:31FromDiscord<Zachary Carter> I'm not really sure...
02:18:28FromDiscord<Zachary Carter> maybe something like this would help - http://blog.paracode.com/2013/04/24/parsing-binary-data-with-node-dot-js/ ?
02:18:52FromDiscord<Zachary Carter> although they're not using PEGs but some nodejs library. I would expect though that you could just adapt this example to use PEGs instead
02:19:14FromDiscord<Zachary Carter> I've only used PEGs once and it was a while ago... I need to spend more time with npeg
02:21:16*sagax quit (Quit: Konversation terminated!)
02:21:59FromDiscord<Zachary Carter> I think I've used https://github.com/PMunch/binaryparse before
02:30:27*muffindrake quit (Ping timeout: 272 seconds)
02:32:10*muffindrake joined #nim
02:41:39*vr0n quit (Ping timeout: 256 seconds)
02:44:33leorize!package nesm
02:44:34disbotdisruptek hung like rhinocerous🦏
02:44:43leorizelol
02:51:36shashlick@leorize - got isLoaded() working
02:51:58shashlickgot time for a review?
02:53:34leorize[m]sure
02:54:08*rockcavera quit (Remote host closed the connection)
03:01:22shashlickokay creating a branch
03:07:51shashlick@leorize - https://github.com/genotrance/lazylib/compare/isloaded
03:16:02leorizewhy is ProcInfo a ref object?
03:16:41shashlicklets just say i didn't know how to add a new entry to the table
03:16:58shashlickProcInfo() i guess
03:17:09leorizetable.add key, ProcInfo()
03:17:16leorizewhy TableRef though?
03:18:51shashlickno special reason - just used to using refs but for one instance, no good reason
03:20:30shashlickchanging as we go, keep it coming
03:22:02shashlickremoved all refs
03:26:22leorizeI think this is pretty much as good as it gets
03:26:33leorizeyou might want to hide some symbols, like lazyRegister away though
03:26:48leorizebindSym them when you need them
03:26:49shashlickI thought of that
03:27:08shashlickBut they are in the caller's code
03:27:16shashlickIt has to be exported no?
03:27:26leorizebindSym helps you with that
03:27:41leorizeit bound the symbol in the macro scope
03:27:50shashlickI see, makes sense
03:27:57shashlickThen none of these need to be exported
03:28:07shashlickJust the pragma and isLoaded
03:28:47*vr0n joined #nim
03:36:02*nkoz quit (Ping timeout: 272 seconds)
03:40:29shashlick@interesting - i hid all the implementation symbols - it still works without bindSym
03:40:37shashlick@leorize ^^
03:42:55shashlickI guess you don't need to bindsym stuff already in the same module, only stuff that's imported from another module
03:49:32*sagax joined #nim
04:03:38*leorize quit (Quit: WeeChat 2.8)
04:06:01*supakeen quit (Quit: WeeChat 2.8)
04:06:42*supakeen joined #nim
04:15:50*marnix_ quit (Ping timeout: 260 seconds)
04:19:12shashlicki've done the libCandidate fix as well - basically the first handle of a lib will always be reused even if it is older
04:22:48shashlickso if a user does `lazylib: "libz.so.1"` in one place and then in another place they have `lazylib: "libz.so(.2|.1)"`, it will load libz.so.1 only if first one compiled first but if second one got compiled first, it will load .2 and .1
04:23:05shashlicki don't see any easy way to make sure only one libz gets loaded if it is done that way
04:28:21shashlick@leorize - have merged isloaded and bumped to v0.3.0
04:28:30shashlickalso, candidates implementation is here - https://github.com/genotrance/lazylib/compare/candidates
04:28:35shashlickptal and let me know what you think
04:32:45*nsf joined #nim
04:37:26*marnix joined #nim
04:44:01*Tongir joined #nim
04:46:53*Tlanger quit (Ping timeout: 256 seconds)
04:47:30*Tlongir joined #nim
04:48:11*Tlongir is now known as Tanger
04:49:25*Tongir quit (Ping timeout: 264 seconds)
05:08:05*Tongir joined #nim
05:11:01*Tanger quit (Ping timeout: 264 seconds)
05:13:38*narimiran joined #nim
05:14:49FromGitter<Knaque> By any chance do Nimble packages get implicit version variables from their .nimble file? i.e. `echo fmt"Version {PkgMajor}.{PkgMinor}.{PkgPatch}"`
05:30:36*maier joined #nim
05:44:44*vr0n quit (Ping timeout: 246 seconds)
05:50:24ZevvVarriount: NPeg can match seq[whatever] these days
05:51:28*marnix quit (Ping timeout: 246 seconds)
05:51:40Zevvbut I'm not sure if it makes sense to use it to parse binary things - that's not typically where you'd find grammar
05:54:27*solitudesf joined #nim
05:58:05*NimBot joined #nim
06:01:07*marnix_ joined #nim
06:01:27*fredrikhr joined #nim
06:06:06FromGitter<tim-st> when I create a seq[int] inside a proc and then copy all elements from the seq to anothet of same length in a proc and return only the new proc, shouldn't the first memory usage be freed before the proc returns? the RAM stays at 1.6gb instead of 800mb...
06:12:29ZevvIt is freed at the application level, but not for the OS
06:12:50ZevvSo the next time you'd need 800mb, it will be avialable to the app
06:13:08Zevvthat's not a Nim issue, it's just the way memory management works at the application level
06:13:25FromGitter<tim-st> but numpy and python stay at 800mb
06:14:08Zevvdo you have a small snippet to share?
06:14:43FromGitter<tim-st> `proc getCol(): Column = int64(20).repeat(100_000_000).asColumn`
06:15:09FromGitter<tim-st> where `asColumn` copies each int64 to an `Data` type which is 9byte object variant
06:15:40FromGitter<tim-st> these a value types
06:17:12FromGitter<tim-st> I tested it only on windows
06:17:49FromGitter<tim-st> and `Column` is just `seq[Data]`
06:18:10ZevvThe data inside a seq is stored on the heap
06:18:25Zevvso if first your repeat() allocs 800 Mb at the start of the heap
06:18:36ZevvasColumn makes a copy that goes *after* that on the heap
06:18:43Zevvand the first part is freeed
06:19:10*Vladar joined #nim
06:19:29FromGitter<tim-st> but pythons [20] * 100_000_000 goes on heap, too?
06:19:30Zevvthe details depend on the C library and the OS, but the heap arena is typically not returned to the os
06:19:45Zevvnot sure about python I must admit
06:20:05FromGitter<tim-st> I dont think python has a better implementation than nim for this
06:20:26ZevvI don't think python would put this on the stack
06:20:40FromGitter<tim-st> I think this is a bug in nim (at least on windows)
06:21:00Zevvif you do think so, make a complete minimal runnable example and post an issue
06:21:13Zevvbut I'm not surprised by what you're describing, that is typically how it works, also in C
06:21:26FromGitter<tim-st> ok, thanks, when I find more time, I will try to create a minimum example
06:21:36Zevvcool
06:25:41FromGitter<tim-st> hm, I remember, this is just how nim works: the largest amount that was ever allocated stays
06:25:54Zevvright. And that's because that is how C works
06:25:54FromGitter<tim-st> I think that was discussed before
06:26:05Zevvtechnically, that's not *really* true
06:26:20Araqwell you can use --gc:orc -d:useMalloc and hope malloc returns memory back to the OS
06:26:30Zevvmalloc will not.
06:26:49Araqit depends on the OS and the allocation sizes I think
06:26:53Zevvmaybe on windows, I dont know. On *nix munmap() is the only way to go
06:27:07Araqfree() can call munmap
06:27:09FromGitter<tim-st> but cpython should use C and windows os too
06:27:16FromGitter<tim-st> I compared it to this
06:29:24Araqas I said, please try --gc:arc -d:useMalloc
06:29:36FromGitter<tim-st> thanks, Aray, will try this
06:30:06FromGitter<tim-st> just checked it in python again: l = [20] * 100_000_000; l2 = [40] * 100_000_000
06:30:14FromGitter<tim-st> memory is then at 1.5gb as expected
06:30:32Zevvbut typically, your first allocations = A, the copy = B, you get "......" -> "AAA..." -> "AAABBB" -> "...BBB"
06:30:35FromDiscord<Varriount> Is narimiran on here somewhere?
06:30:36FromGitter<tim-st> when I make l = l2; memory goes immediately down to half
06:30:42narimiranhe is
06:31:29Zevvtim-st: Maybe python does a mmap() allocation for huge chunks and munmaps() them
06:32:10FromGitter<tim-st> ok, I don't know how it works there, just to show that's not an C or windows issue
06:32:32FromGitter<tim-st> Araq: that doesn't compile because I have deepCopy in my code
06:32:33narimiran@Varriount is it about that alternative PR? :)
06:32:40Zevvtim-st: On linux I just verified it makes a separate OS allocation inded for these large arrays
06:32:46*Varriount joined #nim
06:32:48Zevvso that explains
06:33:02AraqZevv: yes and malloc implementations tend to do the same
06:33:37Araqtim-st: please remove the deepCopy :-)
06:34:22ZevvAraq: true.
06:34:48Zevvbut that will not always work with Nim because it will do the pooling itself. This -d:usemalloc might indeed do better here
06:38:07FromGitter<tim-st> Araq: it seems to work with `--gc:arc -d:useMalloc`
06:38:25FromGitter<tim-st> the memory changed very flexible and goes down again, as I wanted it
06:38:35Zevv\o/
06:38:45FromGitter<tim-st> but deepCopy would be useful too :D
06:38:52FromGitter<tim-st> thanks for the help :)
06:40:55FromGitter<tim-st> `--gc:arc -d:useMalloc` doesnt work... it goes up to 3.2gb
06:41:06FromGitter<tim-st> I meant orc not arc
06:41:08FromGitter<tim-st> arc works
06:44:37*Tlanger joined #nim
06:47:35*Tongir quit (Ping timeout: 272 seconds)
06:48:51FromGitter<tim-st> the first time I compiled with `--gc:arc -d:useMalloc` it worked perfect, but all other times with arc and orc it goes to 3.2gb although the max expected is 1.6gb and the wanted is 800mb
06:50:43FromGitter<tim-st> it's the same result as --gc:none
06:52:42*marnix_ quit (Ping timeout: 256 seconds)
06:53:01FromDiscord<Varriount> tim-st: What memory metric are you using? Physical pages? Commited pages, etc?
06:53:55FromGitter<tim-st> I dont know I just allocate one seq inside a proc copy the values to a new return seq 2
06:54:02FromDiscord<Varriount> @Zevv How would you recommend using NPeg to consume binary data?
06:54:14FromDiscord<Varriount> tim-st: I mean, how are you measuring memory usage?
06:54:31FromGitter<tim-st> just by looking at windows explorer ram usage
06:55:44FromGitter<tim-st> "task-manager" it's called
06:57:56*marnix joined #nim
06:59:28FromGitter<tim-st> it's a nim bug
07:00:06FromGitter<tim-st> I now forced the seq to be `@[]` in the last line to show nim "this should be really removed now" and then I get 800mb instead of 3.2gb
07:01:19FromGitter<tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f056f3f86ccb45b5990943d]
07:01:47FromGitter<tim-st> ok, it was the wrong seq, sry
07:03:49FromGitter<tim-st> that's problematic, I will investigate further and open an issue when I found a good example
07:05:51FromDiscord<demotomohiro> Anyone know why this code generate "invalid object conversion [ObjectConversionError]" error?↵https://play.nim-lang.org/#ix=2raP
07:09:26*marnix quit (Ping timeout: 260 seconds)
07:14:15FromDiscord<Varriount> @demotomohiro I might be reading the code incorrectly, but it looks like you are converting an instance of `Foo` to `Bar`, where Bar is an extension of `Foo`
07:15:10FromDiscord<Varriount> This isn't possible from a type-system point of view - a parent type cannot be treated as a child type unless it is known that the child type is just an alias (equivalent).
07:15:32FromDiscord<Varriount> This is because a child type may be larger than the parent type.
07:17:03FromGitter<tim-st> here is an example with sample types from my problem above: https://play.nim-lang.org/#ix=2raR
07:17:41FromDiscord<Varriount> Also, casting is dangerous - it tells the compiler to just blindly treat one data type as another.
07:19:01FromGitter<tim-st> lol, the example code seems to work with arc and useMalloc, maybe it's only related to object variants
07:19:58FromDiscord<Varriount> @demotomohiro What are you trying to achieve overall?
07:20:10*Varriount left #nim (#nim)
07:21:20FromDiscord<demotomohiro> @Varriount Bar[Foo] is an extension of Foo and I just want to copy instance of Foo to Bar[Foo].Foo.
07:22:04FromDiscord<demotomohiro> I want to initialize Foo part of Bar[Foo] with given instance of Foo.
07:25:29FromGitter<tim-st> Araq: I finally have an minimum example showing the problem: https://play.nim-lang.org/#ix=2raS
07:25:48FromGitter<tim-st> while this one works fine: https://play.nim-lang.org/#ix=2raR
07:26:04FromGitter<tim-st> it seems object variants use either pointers to data insted of copy by value or just leak memory
07:27:33FromDiscord<Varriount> @demotomohiro There might be a way, but in general generic types don't support inheritance very well. I'm trying to find a way though.
07:28:31FromDiscord<Varriount> I vaguely recall the compiler doing something like this though
07:28:31FromDiscord<demotomohiro> @Varriount I want to make a type that wrap osproc.FileHandleStream or streams.FileStream so that I can use `peekChar` to pipe.
07:29:16FromDiscord<Varriount> Why not just inherit from FileHandleStream?
07:31:07FromDiscord<demotomohiro> Type of outputStream is different on Window and Linux.
07:32:15FromDiscord<demotomohiro> On windows, outputStream is osproc.FileHandleStream. On Linux, outputStream is streams.FileStream.
07:32:43FromDiscord<Varriount> This? https://nim-lang.org/docs/osproc.html#outputStream%2CProcess
07:34:45FromDiscord<demotomohiro> @Varriount I will try simpler way without generics.↵Thank you!
07:35:34FromDiscord<Varriount> demotomohiro: For what it's worth, you could probably get that logic to work by using a template, but I'm still not sure it's the best way to go about what you want.
07:41:32FromDiscord<demotomohiro> @Varriount Im studying how to fix this issue
07:41:34FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/issues/14906
07:41:36disbotCalling peekChar with Stream returned from osproc.outputStream generate runtime error ; snippet at 12https://play.nim-lang.org/#ix=2raU
07:42:13*dadada quit (Ping timeout: 264 seconds)
07:55:43*krux02 joined #nim
08:00:23FromDiscord<Varriount> @demotomohiro You can't peek a stream (or at least, not consistently)
08:01:13FromDiscord<Varriount> Or to rephrase, the concept of a stream doesn't inherently support peeking at data.
08:07:05FromDiscord<demotomohiro> I'm trying to make a Stream that have a buffer and when peek a pipe, read pipe, write to buffer and return the content of buffer.↵Next time user try to read the pipe, return content of buffer so that previous peek call looks like not moving read position.
08:10:14FromDiscord<demotomohiro> I really want to do is make a program that can controll neovim using msgpack-rpc via pipe using msgpack4nim.↵https://github.com/jangko/msgpack4nim/issues/58↵As msgpack4nim use peekChar, I need to make outputStream peekable.
08:10:16disbotoutputStream(p: Process) in osproc in standard library cannot call peekChar ; snippet at 12https://play.nim-lang.org/#ix=2rb2
08:11:59*ftsf joined #nim
08:13:12*fanta1 joined #nim
08:14:17FromDiscord<demotomohiro> At least, peek works with StringStream and FileStream, doesn't it?
08:15:39*nikita` joined #nim
08:19:50FromGitter<tim-st> Now my example code from above finally works by using arc or orc it uses even some megabytes less memory than numpy, with default gc it stays still at 2*expected, I had to move the os.sleep outside the proc because dealloc happens at very end of proc and not after first possibility, so as a result: no problems with object variants here and arc/orc should be used (-d:useMalloc not needed)
08:42:28*oddp joined #nim
08:43:38FromDiscord<Varriount> @demotomohiro What kind of protocol does neovim output?
08:45:58FromDiscord<demotomohiro> neovim use msgpack-rpc.↵https://github.com/msgpack-rpc/msgpack-rpc
08:46:56FromDiscord<Varriount> So why not read the appropriate msgpack data from the stream?
08:50:40FromDiscord<demotomohiro> I tried to controll neovim like this code:↵https://github.com/jangko/msgpack4nim/issues/58#issue-650859139
08:50:41disbotoutputStream(p: Process) in osproc in standard library cannot call peekChar ; snippet at 12https://play.nim-lang.org/#ix=2rb2
08:53:41FromDiscord<demotomohiro> msgpack-rpc message can be send/receive to neovim via pipe or TCP socket, but neovim document says TCP sockets are generally less secure than named pipes.
08:54:24*FromDiscord quit (Remote host closed the connection)
08:54:40*FromDiscord joined #nim
08:56:41FromDiscord<Varriount> @demotomohiro Do you know where bytestream is implemented?
08:57:08FromDiscord<Varriount> (in msgpack4nim)
08:57:32FromDiscord<Varriount> I can't seem to find it in that module, or the standard library
09:00:39FromDiscord<demotomohiro> I think ByteStream is just a generics argument name.
09:01:00FromDiscord<demotomohiro> https://github.com/jangko/msgpack4nim/blob/master/msgpack4nim.nim
09:01:21FromDiscord<--HA--> What is a good discord library to use for a simple discord bot? I found discordnim and dimscord so far, are there any others?
09:02:36FromDiscord<Varriount> @demotomohiro Ah thanks, I didn't notice that
09:03:06FromDiscord<Varriount> @--HA-- I don't know if any others off hand, why do you ask?
09:04:27FromDiscord<Varriount> @demotomohiro I recommend implementing a stream type that takes another `Stream` type as an argument, and just maintains a buffer.
09:05:21FromDiscord<Varriount> All streams inherit from the same parent type, which defines the various procedures.
09:08:23FromDiscord<--HA--> @Varriount Just so I pick the "best" one to work with. I want to make a simple bot that reacts to some commands and replies with text messages back. Of those two libs, which one would you recommend?
09:09:32FromDiscord<demotomohiro> @Varriount Implementing Stream type that have another Stream would be simpler, but StreamObj type have 10 pointers to procedure.↵That become a type that holds many unused pointers to procedure.
09:28:05*Tongir joined #nim
09:28:57FromDiscord<Yardanico> @--HA-- use dimscord
09:29:05FromDiscord<Yardanico> discordnim is mostly abandoned
09:29:35FromDiscord<Yardanico> the bot (ircord) used to bridge this discord with IRC uses dimscord
09:30:09FromDiscord<Varriount> @demotomohiro Honestly, unless you're creating millions of streams or are on a memory-constrained system, the waste isn't that bad
09:30:34*Tlanger quit (Ping timeout: 256 seconds)
09:32:14FromDiscord<--HA--> @Yardanico thanks
09:32:19*xet7 quit (Quit: Leaving)
09:33:12*xet7 joined #nim
09:33:25FromDiscord<Yardanico> Although you should use devel version of dimscord (devel branch)
09:33:38FromDiscord<Yardanico> Also its creator is here - @KrispPurg
09:37:25FromDiscord<demotomohiro> @Varriount I got to go.↵Thank you for your help!
09:45:00FromDiscord<KrispPurg> Use the devel branch btw
09:46:18FromDiscord<KrispPurg> @--HA--
09:49:03FromDiscord<--HA--> Can I specify the development branch in a nimble file "requires" statement?
09:49:03FromDiscord<KrispPurg> O
09:49:53FromDiscord<KrispPurg> hm, not sure, but you can just simply install it
09:51:05FromDiscord<Recruit_main707> requires nim >= [version number] works iirc
09:51:49FromDiscord<KrispPurg> Oh yes, I think you need to provide "dimscord#devel"
09:52:03FromDiscord<KrispPurg> @--HA--
09:56:54FromDiscord<--HA--> Seems to have worked. It said `Installing dimscord@#devel`
10:01:03FromDiscord<--HA--> How can I see which commit my local version is at?
10:02:07FromDiscord<Varriount> @--HA-- It's cloned like a regular git repository
10:02:45*ftsf quit (Quit: Leaving)
10:03:05FromDiscord<--HA--> And if eventuall my version is behind the github one, will running nimble install again update it?
10:09:30FromDiscord<--HA--> @KrispPurg trying to compile the example from the readme I get `type mismatch: got <proc (s: Shard, r: Ready){.gcsafe, locks: 0.}> but expected 'proc (s: Shard, r: Ready): Future[system.void]{.closure.}'`
10:09:42FromDiscord<--HA--> for the on_ready handler
10:10:42FromDiscord<lqdev> you need to annotate your proc with {.async.}
10:13:01FromDiscord<--HA--> Oh my bad, I should use the readme from the devel branch
10:27:36FromDiscord<--HA--> All works now. Thanks.
10:27:48FromDiscord<KrispPurg> np
10:30:23Yardanicoarc and lent fixes raining down today :P
10:53:00FromDiscord<impbox> hmm is it possible to make nim compile to one big c file?
10:56:06*fanta1 quit (Quit: fanta1)
11:02:49Yardanico!status
11:02:50FromDiscordUptime - 2 hours and 8 minutes
11:11:05YardanicoI wonder (just out of curiosity) if there's a way to put a proc and a call to it on the same line in Nim 🤔
11:12:37FromDiscord<Rika> doubt
11:14:49Yardanicowait
11:15:02Yardanicoyou can
11:15:22Yardanicoonly on devel though (need sugar module)
11:15:25Yardanicoimport sugar; echo ((x, y: int) => (x + y))(1, 3)
11:15:28YardanicoXD
11:15:35Yardanicoor even
11:15:47Yardanicoimport sugar; let prc = (x, y: int) => (x + y); echo prc(1, 3)
11:15:57Yardanicodamn nice
11:15:58FromDiscord<Rika> :7900\7896-*/9\
11:16:06narimirancan't you do it without sugar?
11:16:08Yardaniconarimiran: nah
11:16:14YardanicoI tried a few times with () and I couldn't do it
11:16:15FromDiscord<Rika> phone fell on keyboard
11:16:21Yardanicomaybe with anonymous procs somehow
11:16:24Yardanicoah right
11:16:24Yardanico maybe
11:16:46Yardanicowell maybe not
11:17:05Yardanicooh you're right!
11:17:10Yardanicolet prc = (proc (x, y: int): int = x + y); echo prc(1, 3)
11:17:16narimiranwhat a rollercoaster!
11:17:40Yardanico!eval let prc = (proc (x, y: int): int = x + y); echo prc(1, 3)
11:17:43NimBot4
11:18:36YardanicoDAMN
11:18:38Yardanico!eval let prc = (proc (x, y: int): int = (for x in 0 ..< 5: (if x > 3: (result += x) else: result += 1))); echo prc(1, 3)
11:18:41NimBot8
11:18:48Yardanico!eval let prc = (proc (x, y: int): int = (for x in 0 ..< 5: (if x > 3: result += x else: result += 1))); echo prc(1, 3)
11:18:51NimBot8
11:18:52YardanicoXDDDD
11:19:02FromDiscord<Rika> lmao nice
11:19:07Yardanicowe figured out the truth
11:20:04Yardaniconow time to add "one-linefier" to nuglifier
11:20:12Yardanicoif that's possible
11:21:04Yardaniconeed to try to convert some more complex nim program to one line
11:21:37Yardanicoah right types
11:22:02Yardanicocan't put them on one line for "object"
11:22:23FromDiscord<Rika> one-lineable nim when
11:29:56*mfx joined #nim
11:31:09*nkoz joined #nim
11:32:20*mfx quit (Client Quit)
11:41:38*Senketsu joined #nim
11:45:11*Senketsu quit (Client Quit)
11:50:53*rockcavera joined #nim
11:57:26FromDiscord<impbox> hmm trying to do an android build, I copied the `nimbase.h` from my nim install to the android jni src dir and now it's trying to compile when I run `gradlew installDebug` but I get `C:/Users/user/git/nico_android/SDL2-2.0.12/build/net.impbox.nico/app/jni/src/nimbase.h:522:64: error: 'Nim_and_C_compiler_disagree_on_target_architecture' declared as an array with a negative size`
11:58:55leorize[m]looks like your C code is not configured with the right os/cpu combination
11:59:04FromDiscord<impbox> I compiled my nim source with `--os:android --cpu:arm -d:androidNDK -d:android`
11:59:19FromDiscord<impbox> I agree... I'm not sure how to fix it
11:59:33FromDiscord<impbox> android builds do a whole lot of different architectures
12:00:19leorize[m]you might need a csources-style collection
12:00:32leorize[m]but can't gradle just call nim directly?
12:01:03FromDiscord<impbox> hmm i don't know much about how gradle works, generally for android native builds you just chuck a bunch of c sources in there for it to use
12:01:29FromDiscord<impbox> doesn't seem like there's way to just build a single architecture either
12:02:04FromDiscord<impbox> (there probably is but I can't figure it out)
12:04:27FromDiscord<demotomohiro> I solved my problem with low level ugly hack.↵https://play.nim-lang.org/#ix=2rbB
12:06:02*supakeen quit (Quit: WeeChat 2.8)
12:06:39*supakeen joined #nim
12:07:20FromDiscord<impbox> hmm strangely I don't get the error when running gradle from android studio, but I do from command line =\
12:08:25FromDiscord<impbox> nevermind, I do
12:10:09*abm joined #nim
12:11:06*nsf quit (Quit: WeeChat 2.8)
12:14:06FromDiscord<impbox> \o/ progress
12:14:15FromDiscord<impbox> i managed to limit my build to a single architecture
12:59:19FromDiscord<dom96> @impbox you need to compile to multiple architectures
12:59:42FromDiscord<dom96> I'm using this for Android Studio: https://gist.github.com/dom96/d91f806b1808a997b4e6f4b6ddfce13f
12:59:51FromDiscord<dom96> Line 27 is the magic
13:00:08FromDiscord<dom96> and I do `nim c --cpu:arm64`, `nim c --cpu:amd64` etc.
13:14:09FromDiscord<impbox> @dom96 thanks
13:15:24FromDiscord<dom96> On a related note, if anyone is up for testing my Nim Android game, pm me your gmail 🙂
13:18:27*dadada joined #nim
13:18:51*dadada is now known as Guest14215
13:22:50FromDiscord<impbox> trying to get nico android builds nice and mostly automated
13:22:57FromDiscord<impbox> hopefully only need to do it once >_>
13:23:03FromDiscord<impbox> android seems to keep breaking everything
13:32:20*vr0n joined #nim
13:37:11*Tongir quit (Remote host closed the connection)
13:38:24*Tongir joined #nim
13:39:41*Tongir quit (Remote host closed the connection)
13:40:02*Tongir joined #nim
13:44:37*endragor quit (Ping timeout: 264 seconds)
13:45:50FromDiscord<--HA--> How can I listen for messages on a udp socket? This is what I got so far https://pastebin.com/P3i8ZeQd
13:46:31FromDiscord<--HA--> The program blocks but when I send something to that udp port with netcat nothing happens
13:49:05FromDiscord<impbox> @--HA-- do you need to bind first?
13:49:22FromDiscord<Clyybber> @flywind Regarding you PR, isn't the issue that markUsed is somehow called multiple times on the same symbol? Maybe thats worth investigating
13:50:38FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/730420583359184936/WNOY66CZT_Z3_Y5I.png
13:50:44FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/730420606922784858/TTKRMWMOGP6WPWEG.png
13:50:49FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/730420628493959299/ZJIT_EZ0SZ0M7ZB90U.png
13:52:23*stisa[m] joined #nim
13:56:38*endragor joined #nim
13:57:04FromDiscord<--HA--> @impbox I didn't think so because it is udp, but I'm not sure. Adding bindAddr had no visible effect.
13:57:56FromDiscord<--HA--> The example in the "net" documentation for sendTo works but there is no example for udp receiving, only tcp.
13:58:41FromDiscord<Yardanico> @Vindaar btw, about https://github.com/nim-lang/Nim/issues/5636#issuecomment-655536289 - even if you do, I don't think it'll be a high priority issue :P, e.g. see https://github.com/nim-lang/Nim/issues/14138#issuecomment-621067141
13:58:43disbotSegfault in create thread using channels with default GC ; snippet at 12https://play.nim-lang.org/#ix=2rbT
13:58:52FromDiscord<Yardanico> but yeah if you manage to minimise it you should still submit an issue
13:59:05FromDiscord<Zachary Carter> @--HA-- - if you read the top section of the `net` module
13:59:11FromDiscord<impbox> @--HA-- i'm not sure about nim's socket implementation, but it looks similar to C, you'd generally bind first for recvFrom, and also recvFrom is non-blocking i think, check the length in return
13:59:14FromDiscord<Zachary Carter> ```↵This module implements a high-level cross-platform sockets interface. The procedures implemented in this module are primarily for blocking sockets. For asynchronous non-blocking sockets use the asyncnet module together with the asyncdispatch module.↵```
13:59:35FromDiscord<impbox> (ok maybe ignore me then)
13:59:52FromDiscord<Zachary Carter> I've never used non-blocking UDP sockets with Nim - I've used a library like enet instead
14:00:04FromDiscord<Zachary Carter> tmk Nim doesn't have support for non-blocking UDP sockets in the stdlib
14:00:07FromDiscord<Zachary Carter> but I could be wrong
14:00:09*Guest14215 quit (Ping timeout: 272 seconds)
14:00:55FromGitter<iffy> I'm happy to see that Nim bindings are listed on the roadmap (Q1 2021) for Tauri: https://tauri.studio/ Tauri seems like a much more mature version of what I'm trying to make with wiish
14:01:10FromDiscord<Clyybber> @Yardanico Eh, seems kinda high priority; at least high priority as in getting arc ready
14:01:21*dadada__ joined #nim
14:01:21FromDiscord<Yardanico> was it an arc issue?
14:01:31FromDiscord<Clyybber> no, but I assume it doens't happen with arc
14:01:36FromDiscord<Yardanico> well yes
14:01:51FromDiscord<--HA--> Blocking or non-blocking does not really matter to me at this time. I'd be happy to be able to just receive data.
14:02:16FromDiscord<Yardanico> @--HA-- well the docs are clear I think 🙂
14:02:18FromDiscord<Zachary Carter> well then treat them like C sockets - or look at the source code for the net module would bey my advice
14:02:27FromDiscord<Yardanico> you really just recv
14:02:46FromDiscord<Yardanico> check recv here and recvs below it - https://nim-lang.org/docs/net.html#recv%2CSocket%2Cpointer%2Cint
14:02:51FromDiscord<Vindaar> @Yardanico yes, saw that one too, but since that uses threads I assume it might be more complicated. In any case, while I understand Ar4qs point, as long as either someone comes in and fixes https://github.com/mratsim/Arraymancer/issues/423 or the upstream bug of https://github.com/mratsim/Arraymancer/pull/420 arc unfortunately is off the table for me
14:02:52disbot[Blocked by upstream bug] Change Tensor backend to pointer+length ; snippet at 12https://play.nim-lang.org/#ix=2qDq
14:03:20FromDiscord<Yardanico> Well the first one https://github.com/mratsim/Arraymancer/issues/423 is probably due to new difference by arc
14:03:22FromDiscord<Yardanico> lemme find an issue about it
14:03:22disbotArraymancer is bugged with gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2rbX
14:03:36FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/14425
14:03:38disbot[arc, destructors] Weird SIGSEGV with {.noinit.} pragma ; snippet at 12https://play.nim-lang.org/#ix=2rbY
14:03:43FromDiscord<Yardanico> it was when I tried to use arc with arraymancer
14:04:32FromDiscord<Yardanico> not sure if @mratsim saw that issue
14:04:39FromDiscord<konradmb> Hello
14:04:43FromDiscord<Yardanico> hi
14:05:34FromDiscord<Vindaar> interesting, I also didn't see that issue
14:05:53FromDiscord<konradmb> has anyone came across "could not import" problem when loading dlls with exe compiled with mingw?
14:05:54FromDiscord<Zachary Carter> C++ destructors for objects which are importcpp'd won't be implicitly invoked if they are declared in global scope - is this correct behavior?
14:06:05FromDiscord<Yardanico> @konradmb that usually comes from incorrect bitness
14:06:20FromDiscord<Yardanico> e.g. your exe is 32bit and you're loading a 64-bit library or vice-versa
14:06:22FromDiscord<Clyybber> @Zachary Carter I think I saw an issue about that, but I can't find it :/
14:06:27FromDiscord<Zachary Carter> hrm
14:06:29FromDiscord<Yardanico> try to compile with -d:nimDebugDlOpen
14:06:33FromDiscord<Yardanico> (edit) 'try to compile ... with' => 'try to compileyour program'
14:06:38FromDiscord<Yardanico> (edit) 'try to compile your program with -d:nimDebugDlOpen ... ' => 'try to compile your program with -d:nimDebugDlOpenand check the error'
14:06:57FromDiscord<Zachary Carter> It's not the end of the world - I can just explicitly invoke the destructor
14:07:03FromDiscord<Zachary Carter> or not declare the object in global scope
14:07:14FromDiscord<Zachary Carter> was just curious - thanks!
14:07:33FromDiscord<konradmb> @Yardanico Yes, I've checked bitness - it's correct
14:07:41FromDiscord<Yardanico> well that dll also might require some other dlls
14:07:44FromDiscord<Yardanico> which couldn't be found
14:07:54FromDiscord<konradmb> And -d:nimDebugDlOpen doesn't do anything on Windows
14:08:19FromDiscord<Yardanico> well it does on devel 🙂
14:08:25FromDiscord<--HA--> The docs are clear for tcp, there is no udp example I can see. And the note on recvFrom says to use that one for udp. @Yardanico
14:08:40FromDiscord<Yardanico> @--HA-- well, for UDP it's the same, you just don't need to connect
14:08:47FromDiscord<Yardanico> you can immediately start to send/receive data
14:09:07FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/730425232120086579/unknown.png
14:09:25FromDiscord<konradmb> @Yardanico Oh, I haven't know that. I'll check it out
14:09:30FromGitter<alehander92> zachary
14:09:37FromGitter<alehander92> can i ask you stuff about c++ on offtopic
14:09:58FromDiscord<Yardanico> @konradmb see https://github.com/nim-lang/Nim/pull/13950
14:09:59disbotadded extended msg for failed library loads w/ incorrect DLL formats
14:10:12FromDiscord<Yardanico> you can even just cherry-pick this patch and add it to your stable stdlib 😄
14:10:48FromDiscord<--HA--> @Yardanico I read the top part of the net docs, and sendTo works. What I can not figure out is how to receive, it is not the same as for tcp. A minimal example for that would be great.
14:11:08FromDiscord<Yardanico> just use recv?
14:11:40FromDiscord<Zachary Carter> I will try to come up with a minimal example on my machine
14:12:54FromDiscord<--HA--> I tried a few variantions of recv and recvFrom with and without bindAddr but I got none of them to do anything. Thanks @Zachary Carter that would be very helpful. Not sure what I'm doing wrong.
14:13:32FromDiscord<Yardanico> well
14:13:39FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rc2
14:13:45FromDiscord<Yardanico> I just tested with `nc -ul -p 5555`
14:13:54FromDiscord<Zachary Carter> well nevermind haha
14:14:03FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rc3
14:14:05FromDiscord<Yardanico> and output in nim:↵```↵asfdasfasf↵```
14:14:16FromDiscord<Yardanico> status was sent from nim to netcat, asfdasfasf was sent from netcat to nim side
14:14:23*vr0n quit (Ping timeout: 260 seconds)
14:14:25FromDiscord<Clyybber> > using netcat instead of socat :p
14:14:33FromDiscord<Yardanico> i rarely use it anyway 🙂
14:16:20*fredrikhr quit (Ping timeout: 272 seconds)
14:17:01*muffindrake quit (Quit: muffindrake)
14:17:43FromDiscord<Yardanico> oh yeah, time to test new scoped arc with arraymancer 😛
14:17:50FromDiscord<Yardanico> " Error: internal error: cannot inject destructors to node kind: nkAsmStmt" hehe
14:18:06FromDiscord<Clyybber> heh
14:18:08FromDiscord<mratsim> I don't use ASM in arraymancer
14:18:14FromDiscord<Yardanico> @mratsim laser does
14:18:23FromDiscord<Yardanico> /home/dian/Stuff/arctests/Arraymancer/src/laser/cpuinfo_x86.nim(11, 5) E
14:18:41FromDiscord<Yardanico> I guess it's optional so i'll remove it
14:18:46FromDiscord<Rika> "E" is that the whole thing? lmao
14:18:47FromDiscord<Yardanico> but need to open an issue
14:18:48FromDiscord<Yardanico> no
14:18:53FromDiscord<Yardanico> /home/dian/Stuff/arctests/Arraymancer/src/laser/cpuinfo_x86.nim(11, 5) Error: internal error: cannot inject destructors to node kind: nkAsmStmt
14:18:58FromDiscord<Rika> thought it was a bug lol
14:19:22FromDiscord<konradmb> @Yardanico checked it out now on devel, still no additional info
14:19:31FromDiscord<Yardanico> really strange
14:19:36FromDiscord<Yardanico> are you sure the dll is in the same dir or in path?
14:19:36FromDiscord<konradmb> `could not import: glib_check_version` and that's all
14:19:47FromDiscord<Yardanico> ohhhhhh
14:19:56FromDiscord<Yardanico> you should've been more specific
14:20:02FromDiscord<Yardanico> this means that it loads the dll
14:20:05FromDiscord<Yardanico> but can't find the symbol in that dll
14:20:21FromDiscord<Yardanico> glib_check_version only exists since glib 2.6
14:20:26FromDiscord<Clyybber> @Yardanico fixed
14:20:30FromDiscord<Yardanico> @Clyybber lol
14:20:38FromDiscord<Yardanico> @konradmb you should have newer gtk/glib DLLs
14:20:41FromDiscord<Yardanico> this ones seem too old
14:20:44FromDiscord<konradmb> yeah, but I've even checked it to be really sure that's its in the dll
14:20:44FromDiscord<Yardanico> (edit) 'this' => 'these'
14:20:57FromDiscord<konradmb> and the symbol is there
14:21:52FromDiscord<Vindaar> @Yardanico yep, that's another issue
14:22:21FromDiscord<Yardanico> ok now more interesting
14:22:23FromDiscord<Yardanico> Error: internal error: cannot inject destructors to node kind: nkParForStmt
14:22:30FromDiscord<Yardanico> (I added nodestroy to that cpuid proc)
14:22:32FromDiscord<Yardanico> (edit) '(I added nodestroy ... to' => '(I added nodestroypragma'
14:22:37FromDiscord<Vindaar> ah
14:22:53FromDiscord<Vindaar> was wondering how you got that
14:22:57FromDiscord<Yardanico> ?
14:23:00FromDiscord<Yardanico> latest devel
14:23:37FromDiscord<Clyybber> @Yardanico Can you try the same fix I just did, but for nkParForStmt?
14:23:40FromDiscord<Vindaar> sorry, I still type too slow, which can be confusing 😛
14:23:45FromDiscord<Yardanico> @Clyybber lemme try
14:24:27FromDiscord<konradmb> @Yardanico wait, maybe not 😅
14:24:43FromDiscord<konradmb> Wrong dll name hehe
14:24:57FromDiscord<konradmb> But it was generated with gintro…
14:25:10FromDiscord<Yardanico> ohh
14:25:34FromDiscord<konradmb> Anyway, thanks! I've compiled it with normal linking and it works
14:25:51FromDiscord<konradmb> (with passL and so on)
14:26:00FromDiscord<Yardanico> @Clyybber well now it at least compiled 😄
14:26:04FromDiscord<Clyybber> :D
14:26:42FromDiscord<Vindaar> uhh, that's progress
14:27:02FromDiscord<Yardanico> after adding nodestroy to newTensor it passes whole two first checks~!
14:27:03FromDiscord<Yardanico> [Suite] Creating a new Tensor↵ [OK] Creating from sequence↵ [OK] Check that Tensor shape is in row-by-column order
14:27:05FromDiscord<Yardanico> and hangs
14:27:21FromDiscord<Vindaar> yay 😐
14:27:27FromDiscord<Yardanico> well that's much better
14:27:37FromDiscord<Yardanico> ah
14:27:39FromDiscord<Yardanico> it's because i need more nodestroy
14:27:46FromDiscord<Yardanico> NODESTROYYY
14:28:16FromDiscord<Yardanico> now it passed 5 tests
14:28:19FromDiscord<Yardanico> sent a long message, see http://ix.io/2rc7
14:28:46FromDiscord<Vindaar> wow, only about 20 more fixes and we're there 🤣
14:28:53FromDiscord<Yardanico> 1 more passed
14:29:34FromDiscord<Vindaar> adding more and more nodestroys or doing something else?
14:29:37FromDiscord<Yardanico> yes
14:29:41FromDiscord<Yardanico> more nodestroys to noInit procs
14:29:48FromDiscord<Vindaar> 👍
14:29:49FromDiscord<Yardanico> ok nice now it's an actual arc bug
14:29:53FromDiscord<Yardanico> /home/dian/Things/Nim/lib/system/avltree.nim(74) del↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)
14:29:59FromDiscord<Yardanico> that's much better
14:30:30FromDiscord<Yardanico> but really if I test individually quite a lot of tests pass
14:30:31FromDiscord<Yardanico> not all
14:30:38FromDiscord<Clyybber> maybe we should warn about using noInit if it would cause reads of uninit memory
14:31:22FromDiscord<Vindaar> shouldn't noinit just imply nodestroy for arc?
14:31:24FromDiscord<Yardanico> basically mratsim will have to add nodestroy to almost any noinit proc 😄
14:31:41FromDiscord<Clyybber> @Vindaar Hmm, nodestroy is a bit of a sledgehammer
14:31:49FromDiscord<Clyybber> I would rather make it just work
14:32:00FromDiscord<Vindaar> ok, I'm pretty clueless here
14:32:10FromDiscord<Yardanico> @Clyybber well the issue is https://github.com/nim-lang/Nim/issues/14425 if you want to try
14:32:11disbot[arc, destructors] Weird SIGSEGV with {.noinit.} pragma ; snippet at 12https://play.nim-lang.org/#ix=2rbY
14:32:41FromDiscord<Clyybber> The issue is that we do firstWrite optimiziation only for sink and not for asgn
14:32:51FromDiscord<Clyybber> (edit) 'asgn' => 'copy'
14:33:29FromDiscord<--HA--> @Yardanico Thanks for the example. That just hangs on runtime for me with no output, I copy & pasted your code.
14:33:38FromDiscord<Yardanico> @--HA-- well you must send some data back to UDP
14:33:43FromDiscord<Yardanico> it "hangs" because it waits for a line
14:34:27FromDiscord<Clyybber> @Yardanico Try putting the nkParForStmt case to the nkForStmt case then
14:34:33FromDiscord<Yardanico> ? why
14:34:37FromDiscord<Yardanico> ah
14:34:41FromDiscord<Clyybber> :)
14:34:50FromDiscord<Yardanico> well idk if that would be more correct, but okay
14:35:37FromDiscord<Yardanico> wait there's no nkForStmt separately
14:35:48FromDiscord<--HA--> Using the same `nc -ul -p 5555` to send data nothing is received
14:36:17FromDiscord<Yardanico> look, you start netcat
14:36:19FromDiscord<Yardanico> start nim program
14:36:23FromDiscord<Yardanico> in netcat you'll see "status"
14:36:24FromDiscord<Clyybber> @Yardanico oh, right. eh, nkWhile then :p
14:36:30FromDiscord<Clyybber> but maybe you need to skip the condition
14:36:31FromDiscord<Yardanico> then in netcat you write something and press enter
14:37:11FromDiscord<Yardanico> @Clyybber well I'm not sure if it'll help me right now, but I'll try to make an example with that nkParForStmt
14:43:44FromDiscord<--HA--> @Yardanico That works. I was not aware the order mattered. I always started netcat after the nim prgram. The behaviour I would like to achieve though is to have the nim program listen on a udp port for anything that is sent there (without it sending first, or at all possibly).
14:44:04FromDiscord<Yardanico> well, then something like
14:45:10FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rce
14:45:52*maier quit (Ping timeout: 256 seconds)
14:45:52FromDiscord<Yardanico> if you want to receive from multiple clients efficiently you might want to use asyncnet though
14:46:30FromDiscord<Yardanico> and then for netcat
14:46:36FromDiscord<Yardanico> `nc -u 127.0.0.1 5555`
14:46:46FromDiscord<Yardanico> (edit) removed 'and then' | 'for ... netcatwith' => 'forthis example - start' | 'this example - startnetcat ... ' => 'this example - startnetcatwith'
14:46:59FromDiscord<Yardanico> and then as you write and press enter in netcat the nim program will display it
14:47:49FromDiscord<Yardanico> you can of course just use socket.recv(numberOfBytes) if you know them
14:48:36FromDiscord<impbox> \o/ got my android building working
14:48:57FromDiscord<impbox> can now make games for my phone
14:49:14FromDiscord<impbox> still need to figure out streaming audio files
14:51:16FromDiscord<--HA--> Perfect that also works, I think I can figure the rest out from here. Thank you for your help @Yardanico . Looks like I ran into more than one issue at the same time earlier. I just noticed that `nc -u 127.0.0.1 5555` and `nc -u localhost 5555` for some reason are not the same. The localhost one does not work and I used that before.
14:52:55FromDiscord<konradmb> `--app:gui` is doing something on os different than Windows?
14:53:14FromDiscord<Yardanico> maybe on macos too? i don't really know
14:54:09FromDiscord<impbox> i don't like how --app:gui on windows stops the app logging errors to console
14:54:19FromDiscord<impbox> since you can't copy the errors from the messagebox
14:56:36*a_b_m joined #nim
14:57:42Araqyou don't have to use --app:gui
14:58:09FromDiscord<konradmb> @impbox Isn't it the Windows feature that when you press ctrl+c, you copy all dialog contents?
14:58:15Yardanicoi think it is
14:58:15*a__b__m joined #nim
14:58:22FromDiscord<impbox> i use it for gui applications so i don't spawn a console, but if i run it from the console i'd like it to log to console
14:58:32FromDiscord<impbox> @konradmb oh i didn't know that
14:58:37FromDiscord<impbox> that helps somewhat =)
14:58:37Yardanicocan't you not spawn a console without --app:gui ?
14:59:10FromDiscord<impbox> hmm i'm pretty sure if you don't use --app:gui it creates its own console if not launched from console
14:59:29Yardanicowell I mean then you can spawn your own console when used with --app:gui
14:59:34*abm quit (Ping timeout: 246 seconds)
14:59:39FromGitter<awr1> if you have win10 you can use winkey + v to open clipboard history
14:59:55FromDiscord<impbox> @Yardanico i don't want to... but as a user if they have an issue with the app they can run it in terminal to get logging output
15:00:02FromDiscord<impbox> and see why they might be getting errors
15:00:18FromDiscord<konradmb> @impbox when I launch --app:gui in console I get error message in console and in dialog
15:01:03FromDiscord<impbox> interesting, i didn't use to get that behaviour (i haven't tested recently)
15:01:39*a__b__m quit (Client Quit)
15:01:43FromDiscord<konradmb> @impbox https://media.discordapp.net/attachments/371759389889003532/730438471705165864/unknown.png
15:01:44*a_b_m quit (Ping timeout: 256 seconds)
15:02:02Yardanicowell that's wine :)
15:02:12FromDiscord<impbox> hmm do you get a stacktrace?
15:02:15FromDiscord<impbox> in a debug build
15:05:47FromDiscord<konradmb> @impbox Well, no 😄
15:06:38*sentreen quit (Quit: sentreen)
15:06:53FromDiscord<impbox> mmm i get nothing on terminal
15:06:58*sentreen joined #nim
15:07:03FromDiscord<impbox> but i can copy the stacktrace from the messagebox =)
15:07:05FromDiscord<impbox> so that's something
15:07:25*sentreen quit (Client Quit)
15:07:28FromDiscord<impbox> I guess I can catch top level exceptions and handle them myself
15:20:18*sentreen joined #nim
15:22:09*sentreen quit (Client Quit)
15:23:20*sentreen joined #nim
15:25:03FromDiscord<Recruit_main707> can i cast an object to/from a seq/array of bytes??
15:25:25FromDiscord<Recruit_main707> i know it would be ugly, but i want to see if it would be fast at least
15:25:30FromDiscord<impbox> pretty sure you can cast to anything
15:25:39*narimiran quit (Ping timeout: 272 seconds)
15:25:59FromDiscord<impbox> something line `cast[ptr UncheckedArray[uint8]](object.addr)` ?
15:27:27*sentreen quit (Client Quit)
15:27:38*lritter joined #nim
15:28:56FromDiscord<Recruit_main707> yep, that seems to work, now pray it also does in the python side
15:32:57*dddddd quit (Ping timeout: 258 seconds)
15:33:52*sentreen joined #nim
15:44:35FromDiscord<Zachary Carter> it actually should be `cast[ptr UncheckedArray[uint8]](addr seq[0])` I think
15:44:45FromDiscord<Yardanico> yeah
15:44:47FromDiscord<impbox> if it's a seq
15:45:03FromDiscord<Zachary Carter> ah I thought Recruit was asking about a seq, my bad
15:49:45FromDiscord<Recruit_main707> 👍
16:15:13*sentreen_ joined #nim
16:16:27*Vladar quit (Quit: Leaving)
16:17:08*NimBot joined #nim
16:17:25*endragor quit (Remote host closed the connection)
16:17:34*nkoz quit (Quit: Ex-Chat)
16:18:00*sentreen_ joined #nim
16:22:06*muffindrake joined #nim
16:32:34*marnix_ joined #nim
16:32:40*endragor joined #nim
16:37:50*endragor quit (Ping timeout: 256 seconds)
16:47:29*marnix_ quit (Quit: WeeChat 2.8)
16:49:47*tane joined #nim
17:01:39FromDiscord<Shucks> ``` let jmpBack = cast[pointer](0x7FF667DB9F98)↵ asm """↵ push `jmpBack`↵ """```
17:01:56FromDiscord<Shucks> shouldn't that work? says undefined reference to jmpback
17:04:22*Vladar joined #nim
17:05:43*endragor joined #nim
17:05:48FromDiscord<Recruit_main707> try with let jmpBack [.exportc.}
17:06:03FromDiscord<Recruit_main707> {.exportc.}*
17:07:11FromDiscord<Stuffe> does anyone know the progress of adding incremental compilation to nim?
17:07:38FromDiscord<Shucks> exportc didnt fixed it ;o
17:08:42Yardanico@Stuffe I think there wasn't any progress in a few months :)
17:09:19FromDiscord<Stuffe> ok i see
17:09:21*sentreen_ quit (Quit: sentreen_)
17:09:37*sentreen_ joined #nim
17:10:46FromDiscord<Recruit_main707> is it me or building with nimble is faster?
17:11:20*endragor quit (Ping timeout: 256 seconds)
17:11:27Yardanicotime it
17:13:02*sentreen_ quit (Client Quit)
17:16:04*Tongir quit (Ping timeout: 258 seconds)
17:20:41*Vladar quit (Quit: Leaving)
17:38:46*endragor joined #nim
17:39:43*narimiran joined #nim
17:43:10*endragor quit (Ping timeout: 260 seconds)
17:48:20*Jim99 joined #nim
17:51:45*vr0n joined #nim
18:04:59*Jim99 quit (Remote host closed the connection)
18:16:41*dddddd joined #nim
18:18:18*marnix joined #nim
18:20:27*rockcavera quit (Remote host closed the connection)
18:22:48leorize[m]@Stuffe ask disruptek
18:38:26FromDiscord<Varriount> Zevv: Are you around?
18:38:50FromDiscord<Varriount> loerize: You troublemaker ;)
18:38:59FromDiscord<Varriount> *leorize
18:46:14*arecaceae quit (Remote host closed the connection)
18:46:58*arecaceae joined #nim
18:51:20*Cthalupa quit (Ping timeout: 256 seconds)
18:51:38*Cthalupa joined #nim
18:57:13*Cthalupa quit (Ping timeout: 246 seconds)
18:57:14*marnix quit (Ping timeout: 240 seconds)
18:57:41*Cthalupa joined #nim
19:04:17*marnix joined #nim
19:14:51FromDiscord<dawmarkir> is there a proc in stdlib that can normalize idents?
19:14:52*marnix quit (Ping timeout: 256 seconds)
19:15:27FromDiscord<dawmarkir> also, why does strutils.normalize's doc say "This should NOT be used to normalize Nim identifier names."
19:17:08FromDiscord<KingDarBoja> What do u mean by indents?
19:17:10*go|dfish quit (Ping timeout: 246 seconds)
19:17:16FromDiscord<KingDarBoja> Normalize indents*
19:17:24*Jesin quit (Quit: Leaving)
19:24:04Yardanico@dawmarkir well there is a way to COMPARE two idents
19:24:05Yardaniconim indents
19:24:09Yardanicosee https://nim-lang.org/docs/macros.html#eqIdent%2Cstring%2Cstring
19:25:36Zevvvarriount: zup
19:25:42Yardanico@Varriount ^
19:28:24FromDiscord<lqdev> @dawmarkir strutils.normalize shouldn't be used because it doesn't take the first letter into account
19:28:30FromDiscord<lqdev> which is case-sensitive
19:30:20*rayman22201 joined #nim
19:32:03*euantor joined #nim
19:32:30*ormiret joined #nim
19:33:05FromGitter<ynfle> @dawmarkir, on devel there is https://nim-lang.github.io/Nim/strutils#nimIdentNormalize%2Cstring
19:33:13*l1x joined #nim
19:33:59*surma joined #nim
19:34:06FromDiscord<dawmarkir> Thanks for the answers 🙂
19:34:17*alehander92_ joined #nim
19:34:27*Jesin joined #nim
19:37:02*zielmicha__ joined #nim
19:38:35*waleee-cl joined #nim
19:40:28*mbuchel quit (Ping timeout: 260 seconds)
19:41:13*stever joined #nim
19:41:54*jholland__ joined #nim
19:41:57FromDiscord<Shucks> Just recognized that nim identifiers on `asm` can't be used with `masm=intel`
19:41:58FromDiscord<Shucks> hurray.
19:44:43FromDiscord<Varriount> Zevv: Is there a way to tell NPeg to repeat a pattern 'N' times, with 'N' being determined at match time?
19:45:12FromDiscord<Varriount> I'm attempting to use it to parse some binary data, which contains things like length-prefixed strings
19:45:45Yardanicoi think there was PMunch's macro for this binary too
19:45:50Yardanicoi mean for binary parsing
19:46:39FromDiscord<Varriount> Yeah, but it doesn't have any examples, nor does it seem to have any looping/backtracking behavior.
19:48:05FromDiscord<Varriount> Yardanico: I'm attempting to parse CLR assemblies, specifically winmd files: https://docs.microsoft.com/en-us/uwp/winrt-cref/winmd-files
19:48:34FromDiscord<Varriount> I had "fun" yesterday going through the ECMA specification on the Common Language Runtime
19:49:14FromDiscord<Varriount> (It wasn't too bad, actually, there's just a lot of content)
19:53:41*go|dfish joined #nim
19:54:06ZevvVarriount: Nope
19:54:19Zevvunless you implement a snippet of nim to match that part
19:55:39Zevvactually there is no run-time looping in npeg. If you match something X times, it simple generates X times the match
19:57:35FromGitter<awr1> https://play.nim-lang.org/#ix=2rdt
19:57:45FromGitter<awr1> is there a reason this is breaking
19:57:47FromGitter<awr1> or is this a bug
19:58:53*Hotbees joined #nim
19:58:58*narimiran quit (Ping timeout: 272 seconds)
19:59:05ZevvT is a static number
19:59:07Zevvwhich is not a type
19:59:27Zevvyou can't say proc bar(x: 3): Foo 3 = discard
19:59:36Zevvwell you can *say* it, but it will not compile
20:01:34FromGitter<awr1> Foo[3] can still be valid
20:02:13FromDiscord<Rika> what? why?
20:02:18FromDiscord<Rika> 3 isnt a type though?
20:02:26FromGitter<awr1> https://nim-lang.org/docs/manual.html#special-types-static-t
20:02:36FromGitter<awr1> > Static params can also appear in the signatures of generic types
20:02:52dadada__want this https://stackoverflow.com/a/15595582 as nim code, how do I create the unsigned long buffer in nim so it gets accepted as ptr culong?
20:03:07FromGitter<awr1> the obvious use case is for vector and matrix-like types, as demonstrated in the manual
20:03:24dadada__XChangeProperty is the interesting func there, I did something that was able to be compiled, but segfaults
20:04:46FromDiscord<Rika> awr1: only on generic types i assume
20:04:51FromDiscord<Rika> not in generic procs
20:05:29FromGitter<awr1> hm
20:06:47FromGitter<awr1> `proc bar[F :Foo](x :F.T) :F = discard` seems to work
20:07:13*sentreen_ joined #nim
20:07:23*konradmb joined #nim
20:07:26*marnix joined #nim
20:07:38*sentreen_ quit (Client Quit)
20:07:53*fowl joined #nim
20:08:33FromGitter<awr1> i think i'll make an issue for this to decide whether or not this is intended behavior and possibly add it to manual
20:08:40*matti joined #nim
20:09:39FromDiscord<Rika> prolly best
20:10:06FromGitter<awr1> hm, also `proc bar(x :static[int]) :Foo[x]` works
20:10:25*matlock joined #nim
20:11:34*sentreen_ joined #nim
20:12:03*sentreen_ quit (Client Quit)
20:15:49*hoek joined #nim
20:15:50*konradmb quit (Read error: Connection reset by peer)
20:16:41*konradmb joined #nim
20:18:48*sentreen_ joined #nim
20:19:41*vr0n quit (Ping timeout: 258 seconds)
20:20:23*msmorgan joined #nim
20:20:28*dadada__ quit (Quit: leaving)
20:24:32*LyndsySimon joined #nim
20:27:58*sirn joined #nim
20:29:56FromDiscord<Clyybber> awr1: But you are writing x: 3
20:30:11*konradmb quit (Read error: Connection reset by peer)
20:30:22*konradmb joined #nim
20:30:47*d10n-work joined #nim
20:30:53*konradmb2 joined #nim
20:31:05FromDiscord<Clyybber> Because specializations of static[int] are literals
20:31:07FromDiscord<Clyybber> not types
20:33:33FromDiscord<Clyybber> This works: https://play.nim-lang.org/#ix=2rdB
20:33:48*marnix quit (Remote host closed the connection)
20:35:01*konradmb quit (Ping timeout: 264 seconds)
20:38:47*r4vi joined #nim
20:40:29*npgm joined #nim
20:45:05*sentreen_ quit (Quit: sentreen_)
20:46:20FromGitter<awr1> ahhhh
20:46:21FromGitter<awr1> i see
20:46:55*mathsaey joined #nim
20:47:07*konradmb2 quit (Quit: Leaving)
21:02:23*mathsaey quit (Quit: mathsaey)
21:02:41*mathsaey joined #nim
21:07:03*mathsaey quit (Client Quit)
21:07:22*mathsaey joined #nim
21:13:50*liblq-dev joined #nim
21:14:23*liblq-dev quit (Client Quit)
21:26:49FromDiscord<Varriount> Hm, anyone have a snippet of Nim code demonstrating how to loop over fields in a type and get a pragma value for each field?
21:27:56FromDiscord<Varriount> I know there's a way to get a field's pragma in the macros library, however I don't see how to combine it with looping over each field.
21:28:59FromDiscord<lqdev> well, each field in an object definition is an nnkIdentDefs
21:29:44FromDiscord<lqdev> not sure how pragma syntax affects that, but the general AST is `nnkIdentDefs(field0, field1, …, type, [defaultValue])`
21:30:55FromDiscord<lqdev> seems like each `field` gets wrapped in an nnkPragmaExpr
21:31:15FromDiscord<lqdev> @Varriount I'm not exactly sure what AST you have
21:31:22FromDiscord<lqdev> can you give an example?
21:31:51FromDiscord<Vindaar> @Varriount for example: https://github.com/LemonBoy/jstin/blob/master/src/jstin.nim#L216-L229
21:33:26FromDiscord<Vindaar> note that the current `hasCustomPragma` code is a little broken for certain nested types
21:33:45FromDiscord<Varriount> Vindaar: Not to mention certain expressions. It's very brittle.
21:34:25FromDiscord<Vindaar> hence this was never finished: https://github.com/nim-lang/Nim/pull/11416
21:34:26disbot`doNotSerialize`, `jsonName` pragmas for JSON serialization closes #8104, #10718, also fixes #11415 ; snippet at 12https://play.nim-lang.org/#ix=24Gg
21:34:57FromDiscord<Varriount> The problem is that there's inherent ambiguity in some expressions. Does `foo.bar` refer to the pragma attached to the type of `bar`, or the pragma attached to the field `bar`?
21:35:27FromDiscord<Vindaar> but hopefully this is merged soon: https://github.com/nim-lang/Nim/pull/11526
21:35:28disbotgetCustomPragma is split up in more usable chunks
21:35:48FromDiscord<Varriount> Yeah, that looked promising. I really liked krux02's work there.
21:36:14FromDiscord<Vindaar> yep
21:37:02FromDiscord<Varriount> By the way, I don't suppose a field's pragma can come after the type, can it?
21:37:16FromDiscord<Varriount> (like Go's field annotations)
21:37:31FromDiscord<Vindaar> not familiar with go. what o
21:37:32FromDiscord<lqdev> nope
21:37:39FromDiscord<Vindaar> *do you mean
21:38:12FromGitter<timotheecour> see jsonutils.toJson,fromJson which allows custom serialization
21:38:26FromDiscord<Varriount> type Foo = object ; fooField: int {. pragmas .}
21:39:26FromDiscord<lqdev> not possible
21:39:28FromDiscord<lqdev> invalid indentation
21:40:28FromDiscord<Varriount> Although... I don't suppose generic templates can take a expression through a generic parameter?
21:40:39FromDiscord<Varriount> Thanks @timotheecour
21:41:57FromDiscord<Vindaar> @timotheecour completely missed that pr. nice work!
21:44:55krux02@Varriount, @Vindaar: that PR is finished.
21:45:24FromDiscord<Vindaar> @krux02 I'm aware of that
21:46:03krux02I think it is some personal issues that this PR isn't merged yet.
21:46:13shashlickthis is bizarre - i added a static[string] param to my macro and the value doesn't come through
21:46:23shashlickis it too many or something?
21:48:02shashlickugh, sometimes you should pre-emptively kick your own ass first just in case
21:49:49FromDiscord<Varriount> Hm. I don't suppose there's an easier way to associate compile-time values with a structure, other than through a pragma?
21:50:49*audiophile joined #nim
21:51:53*solitudesf quit (Ping timeout: 246 seconds)
21:54:51*tane quit (Quit: Leaving)
22:15:36*vr0n joined #nim
22:39:38*fredrikhr joined #nim
22:44:31*endragor joined #nim
22:49:25*endragor quit (Ping timeout: 264 seconds)
22:59:15FromDiscord<me2beats> no built-in sap?
22:59:20FromDiscord<me2beats> (edit) 'sap?' => 'swap?'
23:01:30FromDiscord<Rika> ?
23:01:31FromDiscord<me2beats> ah, there's swap()
23:02:33FromDiscord<me2beats> but only 2 args?
23:02:48FromDiscord<Rika> yeah, how would a three way swap work?
23:03:05FromDiscord<me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2rec
23:03:15FromDiscord<Rika> then you havent really swapped b have you?
23:03:19FromDiscord<Rika> swap a, c
23:04:19FromDiscord<me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2red
23:04:28FromDiscord<me2beats> (edit) 'https://play.nim-lang.org/#ix=2red' => 'https://play.nim-lang.org/#ix=2ree'
23:04:51FromDiscord<Elegant Beef> but all you did was swap a/d and b/c
23:05:03FromDiscord<Rika> swap a, d; swap b, c↵wouldnt 4 way swap be ambiguous between a lot of permutations of a b c and d
23:05:10FromDiscord<Elegant Beef> yes
23:05:17FromDiscord<me2beats> maybe
23:05:35FromDiscord<Rika> sent a long message, see http://ix.io/2ref
23:06:19FromDiscord<Rika> saying "swap" for 4 elements would be ambiguous between people
23:06:22FromDiscord<Elegant Beef> 4! different permuutations isnt it?
23:06:35FromDiscord<Rika> swap for 2 elements is always the same no matter who you ask
23:06:45FromDiscord<Rika> @Elegant Beef minus 1
23:06:55FromDiscord<Elegant Beef> ah yea cause dont want default position
23:07:05FromDiscord<Rika> anyway
23:07:21FromDiscord<Elegant Beef> Just implement a RNG to choose which permutation 😄
23:07:41FromDiscord<Rika> afaik you can always do `(a, b, c, d) = (d, c, b, a)` anyway assuming theyre all the same type and are all variable
23:08:01FromDiscord<Elegant Beef> Well they have to be variables/same type for swap
23:08:33FromDiscord<Rika> !eval var (a, b, c, d) = (1,2,3,4); (a,b,c,d) = (d, c, b, a); echo a, b, c, d
23:08:36NimBot4321
23:08:46FromDiscord<Rika> there 😛
23:09:01FromDiscord<Elegant Beef> Tuple packing/unpacking might be more expensive than a swap, but idk
23:09:04FromDiscord<Rika> i dont know the
23:09:05FromDiscord<Rika> yeah
23:09:24FromDiscord<Rika> might be optimized out by the nim/c compiler though
23:09:45FromDiscord<Elegant Beef> I imagine since it's doing the exact thing swap attempts to avoid it's going to be less performant
23:09:53FromDiscord<Elegant Beef> But we're talking negligably such
23:10:08FromDiscord<Elegant Beef> Unless you're using this 1 bazillion times
23:10:17FromDiscord<Rika> likely at the magnitude of millions of these would see a benefit/loss
23:10:28FromDiscord<Rika> as it says, its useful for sorting algos
23:10:33FromDiscord<Elegant Beef> yea
23:10:38FromDiscord<Rika> since you are doing millions of these
23:10:46FromDiscord<Rika> but otherwise it's fine to use the tuple style
23:10:57FromDiscord<Elegant Beef> Indeed
23:11:07FromDiscord<Rika> likely only doing 10 of them per second or under that even
23:18:19*endragor joined #nim
23:18:36FromDiscord<me2beats> is there something like echos (space), echot (tab)
23:18:55FromDiscord<me2beats> echos(1,2)↵1 2
23:19:36FromDiscord<me2beats> (edit) 'echos(1,2)↵1 2' => 'sent a code paste, see https://play.nim-lang.org/#ix=2reh'
23:20:55FromDiscord<me2beats> (edit) 'https://play.nim-lang.org/#ix=2reh' => 'https://play.nim-lang.org/#ix=2rej'
23:21:47FromDiscord<Elegant Beef> https://play.nim-lang.org/#ix=2rek
23:22:08FromDiscord<Elegant Beef> can easily make those procs
23:22:52*endragor quit (Ping timeout: 246 seconds)
23:23:27shashlick```https://play.nim-lang.org/#ix=2rel```
23:23:54FromDiscord<Elegant Beef> damn youbeat me 😄
23:24:43FromDiscord<Rika> where's echos and echot from?
23:24:59FromDiscord<Elegant Beef> probably `prints` and `printt` or something like that from py
23:25:26FromDiscord<me2beats> prints and printt are in gdscript (godot engine)
23:26:22*fredrikhr quit (Ping timeout: 246 seconds)
23:26:54FromDiscord<Elegant Beef> Ewweey 😄
23:26:56*krux02_ joined #nim
23:28:34FromDiscord<Elegant Beef> Also what's the benefit of using a template over proc there shashlick?
23:28:54shashlickno function call?
23:28:59FromDiscord<Elegant Beef> Ah
23:29:41shashlickdoesn't make a drastic difference here but oh well
23:29:52*krux02 quit (Ping timeout: 256 seconds)
23:30:30FromDiscord<juan_carlos> Question about iterator and where close() ?: https://play.nim-lang.org/#ix=2ren
23:30:43*mathsaey quit (Quit: mathsaey)
23:30:59FromDiscord<Elegant Beef> Havent wrote one but shouldnt it close after the for loop?
23:34:42*mathsaey joined #nim
23:36:19FromDiscord<juan_carlos> It must be after all the body of the iterator it seems, the last iteration passes thru the yields and closes stuff.
23:37:17*nikita` quit (Quit: leaving)
23:45:54FromDiscord<Rika> after the for loop yes
23:50:10*mathsaey quit (Quit: mathsaey)
23:50:18FromDiscord<me2beats> why do I need to cover all `cases`?
23:51:39FromDiscord<me2beats> i mean would it be nice to have implicit `else: discard` in `case`
23:51:54FromDiscord<impbox> So you don't leave one off by accident
23:52:02FromDiscord<impbox> It's handy
23:52:33FromDiscord<impbox> Though I'm not a fan of the error for including else when you have covered all cases
23:55:28FromDiscord<impbox> well I like it, but I would like a way to say that it's ok
23:57:55FromDiscord<Rika> warning would be better imo
23:57:57FromDiscord<me2beats> I'm a noob↵but I think this will be often thing that I will need to write `else: discard`↵so I thought maybe it would ge handy to have it by default unless user specify it
23:58:01FromDiscord<Rika> for else w/ all cases covered
23:58:20FromDiscord<impbox> @Rika yeah I think so
23:58:30FromDiscord<me2beats> (edit) 'specify' => 'specifies'
23:58:45FromDiscord<impbox> @me2beats you'll miss it if it wasn't the default behaviour i think when you're wondering why something doesn't work