<< 02-04-2018 >>

00:31:28*sz0 joined #nim
00:37:29*shashlick1 quit (Quit: WeeChat 1.9.1)
00:37:49*shashlick1 joined #nim
00:43:48FromGitter<matrixbot> `petersjt014` Hi: ⏎ So I've just written my 1st thing in Nim (it almost works maybe) and I wanted to ask: Is there any way I can manage mutithreading by just saying 'call this recursive function to completion, and only use a max of X ram or Y threads' or something? ⏎ It can work out of order (just adding stuff), so I don't give a shite about locks for this situation (should make things easier I imagine).
00:51:23FromGitter<zacharycarter> look into threadpool?
00:51:29FromGitter<zacharycarter> short answer is no
00:51:41FromGitter<zacharycarter> nothing exists at that high of a level
00:55:17FromGitter<matrixbot> `petersjt014` yeah, thought so maybe. I have something recursive in bash that I tried to make mutitheaded
00:55:43FromGitter<matrixbot> `petersjt014` it's for parsing filesystems modeled as trees
00:56:02FromGitter<matrixbot> `petersjt014` I added something to it
00:56:18FromGitter<matrixbot> `petersjt014` a single `&`
00:56:37FromGitter<matrixbot> `petersjt014` the tree was 13 GB
00:59:42*Ven`` joined #nim
01:03:41FromGitter<matrixbot> `petersjt014` life became much harder for the next two hours
01:08:04FromGitter<matrixbot> `petersjt014` Now that I think about it, I could just daemonize conditionally
01:08:07FromGitter<matrixbot> `petersjt014` hmm
01:09:05FromDiscord<treeform> Is there a way to replace int with any numeric type in this func: `func pretty*(number: int): string = $number`
01:09:51*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:11:52FromDiscord<treeform> like `pretty*(number: (int, float, int8, int16, int32... )): string = $number` ?
01:13:14*S1tiSchu joined #nim
01:17:10*SitiSchu quit (Ping timeout: 264 seconds)
01:47:21*yunfan quit (Ping timeout: 240 seconds)
02:10:51FromGitter<Varriount> treeform: Use SomeInteger
02:12:36FromGitter<Varriount> petersjt: You can look into parallel and spawn: https://nim-lang.org/docs/manual.html#parallel-spawn
02:15:10FromGitter<matrixbot> `petersjt014` thanks, I will once I get the single-thread version working
02:18:48*gmpreussner quit (Ping timeout: 260 seconds)
02:21:09*gmpreussner joined #nim
02:28:05*gmpreussner quit (Ping timeout: 256 seconds)
02:29:09*gmpreussner joined #nim
02:36:09FromGitter<matrixbot> `petersjt014` erg, I'm getting an error with a source listed in `strfmt.nim` instead of my own code >_<
02:36:46FromGitter<matrixbot> `petersjt014` I'll see if I can post it without mangling the formatting
02:38:00FromGitter<matrixbot> `petersjt014` well the error itself is: ⏎ `~\.nimble\pkgs\strfmt-0.9.0\strfmt.nim(812, 10) Error: type mismatch: got (uint8, int literal(10))`
02:38:42FromGitter<matrixbot> `petersjt014` ```nim ⏎ import os, osproc, strfmt, strutils, typetraits ⏎ proc recur(hash: string, depth: int, peersnum: int): int = ⏎ ⏎ var (rl, _) = execCmdEx interp"ipfs refs $hash" ... [https://gitter.im/nim-lang/Nim?at=5ac197b2e3d0b1ff2c90284e]
02:39:23FromGitter<matrixbot> `petersjt014` I'm like 90% sure It's something I'm doing with string interp.
02:42:07FromGitter<matrixbot> `petersjt014` I can plop the rest of the error here if needed
02:43:51FromGitter<Varriount> Indentation got screwed up. :/
02:45:37FromGitter<matrixbot> `petersjt014` Hmm. one sec plox
02:45:58*michaeljordan joined #nim
02:50:25FromGitter<matrixbot> `petersjt014` https://pastebin.com/LWpJ4XBp
02:50:41*gmpreussner quit (Ping timeout: 248 seconds)
02:52:10*gmpreussner joined #nim
02:54:00FromGitter<Varriount> That compiles for me.
02:54:07*endragor joined #nim
02:54:24FromGitter<Varriount> When did you download/update your compiler?
02:55:00*endragor quit (Remote host closed the connection)
02:55:11FromGitter<matrixbot> `petersjt014` a few days ago
02:55:43FromGitter<matrixbot> `petersjt014` `version 0.11.2`
02:55:53FromGitter<Varriount> Hm, I have an older version, let me update.
02:56:10*endragor joined #nim
02:56:22FromGitter<matrixbot> `petersjt014` oh
02:56:48FromGitter<matrixbot> `petersjt014` `Copyright (c) 2006-2015`
02:56:48FromGitter<matrixbot> `petersjt014` hm
02:57:02FromGitter<Varriount> O_o
02:57:38FromGitter<matrixbot> `petersjt014` does nimble update nim itself?
02:59:39FromGitter<matrixbot> `petersjt014` or can I just swap out the files?
03:03:18FromGitter<matrixbot> `petersjt014` cuz it turns out I have 0.11.2 when at least 0.18.0 is available
03:03:23FromGitter<Varriount> Nimble doesn't update Nim, just non-stdlib packages.
03:03:35FromGitter<Varriount> Goodness that's old.
03:03:50FromGitter<matrixbot> `petersjt014` It's the version in my package manager
03:04:35FromGitter<matrixbot> `petersjt014` although it *is* a package manager running on Windows, so that's kinda notable I gouess
03:04:52FromGitter<Varriount> I just build Nim from source.
03:11:14FromGitter<matrixbot> `petersjt014` I'm gonna switch to choosenim--chocolatey's version hasn't been updated since 2015 :|
03:15:27*yunfan joined #nim
03:17:43FromGitter<matrixbot> `petersjt014` doesnt work :/
03:21:47FromGitter<matrixbot> `petersjt014` manual worked fine. whew
03:21:58FromGitter<matrixbot> `petersjt014` `Nim Compiler Version 0.18.0`
03:22:03FromGitter<matrixbot> `petersjt014` that feels realllly nice to see
03:22:57FromGitter<matrixbot> `petersjt014` and now it compiles :))
03:47:10*michaeljordan quit (Quit: Page closed)
03:47:54shashlick1petersjt014: what issue did you see with choosenim
03:57:21FromGitter<matrixbot> `petersjt014` there was something about c and nim not seeing the same architechture
03:58:03FromGitter<matrixbot> `petersjt014` I've closed the window w/ the error, soz :\
03:59:11FromGitter<matrixbot> `petersjt014` also I noticed that chosenim seems to only have i386
04:10:11shashlick1okay that's a known defect
04:12:14FromGitter<matrixbot> `petersjt014` good to know
04:12:33shashlick1https://github.com/dom96/choosenim/issues/16
04:18:21*sz0 quit (Quit: Connection closed for inactivity)
04:52:56*r3d9u11 joined #nim
05:02:04FromGitter<matrixbot> `petersjt014` well my thing works I think
05:02:41FromGitter<matrixbot> `petersjt014` problem is that I'm still not sure If it worked in bash cause the only way to verify would be manually
05:02:50FromGitter<matrixbot> `petersjt014` and my test file is 13GB
05:03:05FromGitter<matrixbot> `petersjt014` wait
05:03:12FromGitter<matrixbot> `petersjt014` nvm I'm dumb
05:03:26FromGitter<matrixbot> `petersjt014` gonna go find a smaller one
05:03:48*miran joined #nim
05:35:02FromGitter<matrixbot> `petersjt014` well, more progress. now it's a foreach loop that it won't compile due to.
05:35:08FromGitter<matrixbot> `petersjt014` https://pastebin.com/QahfdcYp
05:35:34FromGitter<matrixbot> `petersjt014` any notable oops?
05:46:46*SenasOzys quit (Read error: Connection reset by peer)
05:47:01*SenasOzys joined #nim
05:59:13*nsf joined #nim
05:59:57*SenasOzys quit (Ping timeout: 240 seconds)
06:01:00*r3d9u11 quit (Remote host closed the connection)
07:20:58*Arrrr joined #nim
07:20:59*Arrrr quit (Changing host)
07:20:59*Arrrr joined #nim
07:23:03*yglukhov quit (Read error: Connection reset by peer)
07:23:40*yglukhov joined #nim
07:33:35FromGitter<alehander42> ugh sometimes I just have to use methods/inheritance instead of adt-s
07:33:53FromGitter<alehander42> I had to convince myself for 5 mins :D
07:47:18FromGitter<matrixbot> `petersjt014` I was trying to do multithreaded recursion in bash before rewriting something in nim
07:47:25FromGitter<matrixbot> `petersjt014` if that's comprable-ish
07:47:46miran!eval echo -1 mod 4
07:47:48FromGitter<matrixbot> `petersjt014` though it was (is) the first thing in nim i've made, so maybe not
07:47:49NimBot-1
07:48:01miranwhy is this not 3?!
07:49:57miranbtw, petersjt014: if you connect matrix with irc (and not with gitter), your messages will pass directly, not via bot
07:53:03*Vladar joined #nim
07:53:18*petersjt014[m] joined #nim
07:54:01petersjt014[m]this the right one?
07:55:58*Trustable joined #nim
07:56:48miranit is
07:57:00petersjt014[m]cool
07:57:01miranpetersjt014[m]: now we can mention you much easier ;)
07:59:28petersjt014[m]since you seem to know a bit more, does anything about my pastebin'd prog above stick out as wrong? my compiler barfs on the for loop for some reason
08:03:58*gmpreussner quit (Ping timeout: 264 seconds)
08:04:53*gmpreussner joined #nim
08:05:16miranpetersjt014[m]: strfmt is some nimble package? why not use the built-in https://nim-lang.org/docs/strformat.html ?
08:08:23miranwhat do i need to pass as arguments to run this?
08:08:30petersjt014[m]I saw it at a glance somewhere and just used it, so I guess yes.
08:08:44miranoh, hash and int
08:09:07petersjt014[m]yeah, it's for parsing IPFS hashes
08:09:17petersjt014[m]or it's supposed to be
08:09:37miranif i comment out `leafcount` (at the end), it seems to work
08:10:42mirani have imported `strformat` and changed every `interp` with `fmt`- everything else works, but line 36 is a problem....
08:11:32petersjt014[m]hmm. then there's some minor thing that I changed that broke it since the paste..
08:12:00mirandeleting `len` there works
08:12:28miran...and i just realized that my stformat change doesn't print what it should :D :D
08:13:56miranevery `$var` needs to be changed to `{var}` to work as expected....
08:16:55miranpetersjt014[m]: changed everything and now i get "/bin/sh: ipfs: command not found" - i guess you will get more meaningful help from somebody else who uses ipfs....
08:17:47petersjt014[m]yeah maybe. but I do have an error that reads `lib\core\macros.nim(377, 1) Error: undeclared identifier: 'hashref'`
08:18:25petersjt014[m]does that need to be some predefined name like `result`?
08:22:59miranoh, i think i see what's going on
08:23:18miransee line 22
08:23:52miranyou have `$hashref`, and `hashref` is not defined
08:24:46miranthe only `hashref` is inside of a for loop - and that name is only available inside that loop
08:25:31petersjt014[m]oh
08:25:32petersjt014[m]whups
08:27:45petersjt014[m]scoping is a fun little snag. I'm gonna have to rearrange the thing's guts to fix that. not too bad at least
08:30:11petersjt014[m]if you're curious and want to see what it's supposed to do, this is the bash version I cooked up:
08:30:20petersjt014[m]https://pastebin.com/z023xQbx
08:31:31petersjt014[m]I'm like 80% sure it does what I want, but I wouldn't hesitate to try running a bash2nim prog over if If I find one
08:35:36*nvn joined #nim
08:42:55*arnetheduck_ joined #nim
08:42:55*arnetheduck quit (Read error: Connection reset by peer)
09:02:16*SenasOzys joined #nim
09:04:38Zevvhttp://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
09:06:59*nvn quit (Ping timeout: 260 seconds)
09:12:44*xkapastel quit (Quit: Connection closed for inactivity)
09:22:45*dddddd joined #nim
09:27:33ArrrrWhat's the best hack to compare two case objects?
09:28:34FromGitter<mratsim> @petersjt014 nice to see other people in crypto using Nim :)
09:28:57FromGitter<mratsim> @Arrrr, memcmp? :P
09:29:27ArrrrThanks again my friend.
09:39:48Araqsystem.equalMem
09:43:39FromGitter<mratsim> oh nice, I was looking for something like that.
09:46:09FromGitter<mratsim> Is there a memcmp that checks if a region is all 0.
09:53:23FromGitter<mratsim> doesn’t seem like it. Have to roll your own.
10:08:32*NimBot joined #nim
10:33:31*athenot joined #nim
10:36:22FromGitter<alehander42> is there a way to force a `ref` object arg fields to be not assigned to?
10:38:11FromGitter<alehander42> I was a bit suprised that if I do ⏎ ⏎ ```let z = A() ⏎ z.f()``` ⏎ ⏎ and `f is proc f*(a: A)` I can still modify its fields inside ( it makes sense but I somehow assumed I have to pass a var for that) [https://gitter.im/nim-lang/Nim?at=5ac2081392f5d62057856195]
10:43:05*miran quit (Ping timeout: 240 seconds)
10:44:16FromGitter<mratsim> Immutability in Nim is shallow
10:44:35FromGitter<mratsim> there are 2 threads in the forum and 2 requests on the tracker related I think
10:45:20FromGitter<mratsim> for ref*
10:49:57*yglukhov quit (Read error: Connection reset by peer)
10:50:31*yglukhov joined #nim
10:51:13FromGitter<mratsim> Some resources: 2013: https://forum.nim-lang.org/t/120#568 November: https://forum.nim-lang.org/t/3374, and closely related copy/memory safety: https://forum.nim-lang.org/t/3635#22673 https://forum.nim-lang.org/t/3663/2
11:00:44FromGitter<tim-st> Is there a builtin way to pack seq[enum] to string and back? I'm especially wondering if it's good to use runes if enum.high+1 >= 256 or if there's a better way that generates shorter strings
11:13:01*vlad1777d joined #nim
11:14:19FromGitter<tim-st> Here is my current code: https://pastebin.com/mpw6F9ks
11:25:34*vlad1777d quit (Ping timeout: 264 seconds)
11:26:48FromGitter<mratsim> I’m not to sure what you want to do but the proper way to use packed enum, as flags typical is set[YourEnum]
11:27:05FromGitter<tim-st> set doesnt keep order
11:28:15FromGitter<mratsim> Otherwise you can always roll your own bit vector like i do here to pack bool: https://github.com/numforge/number-theory/blob/e11ea81ae8aad7833468f1ffad953277f40c329b/src/primes.nim#L6-L15
11:29:53FromGitter<mratsim> be aware that usually it’s a time vs space tradeoff. unpacking less than word size costs CPU. In my case this is heavily outweighted by the benefits of keeping that in the L1 cache.
11:30:34FromGitter<tim-st> Thanks for your help. I want to use the seq[enum] as string key in rocksdb/leveldb
11:31:49FromGitter<tim-st> I think I cant have <= 256 different enum entries so I thought I needed something like a prefix code that shows how many bits follow like Rune does it. But when I use Rune for my enum the string size would be much longer :(
11:31:56FromGitter<mratsim> Note that I’ve wrapped rocksdb here if you didn’t see it: https://github.com/status-im/nim-rocksdb
11:32:34FromGitter<tim-st> Yes, I saw thank you. But I wasnt sure how to pack seq[enum] to key
11:32:40FromGitter<tim-st> (string key)
11:33:02FromGitter<mratsim> otherwise you can always use a hash function
11:33:28FromGitter<Vindaar> @tim-st if using a HashSet was fine, the sets module includes an OrderedSet though
11:33:38FromGitter<Vindaar> https://nim-lang.org/docs/sets.html#OrderedSet
11:34:15FromGitter<tim-st> @mratsim hm that could solve it, thanks :)
11:34:45FromGitter<tim-st> @Vindaar No, I need to know if I have multiple enums in it
11:35:18FromGitter<mratsim> there is a len: https://nim-lang.org/docs/sets.html#len,OrderedSet[A]
11:36:38FromGitter<tim-st> No, I meant @[T.t1, T.t2, T.t1, T.t2] should be packed/hashed without losing order and size so I can recreate it from database
11:37:35FromGitter<tim-st> I think your hashing idea could work, but than I still think of the algorithm to generate short strings (because enum with max(256) -> char is already minimal perfect hashing function)
11:38:00FromGitter<tim-st> that means a hashing function will always be worse if I have enum.high.ord > 256
11:38:13FromGitter<tim-st> because of this I asked if using rune is good
11:39:14FromGitter<mratsim> so basically your issue is that enum are limited to 256 entries? You could create your own custom enum type too
11:40:36FromGitter<tim-st> I didnt check if it's limited to 256, if so I would just use int, the problem remains if I have for example 300 different entries in a custom type
11:41:08FromGitter<tim-st> hm, it seems the Rune way for enum.ord > 256 is already the best
11:41:14FromGitter<tim-st> thanks, though :)
11:41:19FromGitter<mratsim> no problem
11:42:39*DarkArctic joined #nim
11:42:56TrustableHi, I need some advice: Which Nim type should I choose as equivalent to "unsigned char *"? I want to assign the bytes like an array: "myVar[0] = 255". My current solution is to use "cstring" and assign the bytes with "myVar[0] = 255.chr".
11:45:04*gokr joined #nim
11:48:14*user0 joined #nim
11:48:27*user0 is now known as user1101
11:52:08*leorize joined #nim
11:54:24FromGitter<zetashift> Isn't char already an alias for an unsigned 8bit int?
11:54:26Zevvvar a: array[0..100, uint8]?
11:55:50FromGitter<mratsim> there is cuchar for unsigned char compatibility with c
11:55:59FromGitter<mratsim> For pure Nim use “byte"
11:56:18user1101Would it be nice to have the whole C stdlib tucked into a module (for example, "stdc") in the standard? Just asking, I know Nim is not C.
11:56:28FromGitter<mratsim> import ansi_c
11:56:38TrustableI don't know the number of bytes so I can't specify an array size
11:56:55FromGitter<mratsim> use seq[byte] or ptrUncheckArray[byte]
11:57:07FromGitter<mratsim> ptr UncheckedArray[byte] sorry
11:58:21FromGitter<mratsim> UncheckedArray gives you the nice array syntax foo[10] but doesn’t restrit you concerning length, it works like any pointer
11:58:58FromGitter<mratsim> otherwise the simple ptr byte
11:58:59Zevvoh that's nice, new to me
11:59:53user1101>import ansi_c \nmratsim, was that for me by any chance?
12:00:08Trustableptr UncheckedArray[byte] works great for me, thank you mratsim
12:01:45Trustablebtw, maybe "UncheckedArray" should be added to the Nim manual
12:03:37FromGitter<mratsim> @user1101 yes ;)
12:04:02FromGitter<mratsim> @Trustable, i’m on the fence, it’s super useful, but since we don’t want to promote pointer usage … welll ..
12:05:22FromGitter<mratsim> @trustable also if you need some hex<-> byte conversion you can use this: https://github.com/status-im/byteutils
12:06:48*leorize quit (Ping timeout: 260 seconds)
12:07:43user1101mratsim, I cannot find any ansi_c module in the standard library?🤔
12:08:00FromGitter<Vindaar> @mratsim @Trustable especially because for almost all cases a `var seq[byte]` on the Nim side, which is handed to C using `addr(<the seq>[0])` works just as well, no? Only encountered a single case where I read data back from C which was given as a raw pointer where I used a cast to a `ptr UncheckedArray` so far
12:27:52*leorize joined #nim
12:30:19*Arrrr quit (Read error: Connection reset by peer)
12:33:05FromGitter<diegogub> @mratsim nim is really amazing, finally found a solution with a macro..https://gist.github.com/diegogub/dbaa265235d8f672c3644f09b2a1c679
12:35:07FromGitter<tim-st> @mratsim I checked it by interest and nim allows enums bigger than 256 (maybe max uint16 ?)
12:38:10*Snircle joined #nim
12:46:56Yardanicodiegogub: btw, your macro can be simplified a bit - https://gist.github.com/Yardanico/600572a7078a34291468877306eedf92
12:47:09YardanicoI mean you can use quote do instead of constructing all AST nodes by yourself :)
12:47:38Yardanicoand also if you pass some compile-time parameters to a macro it's really better to use `static[type]` instead of `type`
12:50:04FromGitter<tim-st> @ Yardanico I already asked this some time ago here and got no answer: Cant the compiler detect this automatically?
12:50:21Yardanicotim-st what exactly?
12:50:24FromGitter<tim-st> static[T] vs T and make it static if possible?
12:50:40FromGitter<tim-st> at least it is possible in theory
12:50:45Yardanicowell you may also just want to have these parameters as AST passed to a macro
12:50:56Yardanicoso this is the default
12:51:06FromGitter<diegogub> @Yardanico thank you for the review, I will check the new code.
12:51:20Yardanicodiegogub: it's not really a review, just a quick change to quote do :)
12:51:49Yardanicodiegogub: and yeah, don't forget you can just use "for event in events" in Nim
12:52:43Yardanicoand actually you can merge these two "for event in events" loops
12:53:06Yardanicoyeah, that's much better
12:53:16Yardanico(code looks shorter :P )
12:53:48YardanicoI updated the gist
12:54:18FromGitter<diegogub> @Yardanico it looks cleaner now the code, thanks
12:54:43Yardanicoyou can also use templates instead of quote do
12:54:58Yardanico(you can call template from a macro and get AST generated by a template)
12:56:44FromGitter<diegogub> cool, much easier..Its the first macro I write..avoid all the boiler plate to read a stream of json events and parse into the correct obj
12:56:51FromGitter<diegogub> amazing
12:57:14FromGitter<diegogub> @Yardanico will try it
12:57:22FromGitter<diegogub> @Yardanico thanks
12:57:38Yardanico@diegogub: for getting AST from a template - https://nim-lang.org/docs/macros.html#getAst,untyped
12:59:40*SenasOzys quit (Ping timeout: 256 seconds)
13:06:59*SenasOzys joined #nim
13:07:24*SenasOzys quit (Remote host closed the connection)
13:08:22*SenasOzys joined #nim
13:09:23*Trustable quit (Remote host closed the connection)
13:28:38yglukhovAraq, dom96: pls have a look https://github.com/nim-lang/Nim/pull/7336. Comments addressed.
13:29:55FromGitter<Doaxan> Hello, i write monte carlo simulation and i want make it fast as possible (i tried before many languages as c, c++, kotlin, nodejs, julia, cython_pypy_numba, dlang, rust and i get best peromance in crystal (12 sec) and nim (8,6 sec)) ⏎ I guess, if i preallocate values, program will be runs faster, but this code(11,002s): ⏎ ⏎ ```const range_count = 999999999 ⏎ for _ in 0..range_count: ⏎ let val =
13:29:55FromGitter... rand(100.0)``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ac230531130fe3d3692d61b]
13:31:12dom96yglukhov: looks good. Merged.
13:31:53yglukhovdom96: Thanks!
13:34:13dom96Doaxan: if nobody answers you here be sure to try posting it on the Nim forum (I don't have any tips right now)
13:35:07FromGitter<Doaxan> @dom96 ok, ill try, thanks
13:36:31YardanicoDoaxan: do you know number of values beforehand?
13:36:35YardanicoI mean at compilation time
13:41:20FromGitter<zetashift> @mratsim is like the mastermind of Nim with these kind of stuff Doaxan
13:44:09*gokr quit (Ping timeout: 264 seconds)
13:45:12*shashlick left #nim ("User left")
13:45:24FromGitter<Doaxan> @Yardanico maybe its range_count? I think, It would be great if you could do it like this ``` const preall = f() ``` ⏎ ⏎ but in compilation i get this (maybe 16gb is not enough for compilation this): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac233f4bb1018b37a4e9496]
13:45:56Yardanico@Doaxan - I mean, is range_count known at compile-time? You don't need to change it at program start?
13:46:07YardanicoI mean you can just use an array if you know the count of numbers beforehand
13:47:02FromGitter<Doaxan> Yes, range_count is const and dont change
13:47:25Yardanico@Doaxan: why wouldn't you just use an array instead?
13:48:24FromGitter<Vindaar> @mratsim's Chip8 emulator now has keyboard input with custom keybindings :) https://github.com/mratsim/chirp8
13:49:04*miran joined #nim
13:49:13FromGitter<zetashift> @Vindaar does it compile succesfully to JS too, that would make it a really neat demo?
13:49:30Yardanico@zetashift: let me try real quick
13:49:39Yardanicowell, not quick
13:50:06YardanicoIf it only uses SDL2 and doesn't use any unsafe nim features (like raw pointers, cast, etc), it can be compiled to js with emscripten
13:50:18Yardanicohttps://github.com/Jipok/Nim-SDL2-and-Emscripten
13:52:05FromGitter<zetashift> I looked at the source when mratsim posted it, I think it uses SDL2 only to draw
13:53:18Yardanicoyeah, it'll be not hard to compile it with emscripten then
13:53:41FromGitter<narimiran> @Doaxan can you show us the rest of the code? (i'm interested in stuff like that :))
13:55:12*d10n-work joined #nim
13:55:53FromGitter<mratsim> wow, I got ping left and right xD
13:56:25FromGitter<narimiran> btw, in your faster example - you don't "save" your `rand(100.0)` in some seq?
13:57:49*leorize quit (Quit: WeeChat 2.1)
13:57:55FromGitter<mratsim> @user1101, I think this should work: `import system/ansi_c`see there: https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L2933
13:58:35FromGitter<mratsim> @tim-st Yes sets are capped at uint16 so I think enum are also capped at uint16
14:02:04FromGitter<mratsim> @diegogub glad it works, @Yardanico makes a good suggestion, often using result.add quote do or templates makes it easier to use macros: I’ve noted all the tricks there: https://forum.nim-lang.org/t/3672/1#22936
14:03:47FromGitter<mratsim> @Doaxan Will look into it. I need to have the fastest Monte Carlo Tree Search for my go playing bot in Nim anyway ;)
14:04:29Yardanicomratsim: you're preparing to beat AlphaGo ? :P
14:04:32FromGitter<Vindaar> @zetashift good idea actually, I haven't tried. If I find the time, I'll look into @Yardanico's link
14:10:29*endragor quit (Remote host closed the connection)
14:10:40dom96if there are people out there that can beat AlphaGo, I bet mratsim is one of them :)
14:10:56*endragor joined #nim
14:11:25federico3dom96: would jester be smaller? ;) https://news.ycombinator.com/item?id=16727584
14:12:16FromGitter<mratsim> I think this project is the most advanced to beat AlphaGo @Yardanico @dom96 it’s a go bot with training distributed on thousands of computers: https://github.com/gcp/leela-zero
14:13:09dom96federico3: hrm, good question
14:13:20Yardanicofederico3, probably by a lot
14:14:06dom96This Rust hype annoys me
14:14:08FromGitter<mratsim> but I have a more modest aim: getting a go bot at least at the European champion level so about 6D. (At this level it can let me play 4 moves in a row to balance our chances)
14:14:39FromGitter<mratsim> And I started a go bot in Rust in the past and never finished it because I spent too much time fighting with the language: https://github.com/mratsim/rustygo
14:15:11*shashlick1 is now known as shashlick
14:15:27*endragor quit (Ping timeout: 240 seconds)
14:15:36federico3dom96: 500k
14:15:50dom96349K on my Mac with -d:release and --opt:size
14:16:10dom96That's far smaller than Rust's release
14:16:12Yardanicodom96, that uses C libraries from your system though
14:16:14federico3same here
14:16:32federico3264k after strip
14:16:34Yardanicowell, it depends on the environment too
14:16:36dom96Yardanico: so?
14:16:49dom96All systems already have it. So why bundle it in the binary?
14:16:58Araqlink statically with musl
14:17:09YardanicoAraq, yeah, I know about musl, it's cool
14:17:32Yardanicoupx'd binary - 112kb for me
14:17:47Araqand see its size. but we'll get rid of libc eventually too
14:17:56Araqoh and upx is bad :P
14:18:19*dom96 reports findings on HN
14:18:22YardanicoAraq, why? I don't really know anything bad about it
14:18:27dom96Unless somebody else wants to? :)
14:19:32AraqYardanico: it disables on-demand paging of binaries
14:21:11dom96Well: https://news.ycombinator.com/item?id=16734669
14:22:51*dom96 recalls that his malware analysis lecturer suggested that a binary packer indicates malware *shudder*
14:24:07dom96upx'd is 137K for me FWIW
14:24:48dom96Still pretty high, considering that I watched awesome 4K and 8K demos yesterday
14:24:51Yardanicodom96, well, maybe it's lower on linux for some reason (i did strip-s before too)
14:25:23shashlickon ubuntu, that comes to 391k and 262k stripped
14:26:14shashlickand 102k upx'd
14:26:25dom96Now I want to work on Jester but I got this dissertation to write :(
14:32:01FromGitter<Doaxan> > **<Yardanico>** @Doaxan: why wouldn't you just use an array instead? ⏎ Sorry, im noob, this is not work: ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ac23ee15f188ccc15210889]
14:33:40shashlickremove var result = ...
14:33:50miranDoaxan: `countup` is inclusive - your array has one element less than i's in the for loop
14:33:52Yardanicoshashlick, this doesn't help
14:34:12miranor just use `for i in 0 ..< rangeCount`
14:34:19Yardanicoshashlick, the issue here is probably that array is too big
14:35:12miranYardanico: yup
14:35:57Yardanicohttps://github.com/nim-lang/Nim/issues/7349
14:36:14Yardanicohowever we can define our array as a global
14:37:00FromGitter<zacharycarter> JS is out of control - https://github.com/jonschlinkert/is-odd https://github.com/jonschlinkert/is-even https://github.com/jonschlinkert/is-number
14:37:28Yardanicozacharycarter: these repos don't look like a joke
14:38:06FromGitter<zacharycarter> yeah the author is super serious apparently
14:38:14FromGitter<zacharycarter> https://twitter.com/jonschlinkert/status/980110077607710722
14:38:15FromGitter<zacharycarter> lolol
14:38:31FromGitter<zacharycarter> writing those libraries was an absurdly stupid waste of time
14:38:39Yardanicolet just split all nim stdlib into separate repos
14:38:49Yardanicoall functions from math module will be in separate modules
14:39:00Yardanicosin.nim, cos.nim, and add each package to nimble xD
14:39:45miranYardanico, Doaxan: the array in the example is cca 2 orders of a magnitude too large :)
14:40:12FromGitter<zacharycarter> lolol
14:40:25FromGitter<zacharycarter> this is by far the best thing I've seen in weeks
14:41:13dom96I'm surprised you haven't seen this before.
14:41:29FromGitter<zacharycarter> me too
14:41:31dom96Major packages depend on these small things
14:41:42FromGitter<zacharycarter> oh well I've seen that pattern before
14:41:51shashlickhttps://npm-stat.com/charts.html?package=is-odd
14:41:59Yardanicoshashlick, jesus
14:42:04FromGitter<Doaxan> @miran what should I do?
14:42:18dom96The usage is only growing!
14:42:29dom96I don't want to live on this planet anymore... :)
14:42:35shashlickI read about this a couple days ago, wish I could find the link
14:42:39FromGitter<zacharycarter> well I think webpack depends on it
14:42:42FromGitter<zacharycarter> which is ridiculous
14:42:49Yardanicoit's probably because https://www.npmjs.com/package/nanomatch depends on is-odd
14:42:51dom96yep, babel too
14:43:13dom96It must take forever for all these packages to download
14:43:14FromGitter<zacharycarter> the fact that so many things depend on such an asinine library isn't the funny part
14:43:18miranDoaxan: do you really need to save each random value in the seq/array? this will slow you down, so if you don't have to - don't :)
14:43:23FromGitter<zacharycarter> the author's response to all the PR's removing it from projects - is
14:43:52FromGitter<zacharycarter> and the fact that he thinks his package provides a bunch of value
14:44:02FromGitter<zetashift> Is this serious or just next-level trolling?
14:44:14FromGitter<zacharycarter> well the author seems totally serious
14:44:26FromGitter<zacharycarter> all the people issuing PR's to remove his package from various projects - are probably trolling him
14:44:40FromGitter<zetashift> I know NPM had some weird shit on it but this is insane
14:44:45FromGitter<zetashift> also sorry for off-topic I guess?
14:44:51FromGitter<zacharycarter> he did write this - https://github.com/micromatch/nanomatch/pull/11 and https://twitter.com/jonschlinkert/status/980110077607710722
14:44:59miranDoaxan: can you show us the rest of your code? (the one which runs in 8.6 seconds)
14:45:08shashlickthe guy does have 821 repos on github
14:45:13FromGitter<zacharycarter> this is good too - https://github.com/jonschlinkert/is-even/blob/master/index.js#L13
14:45:14FromGitter<zacharycarter> lol
14:45:26FromGitter<zacharycarter> I.... I can't even...
14:45:48FromGitter<zacharycarter> well since Nim compiles to JS this is technically on-topic :P
14:46:17dom96Obviously to attract these JS developers we need a similar ecosyste,
14:46:21dom96*ecosystem
14:46:26FromGitter<alehander42> I have to admit I do like having small util libs but this is crazy hahah
14:46:29FromGitter<Doaxan> > **<miran>** @Doaxan: do you really need to save each random value in the seq/array? this will slow you down, so if you don't have to - don't :⁠) ⏎ Okay, it seems the fastest implementation of all possible is the generation of random numbers on the fly, as below? ⏎ ⏎ ```const range_count = 999999999 ⏎ for _ in 0..range_count: ⏎ let val = rand(100.0)``` [https://git
14:46:29FromGitter... ter.im/nim-lang/Nim?at=5ac242457c3a01610d9d0f46]
14:47:38FromGitter<alehander42> btw joe armstrong had some weird ideas of a "global version-based function key-value store", something like a package manager for functions and people just combining them in their programs
14:47:50FromGitter<alehander42> I remember it sounded cute on theory
14:49:19dom96btw guys, thoughts on using IPFS for Nimble? :D
14:49:29dom96libman suggested it on the forum and it's actually an intriguing idea
14:49:39FromGitter<narimiran> @Doaxan here's a more idiomatic nim (just some small changes to make it more readable, IMO): ⏎ ⏎ ```const rangeCount = int(1e10) ⏎ for _ in 0 ..< rangeCount: ⏎ let val = rand(100.0)``` [https://gitter.im/nim-lang/Nim?at=5ac243035f188ccc15211d3e]
14:49:44FromGitter<zacharycarter> I think it's a bad idea
14:50:10FromGitter<zacharycarter> at least - I don't think it's a good idea to replace the way nimble currently functions, with an IPFS solution
14:50:20FromGitter<zacharycarter> maybe if you can somehow provide both options?
14:50:27dom96Yes, I wouldn't replace it
14:50:35dom96It would be a secondary option
14:50:40dom96Just wondering if it's worthwhile
14:50:51FromGitter<zacharycarter> hrm
14:50:57FromGitter<zacharycarter> well it's certainly a buzzword technology
14:51:03FromGitter<zacharycarter> but I'm not sure how much value you'd be adding
14:51:10FromGitter<zacharycarter> it'd be a good way to generate some buzz / hype though
14:51:37mirandom96: work on your dissertation!! ;)
14:51:53dom96miran: :D
14:52:01dom96miran: I can multi-task :P
14:52:23miranthen give us tuple unpacking in for loops :P (no, seriously, we need this)
14:54:29dom96That's not critical :)
14:55:12miranwhen you try to use results of `zip` and see the ugliness, you see that is very critical :D
14:55:30shashlickdoes nimble already allow installing to a project local directory instead of global?
14:55:45miranbut i'll write more detailed RFC when i catch some free time....
14:56:13dom96shashlick: sorta
14:56:41dom96see the related 'vendor' issues on GitHub
14:58:25FromGitter<Doaxan> > @Doaxan here's a more idiomatic nim (just some small changes to make it more readable, IMO): ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5ac24511c4d0ae8007292c64]
14:59:39FromGitter<Doaxan> > @Doaxan here's a more idiomatic nim (just some small changes to make it more readable, IMO): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac2455b7c3a01610d9d1f32]
15:00:58shashlickhttps://github.com/nim-lang/nimble/issues/131 in case anyone else is interested
15:01:06FromGitter<Doaxan> 8,186s vs 8,480s
15:02:41FromGitter<narimiran> that's quite close. run each version 3 or 5 times and find the average ;)
15:03:37FromGitter<mratsim> @dom96 @zacharycarter @shashlick: Didn’t you hear about the package “left pad” which padded strings in Javascript? It was unpublished and broke half of NPM: https://arstechnica.com/information-technology/2016/03/rage-quit-coder-unpublished-17-lines-of-javascript-and-broke-the-internet/
15:03:38FromGitter<Doaxan> @narimiran yes, I ran several times, nevertheless in my case the performance is critical
15:04:32FromGitter<krux02> I finally decided to write my own AST pattern matching library
15:04:55FromGitter<narimiran> @Doaxan and the only difference is how you declare `rangeCount`? because i have run it as `int(1e9)` and as `1_000_000_000` and i get the same times
15:05:13FromGitter<mratsim> I’m pondering on a domain specific language for neural networks, what do you think of this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac246a9012ff2bf681e1186]
15:05:15FromGitter<krux02> anyone interested in that?
15:05:28*PMunch joined #nim
15:05:42FromGitter<alehander42> @krux02 sounds cool, I've thought about that while working on macros
15:05:54FromGitter<narimiran> @Doaxan btw, you can use underscores as shown, to improve readability (as you can see, i miscounted before)
15:06:06FromGitter<Doaxan> @narimiran i use O3 march=native, possible therefore there is a difference
15:06:10FromGitter<alehander42> however wouldn't a more general pupose variant object matching library be even better?
15:06:25FromGitter<alehander42> (if you're talking about NimNode-s)
15:06:29dom96Hope you guys can help me out: https://forum.nim-lang.org/t/3716
15:06:30dom96:)
15:06:41FromGitter<krux02> @mratsim I wish I could help, but I have zero knowledge in implementing one.
15:06:55shashlick@mratsim: ya that's something that was brought up related go Go as well recently - relying on git repos which could go away anytime
15:07:51FromGitter<krux02> dom96: I am sorry I think by the time I got the book, I didn't need it anymore
15:08:12FromGitter<krux02> maybe I should read it.
15:08:18FromGitter<krux02> until when is the deadline for you?
15:08:23FromGitter<narimiran> @mratsim will you have something similar for simpler ML models? (random forests, SVM, etc.)
15:08:30dom96krux02: don't have a deadline
15:09:50FromGitter<alehander42> @krux02 e.g. you can have something like (similar to patty TODO https://github.com/andreaferretti/patty/blob/master/README.md) ⏎ ⏎ ```match c: ⏎ nnkPrefix(nnkIdent("*"), nnkIdent(name)): ⏎ echo name``` [https://gitter.im/nim-lang/Nim?at=5ac247bebb1018b37a4ef35f]
15:09:53FromGitter<krux02> that's bad because it makes me lazy
15:10:03*Jesin joined #nim
15:10:06dom96krux02: 7 days
15:10:27FromGitter<krux02> haha, well ok, let's see what I can find until then
15:10:29FromGitter<alehander42> would maybe contributing to patty solve both problems? (having an ast pattern matching lib and better pattern matching for variants)
15:10:41FromGitter<krux02> @alehander42: I have a very similar pattern right now
15:11:15FromGitter<krux02> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac2481392f5d62057868cee]
15:11:36FromGitter<alehander42> ok, but can you capture matches in variables ?
15:12:01FromGitter<krux02> this works already, but all "expect" statements
15:12:13FromGitter<krux02> and the ast is generated by (listRepr)
15:12:18FromGitter<krux02> lispRepr
15:13:29FromGitter<alehander42> what I mean is can you write ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac24899bb1018b37a4ef771]
15:13:34FromGitter<krux02> I am not sure about the else branch though
15:13:49FromGitter<krux02> because when I implement it, I basically discard where the ast is not according to the pattern
15:15:27FromGitter<krux02> @alehander42 I thought about backticks, but yours is pretty good, too
15:16:06FromGitter<alehander42> because if you can do the capturing, you should be able to make the lib support all kinds of variant objects (not only NimNode) which would be very useful for many types (I don't see anything in particular unique to the ast types)
15:16:29*miran quit (Ping timeout: 256 seconds)
15:16:34FromGitter<alehander42> yea, backticks might be better if you want to be able to write Ident(existingconstant)
15:16:49FromGitter<krux02> well there is already a pattern maching library (not by me) that bascally supports union types
15:16:52FromGitter<alehander42> I took the idea from patty as I said
15:16:57FromGitter<krux02> but it also needs to generate such union types
15:17:14FromGitter<alehander42> so it can't work with already created types?
15:17:35FromGitter<krux02> I think in the beginning I should just start with an ast matcher that can match any AST including fuzzy AST
15:17:45FromGitter<mratsim> @dom96 Regarding file size: This game with awesome graphics is 8MB: https://www.youtube.com/watch?v=fp0t2jCMGZE
15:18:02Yardanicomratsim: you mean 8kb? :)
15:18:13FromGitter<mratsim> yes KB*
15:18:22FromGitter<krux02> and then in the end I should merge this library with other pattern matching solution to provide a common pattern matching API for all libraries
15:18:33FromGitter<krux02> like it is done right now with hashing libraries
15:18:37dom96mratsim: yes, I saw it yesterday during the Revision livestream ;)
15:18:50FromGitter<mratsim> @narimiran I will do a blackbox like sci-kit learn with fit and predict.
15:19:36FromGitter<mratsim> I’ll add the same to the neural nets, so you combined with my first DSL proposal you could do most visual recognition tasks in 15 lines of Nim code
15:25:33*DarkArctic quit (Ping timeout: 264 seconds)
15:25:33FromGitter<alehander42> @krux02 sounds good
15:27:20dom96mratsim: ooh, speaking of neural nets, is it possible to achieve something like this using Nim yet? https://www.youtube.com/watch?v=qv6UVOQ0F44
15:27:32*dom96 has a project in mind that depends on it :)
15:27:46shashlickdo any of you use weechat + relay?
15:31:32subsetparkSo - returning to some code written on 0.17.x, now on `stable` - previously working code produces a ***stack smashing detected*** SIGABRT
15:31:49subsetparkWhat should I be looking for when updating it?
15:31:51*Jesin quit (Quit: Leaving)
15:31:58dom96subsetpark: unsafe features: addr, ptr, etc
15:32:27subsetpark@dom96 - no pointer/mem manipulation here. It's pretty much all `&`ing together seqs of characters
15:32:56dom96Then I'd love to see the code
15:33:13FromGitter<mratsim> @dom96: yes it’s possible once I have recurrent neural net
15:33:28subsetparkdom96: As a matter of fact, you can: https://github.com/makingspace/rmq/
15:33:32FromGitter<mratsim> You can do it in Python here: https://gym.openai.com/
15:33:35dom96mratsim: cool, that on your roadmap?
15:33:37subsetpark`nimble tests` produces the failure
15:33:38*smt joined #nim
15:33:49subsetparkIn the `values.nim` module
15:33:55FromGitter<mratsim> @dom96 I have a starcraft bot in my roadmap ;) :P
15:34:12FromGitter<mratsim> But I’ll start by training a RNN on the emulator I did on Friday
15:34:31dom96Cool. I'd really rather just use Nim instead of Python :)
15:34:46Araqstarcraft one or two?
15:34:47dom96So if you created some RNN examples that would be useful too :)
15:34:54FromGitter<mratsim> here arre some repo: https://github.com/wenkesj/mario
15:34:58FromGitter<mratsim> https://github.com/ppaquette/gym-super-mario
15:35:02subsetparkdom96: you know what, I'm wrong
15:35:12FromGitter<mratsim> the keywords are “openAI gym” + <insert your favorite game>
15:35:14subsetparkWe are doing addr - it's how we interpret things as bigEndian
15:35:41subsetparkThat was c&ped from a different Nim library... code like this:
15:35:55dom96subsetpark: hrm, so double check that it's not over-reading/over-writing
15:36:17subsetparkproc encode*(v: int32 | uint32): array[0..3, char] =
15:36:19subsetpark var v = v
15:36:21subsetpark bigEndian32(addr result, addr v)
15:37:02FromGitter<Thor77> hey, is there a reason for the non-existence of a Date-type (like DateTIme just without the Time-part) in the times-library?
15:37:50FromGitter<mratsim> time or laziness? :P
15:37:57dom96Thor77: I think this PR aims to fix that: https://github.com/nim-lang/Nim/pull/7096
15:38:28dom96subsetpark: hrm, that looks fine
15:38:50Araqdo we need a 0.18.2 ?
15:39:28dom96We should start releasing more often and regularly
15:39:31subsetparkdom96: I'm pretty sure it would have to be here: https://github.com/makingspace/rmq/blob/master/rmqsrc/utils/encode.nim
15:39:58FromGitter<Thor77> dom96: oh, should've searched for a pr before asking... thanks :)
15:40:35dom96subsetpark: Maybe Araq can assist better, but I would try and replace that code with some dummy safe code and see what happens
15:53:28subsetparkdom96/Araq: I'm a bit out of my element here, but I'm trying to figure out which invocation causes the issue. The weird thing is the calls to `encode()` seem to be successful. I am able to debug at the end of a function call but I never get back up the stack where it was called from. Ordinarily that would seem nonsensical to me but given that the issue is 'stack smashing' - is that possible? that the call could
15:53:30subsetparkseem fine from within one function but cause mayhem as it moves up the stack?
15:56:55*xkapastel joined #nim
16:00:02shashlickaraq, dom96, curious about the PR process - there's 81 open PRs, what can we do to help move them along? the older they get, the more out of sync
16:00:25dom96shashlick: review them :)
16:03:09*DarkArctic joined #nim
16:05:44shashlickWhat's the criteria to accept? #reviews > x
16:09:53dom96There is no criteria
16:10:12dom96Other people's review help me and Araq make a decision whether it's ready though
16:10:29dom96And catches out the common things that should be fixed so we don't have to let people know and wait
16:10:39*jrbrt joined #nim
16:12:01shashlickDo you already have some review guidelines?
16:12:20shashlickOr PR guidelines
16:13:32FromGitter<mratsim> @dom96 does nimble publish work for you? I always get this kind of stuff: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac256ac01a2b40f382e6292]
16:14:08dom96mratsim: I never use it. But I think that was fixed in Nim 0.18.0, are you running an old Nimble?
16:14:20dom96shashlick: not really
16:15:24FromGitter<mratsim> before 0.18 it couldn’t even fork iirc
16:15:42subsetparkdom96: got one more second for this stack smashing stuff? I think the error is actually in one of these procs: https://ghostbin.com/paste/2kcrb when I comment out the bigEndian calls, I don't get the same exception
16:15:43FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ac2572f01a2b40f382e629b]
16:17:37dom96subsetpark: I'm not sure, sorry :(
16:17:49dom96mratsim: compiled with latest Nim?
16:18:55FromGitter<mratsim> I suppose with devel yes. I can’t work on 0.18 :P
16:20:02dom96mratsim: then I dunno
16:20:10shashlick@mratsim I've seen it a few times
16:20:17dom96report it as an issue if it hasn't been reported
16:20:27shashlickIt sometimes creates the pr, sometimes doesn't
16:20:40shashlickNot sure if httpclient issue
16:20:47dom96Araq: Can you help subsetpark out?
16:21:02shashlickNothing funky in nimble code though
16:22:57dom96subsetpark: You should be able to rewrite these bigEndian32 calls without using 'addr', maybe that's worth a shot
16:23:10dom96looking at the endians module they are pretty simple
16:24:26subsetparkYeah, how should I do that? TBH the addr calls were cribbed from some utility library, so I'm happy to hear of an alternative approach
16:25:25dom96subsetpark: https://github.com/nim-lang/Nim/blob/devel/lib/pure/endians.nim#L63
16:26:01*jrbrt quit (Quit: Oíche mhaith)
16:26:54subsetparkdom96: I'm afraid I don't follow - the signature for that proc still expects pointers
16:27:12dom96subsetpark: yeah, but you've got an array[] right?
16:27:24dom96you can do the same on an array
16:27:38dom96in fact, you can do the same on any type that has `[]`
16:28:05dom96as long as the type inside the container type is the right size
16:29:56*icebattle joined #nim
16:30:49subsetparkHm ok
16:31:31subsetparkI'm not sure that's where the issue is - the pastebin i linked to above seems to be what gets rid of the error, and that is swapping endianness on an int, not a char array
16:31:53*gokr joined #nim
16:35:52subsetparkBasically this is code to do this: https://github.com/nim-lang/Nim/issues/7105
16:39:32FromGitter<mratsim> @Doaxan I’ve changed your benchmark a bit so that it’s more stable (regarding cpu governor) and uses the max perf available on your cpu (march native especially). ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Some general tips: ... [https://gitter.im/nim-lang/Nim?at=5ac25cc401a2b40f382e62fc]
16:40:27*smt` joined #nim
16:40:56*smt_ joined #nim
16:44:09*smt quit (Ping timeout: 264 seconds)
16:44:40*smt joined #nim
16:44:49*smt` quit (Ping timeout: 248 seconds)
16:44:56subsetparkWell dom96 ... Final judgment is that something changed between stable and devel... I was pretty sure the error was still present in devel, but it actually appears that the code, as it is written, no longer triggers the stack smashing exception in devel
16:45:53*smt_ quit (Ping timeout: 248 seconds)
16:49:11*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
17:01:02dom96subsetpark: so you can't reproduce anymore?
17:01:30dom96if the data input didn't change then it should produce the same results
17:04:24subsetpark@dom96: I can still reproduce on nim stable
17:04:31subsetparkon nim head, all tests now pass
17:05:41*jrbrt joined #nim
17:06:42dom96oh, I see what you mean
17:06:58dom96I thought you were testing on devel from the outset.
17:07:44dom96That's interesting. I wonder what changed between 0.18.0 and devel
17:09:05subsetparkfeel free to use my repo to run a git bisect :)
17:15:39*endragor joined #nim
17:19:38*PMunch quit (Quit: Leaving)
17:19:57*endragor quit (Ping timeout: 240 seconds)
17:28:58*NimBot joined #nim
17:30:07Demos[m]Oooooo new bot?
17:30:28*mwbrown quit (Ping timeout: 268 seconds)
17:31:44narimiran[m]@mratsim is there a noticeable difference between let inside of a loop, and using an int variable declared outside of it? i haven't noticed it in couple of my tests!?
17:32:47*mwbrown joined #nim
17:33:49FromGitter<mratsim> It depends. Normally the compiler detects that with a let inside a loop, there is no lifetime conflicts so it reuses the same register
17:40:06shashlickdom96: do you see any value in a PR report that gives a spreadsheet view with relevant info included
17:45:35dom96Depends what it contains I guess
17:45:39dom96But not really
17:48:33FromGitter<zacharycarter> I have a game dev web dev job interview tomorrow :D
17:48:46FromGitter<zacharycarter> hopefully I'll finally land a job in the industry I want to be in
17:49:06FromGitter<zacharycarter> even if it's not the specific role
17:49:52shashlickdom96: okay, i'll do some reviews of existing PRs - in the meantime, will you be able to approve https://github.com/nim-lang/Nim/pull/7442 and https://github.com/nim-lang/Nim/pull/7440
17:51:14*smt` joined #nim
17:51:24dom96I want Araq to take a look at those
17:51:43shashlickcool
17:51:44dom96zacharycarter: awesome! All the best for the interview :)
17:52:21FromGitter<mratsim> oh cpDir: :)
17:52:34FromGitter<genotrance> :)
17:53:59FromGitter<zacharycarter> thanks dom96!
17:54:33dom96https://news.ycombinator.com/item?id=16736917 :/
17:54:43dom96How am I taking it to the next level? :(
17:55:08*smt quit (Ping timeout: 268 seconds)
17:55:47FromGitter<zacharycarter> I'd just ignore them - unless we have folks running around posting Issues saying "RIIN" we're nowhere near as bad
17:56:07FromGitter<mratsim> Yes good luck zachary :)
17:56:26FromGitter<zacharycarter> thanks @mratsim !
17:57:37FromGitter<mratsim> @dom96 I’m sure he is confusing Nim with Zig ;)
17:58:46shashlickwell, it is arguable that nim is offtopic on a rust article
18:00:04FromGitter<mratsim> I think most of the people who discovered Nim through HN or Reddit discovered it through an offtopic comment ;)
18:01:20FromGitter<mratsim> I certainly did
18:01:43shashlickno doubt
18:01:58dom96That ^
18:03:31FromGitter<zacharycarter> I mean - we as Nim fanatics would probably be annoyed if the roles were reversed, and every time we posted on HN, the rustaceans were chiming in with "we can do that too"
18:03:43FromGitter<zacharycarter> in a sense it makes Nim look a little desperate
18:04:19*nsf quit (Quit: WeeChat 2.0.1)
18:05:14FromGitter<zacharycarter> but I don't know how else to make people aware that Nim exists either
18:06:43shashlickI know, it's hard to decide
18:06:49FromGitter<cabhishek> @zacharycarter +1
18:09:05FromGitter<mratsim> The pony guy did a neat trick to promote Pony on HN: https://kaizenboard.xyz/#/
18:09:10dom96And yet I bet if you search for Rust in any Nim-related post on HN/Reddit you will find at least one mention
18:09:36FromGitter<mratsim> I think it’s fine to mention other language for meta discussions like Araq destructors blog post
18:12:06shashlickI had to do a similar thing for my NTLM proxy server px, but I tried to restrict it to places where it was a solution to a question and not unrelated
18:12:50FromGitter<mratsim> Nim is a solution to all issues that plague devs in other language but they don’t know it :D
18:12:57shashlicke.g. question on a feature or usage of cntlm doesn't warrant a mention unless px actually has that feature and cntlm doesn't
18:13:00FromGitter<mratsim> except COBOL
18:13:20shashlick@mratsim - I think that's the main challenge with a programming language - it applies in most situations
18:13:29shashlickwant a smaller binary? use nim :)
18:13:43shashlickthat's kind of the main reason why I moved from Python
18:14:30FromGitter<mratsim> nimsuggest log file are becoming huge really fast, I have to delete them every 4 days.
18:14:41FromGitter<zetashift> Most popular things about Nim I've seen were https://www.euantorano.co.uk/posts/faster-command-line-tools-in-nim/ and 'pointer free programming' we need more of those!
18:15:08FromGitter<zetashift> Also I found it weird that this wasn't posted on the interwebs: https://nim-lang.org/blog/2018/01/22/yes-command-in-nim.html
18:15:46FromGitter<zetashift> I do know Nim is sometimes mentioned in the Godot discussions
18:22:31shashlickdom96: you have some supporters now
18:24:25dom96yay
18:24:54dom96zetashift: it was: https://news.ycombinator.com/item?id=16263429
18:31:30shashlickhow do you keep track of nim mentions in reddit and hackernews
18:32:04euantorI did some work on the "faster command line tools in Nim" repository the other day actually: https://github.com/euantorano/faster-command-line-tools-in-nim
18:32:14euantorUnforutnately the D (LDC) version now beats the Nim version
18:32:17euantor:(
18:32:19dom96shashlick: for HN I use HNWatcher
18:32:24dom96For reddit I just hope I see the comment
18:33:09shashlickhttps://hn.algolia.com/?query=nim&sort=byDate&prefix=false&page=0&dateRange=pastWeek&type=all
18:33:14FromGitter<zacharycarter> https://twitter.com/ncweaver/status/980485587827224577
18:35:27euantorIt is pretty sad seeing how much slower Python 3 is than Python 2 for the same code. It's around ~3 seconds slower, which is quite a lot
18:35:46dom96euantor: really? I thought Python 3 was supposed to be faster :O
18:35:55euantoryeah
18:36:01euantorPython 2: https://euantorano.github.io/faster-command-line-tools-in-nim/python2.txt
18:36:07euantorPython 3: https://euantorano.github.io/faster-command-line-tools-in-nim/python3.txt
18:36:21euantorThe only difference is using brackets with `print` for 3
18:36:27*smt joined #nim
18:36:50Yardanicoeuantor, probably that's because unicode is the default in py3
18:37:08Yardanicoand why wouldn't you use the same file for py2/py3?
18:37:16Yardanicopython 2 understands brackets too
18:37:21dom96hrm, is your blog down? https://www.euantorano.co.uk/posts/faster-command-line-tools-in-nim/
18:37:39Yardanicodom96, works for me
18:37:55euantorFeel free to make a PR @Yardanico :) I rarely write Python
18:37:56dom96hrm, must be my shitty ISP
18:38:09*smt_ joined #nim
18:38:15euantorAnd yeah, it works for me too. I've never seen it die before
18:38:20*smt_ quit (Remote host closed the connection)
18:38:47*smt_ joined #nim
18:39:55*smt` quit (Ping timeout: 256 seconds)
18:41:15*smt quit (Ping timeout: 256 seconds)
18:44:32*SenasOzys quit (Ping timeout: 260 seconds)
18:50:11FromGitter<zetashift> Yeah LDC is pretty impressive in benchmarks I wonder how nlvm would fare
18:51:46euantorThe code isn't really a fair benchmark at the minute to be fair, as the D code reads the full file into memory. Nim might well beat it by doing the same :)
18:57:25FromGitter<data-man> @euantor: Try to use newFileStream(filename, fmRead, 1000000) :)
18:57:47*SenasOzys joined #nim
18:59:34*SenasOzys quit (Read error: Connection reset by peer)
19:00:25*SenasOzys joined #nim
19:02:10*smt joined #nim
19:06:11*smt_ quit (Ping timeout: 256 seconds)
19:07:27euantorYep
19:16:17*aguspiza joined #nim
19:18:06*miran joined #nim
19:21:57*arecaceae quit (Remote host closed the connection)
19:22:21*arecaceae joined #nim
19:28:39*beatmox quit (Remote host closed the connection)
19:28:54*jrbrt quit (Quit: Oíche mhaith)
19:29:10*beatmox joined #nim
19:32:31*smt` joined #nim
19:36:28*smt quit (Ping timeout: 256 seconds)
19:38:49*yglukhov quit (Read error: Connection reset by peer)
19:39:21*yglukhov joined #nim
19:47:22subsetparkHere's something I've never really understood when defining proc types: if I define a type like `MyProc = proc(c: Foo, r: Bar)`, and then perhaps make an object field with type seq[MyProc], I always get an error trying to construct an object with a field value like @[defaultProc] - where `defaultProc` is defined with the exact same signature.
19:47:54subsetparkDo I have to do something specific with closure pragmas or what-not?
19:49:30*r3d9u11 joined #nim
19:49:30*r3d9u11 quit (Client Quit)
19:49:39*nsf joined #nim
19:52:02*vivus joined #nim
20:01:13FromGitter<krux02> subsetpark: can you create an example code? To me it looks like a bug.
20:01:28FromGitter<krux02> but to be honest seq initialization could be the problem
20:02:04FromGitter<krux02> when you do [x, .. .. ], the first element defines the type of the seq/array, and the type cannot be deduced from anywhere else at all.
20:03:12FromGitter<krux02> so the first element really has to be very precice in it's type, not just convertible os something like that
20:04:27subsetparkkrux02 - in this case, the type is declared in the object type declaration
20:06:44subsetparkbut i'll give an example next time it crops up
20:18:25*jrbrt joined #nim
20:20:09*athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:20:30*Jesin joined #nim
20:25:22*miran quit (Quit: Konversation terminated!)
20:36:45euantorIf I remember correctly you might need the procVar pragma or something
20:42:29*Jesin quit (Quit: Leaving)
20:44:21*Trustable joined #nim
20:54:38*jaco60 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:56:02*Vladar quit (Quit: Leaving)
20:58:04Araq.procVar is not a thing anymore but proc types default to .closure and top level procs are not closure
21:07:37*Trustable quit (Remote host closed the connection)
21:10:22*ketralni` is now known as ketralnis
21:23:08subsetparkHere's one along the same lines that's even stranger
21:23:28subsetparkfirst type mismatch at position: 4
21:23:30subsetpark required type: PubSubCallback
21:23:32subsetpark but expression 'callback' is of type: PubSubCallback
21:23:45subsetparkIn this case there isn't even a top level proc
21:29:52Araqmaybe you have multiple definitions of PubSubCallback
21:30:02subsetparkyes, I think that must be it...
21:31:52dom96the compiler should prefix those types with the module names in this case
21:41:02dom96Tables module needs a proc that returns an Option[V]
21:42:21*smt` quit (Ping timeout: 264 seconds)
21:43:19FromGitter<krux02> I think strutils.escape should be deprecated
21:43:49FromGitter<krux02> people assume it is useful, but it is not. I concider it as harmful.
21:44:00FromGitter<krux02> what do you think?
21:44:40dom96example of people being wrong?
21:45:31FromGitter<krux02> well when you see `escape` you should know about wherer this escaping is useful
21:45:50FromGitter<krux02> for example in C embedding, or in javascript embedding, or in sql embedding etc.
21:45:55FromGitter<krux02> but this function does not tell
21:46:05FromGitter<krux02> people use it for everything
21:46:17FromGitter<krux02> and it works in example cases
21:46:37FromGitter<krux02> but it breaks horribly later.
21:47:27dom96well, perhaps we should define what it escapes in the docs
21:47:30FromGitter<krux02> when there is escaping, there should be `shellEscape` `ansicEscape`, `jscriptEscape` etc
21:48:05FromGitter<krux02> and as long as they are not there, no escaping at all is better that a wrong one in my opinion.
21:48:33FromGitter<krux02> well it describes the escaping mechanism.
21:48:59FromGitter<krux02> but that requires that the user knows the exact escaping rules for the target and does no mistake in comparing them
21:50:37FromGitter<krux02> I just fixed a bug by not using strutils.escape in the Nim compiler
21:50:51FromGitter<krux02> https://github.com/nim-lang/Nim/pull/7475
21:50:59FromGitter<krux02> tests are still running though
21:51:51dom96ooh, first time I had to use 'import std/options' and this feature saved me
21:52:15dom96krux02: well, I dunno, i'd like to know what others think
21:53:55*d10n-work quit (Quit: Connection closed for inactivity)
21:54:39*nsf quit (Quit: WeeChat 2.0.1)
21:55:45Araqkrux02: I agree but I am against more tiny changes in the stdlib everywhere
21:56:31FromGitter<mratsim> do you mean you want big changes? :P
22:00:41FromGitter<data-man> Using strformat in the stdlib everywhere, is this a big changes?
22:05:39FromGitter<krux02> Araq: What do you mean? Do you want to stick to the stdlib like it is, even when it is kind of broken?
22:07:40*xet7 quit (Quit: Leaving)
22:18:06*smt joined #nim
22:19:41*aguspiza quit (Ping timeout: 268 seconds)
22:22:40Araqchangelog: deprecated strutils.escape for the people who do not know what they are doing. Instead write your own escapeJson, escapeC, escapeUrl, escapeCsharp
22:23:02Araqbecause strutils.escape "is kind of broken".
22:23:22Araqwhat is not kind of broken assuming you don't read its docs?
22:33:00dom96Araq: SmallString<128> Data;
22:33:07dom96Any ideas how to wrap that in C++?
22:33:31dom96I guess I can just emit it...
22:33:42dom96but maybe there is a better way
22:33:58Araqtype SmallString {.importcpp.}[N: static[int]] = object
22:34:12dom96Hope that's been tested :)
22:34:23FromGitter<mratsim> Yes we use it at Status
22:35:39FromGitter<mratsim> it was fixed a month ago: https://github.com/nim-lang/Nim/issues/6415
22:36:06dom96Still worries me
22:36:17dom96This is too cutting edge
22:37:19FromGitter<mratsim> You will have first-class zah support for that, the whole ttmath library that we use everywhere is built on this: https://github.com/status-im/nim-ttmath
22:37:47FromGitter<mratsim> we need it for Uint256 integers that are pervasive for Ethereum
22:38:33dom96Soon we'll have a better clang wrapper than libclang offers :D
22:39:02dom96It's a bit hacky but it works
22:39:25FromGitter<mratsim> Repeat after me “Static is not a hack” :P
22:42:22dom96my clang wrapper is :P
22:50:17dom96So I have this:
22:50:18dom96type
22:50:18dom96 SmallStringObj* {.importcpp: "llvm::SmallString", header: "llvm/ADT/SmallString.h".}[N: static[int]] = object
22:50:18dom96 SmallString*[N: static[int]] = ptr SmallStringObj[N]
22:50:32dom96Nim is generating this: typedef llvm::SmallString<NI> TY_UeWaPvSqgj7oqe6toRA9bhA;
22:56:11*jrbrt quit (Quit: Oíche mhaith)
22:59:19Araqwhat's that 'ptr' doing here?
23:05:44dom96Most functions take a 'ptr'
23:11:03dom96I'm just going to hardcode the size for now
23:11:30dom96Another issue I've run into now is that I need to emit 'using namespace blah' inside the module that I am using a C++ function in
23:11:35dom96Is there some way around that?
23:17:30dom96btw this also generates the same code as above:
23:17:31dom96SmallString* {.importcpp: "llvm::SmallString", header: "llvm/ADT/SmallString.h".} [N: static[int]] = object
23:22:42dom96https://github.com/nim-lang/Nim/issues/7477
23:27:08dom96Aww yess
23:27:23dom96To fix the namespacing problems I just created a dummy proc in my wrapper module.
23:36:22*girvo quit (Ping timeout: 264 seconds)
23:37:23*girvo joined #nim
23:41:38FromGitter<krux02> Araq: The question is rather "Where does strutils.escape
23:41:56FromGitter<krux02> " actaually work?
23:42:25FromGitter<krux02> I could not find anything yet, where
23:42:39FromGitter<krux02> `escape` actually did the right thing.
23:43:22FromGitter<dandevelo> Any thoughts on this? https://github.com/kostya/benchmarks/blob/master/README.md
23:47:23*gokr quit (Ping timeout: 260 seconds)
23:47:42FromGitter<krux02> well Nim seems to be pretty fast