00:04:09 | * | Senketsu quit (Ping timeout: 272 seconds) |
00:04:10 | FromGitter | <Knaque> Ah, I see now. Thanks. |
00:06:14 | FromDiscord | <Recruit_main707> Is the guy of raylib forever in the server? |
00:24:29 | FromDiscord | <Zachary Carter> who is the guy of raylib |
00:29:43 | FromDiscord | <Zed> https://github.com/Guevara-chan/Raylib-Forever |
00:29:48 | FromDiscord | <Zed> this @Recruit_main707 ? |
00:36:53 | FromDiscord | <Zachary Carter> ah |
00:40:37 | * | audiophile quit (Quit: Default Quit Message) |
00:49:34 | dadada | anything in stdnim that executes a process and calls a afterProc as soon as the process is done? |
00:51:29 | FromDiscord | <Elegant Beef> The execProcesses does if you mean system procs |
00:51:52 | FromDiscord | <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:31 | FromDiscord | <Varriount> @Zachary Carter How would you recommend using NPeg with binary data? |
02:13:09 | FromDiscord | <Varriount> I'm wondering if it's feasible to parse exe/DLLs with it. |
02:14:31 | FromDiscord | <Zachary Carter> I'm not really sure... |
02:18:28 | FromDiscord | <Zachary Carter> maybe something like this would help - http://blog.paracode.com/2013/04/24/parsing-binary-data-with-node-dot-js/ ? |
02:18:52 | FromDiscord | <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:14 | FromDiscord | <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:59 | FromDiscord | <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:33 | leorize | !package nesm |
02:44:34 | disbot | disruptek hung like rhinocerous🦏 |
02:44:43 | leorize | lol |
02:51:36 | shashlick | @leorize - got isLoaded() working |
02:51:58 | shashlick | got time for a review? |
02:53:34 | leorize[m] | sure |
02:54:08 | * | rockcavera quit (Remote host closed the connection) |
03:01:22 | shashlick | okay creating a branch |
03:07:51 | shashlick | @leorize - https://github.com/genotrance/lazylib/compare/isloaded |
03:16:02 | leorize | why is ProcInfo a ref object? |
03:16:41 | shashlick | lets just say i didn't know how to add a new entry to the table |
03:16:58 | shashlick | ProcInfo() i guess |
03:17:09 | leorize | table.add key, ProcInfo() |
03:17:16 | leorize | why TableRef though? |
03:18:51 | shashlick | no special reason - just used to using refs but for one instance, no good reason |
03:20:30 | shashlick | changing as we go, keep it coming |
03:22:02 | shashlick | removed all refs |
03:26:22 | leorize | I think this is pretty much as good as it gets |
03:26:33 | leorize | you might want to hide some symbols, like lazyRegister away though |
03:26:48 | leorize | bindSym them when you need them |
03:26:49 | shashlick | I thought of that |
03:27:08 | shashlick | But they are in the caller's code |
03:27:16 | shashlick | It has to be exported no? |
03:27:26 | leorize | bindSym helps you with that |
03:27:41 | leorize | it bound the symbol in the macro scope |
03:27:50 | shashlick | I see, makes sense |
03:27:57 | shashlick | Then none of these need to be exported |
03:28:07 | shashlick | Just the pragma and isLoaded |
03:28:47 | * | vr0n joined #nim |
03:36:02 | * | nkoz quit (Ping timeout: 272 seconds) |
03:40:29 | shashlick | @interesting - i hid all the implementation symbols - it still works without bindSym |
03:40:37 | shashlick | @leorize ^^ |
03:42:55 | shashlick | I 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:12 | shashlick | i'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:48 | shashlick | so 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:05 | shashlick | i don't see any easy way to make sure only one libz gets loaded if it is done that way |
04:28:21 | shashlick | @leorize - have merged isloaded and bumped to v0.3.0 |
04:28:30 | shashlick | also, candidates implementation is here - https://github.com/genotrance/lazylib/compare/candidates |
04:28:35 | shashlick | ptal 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:49 | FromGitter | <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:24 | Zevv | Varriount: NPeg can match seq[whatever] these days |
05:51:28 | * | marnix quit (Ping timeout: 246 seconds) |
05:51:40 | Zevv | but 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:06 | FromGitter | <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:29 | Zevv | It is freed at the application level, but not for the OS |
06:12:50 | Zevv | So the next time you'd need 800mb, it will be avialable to the app |
06:13:08 | Zevv | that's not a Nim issue, it's just the way memory management works at the application level |
06:13:25 | FromGitter | <tim-st> but numpy and python stay at 800mb |
06:14:08 | Zevv | do you have a small snippet to share? |
06:14:43 | FromGitter | <tim-st> `proc getCol(): Column = int64(20).repeat(100_000_000).asColumn` |
06:15:09 | FromGitter | <tim-st> where `asColumn` copies each int64 to an `Data` type which is 9byte object variant |
06:15:40 | FromGitter | <tim-st> these a value types |
06:17:12 | FromGitter | <tim-st> I tested it only on windows |
06:17:49 | FromGitter | <tim-st> and `Column` is just `seq[Data]` |
06:18:10 | Zevv | The data inside a seq is stored on the heap |
06:18:25 | Zevv | so if first your repeat() allocs 800 Mb at the start of the heap |
06:18:36 | Zevv | asColumn makes a copy that goes *after* that on the heap |
06:18:43 | Zevv | and the first part is freeed |
06:19:10 | * | Vladar joined #nim |
06:19:29 | FromGitter | <tim-st> but pythons [20] * 100_000_000 goes on heap, too? |
06:19:30 | Zevv | the details depend on the C library and the OS, but the heap arena is typically not returned to the os |
06:19:45 | Zevv | not sure about python I must admit |
06:20:05 | FromGitter | <tim-st> I dont think python has a better implementation than nim for this |
06:20:26 | Zevv | I don't think python would put this on the stack |
06:20:40 | FromGitter | <tim-st> I think this is a bug in nim (at least on windows) |
06:21:00 | Zevv | if you do think so, make a complete minimal runnable example and post an issue |
06:21:13 | Zevv | but I'm not surprised by what you're describing, that is typically how it works, also in C |
06:21:26 | FromGitter | <tim-st> ok, thanks, when I find more time, I will try to create a minimum example |
06:21:36 | Zevv | cool |
06:25:41 | FromGitter | <tim-st> hm, I remember, this is just how nim works: the largest amount that was ever allocated stays |
06:25:54 | Zevv | right. And that's because that is how C works |
06:25:54 | FromGitter | <tim-st> I think that was discussed before |
06:26:05 | Zevv | technically, that's not *really* true |
06:26:20 | Araq | well you can use --gc:orc -d:useMalloc and hope malloc returns memory back to the OS |
06:26:30 | Zevv | malloc will not. |
06:26:49 | Araq | it depends on the OS and the allocation sizes I think |
06:26:53 | Zevv | maybe on windows, I dont know. On *nix munmap() is the only way to go |
06:27:07 | Araq | free() can call munmap |
06:27:09 | FromGitter | <tim-st> but cpython should use C and windows os too |
06:27:16 | FromGitter | <tim-st> I compared it to this |
06:29:24 | Araq | as I said, please try --gc:arc -d:useMalloc |
06:29:36 | FromGitter | <tim-st> thanks, Aray, will try this |
06:30:06 | FromGitter | <tim-st> just checked it in python again: l = [20] * 100_000_000; l2 = [40] * 100_000_000 |
06:30:14 | FromGitter | <tim-st> memory is then at 1.5gb as expected |
06:30:32 | Zevv | but typically, your first allocations = A, the copy = B, you get "......" -> "AAA..." -> "AAABBB" -> "...BBB" |
06:30:35 | FromDiscord | <Varriount> Is narimiran on here somewhere? |
06:30:36 | FromGitter | <tim-st> when I make l = l2; memory goes immediately down to half |
06:30:42 | narimiran | he is |
06:31:29 | Zevv | tim-st: Maybe python does a mmap() allocation for huge chunks and munmaps() them |
06:32:10 | FromGitter | <tim-st> ok, I don't know how it works there, just to show that's not an C or windows issue |
06:32:32 | FromGitter | <tim-st> Araq: that doesn't compile because I have deepCopy in my code |
06:32:33 | narimiran | @Varriount is it about that alternative PR? :) |
06:32:40 | Zevv | tim-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:48 | Zevv | so that explains |
06:33:02 | Araq | Zevv: yes and malloc implementations tend to do the same |
06:33:37 | Araq | tim-st: please remove the deepCopy :-) |
06:34:22 | Zevv | Araq: true. |
06:34:48 | Zevv | but that will not always work with Nim because it will do the pooling itself. This -d:usemalloc might indeed do better here |
06:38:07 | FromGitter | <tim-st> Araq: it seems to work with `--gc:arc -d:useMalloc` |
06:38:25 | FromGitter | <tim-st> the memory changed very flexible and goes down again, as I wanted it |
06:38:35 | Zevv | \o/ |
06:38:45 | FromGitter | <tim-st> but deepCopy would be useful too :D |
06:38:52 | FromGitter | <tim-st> thanks for the help :) |
06:40:55 | FromGitter | <tim-st> `--gc:arc -d:useMalloc` doesnt work... it goes up to 3.2gb |
06:41:06 | FromGitter | <tim-st> I meant orc not arc |
06:41:08 | FromGitter | <tim-st> arc works |
06:44:37 | * | Tlanger joined #nim |
06:47:35 | * | Tongir quit (Ping timeout: 272 seconds) |
06:48:51 | FromGitter | <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:43 | FromGitter | <tim-st> it's the same result as --gc:none |
06:52:42 | * | marnix_ quit (Ping timeout: 256 seconds) |
06:53:01 | FromDiscord | <Varriount> tim-st: What memory metric are you using? Physical pages? Commited pages, etc? |
06:53:55 | FromGitter | <tim-st> I dont know I just allocate one seq inside a proc copy the values to a new return seq 2 |
06:54:02 | FromDiscord | <Varriount> @Zevv How would you recommend using NPeg to consume binary data? |
06:54:14 | FromDiscord | <Varriount> tim-st: I mean, how are you measuring memory usage? |
06:54:31 | FromGitter | <tim-st> just by looking at windows explorer ram usage |
06:55:44 | FromGitter | <tim-st> "task-manager" it's called |
06:57:56 | * | marnix joined #nim |
06:59:28 | FromGitter | <tim-st> it's a nim bug |
07:00:06 | FromGitter | <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:19 | FromGitter | <tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f056f3f86ccb45b5990943d] |
07:01:47 | FromGitter | <tim-st> ok, it was the wrong seq, sry |
07:03:49 | FromGitter | <tim-st> that's problematic, I will investigate further and open an issue when I found a good example |
07:05:51 | FromDiscord | <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:15 | FromDiscord | <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:10 | FromDiscord | <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:32 | FromDiscord | <Varriount> This is because a child type may be larger than the parent type. |
07:17:03 | FromGitter | <tim-st> here is an example with sample types from my problem above: https://play.nim-lang.org/#ix=2raR |
07:17:41 | FromDiscord | <Varriount> Also, casting is dangerous - it tells the compiler to just blindly treat one data type as another. |
07:19:01 | FromGitter | <tim-st> lol, the example code seems to work with arc and useMalloc, maybe it's only related to object variants |
07:19:58 | FromDiscord | <Varriount> @demotomohiro What are you trying to achieve overall? |
07:20:10 | * | Varriount left #nim (#nim) |
07:21:20 | FromDiscord | <demotomohiro> @Varriount Bar[Foo] is an extension of Foo and I just want to copy instance of Foo to Bar[Foo].Foo. |
07:22:04 | FromDiscord | <demotomohiro> I want to initialize Foo part of Bar[Foo] with given instance of Foo. |
07:25:29 | FromGitter | <tim-st> Araq: I finally have an minimum example showing the problem: https://play.nim-lang.org/#ix=2raS |
07:25:48 | FromGitter | <tim-st> while this one works fine: https://play.nim-lang.org/#ix=2raR |
07:26:04 | FromGitter | <tim-st> it seems object variants use either pointers to data insted of copy by value or just leak memory |
07:27:33 | FromDiscord | <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:31 | FromDiscord | <Varriount> I vaguely recall the compiler doing something like this though |
07:28:31 | FromDiscord | <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:16 | FromDiscord | <Varriount> Why not just inherit from FileHandleStream? |
07:31:07 | FromDiscord | <demotomohiro> Type of outputStream is different on Window and Linux. |
07:32:15 | FromDiscord | <demotomohiro> On windows, outputStream is osproc.FileHandleStream. On Linux, outputStream is streams.FileStream. |
07:32:43 | FromDiscord | <Varriount> This? https://nim-lang.org/docs/osproc.html#outputStream%2CProcess |
07:34:45 | FromDiscord | <demotomohiro> @Varriount I will try simpler way without generics.↵Thank you! |
07:35:34 | FromDiscord | <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:32 | FromDiscord | <demotomohiro> @Varriount Im studying how to fix this issue |
07:41:34 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/issues/14906 |
07:41:36 | disbot | ➥ Calling 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:23 | FromDiscord | <Varriount> @demotomohiro You can't peek a stream (or at least, not consistently) |
08:01:13 | FromDiscord | <Varriount> Or to rephrase, the concept of a stream doesn't inherently support peeking at data. |
08:07:05 | FromDiscord | <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:14 | FromDiscord | <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:16 | disbot | ➥ outputStream(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:17 | FromDiscord | <demotomohiro> At least, peek works with StringStream and FileStream, doesn't it? |
08:15:39 | * | nikita` joined #nim |
08:19:50 | FromGitter | <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:38 | FromDiscord | <Varriount> @demotomohiro What kind of protocol does neovim output? |
08:45:58 | FromDiscord | <demotomohiro> neovim use msgpack-rpc.↵https://github.com/msgpack-rpc/msgpack-rpc |
08:46:56 | FromDiscord | <Varriount> So why not read the appropriate msgpack data from the stream? |
08:50:40 | FromDiscord | <demotomohiro> I tried to controll neovim like this code:↵https://github.com/jangko/msgpack4nim/issues/58#issue-650859139 |
08:50:41 | disbot | ➥ outputStream(p: Process) in osproc in standard library cannot call peekChar ; snippet at 12https://play.nim-lang.org/#ix=2rb2 |
08:53:41 | FromDiscord | <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:41 | FromDiscord | <Varriount> @demotomohiro Do you know where bytestream is implemented? |
08:57:08 | FromDiscord | <Varriount> (in msgpack4nim) |
08:57:32 | FromDiscord | <Varriount> I can't seem to find it in that module, or the standard library |
09:00:39 | FromDiscord | <demotomohiro> I think ByteStream is just a generics argument name. |
09:01:00 | FromDiscord | <demotomohiro> https://github.com/jangko/msgpack4nim/blob/master/msgpack4nim.nim |
09:01:21 | FromDiscord | <--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:36 | FromDiscord | <Varriount> @demotomohiro Ah thanks, I didn't notice that |
09:03:06 | FromDiscord | <Varriount> @--HA-- I don't know if any others off hand, why do you ask? |
09:04:27 | FromDiscord | <Varriount> @demotomohiro I recommend implementing a stream type that takes another `Stream` type as an argument, and just maintains a buffer. |
09:05:21 | FromDiscord | <Varriount> All streams inherit from the same parent type, which defines the various procedures. |
09:08:23 | FromDiscord | <--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:32 | FromDiscord | <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:57 | FromDiscord | <Yardanico> @--HA-- use dimscord |
09:29:05 | FromDiscord | <Yardanico> discordnim is mostly abandoned |
09:29:35 | FromDiscord | <Yardanico> the bot (ircord) used to bridge this discord with IRC uses dimscord |
09:30:09 | FromDiscord | <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:14 | FromDiscord | <--HA--> @Yardanico thanks |
09:32:19 | * | xet7 quit (Quit: Leaving) |
09:33:12 | * | xet7 joined #nim |
09:33:25 | FromDiscord | <Yardanico> Although you should use devel version of dimscord (devel branch) |
09:33:38 | FromDiscord | <Yardanico> Also its creator is here - @KrispPurg |
09:37:25 | FromDiscord | <demotomohiro> @Varriount I got to go.↵Thank you for your help! |
09:45:00 | FromDiscord | <KrispPurg> Use the devel branch btw |
09:46:18 | FromDiscord | <KrispPurg> @--HA-- |
09:49:03 | FromDiscord | <--HA--> Can I specify the development branch in a nimble file "requires" statement? |
09:49:03 | FromDiscord | <KrispPurg> O |
09:49:53 | FromDiscord | <KrispPurg> hm, not sure, but you can just simply install it |
09:51:05 | FromDiscord | <Recruit_main707> requires nim >= [version number] works iirc |
09:51:49 | FromDiscord | <KrispPurg> Oh yes, I think you need to provide "dimscord#devel" |
09:52:03 | FromDiscord | <KrispPurg> @--HA-- |
09:56:54 | FromDiscord | <--HA--> Seems to have worked. It said `Installing dimscord@#devel` |
10:01:03 | FromDiscord | <--HA--> How can I see which commit my local version is at? |
10:02:07 | FromDiscord | <Varriount> @--HA-- It's cloned like a regular git repository |
10:02:45 | * | ftsf quit (Quit: Leaving) |
10:03:05 | FromDiscord | <--HA--> And if eventuall my version is behind the github one, will running nimble install again update it? |
10:09:30 | FromDiscord | <--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:42 | FromDiscord | <--HA--> for the on_ready handler |
10:10:42 | FromDiscord | <lqdev> you need to annotate your proc with {.async.} |
10:13:01 | FromDiscord | <--HA--> Oh my bad, I should use the readme from the devel branch |
10:27:36 | FromDiscord | <--HA--> All works now. Thanks. |
10:27:48 | FromDiscord | <KrispPurg> np |
10:30:23 | Yardanico | arc and lent fixes raining down today :P |
10:53:00 | FromDiscord | <impbox> hmm is it possible to make nim compile to one big c file? |
10:56:06 | * | fanta1 quit (Quit: fanta1) |
11:02:49 | Yardanico | !status |
11:02:50 | FromDiscord | Uptime - 2 hours and 8 minutes |
11:11:05 | Yardanico | I 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:37 | FromDiscord | <Rika> doubt |
11:14:49 | Yardanico | wait |
11:15:02 | Yardanico | you can |
11:15:22 | Yardanico | only on devel though (need sugar module) |
11:15:25 | Yardanico | import sugar; echo ((x, y: int) => (x + y))(1, 3) |
11:15:28 | Yardanico | XD |
11:15:35 | Yardanico | or even |
11:15:47 | Yardanico | import sugar; let prc = (x, y: int) => (x + y); echo prc(1, 3) |
11:15:57 | Yardanico | damn nice |
11:15:58 | FromDiscord | <Rika> :7900\7896-*/9\ |
11:16:06 | narimiran | can't you do it without sugar? |
11:16:08 | Yardanico | narimiran: nah |
11:16:14 | Yardanico | I tried a few times with () and I couldn't do it |
11:16:15 | FromDiscord | <Rika> phone fell on keyboard |
11:16:21 | Yardanico | maybe with anonymous procs somehow |
11:16:24 | Yardanico | ah right |
11:16:24 | Yardanico | maybe |
11:16:46 | Yardanico | well maybe not |
11:17:05 | Yardanico | oh you're right! |
11:17:10 | Yardanico | let prc = (proc (x, y: int): int = x + y); echo prc(1, 3) |
11:17:16 | narimiran | what a rollercoaster! |
11:17:40 | Yardanico | !eval let prc = (proc (x, y: int): int = x + y); echo prc(1, 3) |
11:17:43 | NimBot | 4 |
11:18:36 | Yardanico | DAMN |
11:18:38 | Yardanico | !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:41 | NimBot | 8 |
11:18:48 | Yardanico | !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:51 | NimBot | 8 |
11:18:52 | Yardanico | XDDDD |
11:19:02 | FromDiscord | <Rika> lmao nice |
11:19:07 | Yardanico | we figured out the truth |
11:20:04 | Yardanico | now time to add "one-linefier" to nuglifier |
11:20:12 | Yardanico | if that's possible |
11:21:04 | Yardanico | need to try to convert some more complex nim program to one line |
11:21:37 | Yardanico | ah right types |
11:22:02 | Yardanico | can't put them on one line for "object" |
11:22:23 | FromDiscord | <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:26 | FromDiscord | <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:55 | leorize[m] | looks like your C code is not configured with the right os/cpu combination |
11:59:04 | FromDiscord | <impbox> I compiled my nim source with `--os:android --cpu:arm -d:androidNDK -d:android` |
11:59:19 | FromDiscord | <impbox> I agree... I'm not sure how to fix it |
11:59:33 | FromDiscord | <impbox> android builds do a whole lot of different architectures |
12:00:19 | leorize[m] | you might need a csources-style collection |
12:00:32 | leorize[m] | but can't gradle just call nim directly? |
12:01:03 | FromDiscord | <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:29 | FromDiscord | <impbox> doesn't seem like there's way to just build a single architecture either |
12:02:04 | FromDiscord | <impbox> (there probably is but I can't figure it out) |
12:04:27 | FromDiscord | <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:20 | FromDiscord | <impbox> hmm strangely I don't get the error when running gradle from android studio, but I do from command line =\ |
12:08:25 | FromDiscord | <impbox> nevermind, I do |
12:10:09 | * | abm joined #nim |
12:11:06 | * | nsf quit (Quit: WeeChat 2.8) |
12:14:06 | FromDiscord | <impbox> \o/ progress |
12:14:15 | FromDiscord | <impbox> i managed to limit my build to a single architecture |
12:59:19 | FromDiscord | <dom96> @impbox you need to compile to multiple architectures |
12:59:42 | FromDiscord | <dom96> I'm using this for Android Studio: https://gist.github.com/dom96/d91f806b1808a997b4e6f4b6ddfce13f |
12:59:51 | FromDiscord | <dom96> Line 27 is the magic |
13:00:08 | FromDiscord | <dom96> and I do `nim c --cpu:arm64`, `nim c --cpu:amd64` etc. |
13:14:09 | FromDiscord | <impbox> @dom96 thanks |
13:15:24 | FromDiscord | <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:50 | FromDiscord | <impbox> trying to get nico android builds nice and mostly automated |
13:22:57 | FromDiscord | <impbox> hopefully only need to do it once >_> |
13:23:03 | FromDiscord | <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:50 | FromDiscord | <--HA--> How can I listen for messages on a udp socket? This is what I got so far https://pastebin.com/P3i8ZeQd |
13:46:31 | FromDiscord | <--HA--> The program blocks but when I send something to that udp port with netcat nothing happens |
13:49:05 | FromDiscord | <impbox> @--HA-- do you need to bind first? |
13:49:22 | FromDiscord | <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:38 | FromDiscord | <flywind> https://media.discordapp.net/attachments/371759389889003532/730420583359184936/WNOY66CZT_Z3_Y5I.png |
13:50:44 | FromDiscord | <flywind> https://media.discordapp.net/attachments/371759389889003532/730420606922784858/TTKRMWMOGP6WPWEG.png |
13:50:49 | FromDiscord | <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:04 | FromDiscord | <--HA--> @impbox I didn't think so because it is udp, but I'm not sure. Adding bindAddr had no visible effect. |
13:57:56 | FromDiscord | <--HA--> The example in the "net" documentation for sendTo works but there is no example for udp receiving, only tcp. |
13:58:41 | FromDiscord | <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:43 | disbot | ➥ Segfault in create thread using channels with default GC ; snippet at 12https://play.nim-lang.org/#ix=2rbT |
13:58:52 | FromDiscord | <Yardanico> but yeah if you manage to minimise it you should still submit an issue |
13:59:05 | FromDiscord | <Zachary Carter> @--HA-- - if you read the top section of the `net` module |
13:59:11 | FromDiscord | <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:14 | FromDiscord | <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:35 | FromDiscord | <impbox> (ok maybe ignore me then) |
13:59:52 | FromDiscord | <Zachary Carter> I've never used non-blocking UDP sockets with Nim - I've used a library like enet instead |
14:00:04 | FromDiscord | <Zachary Carter> tmk Nim doesn't have support for non-blocking UDP sockets in the stdlib |
14:00:07 | FromDiscord | <Zachary Carter> but I could be wrong |
14:00:09 | * | Guest14215 quit (Ping timeout: 272 seconds) |
14:00:55 | FromGitter | <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:10 | FromDiscord | <Clyybber> @Yardanico Eh, seems kinda high priority; at least high priority as in getting arc ready |
14:01:21 | * | dadada__ joined #nim |
14:01:21 | FromDiscord | <Yardanico> was it an arc issue? |
14:01:31 | FromDiscord | <Clyybber> no, but I assume it doens't happen with arc |
14:01:36 | FromDiscord | <Yardanico> well yes |
14:01:51 | FromDiscord | <--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:16 | FromDiscord | <Yardanico> @--HA-- well the docs are clear I think 🙂 |
14:02:18 | FromDiscord | <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:27 | FromDiscord | <Yardanico> you really just recv |
14:02:46 | FromDiscord | <Yardanico> check recv here and recvs below it - https://nim-lang.org/docs/net.html#recv%2CSocket%2Cpointer%2Cint |
14:02:51 | FromDiscord | <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:52 | disbot | ➥ [Blocked by upstream bug] Change Tensor backend to pointer+length ; snippet at 12https://play.nim-lang.org/#ix=2qDq |
14:03:20 | FromDiscord | <Yardanico> Well the first one https://github.com/mratsim/Arraymancer/issues/423 is probably due to new difference by arc |
14:03:22 | FromDiscord | <Yardanico> lemme find an issue about it |
14:03:22 | disbot | ➥ Arraymancer is bugged with gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2rbX |
14:03:36 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/14425 |
14:03:38 | disbot | ➥ [arc, destructors] Weird SIGSEGV with {.noinit.} pragma ; snippet at 12https://play.nim-lang.org/#ix=2rbY |
14:03:43 | FromDiscord | <Yardanico> it was when I tried to use arc with arraymancer |
14:04:32 | FromDiscord | <Yardanico> not sure if @mratsim saw that issue |
14:04:39 | FromDiscord | <konradmb> Hello |
14:04:43 | FromDiscord | <Yardanico> hi |
14:05:34 | FromDiscord | <Vindaar> interesting, I also didn't see that issue |
14:05:53 | FromDiscord | <konradmb> has anyone came across "could not import" problem when loading dlls with exe compiled with mingw? |
14:05:54 | FromDiscord | <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:05 | FromDiscord | <Yardanico> @konradmb that usually comes from incorrect bitness |
14:06:20 | FromDiscord | <Yardanico> e.g. your exe is 32bit and you're loading a 64-bit library or vice-versa |
14:06:22 | FromDiscord | <Clyybber> @Zachary Carter I think I saw an issue about that, but I can't find it :/ |
14:06:27 | FromDiscord | <Zachary Carter> hrm |
14:06:29 | FromDiscord | <Yardanico> try to compile with -d:nimDebugDlOpen |
14:06:33 | FromDiscord | <Yardanico> (edit) 'try to compile ... with' => 'try to compileyour program' |
14:06:38 | FromDiscord | <Yardanico> (edit) 'try to compile your program with -d:nimDebugDlOpen ... ' => 'try to compile your program with -d:nimDebugDlOpenand check the error' |
14:06:57 | FromDiscord | <Zachary Carter> It's not the end of the world - I can just explicitly invoke the destructor |
14:07:03 | FromDiscord | <Zachary Carter> or not declare the object in global scope |
14:07:14 | FromDiscord | <Zachary Carter> was just curious - thanks! |
14:07:33 | FromDiscord | <konradmb> @Yardanico Yes, I've checked bitness - it's correct |
14:07:41 | FromDiscord | <Yardanico> well that dll also might require some other dlls |
14:07:44 | FromDiscord | <Yardanico> which couldn't be found |
14:07:54 | FromDiscord | <konradmb> And -d:nimDebugDlOpen doesn't do anything on Windows |
14:08:19 | FromDiscord | <Yardanico> well it does on devel 🙂 |
14:08:25 | FromDiscord | <--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:40 | FromDiscord | <Yardanico> @--HA-- well, for UDP it's the same, you just don't need to connect |
14:08:47 | FromDiscord | <Yardanico> you can immediately start to send/receive data |
14:09:07 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/730425232120086579/unknown.png |
14:09:25 | FromDiscord | <konradmb> @Yardanico Oh, I haven't know that. I'll check it out |
14:09:30 | FromGitter | <alehander92> zachary |
14:09:37 | FromGitter | <alehander92> can i ask you stuff about c++ on offtopic |
14:09:58 | FromDiscord | <Yardanico> @konradmb see https://github.com/nim-lang/Nim/pull/13950 |
14:09:59 | disbot | ➥ added extended msg for failed library loads w/ incorrect DLL formats |
14:10:12 | FromDiscord | <Yardanico> you can even just cherry-pick this patch and add it to your stable stdlib 😄 |
14:10:48 | FromDiscord | <--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:08 | FromDiscord | <Yardanico> just use recv? |
14:11:40 | FromDiscord | <Zachary Carter> I will try to come up with a minimal example on my machine |
14:12:54 | FromDiscord | <--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:32 | FromDiscord | <Yardanico> well |
14:13:39 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rc2 |
14:13:45 | FromDiscord | <Yardanico> I just tested with `nc -ul -p 5555` |
14:13:54 | FromDiscord | <Zachary Carter> well nevermind haha |
14:14:03 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rc3 |
14:14:05 | FromDiscord | <Yardanico> and output in nim:↵```↵asfdasfasf↵``` |
14:14:16 | FromDiscord | <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:25 | FromDiscord | <Clyybber> > using netcat instead of socat :p |
14:14:33 | FromDiscord | <Yardanico> i rarely use it anyway 🙂 |
14:16:20 | * | fredrikhr quit (Ping timeout: 272 seconds) |
14:17:01 | * | muffindrake quit (Quit: muffindrake) |
14:17:43 | FromDiscord | <Yardanico> oh yeah, time to test new scoped arc with arraymancer 😛 |
14:17:50 | FromDiscord | <Yardanico> " Error: internal error: cannot inject destructors to node kind: nkAsmStmt" hehe |
14:18:06 | FromDiscord | <Clyybber> heh |
14:18:08 | FromDiscord | <mratsim> I don't use ASM in arraymancer |
14:18:14 | FromDiscord | <Yardanico> @mratsim laser does |
14:18:23 | FromDiscord | <Yardanico> /home/dian/Stuff/arctests/Arraymancer/src/laser/cpuinfo_x86.nim(11, 5) E |
14:18:41 | FromDiscord | <Yardanico> I guess it's optional so i'll remove it |
14:18:46 | FromDiscord | <Rika> "E" is that the whole thing? lmao |
14:18:47 | FromDiscord | <Yardanico> but need to open an issue |
14:18:48 | FromDiscord | <Yardanico> no |
14:18:53 | FromDiscord | <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:58 | FromDiscord | <Rika> thought it was a bug lol |
14:19:22 | FromDiscord | <konradmb> @Yardanico checked it out now on devel, still no additional info |
14:19:31 | FromDiscord | <Yardanico> really strange |
14:19:36 | FromDiscord | <Yardanico> are you sure the dll is in the same dir or in path? |
14:19:36 | FromDiscord | <konradmb> `could not import: glib_check_version` and that's all |
14:19:47 | FromDiscord | <Yardanico> ohhhhhh |
14:19:56 | FromDiscord | <Yardanico> you should've been more specific |
14:20:02 | FromDiscord | <Yardanico> this means that it loads the dll |
14:20:05 | FromDiscord | <Yardanico> but can't find the symbol in that dll |
14:20:21 | FromDiscord | <Yardanico> glib_check_version only exists since glib 2.6 |
14:20:26 | FromDiscord | <Clyybber> @Yardanico fixed |
14:20:30 | FromDiscord | <Yardanico> @Clyybber lol |
14:20:38 | FromDiscord | <Yardanico> @konradmb you should have newer gtk/glib DLLs |
14:20:41 | FromDiscord | <Yardanico> this ones seem too old |
14:20:44 | FromDiscord | <konradmb> yeah, but I've even checked it to be really sure that's its in the dll |
14:20:44 | FromDiscord | <Yardanico> (edit) 'this' => 'these' |
14:20:57 | FromDiscord | <konradmb> and the symbol is there |
14:21:52 | FromDiscord | <Vindaar> @Yardanico yep, that's another issue |
14:22:21 | FromDiscord | <Yardanico> ok now more interesting |
14:22:23 | FromDiscord | <Yardanico> Error: internal error: cannot inject destructors to node kind: nkParForStmt |
14:22:30 | FromDiscord | <Yardanico> (I added nodestroy to that cpuid proc) |
14:22:32 | FromDiscord | <Yardanico> (edit) '(I added nodestroy ... to' => '(I added nodestroypragma' |
14:22:37 | FromDiscord | <Vindaar> ah |
14:22:53 | FromDiscord | <Vindaar> was wondering how you got that |
14:22:57 | FromDiscord | <Yardanico> ? |
14:23:00 | FromDiscord | <Yardanico> latest devel |
14:23:37 | FromDiscord | <Clyybber> @Yardanico Can you try the same fix I just did, but for nkParForStmt? |
14:23:40 | FromDiscord | <Vindaar> sorry, I still type too slow, which can be confusing 😛 |
14:23:45 | FromDiscord | <Yardanico> @Clyybber lemme try |
14:24:27 | FromDiscord | <konradmb> @Yardanico wait, maybe not 😅 |
14:24:43 | FromDiscord | <konradmb> Wrong dll name hehe |
14:24:57 | FromDiscord | <konradmb> But it was generated with gintro… |
14:25:10 | FromDiscord | <Yardanico> ohh |
14:25:34 | FromDiscord | <konradmb> Anyway, thanks! I've compiled it with normal linking and it works |
14:25:51 | FromDiscord | <konradmb> (with passL and so on) |
14:26:00 | FromDiscord | <Yardanico> @Clyybber well now it at least compiled 😄 |
14:26:04 | FromDiscord | <Clyybber> :D |
14:26:42 | FromDiscord | <Vindaar> uhh, that's progress |
14:27:02 | FromDiscord | <Yardanico> after adding nodestroy to newTensor it passes whole two first checks~! |
14:27:03 | FromDiscord | <Yardanico> [Suite] Creating a new Tensor↵ [OK] Creating from sequence↵ [OK] Check that Tensor shape is in row-by-column order |
14:27:05 | FromDiscord | <Yardanico> and hangs |
14:27:21 | FromDiscord | <Vindaar> yay 😐 |
14:27:27 | FromDiscord | <Yardanico> well that's much better |
14:27:37 | FromDiscord | <Yardanico> ah |
14:27:39 | FromDiscord | <Yardanico> it's because i need more nodestroy |
14:27:46 | FromDiscord | <Yardanico> NODESTROYYY |
14:28:16 | FromDiscord | <Yardanico> now it passed 5 tests |
14:28:19 | FromDiscord | <Yardanico> sent a long message, see http://ix.io/2rc7 |
14:28:46 | FromDiscord | <Vindaar> wow, only about 20 more fixes and we're there 🤣 |
14:28:53 | FromDiscord | <Yardanico> 1 more passed |
14:29:34 | FromDiscord | <Vindaar> adding more and more nodestroys or doing something else? |
14:29:37 | FromDiscord | <Yardanico> yes |
14:29:41 | FromDiscord | <Yardanico> more nodestroys to noInit procs |
14:29:48 | FromDiscord | <Vindaar> 👍 |
14:29:49 | FromDiscord | <Yardanico> ok nice now it's an actual arc bug |
14:29:53 | FromDiscord | <Yardanico> /home/dian/Things/Nim/lib/system/avltree.nim(74) del↵SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
14:29:59 | FromDiscord | <Yardanico> that's much better |
14:30:30 | FromDiscord | <Yardanico> but really if I test individually quite a lot of tests pass |
14:30:31 | FromDiscord | <Yardanico> not all |
14:30:38 | FromDiscord | <Clyybber> maybe we should warn about using noInit if it would cause reads of uninit memory |
14:31:22 | FromDiscord | <Vindaar> shouldn't noinit just imply nodestroy for arc? |
14:31:24 | FromDiscord | <Yardanico> basically mratsim will have to add nodestroy to almost any noinit proc 😄 |
14:31:41 | FromDiscord | <Clyybber> @Vindaar Hmm, nodestroy is a bit of a sledgehammer |
14:31:49 | FromDiscord | <Clyybber> I would rather make it just work |
14:32:00 | FromDiscord | <Vindaar> ok, I'm pretty clueless here |
14:32:10 | FromDiscord | <Yardanico> @Clyybber well the issue is https://github.com/nim-lang/Nim/issues/14425 if you want to try |
14:32:11 | disbot | ➥ [arc, destructors] Weird SIGSEGV with {.noinit.} pragma ; snippet at 12https://play.nim-lang.org/#ix=2rbY |
14:32:41 | FromDiscord | <Clyybber> The issue is that we do firstWrite optimiziation only for sink and not for asgn |
14:32:51 | FromDiscord | <Clyybber> (edit) 'asgn' => 'copy' |
14:33:29 | FromDiscord | <--HA--> @Yardanico Thanks for the example. That just hangs on runtime for me with no output, I copy & pasted your code. |
14:33:38 | FromDiscord | <Yardanico> @--HA-- well you must send some data back to UDP |
14:33:43 | FromDiscord | <Yardanico> it "hangs" because it waits for a line |
14:34:27 | FromDiscord | <Clyybber> @Yardanico Try putting the nkParForStmt case to the nkForStmt case then |
14:34:33 | FromDiscord | <Yardanico> ? why |
14:34:37 | FromDiscord | <Yardanico> ah |
14:34:41 | FromDiscord | <Clyybber> :) |
14:34:50 | FromDiscord | <Yardanico> well idk if that would be more correct, but okay |
14:35:37 | FromDiscord | <Yardanico> wait there's no nkForStmt separately |
14:35:48 | FromDiscord | <--HA--> Using the same `nc -ul -p 5555` to send data nothing is received |
14:36:17 | FromDiscord | <Yardanico> look, you start netcat |
14:36:19 | FromDiscord | <Yardanico> start nim program |
14:36:23 | FromDiscord | <Yardanico> in netcat you'll see "status" |
14:36:24 | FromDiscord | <Clyybber> @Yardanico oh, right. eh, nkWhile then :p |
14:36:30 | FromDiscord | <Clyybber> but maybe you need to skip the condition |
14:36:31 | FromDiscord | <Yardanico> then in netcat you write something and press enter |
14:37:11 | FromDiscord | <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:44 | FromDiscord | <--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:04 | FromDiscord | <Yardanico> well, then something like |
14:45:10 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rce |
14:45:52 | * | maier quit (Ping timeout: 256 seconds) |
14:45:52 | FromDiscord | <Yardanico> if you want to receive from multiple clients efficiently you might want to use asyncnet though |
14:46:30 | FromDiscord | <Yardanico> and then for netcat |
14:46:36 | FromDiscord | <Yardanico> `nc -u 127.0.0.1 5555` |
14:46:46 | FromDiscord | <Yardanico> (edit) removed 'and then' | 'for ... netcatwith' => 'forthis example - start' | 'this example - startnetcat ... ' => 'this example - startnetcatwith' |
14:46:59 | FromDiscord | <Yardanico> and then as you write and press enter in netcat the nim program will display it |
14:47:49 | FromDiscord | <Yardanico> you can of course just use socket.recv(numberOfBytes) if you know them |
14:48:36 | FromDiscord | <impbox> \o/ got my android building working |
14:48:57 | FromDiscord | <impbox> can now make games for my phone |
14:49:14 | FromDiscord | <impbox> still need to figure out streaming audio files |
14:51:16 | FromDiscord | <--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:55 | FromDiscord | <konradmb> `--app:gui` is doing something on os different than Windows? |
14:53:14 | FromDiscord | <Yardanico> maybe on macos too? i don't really know |
14:54:09 | FromDiscord | <impbox> i don't like how --app:gui on windows stops the app logging errors to console |
14:54:19 | FromDiscord | <impbox> since you can't copy the errors from the messagebox |
14:56:36 | * | a_b_m joined #nim |
14:57:42 | Araq | you don't have to use --app:gui |
14:58:09 | FromDiscord | <konradmb> @impbox Isn't it the Windows feature that when you press ctrl+c, you copy all dialog contents? |
14:58:15 | Yardanico | i think it is |
14:58:15 | * | a__b__m joined #nim |
14:58:22 | FromDiscord | <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:32 | FromDiscord | <impbox> @konradmb oh i didn't know that |
14:58:37 | FromDiscord | <impbox> that helps somewhat =) |
14:58:37 | Yardanico | can't you not spawn a console without --app:gui ? |
14:59:10 | FromDiscord | <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:29 | Yardanico | well 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:39 | FromGitter | <awr1> if you have win10 you can use winkey + v to open clipboard history |
14:59:55 | FromDiscord | <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:02 | FromDiscord | <impbox> and see why they might be getting errors |
15:00:18 | FromDiscord | <konradmb> @impbox when I launch --app:gui in console I get error message in console and in dialog |
15:01:03 | FromDiscord | <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:43 | FromDiscord | <konradmb> @impbox https://media.discordapp.net/attachments/371759389889003532/730438471705165864/unknown.png |
15:01:44 | * | a_b_m quit (Ping timeout: 256 seconds) |
15:02:02 | Yardanico | well that's wine :) |
15:02:12 | FromDiscord | <impbox> hmm do you get a stacktrace? |
15:02:15 | FromDiscord | <impbox> in a debug build |
15:05:47 | FromDiscord | <konradmb> @impbox Well, no 😄 |
15:06:38 | * | sentreen quit (Quit: sentreen) |
15:06:53 | FromDiscord | <impbox> mmm i get nothing on terminal |
15:06:58 | * | sentreen joined #nim |
15:07:03 | FromDiscord | <impbox> but i can copy the stacktrace from the messagebox =) |
15:07:05 | FromDiscord | <impbox> so that's something |
15:07:25 | * | sentreen quit (Client Quit) |
15:07:28 | FromDiscord | <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:03 | FromDiscord | <Recruit_main707> can i cast an object to/from a seq/array of bytes?? |
15:25:25 | FromDiscord | <Recruit_main707> i know it would be ugly, but i want to see if it would be fast at least |
15:25:30 | FromDiscord | <impbox> pretty sure you can cast to anything |
15:25:39 | * | narimiran quit (Ping timeout: 272 seconds) |
15:25:59 | FromDiscord | <impbox> something line `cast[ptr UncheckedArray[uint8]](object.addr)` ? |
15:27:27 | * | sentreen quit (Client Quit) |
15:27:38 | * | lritter joined #nim |
15:28:56 | FromDiscord | <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:35 | FromDiscord | <Zachary Carter> it actually should be `cast[ptr UncheckedArray[uint8]](addr seq[0])` I think |
15:44:45 | FromDiscord | <Yardanico> yeah |
15:44:47 | FromDiscord | <impbox> if it's a seq |
15:45:03 | FromDiscord | <Zachary Carter> ah I thought Recruit was asking about a seq, my bad |
15:49:45 | FromDiscord | <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:39 | FromDiscord | <Shucks> ``` let jmpBack = cast[pointer](0x7FF667DB9F98)↵ asm """↵ push `jmpBack`↵ """``` |
17:01:56 | FromDiscord | <Shucks> shouldn't that work? says undefined reference to jmpback |
17:04:22 | * | Vladar joined #nim |
17:05:43 | * | endragor joined #nim |
17:05:48 | FromDiscord | <Recruit_main707> try with let jmpBack [.exportc.} |
17:06:03 | FromDiscord | <Recruit_main707> {.exportc.}* |
17:07:11 | FromDiscord | <Stuffe> does anyone know the progress of adding incremental compilation to nim? |
17:07:38 | FromDiscord | <Shucks> exportc didnt fixed it ;o |
17:08:42 | Yardanico | @Stuffe I think there wasn't any progress in a few months :) |
17:09:19 | FromDiscord | <Stuffe> ok i see |
17:09:21 | * | sentreen_ quit (Quit: sentreen_) |
17:09:37 | * | sentreen_ joined #nim |
17:10:46 | FromDiscord | <Recruit_main707> is it me or building with nimble is faster? |
17:11:20 | * | endragor quit (Ping timeout: 256 seconds) |
17:11:27 | Yardanico | time 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:48 | leorize[m] | @Stuffe ask disruptek |
18:38:26 | FromDiscord | <Varriount> Zevv: Are you around? |
18:38:50 | FromDiscord | <Varriount> loerize: You troublemaker ;) |
18:38:59 | FromDiscord | <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:51 | FromDiscord | <dawmarkir> is there a proc in stdlib that can normalize idents? |
19:14:52 | * | marnix quit (Ping timeout: 256 seconds) |
19:15:27 | FromDiscord | <dawmarkir> also, why does strutils.normalize's doc say "This should NOT be used to normalize Nim identifier names." |
19:17:08 | FromDiscord | <KingDarBoja> What do u mean by indents? |
19:17:10 | * | go|dfish quit (Ping timeout: 246 seconds) |
19:17:16 | FromDiscord | <KingDarBoja> Normalize indents* |
19:17:24 | * | Jesin quit (Quit: Leaving) |
19:24:04 | Yardanico | @dawmarkir well there is a way to COMPARE two idents |
19:24:05 | Yardanico | nim indents |
19:24:09 | Yardanico | see https://nim-lang.org/docs/macros.html#eqIdent%2Cstring%2Cstring |
19:25:36 | Zevv | varriount: zup |
19:25:42 | Yardanico | @Varriount ^ |
19:28:24 | FromDiscord | <lqdev> @dawmarkir strutils.normalize shouldn't be used because it doesn't take the first letter into account |
19:28:30 | FromDiscord | <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:05 | FromGitter | <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:06 | FromDiscord | <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:57 | FromDiscord | <Shucks> Just recognized that nim identifiers on `asm` can't be used with `masm=intel` |
19:41:58 | FromDiscord | <Shucks> hurray. |
19:44:43 | FromDiscord | <Varriount> Zevv: Is there a way to tell NPeg to repeat a pattern 'N' times, with 'N' being determined at match time? |
19:45:12 | FromDiscord | <Varriount> I'm attempting to use it to parse some binary data, which contains things like length-prefixed strings |
19:45:45 | Yardanico | i think there was PMunch's macro for this binary too |
19:45:50 | Yardanico | i mean for binary parsing |
19:46:39 | FromDiscord | <Varriount> Yeah, but it doesn't have any examples, nor does it seem to have any looping/backtracking behavior. |
19:48:05 | FromDiscord | <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:34 | FromDiscord | <Varriount> I had "fun" yesterday going through the ECMA specification on the Common Language Runtime |
19:49:14 | FromDiscord | <Varriount> (It wasn't too bad, actually, there's just a lot of content) |
19:53:41 | * | go|dfish joined #nim |
19:54:06 | Zevv | Varriount: Nope |
19:54:19 | Zevv | unless you implement a snippet of nim to match that part |
19:55:39 | Zevv | actually there is no run-time looping in npeg. If you match something X times, it simple generates X times the match |
19:57:35 | FromGitter | <awr1> https://play.nim-lang.org/#ix=2rdt |
19:57:45 | FromGitter | <awr1> is there a reason this is breaking |
19:57:47 | FromGitter | <awr1> or is this a bug |
19:58:53 | * | Hotbees joined #nim |
19:58:58 | * | narimiran quit (Ping timeout: 272 seconds) |
19:59:05 | Zevv | T is a static number |
19:59:07 | Zevv | which is not a type |
19:59:27 | Zevv | you can't say proc bar(x: 3): Foo 3 = discard |
19:59:36 | Zevv | well you can *say* it, but it will not compile |
20:01:34 | FromGitter | <awr1> Foo[3] can still be valid |
20:02:13 | FromDiscord | <Rika> what? why? |
20:02:18 | FromDiscord | <Rika> 3 isnt a type though? |
20:02:26 | FromGitter | <awr1> https://nim-lang.org/docs/manual.html#special-types-static-t |
20:02:36 | FromGitter | <awr1> > Static params can also appear in the signatures of generic types |
20:02:52 | dadada__ | 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:07 | FromGitter | <awr1> the obvious use case is for vector and matrix-like types, as demonstrated in the manual |
20:03:24 | dadada__ | XChangeProperty is the interesting func there, I did something that was able to be compiled, but segfaults |
20:04:46 | FromDiscord | <Rika> awr1: only on generic types i assume |
20:04:51 | FromDiscord | <Rika> not in generic procs |
20:05:29 | FromGitter | <awr1> hm |
20:06:47 | FromGitter | <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:33 | FromGitter | <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:39 | FromDiscord | <Rika> prolly best |
20:10:06 | FromGitter | <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:56 | FromDiscord | <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:05 | FromDiscord | <Clyybber> Because specializations of static[int] are literals |
20:31:07 | FromDiscord | <Clyybber> not types |
20:33:33 | FromDiscord | <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:20 | FromGitter | <awr1> ahhhh |
20:46:21 | FromGitter | <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:49 | FromDiscord | <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:56 | FromDiscord | <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:59 | FromDiscord | <lqdev> well, each field in an object definition is an nnkIdentDefs |
21:29:44 | FromDiscord | <lqdev> not sure how pragma syntax affects that, but the general AST is `nnkIdentDefs(field0, field1, …, type, [defaultValue])` |
21:30:55 | FromDiscord | <lqdev> seems like each `field` gets wrapped in an nnkPragmaExpr |
21:31:15 | FromDiscord | <lqdev> @Varriount I'm not exactly sure what AST you have |
21:31:22 | FromDiscord | <lqdev> can you give an example? |
21:31:51 | FromDiscord | <Vindaar> @Varriount for example: https://github.com/LemonBoy/jstin/blob/master/src/jstin.nim#L216-L229 |
21:33:26 | FromDiscord | <Vindaar> note that the current `hasCustomPragma` code is a little broken for certain nested types |
21:33:45 | FromDiscord | <Varriount> Vindaar: Not to mention certain expressions. It's very brittle. |
21:34:25 | FromDiscord | <Vindaar> hence this was never finished: https://github.com/nim-lang/Nim/pull/11416 |
21:34:26 | disbot | ➥ `doNotSerialize`, `jsonName` pragmas for JSON serialization closes #8104, #10718, also fixes #11415 ; snippet at 12https://play.nim-lang.org/#ix=24Gg |
21:34:57 | FromDiscord | <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:27 | FromDiscord | <Vindaar> but hopefully this is merged soon: https://github.com/nim-lang/Nim/pull/11526 |
21:35:28 | disbot | ➥ getCustomPragma is split up in more usable chunks |
21:35:48 | FromDiscord | <Varriount> Yeah, that looked promising. I really liked krux02's work there. |
21:36:14 | FromDiscord | <Vindaar> yep |
21:37:02 | FromDiscord | <Varriount> By the way, I don't suppose a field's pragma can come after the type, can it? |
21:37:16 | FromDiscord | <Varriount> (like Go's field annotations) |
21:37:31 | FromDiscord | <Vindaar> not familiar with go. what o |
21:37:32 | FromDiscord | <lqdev> nope |
21:37:39 | FromDiscord | <Vindaar> *do you mean |
21:38:12 | FromGitter | <timotheecour> see jsonutils.toJson,fromJson which allows custom serialization |
21:38:26 | FromDiscord | <Varriount> type Foo = object ; fooField: int {. pragmas .} |
21:39:26 | FromDiscord | <lqdev> not possible |
21:39:28 | FromDiscord | <lqdev> invalid indentation |
21:40:28 | FromDiscord | <Varriount> Although... I don't suppose generic templates can take a expression through a generic parameter? |
21:40:39 | FromDiscord | <Varriount> Thanks @timotheecour |
21:41:57 | FromDiscord | <Vindaar> @timotheecour completely missed that pr. nice work! |
21:44:55 | krux02 | @Varriount, @Vindaar: that PR is finished. |
21:45:24 | FromDiscord | <Vindaar> @krux02 I'm aware of that |
21:46:03 | krux02 | I think it is some personal issues that this PR isn't merged yet. |
21:46:13 | shashlick | this is bizarre - i added a static[string] param to my macro and the value doesn't come through |
21:46:23 | shashlick | is it too many or something? |
21:48:02 | shashlick | ugh, sometimes you should pre-emptively kick your own ass first just in case |
21:49:49 | FromDiscord | <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:15 | FromDiscord | <me2beats> no built-in sap? |
22:59:20 | FromDiscord | <me2beats> (edit) 'sap?' => 'swap?' |
23:01:30 | FromDiscord | <Rika> ? |
23:01:31 | FromDiscord | <me2beats> ah, there's swap() |
23:02:33 | FromDiscord | <me2beats> but only 2 args? |
23:02:48 | FromDiscord | <Rika> yeah, how would a three way swap work? |
23:03:05 | FromDiscord | <me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2rec |
23:03:15 | FromDiscord | <Rika> then you havent really swapped b have you? |
23:03:19 | FromDiscord | <Rika> swap a, c |
23:04:19 | FromDiscord | <me2beats> sent a code paste, see https://play.nim-lang.org/#ix=2red |
23:04:28 | FromDiscord | <me2beats> (edit) 'https://play.nim-lang.org/#ix=2red' => 'https://play.nim-lang.org/#ix=2ree' |
23:04:51 | FromDiscord | <Elegant Beef> but all you did was swap a/d and b/c |
23:05:03 | FromDiscord | <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:10 | FromDiscord | <Elegant Beef> yes |
23:05:17 | FromDiscord | <me2beats> maybe |
23:05:35 | FromDiscord | <Rika> sent a long message, see http://ix.io/2ref |
23:06:19 | FromDiscord | <Rika> saying "swap" for 4 elements would be ambiguous between people |
23:06:22 | FromDiscord | <Elegant Beef> 4! different permuutations isnt it? |
23:06:35 | FromDiscord | <Rika> swap for 2 elements is always the same no matter who you ask |
23:06:45 | FromDiscord | <Rika> @Elegant Beef minus 1 |
23:06:55 | FromDiscord | <Elegant Beef> ah yea cause dont want default position |
23:07:05 | FromDiscord | <Rika> anyway |
23:07:21 | FromDiscord | <Elegant Beef> Just implement a RNG to choose which permutation 😄 |
23:07:41 | FromDiscord | <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:01 | FromDiscord | <Elegant Beef> Well they have to be variables/same type for swap |
23:08:33 | FromDiscord | <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:36 | NimBot | 4321 |
23:08:46 | FromDiscord | <Rika> there 😛 |
23:09:01 | FromDiscord | <Elegant Beef> Tuple packing/unpacking might be more expensive than a swap, but idk |
23:09:04 | FromDiscord | <Rika> i dont know the |
23:09:05 | FromDiscord | <Rika> yeah |
23:09:24 | FromDiscord | <Rika> might be optimized out by the nim/c compiler though |
23:09:45 | FromDiscord | <Elegant Beef> I imagine since it's doing the exact thing swap attempts to avoid it's going to be less performant |
23:09:53 | FromDiscord | <Elegant Beef> But we're talking negligably such |
23:10:08 | FromDiscord | <Elegant Beef> Unless you're using this 1 bazillion times |
23:10:17 | FromDiscord | <Rika> likely at the magnitude of millions of these would see a benefit/loss |
23:10:28 | FromDiscord | <Rika> as it says, its useful for sorting algos |
23:10:33 | FromDiscord | <Elegant Beef> yea |
23:10:38 | FromDiscord | <Rika> since you are doing millions of these |
23:10:46 | FromDiscord | <Rika> but otherwise it's fine to use the tuple style |
23:10:57 | FromDiscord | <Elegant Beef> Indeed |
23:11:07 | FromDiscord | <Rika> likely only doing 10 of them per second or under that even |
23:18:19 | * | endragor joined #nim |
23:18:36 | FromDiscord | <me2beats> is there something like echos (space), echot (tab) |
23:18:55 | FromDiscord | <me2beats> echos(1,2)↵1 2 |
23:19:36 | FromDiscord | <me2beats> (edit) 'echos(1,2)↵1 2' => 'sent a code paste, see https://play.nim-lang.org/#ix=2reh' |
23:20:55 | FromDiscord | <me2beats> (edit) 'https://play.nim-lang.org/#ix=2reh' => 'https://play.nim-lang.org/#ix=2rej' |
23:21:47 | FromDiscord | <Elegant Beef> https://play.nim-lang.org/#ix=2rek |
23:22:08 | FromDiscord | <Elegant Beef> can easily make those procs |
23:22:52 | * | endragor quit (Ping timeout: 246 seconds) |
23:23:27 | shashlick | ```https://play.nim-lang.org/#ix=2rel``` |
23:23:54 | FromDiscord | <Elegant Beef> damn youbeat me 😄 |
23:24:43 | FromDiscord | <Rika> where's echos and echot from? |
23:24:59 | FromDiscord | <Elegant Beef> probably `prints` and `printt` or something like that from py |
23:25:26 | FromDiscord | <me2beats> prints and printt are in gdscript (godot engine) |
23:26:22 | * | fredrikhr quit (Ping timeout: 246 seconds) |
23:26:54 | FromDiscord | <Elegant Beef> Ewweey 😄 |
23:26:56 | * | krux02_ joined #nim |
23:28:34 | FromDiscord | <Elegant Beef> Also what's the benefit of using a template over proc there shashlick? |
23:28:54 | shashlick | no function call? |
23:28:59 | FromDiscord | <Elegant Beef> Ah |
23:29:41 | shashlick | doesn't make a drastic difference here but oh well |
23:29:52 | * | krux02 quit (Ping timeout: 256 seconds) |
23:30:30 | FromDiscord | <juan_carlos> Question about iterator and where close() ?: https://play.nim-lang.org/#ix=2ren |
23:30:43 | * | mathsaey quit (Quit: mathsaey) |
23:30:59 | FromDiscord | <Elegant Beef> Havent wrote one but shouldnt it close after the for loop? |
23:34:42 | * | mathsaey joined #nim |
23:36:19 | FromDiscord | <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:54 | FromDiscord | <Rika> after the for loop yes |
23:50:10 | * | mathsaey quit (Quit: mathsaey) |
23:50:18 | FromDiscord | <me2beats> why do I need to cover all `cases`? |
23:51:39 | FromDiscord | <me2beats> i mean would it be nice to have implicit `else: discard` in `case` |
23:51:54 | FromDiscord | <impbox> So you don't leave one off by accident |
23:52:02 | FromDiscord | <impbox> It's handy |
23:52:33 | FromDiscord | <impbox> Though I'm not a fan of the error for including else when you have covered all cases |
23:55:28 | FromDiscord | <impbox> well I like it, but I would like a way to say that it's ok |
23:57:55 | FromDiscord | <Rika> warning would be better imo |
23:57:57 | FromDiscord | <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:01 | FromDiscord | <Rika> for else w/ all cases covered |
23:58:20 | FromDiscord | <impbox> @Rika yeah I think so |
23:58:30 | FromDiscord | <me2beats> (edit) 'specify' => 'specifies' |
23:58:45 | FromDiscord | <impbox> @me2beats you'll miss it if it wasn't the default behaviour i think when you're wondering why something doesn't work |