<< 28-06-2017 >>

00:18:23*xet7 quit (Ping timeout: 240 seconds)
00:18:54*xet7 joined #nim
00:54:42*chemist69_ quit (Ping timeout: 255 seconds)
00:59:18*chemist69 joined #nim
01:01:11*handlex joined #nim
01:11:19*Nobabs27 joined #nim
01:17:48*yglukhov joined #nim
01:18:07*ipjk quit (Quit: Leaving)
01:22:20*yglukhov quit (Ping timeout: 268 seconds)
01:34:16*adeohluwa quit (Quit: Connection closed for inactivity)
01:47:02*Nobabs27 quit (Quit: Leaving)
01:52:45*chemist69 quit (Ping timeout: 255 seconds)
01:56:32*libman joined #nim
02:01:18*NotSpooky_ joined #nim
02:04:12*NotSpooky quit (Ping timeout: 260 seconds)
02:04:17*NotSpooky__ joined #nim
02:06:27*chemist69 joined #nim
02:07:28libmandom96: heads up, https://www.youtube.com/watch?v=4D2ryw7tyBA about to start getting views ;)
02:07:28*NotSpooky_ quit (Ping timeout: 260 seconds)
02:34:17*jmkr quit (Ping timeout: 246 seconds)
02:34:33*Guest85780 quit (Ping timeout: 260 seconds)
02:36:29*jmkr joined #nim
02:39:44*gsingh93 joined #nim
02:42:15*arnetheduck joined #nim
03:08:45*handlex quit (Quit: handlex)
03:17:48*def-pri-pub joined #nim
03:20:33*yglukhov joined #nim
03:24:46*NotSpooky__ quit (Quit: Leaving)
03:24:53*yglukhov quit (Ping timeout: 240 seconds)
03:27:27*pilne quit (Quit: Quitting!)
03:28:40*Jesin quit (Quit: Leaving)
03:45:56*chrisheller quit (Ping timeout: 260 seconds)
04:01:42*def-pri-pub quit (Quit: leaving)
04:03:40*bahtiyar joined #nim
04:06:41*Jesin joined #nim
04:08:23*bahtiyar quit (Ping timeout: 240 seconds)
04:10:37*pydsigner is now known as aoui
04:10:49*aoui is now known as aoeu
04:11:12*aoeu is now known as pydsigner
04:17:06libmanhttps://www.reddit.com/r/ProgrammingLanguages/comments/6jy41q/nim_intro_talk_a_young_systems_programming/
04:33:30*jinshil joined #nim
04:40:16*jszymanski joined #nim
04:50:02*jinshil_ joined #nim
04:53:22*chrisheller joined #nim
04:53:49*jinshil quit (Ping timeout: 276 seconds)
05:06:50*aerx quit (Remote host closed the connection)
05:22:34*yglukhov joined #nim
05:27:12*yglukhov quit (Ping timeout: 260 seconds)
05:27:30*Vladar joined #nim
05:43:03*nsf joined #nim
06:09:23*user0 joined #nim
06:51:53*xet7 quit (Ping timeout: 240 seconds)
07:05:28*xet7 joined #nim
07:13:25*tankfeeder joined #nim
07:21:14*vlad1777d joined #nim
07:25:46*couven92 joined #nim
07:26:49*Andris_zbx joined #nim
07:44:54*yglukhov joined #nim
07:46:18*yglukhov quit (Remote host closed the connection)
07:46:33*yglukhov joined #nim
07:51:13*PMunch joined #nim
07:53:32euantorNice, I think I'll watch that this morning
08:03:32couven92Nice dom96, I'll watch it now :)
08:03:59PMunchOh yeah, saw that over in r/nim. Watched the first half already :)
08:05:50*libman quit (Quit: Connection closed for inactivity)
08:16:28*chrisheller quit (Remote host closed the connection)
08:17:36*Arrrr joined #nim
08:17:36*Arrrr quit (Changing host)
08:17:36*Arrrr joined #nim
08:21:16*vlad1777d quit (Ping timeout: 260 seconds)
08:29:05tankfeedermorning
08:29:23tankfeederi want add test over vector to blake2
08:29:24couven92tankfeeder, morning, how're u doing? :)
08:29:25tankfeederhttps://github.com/BLAKE2/BLAKE2/blob/master/testvectors/blake2b-kat.txt
08:29:34tankfeedercouven92, good
08:29:37*skrylar joined #nim
08:29:48tankfeederi need a hint how to parse
08:30:08couven92RegExp! (Shoot me! :P )
08:30:58*arnetheduck quit (Ping timeout: 260 seconds)
08:31:29skrylarmorning
08:31:48PMunchtankfeeder, how to parse that format?
08:31:58tankfeederyea, just a hint
08:32:13tankfeedermaybe pegs
08:32:35couven92tankfeeder, I actually wasn't kidding :P
08:32:39*Matthias247 joined #nim
08:33:03PMunchWell you could just open the file, put in a loop three readlines (and one readline to skip the whitespace). Then do a substring from x to ^0 and use parseInt
08:33:34tankfeederok
08:34:47PMunchOh wait, maybe not parseInt :P
08:34:55PMunchWhat do you want the values as?
08:35:01tankfeederstrings
08:35:12PMunchWell that's even easier :)
08:36:03couven92or: Regular Expression matcher for line 1: "(in:)\s*([0-9a-bA-F]+)?", line 2: "(key:)\s*([0-9A-Fa-f]+)?" and so on
08:36:34PMunchin = f.readline()[4..^0]
08:36:48PMunchkey = f.readline()[5..^0]
08:37:01PMunchhash = f.readline()[6..^0]
08:37:06PMunchdiscard f.readline()
08:37:15PMunchThrow that in a loop and voila
08:37:40couven92and then you'd have to trim in, key and hash to strip whitespace at start and end
08:37:53PMunch4, 5, 6 to match "in:\t", "key:\t", and "hash:\t" respectively
08:38:13couven92ah, it's a tabstop? okay... nice
09:03:26Araqtankfeeder: https://nim-lang.org/docs/strscans.html
09:04:21tankfeederok
09:09:43*jinshil_ quit (Quit: Good-bye!)
09:11:36*skrylar quit (Quit: Textual IRC Client: www.textualapp.com)
09:13:39couven92"Developers tend to be lazy, good developers anyways!" (Ian Cooper at NDC Oslo 2017) :D
09:13:49couven92nice one! :D
09:16:46tankfeederis there function to convert "FFFF" hex to string ?
09:16:53tankfeederor should implement myself ?
09:17:20couven92tankfeeder, https://nim-lang.org/docs/parseutils.html#parseHex,string,int,int,int
09:17:32tankfeederok
09:18:17PMunchTo hex?
09:18:25PMunchparseHex is from hex isn't it?
09:18:50tankfeederfrom hex to string
09:18:50couven92PMunch, yeah he wanted to convert "FFFF" to a number!
09:19:01tankfeederis there function to convert "FFFF" hex to string ?
09:19:05tankfeeder^^^
09:19:13PMunchHe said convert to string..
09:21:43couven92in any case you can use https://nim-lang.org/docs/strutils.html#toHex,T to do the other way round, right?
09:21:59Arrrrcan't you use `$0xFFFF` ?
09:22:52tankfeedertrying
09:23:52PMunchArrrr, wouldn't that just create the string of the number?
09:23:53PMunchNot as hex
09:25:03tankfeederanother way:
09:25:24tankfeederi read hex string from test vector, say "ff2a"
09:25:40tankfeederhow to pass it to getMD5 ?
09:25:49tankfeederfrom import md5
09:26:13couven92tankfeeder, don't do MD5! :P
09:26:44tankfeederi'm implementing test vectors for blake2
09:27:42couven92tankfeeder, hmm... getMD5 takes a string? wtf?
09:29:03tankfeederbut md5update takes cstring
09:29:16PMunchArrrr, I looked at the switch question you posed yesterday by the way
09:29:16tankfeederhttps://forum.nim-lang.org/t/716
09:29:25PMunchBut you had logged off before I got to answering you :P
09:29:46couven92tankfeeder, yeah, and the only thing getMD5 does, is converting the input to a cstring and calling md5update :)
09:30:21PMunchApparently it does have a C++ SDK, so you should be able to program it in Nim. But I haven't found any more information about this SDK other than it is supposed to exist..
09:31:08PMunchBut then again I haven't bothered to get a Nintendo developer account to check
09:35:11PMunchhttps://gamedev.stackexchange.com/questions/141291/how-to-get-access-to-nintendo-switch-development-environment
09:37:09*bjz joined #nim
09:40:27ArrrrThat's quite interesting. I'll read it
09:41:05*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:43:10*bjz joined #nim
10:10:19*enthus1ast joined #nim
10:14:50Trioxinneed someone to tell me what c2nim is complaining about on line 32 https://github.com/BLAKE2/libb2/blob/master/src/blake2.h : blake2.h(143, 30) Error: ';' expected. This is the first time I've used c2nim and I'm no C dev
10:16:05Trioxinc2nim is presumably what would make up for the lack of a large community and tons of packages so I have to get it going
10:23:06FromGitter<andreaferretti> you probably need this https://nim-lang.org/docs/c2nim.html#preprocessor-support-def-directive
10:23:24FromGitter<andreaferretti> `#def BLAKE2_API`
10:23:28FromGitter<andreaferretti> or something like this
10:26:11*PMunch quit (Quit: leaving)
10:33:20Trioxinc2nim can't convert a C implementation right? Just the .h?
10:41:13AraqTrioxin: it can convert a C implementation too
10:43:46tankfeederi've implement hex to string
10:43:50tankfeederback to file
10:43:53tankfeederparsing
10:49:20couven92tankfeeder, but why????? parseHex and toHex wok just fine, don't they?
10:49:47*themagician joined #nim
10:49:59tankfeederi need convert "ff2a78" to string
10:50:07tankfeederbe back soon
10:50:08*tankfeeder quit (Quit: Leaving)
10:55:01*arnetheduck joined #nim
11:04:07*krux02 joined #nim
11:09:56*tankfeeder joined #nim
11:12:56*enthus1ast quit (Quit: Lost terminal)
11:16:46*krux02 quit (Disconnected by services)
11:16:47*krux02- joined #nim
11:16:55*krux02 joined #nim
11:17:42*krux02- quit (Remote host closed the connection)
11:29:34*Jesin quit (Read error: Connection timed out)
11:34:48*Snircle joined #nim
11:34:52*arnetheduck quit (Ping timeout: 276 seconds)
11:40:34*vlad1777d joined #nim
11:41:07*krux02 quit (Remote host closed the connection)
11:45:27FromGitter<girvo> Slightly crazy question: Anyone run Nim on POWER (specifically OpenPOWER/POWER8)?
11:50:40*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
11:53:33euantorNope, I've never tried. I wanted to when OVH had their PWER8 servers, but I can't find anywhere else offering them at a decent price
12:16:50*NotSpooky joined #nim
12:16:53*eeproks quit (Ping timeout: 240 seconds)
12:30:07*xet7 quit (Ping timeout: 276 seconds)
12:37:31tankfeederi give up no progress in several hours
12:38:07tankfeederi need more help or hints in parsing this file
12:38:08tankfeederhttps://github.com/BLAKE2/BLAKE2/blob/master/testvectors/blake2b-kat.txt
12:43:32FromGitter<ephja> were you not able to do it with strscans?
12:44:34tankfeederAraq, told the same
12:44:55tankfeedercant find example, hard entry point
12:45:34couven92tankfeeder, PMunch actually gave you the three lines of code you need
12:45:38*xet7 joined #nim
12:45:46tankfeederstill trying
12:47:02couven92if you'd tell us what the problem is, e.g. the error message Nim is spitting out or similar, we could actually be helpful. Else, your problem is one of the simplest things with reading a file, so it's kinda hard for us to know what your issue is
12:49:04tankfeeder10x
12:59:57*PMunch joined #nim
13:12:58tankfeederthis is my current problem
13:12:59tankfeederhttps://pastebin.com/qrrzkgWz
13:13:13tankfeederi dont know why it happens
13:13:27tankfeeder in [3..^0]
13:14:08*planhths joined #nim
13:16:00Araq^0 makes no sense, it's ^1
13:17:09PMunch^0 makes sense, it's 0 characters off from the end
13:17:15PMunchIsn't it?
13:17:57tankfeeder^1 the same
13:18:51PMunchHmm, that's weird..
13:19:18Araqyes, 0 characters from the end is the \0 terminator
13:19:29Araq^x is len-x
13:19:50tankfeedernim 0.17
13:19:52Araq^1 is what you want, the last valid index
13:20:30tankfeeder[0..^1] returns char i
13:21:30tankfeedertrying in 0.16
13:22:11PMunchAh right, that makes sense Araq
13:25:35*yglukhov quit (Remote host closed the connection)
13:25:48tankfeeder0.16 the same
13:26:04PMunchtankfeeder [0..^1] should return the string in it's entirety (technically without it's null terminator, but if you store it as a string it will get added back again AFAIK)
13:26:42tankfeederin line in=123
13:26:46tankfeederi want get 123
13:26:57tankfeeder[3..^1] ?
13:27:02PMunchYes
13:27:05PMunchThat should be right
13:28:20tankfeederempty line and f
13:28:27tankfeederas in pastebin link
13:28:42tankfeedercan anyone repeat ?
13:29:51PMunchHmm, I just tried
13:29:56PMunchBut I got some even weirder results
13:30:13PMunchI have a file, with two lines in it, in=123 and some random text
13:30:27PMunchI've got two f.readline() statements and everything works fine
13:30:42PMunchI throw a slice operation on one of them and get an EOFerror...
13:31:43FromGitter<ephja> huh
13:31:50PMunchhttp://ix.io/y4L
13:31:55PMunchThat however works fine
13:32:22PMunchhttp://ix.io/y4N
13:32:29PMunchThat doesn't (crash message included)
13:32:36*yglukhov joined #nim
13:35:20Araqdon't use 0..x with a sideeffect
13:35:43PMunch?
13:36:29FromGitter<ephja> oh I see
13:38:41euantortankfeeder: This appears to work for me. Can probably be optimised a little: https://glot.io/snippets/er89kf0adi
13:39:36tankfeederthanks.
13:41:35euantorJust change the "^0" stuff to "^1", having read the above :)
13:42:02couven92tankfeeder, alternatively you could just get it directly from the raw on GitHub, which this code does: https://gist.github.com/couven92/ddc714bffc8078e0edf1b489b8340107
13:42:34FromGitter<ephja> euantor: no, you also need to perform the slice separately
13:42:49euantorIt works fine for me, note the string copy of the read line
13:42:56PMunchBut why does it behave so weirdly with readline and slices?
13:43:34tankfeederdoes issue exist ?
13:43:37tankfeederknown
13:43:41euantorAlso note I'm using a FileStream to read the file
13:43:50couven92PMunch, in my code https://gist.github.com/couven92/ddc714bffc8078e0edf1b489b8340107#file-blake2bkkatparse-nim-L12 you see I dropped the misleading ^1 and just used high instead
13:43:55FromGitter<ephja> does it evaluate to something like `f.readline()[x .. f.readline().len - 1]`?
13:44:05PMunchMisleading?
13:44:22PMunchAaah, that would make sense ephja
13:44:52couven92I don't want to thing or remember whether to use ^0 or ^1 or some other random number, so I'd use high instead, more explicit on the intention
13:44:52PMunchcouven92, ^1 is only misleading if you haven't read the documentation :P
13:45:06couven92s/thing/think
13:45:23FromGitter<ephja> I was talking rubbish about importc before. of course you need it if you don't want to use the proc name as the string
13:46:02couven92PMunch, I cannot be bothered to walk around remembering tiny and basically irrelevant details like that in my head, even after I read the documentation
13:46:28PMunchWell that's your loss, it's a nice little shorthand
13:46:39PMunchSame as Pythons [0..-1] notation
13:46:47PMunchMore or less
13:47:22couven92PMunch, hard to read, hard to wrap your head around, no idea what it means at first glance... high is there for exactly that reason!
13:48:54demi-hey dom96 i seem to be having difficulty using choosenim to build 0.16.0 on ubuntu
13:49:13demi-also the initial setup for a non-priviledged user on linux is really bad
13:49:24PMunchI beg to differ, high is there for things like iterations and a shorthand for .len-1. In a slice it's so often the case that you want the last part to be relative to the end of the input that introducing ^ makes perfect sense. I can agree that maybe the symbol is a bit arbitrary but the concept is good
13:49:32couven92PMunch, and honestly: looking at my keyboard to figure out where the cirumflex accent is, then remembering that you need to hit space afterwards and then typing 0 takes me much longer than writing "high"
13:49:56PMunchWell that is a question about keyboard layouts..
13:50:06FromGitter<ephja> it's 'high' + a long prefix in some cases ;)
13:50:23PMunchephja, exactly
13:50:24couven92PMunch, no, circumflex is a combinator in any layout!
13:50:41FromGitter<ephja> maybe not that often in Araq's case. he likes them single-char identifiers :p
13:53:22couven92and PMunch, if you're going down the road comparing to Python syntax: In python you'd do: `myFancyString[someIdx,]`
13:53:30PMunchNo it's not couven92. That's only for international layouts
13:53:48PMunchNot if you wanted the end minus n characters
13:55:05couven92PMunch, but we're not talking about the minus n characters (then high would just as confusing), we're talking about getting the rest (or right-side) of the string starting at a certain index
13:55:44PMunchI'm not, I'm taking about slicing in general and how ^ to denote the second slice parameter in relation to the end of a string..
13:56:54couven92getting the middle part of a string is messy in any case, and then you'll have to be careful with you index values anyways (taking 0-based and len vs. len-1 into consideration)
13:58:35PMunchNot necessarily the middle, maybe I want to grab everything but the last five characters [0..^6]
13:59:07couven92PMunch, that's the middle!
13:59:23PMunchNo, it's the beginning..
13:59:34PMunchMiddle would be cutting from both ends like [5..^6]
14:01:55couven92so cutting at the end is complicated, and if you want to understand and/or error-check that, you'll have to think about the indexing anyways. However, when you get the rest of a string, you really could care less what the ending index is, and certainly don't care whether the slicing is exclusive, length based or inclusive!
14:03:02couven92`high`, gives you the oppurtunity to simply not care and on German/Norwegian/English keyboards it's mostly even faster typing as well
14:03:25*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
14:04:05PMunchYeah I'm not saying don't use high, I'm just saying that there's nothing wrong with using ^
14:04:37couven92PMunch, nothing wrong with it, but I'd never use it if I could use high instead
14:04:51PMunchAnd by the way it's "couldn't care less"
14:05:39PMunchWell consider you have 'var long_variable_name_for_a_pretty_regular_string = "Hello World!"', something I'm sure you can appreciate as a C# programmer :P
14:05:57PMunchecho long_variable_name_for_a_pretty_regular_string[5..^1]
14:06:05couven92ah... yeah I see
14:06:13PMunchecho long_variable_name_for_a_pretty_regular_string[5..long_variable_name_for_a_pretty_regular_string.high]
14:06:29couven92didn't think abou that actually... okay, point taken
14:07:43PMunchWhere is the implementation of slices by the way?
14:08:21PMunchHaving it rewrite to f.readline()[0..f.readline().len-1] is not the best..
14:08:46FromGitter<ephja> the system module defines most of these constructs
14:08:52couven92PMunch, especially since calling readline twice there, so you'd get two different strings?
14:09:03PMunchYeah, that's the problem
14:09:28PMunchIt really should create an intermediary string
14:09:37AraqPMunch: it's a frontend transformation that macros cannot do and unfortunately sideeffect analysis is done later
14:09:48Araqwe used to error on this construct but now can't -.-
14:09:54PMunchHmm, that's a shame..
14:10:24Araqrewriting it to (let x = f(); x[^1]) should probably be done here
14:10:57Araqlooks hard to implement, in fact, this feature is surprisingly difficult to implement
14:11:02PMunchWould it be preferable to always err on the side of caution and rewrite it to let :tmp3492834 = f.readline(); result = :tmp3492834[0..:tmp3492834.len-1]
14:11:11PMunchAh yeha
14:12:53PMunchIt really should be done that way though.. The current way is not how you normally would assume a slice works..
14:12:58couven92Araq, it would be nice to have utility functions for this in strutils, like a `left`, `right`, `cutRight` and `middle`?
14:14:11couven92uhm... why `cutRight` when you have `left`? sorry... :P
14:14:56Araqwhy utilities? we have ..^ for that
14:15:04Araqbbl
14:15:10couven92Araq, for verbosity?
14:15:26PMunchHmm, but since you can do things like assign by slice as in the slices part of the tutorial: b[11..^2]="useful" I can see it being difficult to implement
14:15:44AraqPython's - is Nim's ^
14:15:54Araqit's really not all that difficult to learn and accept
14:16:18couven92yeah, okay you're probably both right...
14:16:32AraqNim's way has the benefit that it moves the decision to compiletime
14:16:39Araqno nonsense like
14:17:08Araqlet x = parseInt(stdin.readline); a[x] # last for -1 ? ugh
14:17:09couven92Araq, so, a template then? :D
14:17:12shmupAnything in particular that made you think of the ^ syntax?
14:17:16shmupdoes it relate to something
14:17:57Araqit looked better than ~ or @ and we didn't have all that many symbols to choose from
14:19:20Araq^ can be seen as an arrow upwards and the usual reading direction is downwards, so it's ok as "change direction" symbol
14:19:34Araqymmv
14:20:00shmupsure, that's fair
14:21:04*stvc quit (Quit: WeeChat 1.5)
14:21:08*yglukhov quit (Remote host closed the connection)
14:23:07PMunchBut yeah, slices should be rewritten to something which can later be checked by the compiler against side effects and such.
14:24:30couven92why does this not work: https://pastebin.com/Hr4U9Ct9
14:24:37subsetpark Araq can you explain what you mean about moving the decision to compile time
14:25:02PMunchSo begin with rewriting it to a template/macro invocation or something, and then later (when the template/macro is evaluated) it should check if that is actually "legal".
14:26:59couven92PMunch, just for sake of argument `f.readline()[0..^f.readline().len]` is perfectly okay. Imagine the case that the following line contains a placeholder characters that state how many of the character of line above a relevant!
14:27:25*bjz joined #nim
14:27:27ArrrrIf you change typed to string, it works
14:27:44couven92Arrrr, nope
14:28:02*bjz quit (Client Quit)
14:28:12ArrrrWell, that and leave a space between 0, ^ and ..
14:28:17*krux02 joined #nim
14:28:43couven92woah! okay... that DID work, why?
14:28:43PMunchI assume you mean `f.readline()[0..f.readline().len]` couven92?
14:29:01couven92PMunch, yeah, whatever
14:29:19ArrrrCan you actually return typed in templates?
14:29:33PMunchNot really, what you wrote would be rewritten as: `f.readline()[0..f.readline().len-f.readline().len]`
14:29:43PMunchWhich is something else entirely :P
14:30:07couven92Oh crap! Shit, you're right
14:30:27PMunchBut I get your point, and while that would be a legitimate scenario I don't think f.readline()[0..^1] should be the way to achieve that :P
14:30:56couven92no, agreed
14:31:08couven92what about my cutRight template?
14:31:12PMunchOr rather, what you wrote should do what you think it does, read two lines and use the second for slicing
14:31:41couven92should I PR that to add to strutils (just to make verbose people like me happy)? :P
14:31:59PMunchWell, since it takes it in a string I think it would be okay. If it took it as untyped then it would probably have the same problem, although I'm not 100% sure..
14:32:25*yglukhov joined #nim
14:32:51*enthus1ast joined #nim
14:33:19ArrrrI'd like to see this in strutils: `proc pad*(str: string, space: int, by: char = ' '): string = str & repeat(by, space - len(str))`
14:33:28Arrrrquite useful for console purpouses
14:34:39ArrrrI could make a nimble package
14:35:02euantorhttps://nim-lang.org/docs/strutils.html#align,string,Natural,Char
14:35:17euantorLike that you mean? ;)
14:35:29ArrrrExpect the opposite
14:35:33Arrrr*except
14:35:34euantorTHough it would be nice to have a version that adds the padding to the right rather than the end
14:36:06ArrrrYeah, maybe `ralign`
14:36:14couven92euantor, like in C# where we have PadLeft and PadRight?
14:36:23euantorYeah, exactly
14:36:40euantorSame as we have Trim, TrimStart and TrimEnd
14:37:10shmupare those in strutils?
14:37:18*yglukhov quit (Ping timeout: 260 seconds)
14:37:32couven92`strip` has bool arguments for left and right stripping
14:37:48euantorYeah, which is a nice way to handle it, thanks to named arguments
14:37:56couven92or `trailing` and `leading` as they are called
14:38:16couven92euantor, yup, I thought so, too
14:40:57*onionhammer1 joined #nim
14:42:27shmuphm kidna want to see a nice nim example on here https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax
14:42:42shmupjust because it only lists D and Rust and Nim there, but only has Rust and D example
14:42:50shmupi'd have a much simpler example than the other 2
14:42:57*onionhammer quit (Ping timeout: 240 seconds)
14:43:36PMunchJust write one shmup :)
14:44:12shmuphow about one for adding two vectors together or something
14:44:32shmupi'll show here first whatever i do
14:44:35PMunchYeah that would be nice :)
14:44:40ArrrrIf i were you i'd write something that requires a few lines. I don't know why they need so many for such a simple concept
14:44:49shmupi completely agree, yeah
14:44:53PMunchx.add(y); add(x,y), y.add x
14:45:14shmupyeah, exactly. altho i might spend 2 lines on writing my own proc
14:45:14PMunchArrr, they use most of that to define the procedures :P
14:45:33PMunchYou should, it's nice to have a self-containe example
14:45:45couven92so how about this: I could imagine this to be found in strutils... It wouldn't hurt, right?
14:45:50couven92https://pastebin.com/s2kaKN8M
14:46:40*krux02 quit (Remote host closed the connection)
14:47:00PMunchMaybe a "template cut(s: string, left: Natural = 0, right: Natural = 0): string"?
14:47:02*Calinou is now known as CALINOU
14:47:47couven92PMunch, or `slice`?
14:48:26PMunchWell I guess the cut template would be the same as a slice :P
14:48:26couven92no, actually `cut` is better, since you away the specified number of chars...
14:48:49euantor`slice` is already used: https://nim-lang.org/docs/tut1.html#advanced-types-slices
14:49:19ArrrrD example done in nim https://pastebin.com/gMqBtweD
14:49:23couven92okay... cut it is then... rather a single template than two separate ones?
14:50:27*aerx joined #nim
14:50:41PMunchWell, "Hello".cut(left=5) is almost the same as "Hello".cutLeft(5)..
14:51:45couven92PMunch, I agree
14:54:07couven92Hmm... that didn't work: https://pastebin.com/xT7Ge6fC
14:54:52shmupok would y'all name arguments any differently? adding convention a and b? https://gist.github.com/shmup/e912ca6ccfc4ae86dfd135ef78af95fc
14:55:10shmupstyle guide for x,y: int, does it have a space between x, y
14:55:56couven92shmup, spaces between is definitely nicer to look at
14:57:10shmupoh, chaining is nice for the example
14:57:39Arrrralso you could include `add v1, v2` maybe
14:59:38couven92Uhm, anyone know why mine failed? I got nothing here... :O
14:59:59Nikkyin c2nim with #defines in structures is there any good way to handle that withouzt manually editing the .h files ? as ihave a script to cppp that stuff
15:00:05couven92Do templates not ilke optional args?
15:01:29ArrrrNatural -> int
15:02:29couven92Arrrr, okay that works... why?
15:03:07ArrrrSeems like `[]` doesn't accept natural, but i'm not sure
15:03:37couven92okay... will have to live with it being ints :P
15:03:43*dom96|w joined #nim
15:04:01dom96|wWhen people find your talk before you, you know they're excited :)
15:04:17dom96|wSlides aren't very visible unfortunately.
15:04:44couven92dom96|w, and the sound was not the greates either...
15:04:49PMunchYeah, the code examples are a bit weird :P
15:04:57PMunchAnd the clapping ridiculously loud..
15:05:12dom96|wlol. Well, it is a Northern Irish conference :P
15:05:13PMunchs/weird/unreadable
15:05:16dom96|wand the first of its kind
15:05:25shmupArrrr: come again re: add v1, v2 (that is valid syntax?)
15:05:27dom96|wThey used iPads to do the recordings
15:05:33dom96|wand they were placed right beside the audience
15:05:34shmupArrrr: not compiling, and maybe i'm doing something wrong
15:06:00PMunchThey could've also cut the information about the day from the video. Watching it online I don't really care that things are running behind schedule or if there is something going on downstairs later :P
15:06:01dom96|wAnyway, here are the slides https://picheta.me/nidevconf/reveal/
15:06:01ArrrrIt should work.
15:06:04shmupit's saying got (Vector), but expected a, b: Vector
15:06:20PMunchYeah I guessed it was something like that :)
15:06:29dom96|wI also asked them to let me view the video before they published it...
15:06:33dom96|wHeard nothing
15:06:46PMunchAnd me and couven92 might steal some of those slides :) We're probably going to do a talk on Nim after the summer
15:07:25ArrrrIt is working ok in play.nim
15:08:29couven92PMunch and I were talking about it earlier today... We're thinking about using our never-used video recording infrastructure in our auditoriums to actually record our talk :P
15:08:39dom96|wdemi- what issue were you having?
15:08:54shmupArrrr: adjust my add to return a `var Vector` so that you can chain them
15:09:06dom96|wcouven92, PMunch: awesome, feel free to use it. The source is on GitHub as well :)
15:09:09shmupindeed playground does work with add v1, v2 if I don't return anything in add
15:09:10PMunchcouven92, how's the audio on that though?
15:09:24dom96|wBonus points for showing the snake game as well. I think people were impressed.
15:09:38PMunchYeah, people seemed to like that
15:09:43shmuphttps://gist.github.com/shmup/e912ca6ccfc4ae86dfd135ef78af95fc
15:09:49dom96|wI was rushed though so I don't think it had as much impact as it could have had
15:09:50couven92Well have to try it out... we could actually test that now, when there are no student to distrib
15:09:50PMunchAnd it's cool that server and client can share code
15:09:55shmupin that example `add v1, v2` does not compile
15:10:13couven92Arrrr, euantor, PMunch okay, so I'm creating a PR for the `cut` template to be added to strutils... I can throw in `alignLeft` as well, if you like?
15:10:16shmupi kinda wanna leave out discard and var syntax in the example, hm
15:10:21dom96|wPMunch: yep, glad that's what you picked out of that, it was exactly my intention :)
15:10:27ArrrrFor that example you don't need Vector to be var
15:10:39Arrrrprobably it doesnt work because of discard
15:10:51*yglukhov joined #nim
15:11:00Arrrrnot using parenthesis does weird things when you are returning something
15:11:03euantorcouven92: Align left would definitely be nice :)
15:11:26shmupsorry Arrrr yeah you're right, in _this_ example I need var https://gist.github.com/shmup/e912ca6ccfc4ae86dfd135ef78af95fc
15:11:48ArrrrMaybe use {.discardable.}
15:11:59ArrrrOr just ignore it
15:13:04shmupyeah, don't really wanna throw that {..} syntax in it. uh. hm.
15:14:45*Andris_zbx quit (Remote host closed the connection)
15:14:57*yglukhov quit (Ping timeout: 240 seconds)
15:16:30*krux02 joined #nim
15:20:40*bjz joined #nim
15:21:10shmupwould you remove my comment regarding discard-statement bc not relevant to UFCS https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax#Nim_programming_language
15:22:45ArrrrI think it is not worth it, either remove discardable and the comment or let it be
15:23:19shmupso just to clarify: remove it and let it compile error?
15:23:21ArrrrBut the snippet is small, so i don't think it is a nuisance
15:23:33PMunchI think it's fine with the {.discardable.}
15:25:15Arrrrremove the example that makes the discardable needed or just leave it without commenting it
15:25:50ArrrrLet it be, the example looks good.
15:26:05Arrrrbtw, shouldn't it color the syntax?
15:26:28shmupyou mean more than it is? http://i.imgur.com/wlYIe4w.png
15:27:23*NotSpooky quit (Quit: Leaving)
15:27:28shmupdiscardable is needed in all 5 of those examples, by the way. not just the add v1, v2
15:27:42shmupok. i'm going to remove the comment, but i do think it's kinda nice :P
15:27:48ArrrrDoesn't look green in my screen. Maybe because i use wikiwand
15:28:30ArrrrBtw, your example doesn't return a thing. It should read `(a.x + b.x, a.y + b.y)`
15:28:50shmup!!
15:29:09ArrrrWell, it is currently returning (0, 0)
15:29:31shmupyeah
15:31:12ArrrrMaybe you want to add a second proc that actually returns the sum of both
15:31:14shmupif I'm not mistaken, I need to create a new Vector in that proc, right?
15:31:16shmupa mutable one
15:34:41Arrrror `result.x = a.x + b.x` etc
15:35:30shmuphuh. wow. I didn't know that would work
15:35:31*enthus1ast quit (Quit: Lost terminal)
15:35:42shmupI know about result so little I didn't know it would `be` the return type
15:35:46shmupout of the box
15:35:55shmupthanks, I like this
15:36:14shmupalthough now it's even more `magical` to non-nim readers, lol
15:38:01Arrrrhttps://nim-lang.org/docs/manual.html#statements-and-expressions-return-statement
15:40:41shmupArrrr: can you maybe help me understand why SIGSEGV: Illegal storage access. (Attempt to read from nil?)
15:40:59shmupin the case of line 16 https://gist.github.com/shmup/f2fd90559545b1fdceb4dffc34fed33f
15:41:00*Trustable joined #nim
15:42:55Arrrrlel
15:43:52ArrrrBecause : var Type actually returns a pointer
15:45:04shmupok, yeah, no, I thought I needed var because when first doing this compiler was talking about immutability but perhaps I was.. doing something different then. I don't know. I pull it out, all is well.
15:45:42*tankfeeder quit (Quit: Leaving)
15:46:38shmupI'm losing my mind, var _is_ needed for chaining. I'm being scatter brained as heck right now. Need to actually focus on work lol. I'll think about this later. I just want a nice example that compiles.
15:47:51ArrrrIf i were you i'd leave the example similar to this https://pastebin.com/g982uzRp
15:48:27Arrrr(there was a v3 that i removed)
15:49:26*yglukhov joined #nim
15:51:38shmupthanks. lol. yes. that is good
15:53:10*vlad1777d quit (Remote host closed the connection)
15:54:22couven92PMunch, euantor, https://github.com/nim-lang/Nim/pull/6023
15:54:31krux02when I start my nim program it fails with the message "out of memory"
15:54:36krux02but in gdb I don't have a stack trace
15:54:41krux02how do I get the stack trace?
15:54:57*v17d joined #nim
15:56:12krux02the progam just quits with a non informative message "out of memory"
15:56:18krux02and quits
15:56:32ArrrrWhat if it happens because of global vars?
15:57:07FromGitter<ephja> yay more vectors
15:57:43FromGitter<ephja> some things are indeed confusing for beginners, but of great help to those who are more experienced
15:59:09*Matthias247_ joined #nim
15:59:25*Matthias247 quit (Ping timeout: 276 seconds)
16:00:56*v17d quit (Remote host closed the connection)
16:01:09*yglukhov quit (Remote host closed the connection)
16:02:30*v17d joined #nim
16:02:32ArrrrFrom that article i think the nim example is the clearest one
16:03:00*EastByte quit (Read error: Connection reset by peer)
16:03:13*EastByte joined #nim
16:05:15*krux02 quit (Remote host closed the connection)
16:06:46FromGitter<Varriount> Nikky: You could try implementing handling in C2Nim, but it's not easy
16:07:23FromGitter<Varriount> Or rather, it requires knowledge about parsers and such.
16:07:54FromGitter<Varriount> (I'm assuming you mean 'ifdefs' in structure definitions.
16:08:07*nhywyll joined #nim
16:13:08FromGitter<ephja> now I can't pass some undefined identifier to an untyped parameter for some reason
16:18:15Nikkywell the ifdefs i solved by using cppp
16:18:55Nikkyc2nim is stumbling over #defines like in here.. https://github.com/nim-lang/c2nim/issues/73
16:19:14*chrisheller joined #nim
16:19:31Nikkywhich cppp does nto preprocess apparently
16:19:36FromGitter<ephja> yeah I think there are some issues related to using untyped in macros
16:20:47Nikkybut i cannot really ruse gcc -E unless i somehow mess with the rather complex configure and makefile..
16:21:31Nikkyanother option might be to manually fix it in the .h files but i would have to repeat that every time i run cppp again , and that is assuming i know what the right thing to do is..
16:23:27FromGitter<ephja> regex preprocessing is viable in some cases
16:28:50*cspar_ joined #nim
16:31:34*cspar quit (Ping timeout: 255 seconds)
16:35:47*Matthias247_ quit (Read error: Connection reset by peer)
16:39:27*NotSpooky joined #nim
16:45:14*yglukhov joined #nim
16:45:59*nsf quit (Quit: WeeChat 1.7.1)
16:50:21ehmryhey, I'm getting``Error: illegal capture 'strWrapper'`` with a nested proc in a template, but I'm not sure why its illegal or what is being captured https://gist.github.com/ehmry/60201d4cabef4d0a87bdcdb5f3a56f3b#file-rom-nim-L32
17:00:30*johnny_b quit (Ping timeout: 240 seconds)
17:01:58FromGitter<Varriount> Nikky: I'd just move them around.
17:02:53*johnny_b joined #nim
17:03:02Nikkyi am not that knowledgeable in C and .h files.. could i move all defines that make problems out of their scopes ?
17:03:12Nikkylike type definitions and enumes etc..
17:03:17Nikky*enums
17:03:17FromGitter<Varriount> Just move them outside the structure definition
17:03:35Nikkydoes it make a logical difference if its before or after it ?
17:04:05Nikkyotherwise i would probably write a script that keeps trying to compile and moves the lines to the end of the file
17:04:17FromGitter<Varriount> Only if you move the define after a point it's been used.
17:04:45FromGitter<Varriount> Nikky: Can you show me a file?
17:05:35*yglukhov quit (Remote host closed the connection)
17:08:01*dom96|w quit (Ping timeout: 255 seconds)
17:08:45Nikkysame i showed you yesterday would work as a example.. the line numbers are all messed up though.. because i just leave out all uneeded features..
17:09:39Nikkyah well here.. partially preprocessed https://gist.github.com/NikkyAI/f3dcc740478ffe3c31e79c492acd5f5c
17:10:45FromGitter<raydf> Hi everyone
17:11:24FromGitter<raydf> i'm following karax framework, any idea on how to animate with velocity?
17:13:06Araqraydf: cool. but no, what do you mean?
17:14:50*Trustable quit (Remote host closed the connection)
17:15:31FromGitter<raydf> http://velocityjs.org/
17:15:46FromGitter<raydf> how to call external javascript libraries
17:16:24FromGitter<raydf> maybe i'm missing some documentation
17:18:27FromGitter<raydf> This is a simple call in Velocity ``` Velocity(document.getElementById("dummy"), { opacity: 0.5 }, { duration: 1000 });```
17:19:00Araqlook at examples/mediaplayer/mediaplayer.nim
17:19:10FromGitter<raydf> OK, thanks
17:20:02Araqor at kdom.nim
17:20:09*NotSpooky quit (Quit: Leaving)
17:20:22Araqimportc and importcpp pragmas do the import from JS
17:20:52Araq(yes, I know these are misnamed and hardly documented. please create a PR)
17:22:54FromGitter<raydf> Nice!
17:27:13FromGitter<raydf> Done, https://github.com/nim-lang/Nim/issues/6024
17:28:32FromGitter<raydf> The correct way to make web components is the structure displayed in the mediaplayer example?
17:33:01FromGitter<raydf> sorry, already saw Carousel example, kudos for the framework, i love the speed of compiling and that i can keep using nim for the frontend part.
17:33:41Araqyeah, carousel is the example to look at. keep in mind we're designing a 'component' macro so these things will get easier.
17:34:06Araqfor now we focussed on getting the algorithms right. and well... it's still ongoing but progress is good
17:34:07Trioxinthere needs to be a team of people dedicated to pumping out wrappers. I think that would greatly expand the community
17:34:50AraqTrioxin: maybe, or maybe we need to make c2nim smarter
17:34:58Trioxinthat would do it too
17:35:03Nikkyi am trying :P currently trying to understnad how Arayq did it on wxWindgets
17:35:30TrioxinI keep being forced to use damn Go for things
17:35:31FromGitter<raydf> I'll try to contribute with any wrapper i can develop, is there any example of a wrapper for any javascript library?
17:36:41Trioxinhell I could wrap JS stuff easy but C libs are what's really needed
17:37:30FromGitter<raydf> right @Trioxin
17:37:59FromGitter<raydf> i tried to use the redis lib, but it doesn't implement some features.
17:38:57TrioxinI started a blake2 wrapper earlier just because I thought it would be cool https://github.com/TomAshley303/BLAKE2
17:39:42FromGitter<raydf> Nice
17:40:06Trioxinpretty sure it can't quite be used yet. idk. i'll get back to it later
17:45:49Trioxinwho made nimx? each time I run the example, the window content glitches
17:48:11shmupraydf: https://github.com/andreaferretti/react.nim
17:50:23*PMunch quit (Ping timeout: 260 seconds)
17:52:25*v17d quit (Remote host closed the connection)
17:54:17*PMunch joined #nim
17:56:26*dom96|w joined #nim
17:56:36FromGitter<raydf> @shmup, thanks, a great example, i really need to learn a lot about pragmas and the macro system.
17:56:50Trioxinhrm. no way to make nim gui easy without nimx
17:57:00shmupthis might be useful too, raydf: https://github.com/nim-lang/Nim/issues/4873
17:57:06shmupraydf: as in learning about jsffi
17:57:50*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
17:59:40*bjz joined #nim
18:02:37FromGitter<raydf> @shmup, excellent, a lot of goodies :).
18:08:12FromGitter<ephja> Araq: this seems to work https://gist.github.com/ephja/6124deeff204a32f9b02d207e648211a
18:09:13FromGitter<ephja> it's a nice typedesc shortcut btw, but maybe I shouldn't use it
18:11:10*Trioxin quit (Ping timeout: 240 seconds)
18:15:39FromGitter<ephja> reporting it now
18:16:12*nhywyll quit (Quit: nhywyll)
18:16:32Araqephja: what do you mean "it works and I'm reporting it" ?
18:17:06shmupdo we tag github projects `nim` or `nim-language` :P
18:17:47FromGitter<ephja> Araq: well, should it? the second overload is never called for the array case, but called when typedesc[int] is passed and when the occurences of array are replaced with int
18:19:13FromGitter<ephja> btw, is the presence of the generic arguments I and T from a time when they couldn't be omitted?
18:19:19Araqnot sure I can follow you. do you ask about overloading and typedesc or about .magic?
18:19:41Araqyes to your btw
18:22:49Nikkythe #dynlib directive in c2nim, does it autogenerate the code that picks the names for the fiels on the different platforms ? or do i hvar to copy that into the generated nim file ?
18:23:37Nikkyand i assume putting it into the c2nim file would not help ..
18:25:09dom96|wshmup 'nim'
18:25:14AraqNikky: #dynlib produces .dynlib for procs
18:28:13PMunchAww, Trioxin quit. Should've told him about wxnim :)
18:28:52*pilne joined #nim
18:28:59*yglukhov joined #nim
18:29:47Araqyglukhov: Trioxin reported an issue with 'nimx'
18:30:14Araq"who made nimx? each time I run the example, the window content glitches"
18:30:53FromGitter<ephja> Araq: the issues are related to overloading
18:31:06FromGitter<ephja> also: `proc p(x: array) = discard`: "Error: invalid type: 'T' in this context: 'proc (x: array)'"
18:31:19yglukhovAraq: right, thanks.
18:32:47FromGitter<ephja> yglukhov: is nimx still broken on devel?
18:33:13yglukhovephja: no, its good.
18:33:20FromGitter<ephja> great
18:33:51FromGitter<ephja> btw, have you considered including an OOP macro for simplifying inheritance?
18:34:34yglukhovephja: i'm not sure i'm following. which macro are you talking about?
18:36:19FromGitter<ephja> yglukhov: just one that cuts down on some of the boilerplate related to inheriting from widgets
18:37:48FromGitter<ephja> I wonder if that nakefile can be replaced with nimscript now
18:37:48yglukhovephja: can you please point me exactly at the boilerplate which can be reduced? =)
18:38:41yglukhovnakefile runs jester when building js/emscripten. jester is compiled right into the nalefile. nims can't do that.
18:38:49FromGitter<ephja> I can't remember exactly, but you need to type certain things for every widget that you inherit from. I'll try nimx again btw
18:40:30yglukhovsure, thanks. feel free to ping me with feedback =)
18:44:18Nikkyso i managed to convert libtorrent.h using c2nim and it seems to work but their simple_client makes me run into problems where it does not know fprintf
18:44:28Nikkyi probably just overlooked some stuff
18:45:19FromGitter<ephja> just use 'echo' instead
18:45:23FromGitter<ephja> ls
18:45:31FromGitter<ephja> oops
18:46:24Nikkywell this is just the first error i am worried about which other c std lib functions will not work because i overlooked something
18:54:29*tankfeeder joined #nim
18:54:55FromGitter<ephja> yglukhov: the scrolling workaround might not work anymore. are you able to scroll windows at all?
18:55:28FromGitter<Varriount> Nikky: is the converted code posted anywhere?
18:55:30tankfeederhttps://bitbucket.org/mihailp/blake2/src/default/blake2.nim
18:55:41Nikkyi can gist it..
18:55:49tankfeederstill cant get working test vectors
18:56:07Nikkyhttps://gist.github.com/NikkyAI/9ed8c99997e89e36cf61a66ce2291d5f
18:56:28tankfeederquestion: in the code you see group of asserts working on getBlake2b
18:56:35Nikkyit fails to compile because it does not know fprintf and probably all over c functions it uses
18:56:53tankfeedergetBlake2b generates different results, its ok :)
18:56:59Nikkyi could probably rewrite that.. but there should be a solution for that right ?
18:57:13FromGitter<ephja> yglukhov: repeatedly appending text seems to cause delays, but I dunno if I'm responsible for that
18:57:27tankfeederwhen i run on test vectors it generates the same result for every vector of two
18:57:59tankfeederproblem somewhere data variable and proc hex2str
18:59:10FromGitter<Varriount> Nikky: Oh wow, you actually translated code that does something.
18:59:11tankfeedermaybe while loop
18:59:19FromGitter<Varriount> Usually C2Nim is just passed header files.
18:59:35FromGitter<ephja> you are discarding the pre-allocated strings btw
19:00:05Nikky@Varriount i switched from ffmpeg which just did not work to libtorrent which i might need as well which is a whole lot less complex and has a test_client in c code i can test with
19:00:41Nikkythe name of c2nim seems to imply it is for c.. otherwise would it not be h2nim ?
19:00:55FromGitter<ephja> also, you can do: `result = @[]`
19:01:20FromGitter<Varriount> Nikky: Technically it can convert all C code, however in practice it's usually used on just header files.
19:01:22FromGitter<ephja> Nikky: it can handle bodies too to some extent
19:01:29tankfeederephja: i will tru
19:01:31tankfeedertry
19:01:40FromGitter<Varriount> It's easier to wrap a library, then manually write the logic in Nim
19:01:50*dom96|w quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:02:17subsetparkwake me up when c2nim can process nimbase.h
19:02:17yglukhovephja: i don't have windows. are you saying that scrolling doesnt work at all?
19:02:34Nikkywell it tried .. but i am missing the fprintf and other function imported from stdlib (or whatever it was called) can i do that in embedded nim code when converting ?
19:03:35FromGitter<Varriount> Nikky: Replace fprintf with echo.
19:03:37FromGitter<ephja> yglukhov: nah. I think it did before after minimizing and possible clicking on the window
19:03:56Nikkywill that fowork with echo(stderr, ...)
19:03:59Nikky?
19:04:01FromGitter<Varriount> Nikky: c2nim just does dumb translation, it doesn't check that the code actually works.
19:04:03Nikky*work
19:04:05FromGitter<ephja> the other bug remains, so I'll just work around it somehow
19:04:09FromGitter<Varriount> Nikky: For stderr, use stderr.write()
19:04:21yglukhovephja: about text lagging?
19:04:40Nikkyok thanks.. gonna rewrite and come back on the next non obvious errors
19:05:00yglukhovephja: which language are you using?
19:05:02yglukhovfor typing
19:05:35*dom96|w joined #nim
19:05:55yglukhovephja: english?
19:05:57FromGitter<ephja> yglukhov: no, scrolling. if only profiling worked with threads, but I could try a minimal example
19:06:05FromGitter<ephja> yes
19:06:19FromGitter<ephja> it's not like I need to hold enter anyway
19:08:01yglukhovephja, sorry, it's hard for me to understand whats going on there. what is the common way of reporting ui lib event handling bugs? =)
19:08:27yglukhovmaybe a video would help =)
19:09:25*jszymanski quit (Quit: computer sleeps...)
19:18:28*dom96|w quit (Ping timeout: 240 seconds)
19:18:35FromGitter<ephja> yeah
19:27:57*yglukhov quit (Remote host closed the connection)
19:34:55Nikkywhat would be the nim equivalent of this ?
19:35:02Nikky`~(cat_progress | cat_port_mapping | cat_debug | cat_performance_warning | cat_peer)`
19:35:21Nikkyc2nim translated it with not and or
19:35:30Nikkybut nim throws some weird type errors
19:36:09Nikkythose are enum values btw
19:36:37FromGitter<ephja> yglukhov: great lib in any case. the only problem is that a lot of people are picky when it comes to native looks
19:36:50FromGitter<ephja> I don't see why, because every website is like a different UI
19:38:49Nikkythiese are the values .. https://gist.github.com/NikkyAI/9ed8c99997e89e36cf61a66ce2291d5f#file-libtorrent-nim-L100-L112
19:39:16*jordonbiondo joined #nim
19:42:46*SusWombat quit (Remote host closed the connection)
19:44:53*Arrrr quit (Read error: Connection reset by peer)
19:45:38Nikkyso nim cannot do bitwise operations on the type of category_t
19:46:34*libman joined #nim
19:46:41*SusWombat joined #nim
19:47:45*v17d joined #nim
19:49:06*enthus1ast joined #nim
19:49:12enthus1asthi
19:49:40enthus1astare you aware of a http byte range implementation for asynchttp?
19:50:04*jordonbiondo quit (Ping timeout: 260 seconds)
19:57:02*nsf joined #nim
20:01:44*yglukhov joined #nim
20:06:20*Matthias247 joined #nim
20:13:53*Vladar quit (Quit: Leaving)
20:21:05FromGitter<Varriount> Nikky: Hm
20:22:41FromGitter<Varriount> Nikky: `not (cint(cat_progress) or cint(cat_port_mapping) or cint(cat_debug) or cint(cat_performance_warning) or cint(cat_peer))`
20:23:03*Snircle joined #nim
20:23:15*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
20:23:16FromGitter<Varriount> There's probably a less verbose way to do it using the built-in set type, but that's the most obvious way.
20:23:19*enthus1ast quit (Ping timeout: 276 seconds)
20:24:35*tankfeeder quit (Quit: Leaving)
20:25:31*bjz joined #nim
20:29:40*enthus1ast joined #nim
20:30:40*couven92 quit (Ping timeout: 260 seconds)
20:31:24Nikkyi tried using set but i have no idea how to convert that to cint then.. trying out your suggestion
20:32:46Nikkyoh yeah well the types are still incorrect.. i think.. lets just wrap it all in cint then
20:45:53*ipjk joined #nim
20:50:52Nikkywhen i create a array is there a way to not define the length and infer that from the amount of strings on the righthand side ?
20:51:31LyndsySimonAnyone using vim and have syntax highlighting working?
20:54:28*enthus1ast quit (Ping timeout: 260 seconds)
20:54:42LyndsySimonAhh... baabelfish/nvim-nim works.
20:54:47PMunchLyndsySimon, yeah
20:54:52PMunchI have it working :)
20:54:53AraqNikky: var x = [1, 3, 4]
20:55:09PMunchEven shows errors when I save the file
20:56:00LyndsySimonWoot :)
20:56:15LyndsySimonHave a .vimrc or init.vim to share?
20:56:48PMunchhttp://ix.io/y5m
20:56:53PMunchNot all that much tbh
20:57:22LyndsySimonAh, TY :)
20:57:51LyndsySimonzah/nim.vim wont' work for me. I'm using neovim without a python provider.
20:58:02PMunchAh, Windows user?
20:58:11LyndsySimonNope, on a Mac atm.
20:58:18LyndsySimonJust an odd setup.
20:58:26PMunchHaha, okay :P
20:58:31LyndsySimonI'm trying to keep vim as fast as possible
20:59:09Nikkythise call of the c libarary wants a value of type "ptr cint" and the original test_client just passed in 0.. how can i cast that ?
20:59:12PMunchHmm, can't say I've even thought vim was slow :P
20:59:22PMunchBut I see what you mean
20:59:34Nikkyi will look into simplifying the cint string madness later if its possible at all
20:59:48PMunchNikky, addr?
21:00:06Nikkyoh so that is the keyword.. thanks
21:00:34PMunchNo problem :)
21:00:45Nikkyexcept it tells me the expression has no adress so i guess it expects a variable or such
21:01:00PMunchWhat are you trying to pass it?
21:01:20*enthus1ast joined #nim
21:01:23PMunchOh yeah, I think only vars have an addr. Const and let doesn't
21:01:25PMunchIIRC
21:01:26Nikkyliterally 0
21:01:30*CALINOU is now known as Calinou
21:01:41PMunchAh, in that case you can just pass it nil
21:01:57PMunchIf you want NULL
21:01:58Nikkybut will the types match ?
21:02:35PMunchWhat signature are you trying to call?
21:02:46LyndsySimonPMunch: vim can be very slow if you have it set up badly, lol. I moved away from it because of that.
21:02:54PMunchAh right
21:03:02LyndsySimonPMunch: Here's my current vimrc: https://github.com/lyndsysimon/dotfiles/blob/master/nvim/init.vim
21:03:03Nikkyjust from seeing how often i have to cast things to cint and cstring using this seems to be a pain in the ass.. i hope there is a way to implicetly convert that later
21:03:23Nikkyproc session_pop_alert*(ses: pointer; dest: cstring; len: cint; category: ptr cint): cint {.
21:03:25Nikky cdecl, importc: "session_pop_alert", dynlib: libname.}
21:03:51Nikkycategory: ptr cint is the one causing issues
21:04:17Nikkybut i saved zero as a cint and passed it addr(category) seems to work now
21:05:22PMunchWell, it depends on what you want. Typically in C when it asks for a pointer to something it wants to save some value there
21:05:48PMunchSo nil and var x:cint = 0 have two quite different meanings :P
21:06:15PMunchOften times when passed NULL these functions will not store something, maybe saving the execution of a branch
21:07:33PMunchAh: if (category) *category = a->category();
21:07:49*dexterk quit (Read error: Connection reset by peer)
21:07:58Nikkyah so it tries to call that ?
21:08:02*dexterk joined #nim
21:08:24Nikkyand i thought this wuld be easier than ffmpeg.. well it probably is but C sucks
21:08:38PMunchNo, it checks if category, which is a NULL check essentially. So if category != NULL
21:09:01Nikkyok i think i understand
21:09:10PMunchAnd then in writes a->category() to that location
21:09:27PMunchSo after you run session_pop_alert you category value should have changed to something
21:10:09Nikkyi see
21:10:17PMunchWhich is defined in an enum category_t
21:10:30Nikkywell in the test_client it was not used at all but good to know
21:11:22PMunchAh yeah, they pass 0. In Nim that would be nil
21:11:35PMunchC doesn't distinguish between 0 and NULL
21:12:02PMunchYou could type 1 there as well, but that would lead to an illegal storage access fault
21:12:22PMunchAs it would try to write it to memory position 1 :P
21:14:14Nikkyi get that
21:15:22PMunchSo whenever you see 0 passed to a pointer field just use nil in Nim :)
21:15:55Nikkyso the converted main proc has a header like this.. `proc main*(argc: cint; argv: ptr cstring): cint {.cdecl.} =`
21:15:56PMunchUnless you actually want that value passed back
21:16:20Nikkyptr ctring is a string array is my guess ?
21:16:28PMunchYes
21:16:51PMunchhttps://stackoverflow.com/questions/3024197/what-does-int-argc-char-argv-mean
21:16:59PMunchBasically they are the command line arguments passed in
21:17:09Nikkywell i could either try to create a array and then get the addr of the first element or just change the definition
21:17:37Nikkybut afaik nim does not like uknown length of array does it ?
21:17:48PMunchWait, do you want to call a main proc?
21:17:51Nikkyi need a varargs pragma there ?
21:18:03Nikkywell main is in the test_client
21:18:18PMunchYeah
21:18:37PMunchIn C main(int argc, char* argv[]) is the procedure called when you run the program
21:18:43Nikkyso i can modify it .. as long as i can convert the passed filenames to cstring i think
21:19:25PMunchSo if you compiled it and wanted to run it you could do "./test_client --help" for example. Then argc would be 2 (1 is the program name) and argv would be ["test_client", "--help"]
21:19:37Nikkywhich is converted to that.. how do you get commandline arguiments in nim btw ? have not looked that up.. can you convert to ptr ctring somehow ?
21:19:42PMunchIn Nim the entire file just runs from the beginning
21:20:36PMunchcommandLineParams()
21:20:43PMunchThat would give you the parameters
21:22:17PMunchSo in your nim program running "./nimprogram --help" commandLineParams() would return @["--help"] and getAppFilename() would return "nimprogram".
21:22:49PMunchSo if you wanted to port the test_client to Nim you would use that instead
21:22:56*Pisuke quit (Quit: WeeChat 1.6-dev)
21:23:19Nikkyi see.. thanks that helps a lot..
21:23:28PMunchNo problem :)
21:30:39libmanhttps://warosu.org/g/?task=search&ghost=&search_text=nim+programming - that site came up in my Nim news search
21:30:41*nsf quit (Quit: WeeChat 1.7.1)
21:30:53*xet7 quit (Quit: Leaving)
21:40:40*planhths quit (Ping timeout: 260 seconds)
21:50:59*ipjk quit (Quit: Leaving)
21:51:59*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:12:56*v17d quit (Ping timeout: 268 seconds)
22:14:57*bjz joined #nim
22:19:35*PMunch quit (Quit: leaving)
22:24:55*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:25:42FromGitter<zacharycarter> is it just like an aggregator?
22:29:26*couven92 joined #nim
22:31:31*bjz joined #nim
22:35:45*themagician quit ()
22:40:17*shashlick joined #nim
22:41:29*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:47:28*enthus1ast quit (Ping timeout: 268 seconds)
22:48:04shashlickrunning into a weird issue - am using secureHashFile() to get the SHA of files and am running out of memory - appears the memory from the readFile() doesn't get garbage collected
22:49:25*enthus1ast joined #nim
22:50:59*Matthias247 quit (Read error: Connection reset by peer)
22:51:53libmanAre there any English-language Nim videos missing from https://www.youtube.com/playlist?list=PLXIivpcMlfwAevvA4IvLIiYOujqSuyyKY (not counting that one-minute teaser of Rumpf in Kiev).
22:52:29libmans/.$/?/
22:56:48LyndsySimonI need some advice: I'm playing with building a roguelike to learn Nim, and I want to represent a map as a type. The map will be an two-dimensional dense array of Tiles (another type), the dimensions of which will not be known at compile-time, but will be known at runtime and will not change. Must I use a sequence, or is there a better type of which I'm unaware?
23:00:22LyndsySimonI fear I'm thinking of this in too much of an OOP-centric mindset.
23:04:22FromGitter<zacharycarter> oooo
23:04:27FromGitter<zacharycarter> my kind of question
23:04:33FromGitter<zacharycarter> why not just an array
23:04:55FromGitter<zacharycarter> oh you said the size is variable
23:05:19FromGitter<zacharycarter> LyndsySimon: I would use a sequence
23:05:35FromGitter<zacharycarter> single dimension
23:06:54FromGitter<zacharycarter> also you should consider using https://github.com/zacharycarter/blt-nim :P
23:10:03LyndsySimonzacharycarter: Thanks! I'll read up on that.
23:11:00LyndsySimonzacharycarter: I'm really trying to stay super simple. I'm less concerned with it getting done that I am with thoroughly learning nim.
23:11:24FromGitter<zacharycarter> LyndsySimon: blt is pretty simple to use it's like a opengl version of ncurses
23:11:39LyndsySimonI've never used either either of those :)
23:11:55LyndsySimonMy background is mostly backend webdev, with some scientific computing thrown in for spice.
23:12:02FromGitter<zacharycarter> ah okay - I kind of love programming roguelikes so these are all roguelike things :P
23:12:32FromGitter<zacharycarter> gotcha - ncurses is a library a lot of roguelikes are programmed with it's a unix terminal friendly library for graphical terminal output
23:13:16FromGitter<zacharycarter> bearlibterminal uses opengl and sdl I believe for windowing / rendering respectively, but it has a very high level api similar to ncurses
23:14:00FromGitter<zacharycarter> if you need some way of rendering graphics for your roguelike blt is a great fit
23:14:08*LyndsySimon nods
23:14:23FromGitter<zacharycarter> also if you want any advice on how to code roguelikes there are a few good channels on irc
23:14:29FromGitter<zacharycarter> ===rgrd on irc.quakenet.org===
23:14:49LyndsySimonYeah, on second thought that's a good idea. I need to learn environment management and how to navigate a foreign codebase, too.
23:15:40LyndsySimonI'm following this series: https://www.reddit.com/r/roguelikedev/comments/6jqemp/roguelikedev_does_the_complete_python_tutorial/
23:16:06FromGitter<zacharycarter> yeah that's not a bad tutorial
23:16:16FromGitter<zacharycarter> I did the C++ version years ago
23:16:33FromGitter<zacharycarter> it doesn't lead to very good game code but if you just want to learn the language it should suffice I'd think
23:16:53FromGitter<zacharycarter> it uses libtcod which there also exist bindings for, for Nim, but I think you could get away with using bearlibterminal
23:18:26LyndsySimonI'm not trying to follow it exactly, so much as just give myself some ongoing motivation to continue.
23:18:40LyndsySimonI was originally planning on doing it all from scratch, lol.
23:18:51FromGitter<zacharycarter> roguelikes are a black hole :P so if you actually start liking the game you're writing you could get really into it, I know I have
23:18:55LyndsySimonI figured I'd lose interest about the time I was starting to flesh out map generation.
23:18:59FromGitter<zacharycarter> they're extremely algorithm heavy
23:19:02*LyndsySimon nods
23:19:16FromGitter<zacharycarter> what kind of maps are you looking to generate?
23:19:18LyndsySimonI lose Monday and Tuesday nights to playing Dwarf Fortress.
23:19:25LyndsySimons/lose/lost
23:19:46*LyndsySimon shrugs
23:19:49FromGitter<zacharycarter> I barely play games anymore I spend so much time trying to write them / things for them
23:19:59*yglukhov quit (Remote host closed the connection)
23:20:02FromGitter<zacharycarter> well you can get very creative with map generation
23:20:08LyndsySimonNo idea :) I was going to hardcode a simple map and hide it behind a `generateDungeon` proc, then go back later.
23:20:51FromGitter<zacharycarter> example: https://github.com/zacharycarter/mapgen
23:21:08LyndsySimonSo... blt-nim isn't on nimble, is it? How do I go about including it in my project properly?
23:21:22FromGitter<zacharycarter> you can just include the github url
23:21:31LyndsySimonYep, I definitely found the right person to talk to :)
23:21:38LyndsySimonDo I remember you being from NoVA?
23:21:43FromGitter<zacharycarter> yup!
23:21:48FromGitter<zacharycarter> I work in Centreville
23:22:21FromGitter<zacharycarter> so require "https://github.com/zacharycarter/blt-nim.git" should work
23:22:44FromGitter<zacharycarter> were you from Charlottesville?
23:24:32FromGitter<zacharycarter> or are you rather haha
23:26:35LyndsySimonYep, I am :)
23:26:41LyndsySimonThat's awesome.
23:27:02LyndsySimonI'm going on vacation in OBX all next week, and hope to have enough time to really sink my teeth into this stuff.
23:27:27FromGitter<zacharycarter> Awesome :D, good place to do it, nice and relaxing
23:28:02FromGitter<zacharycarter> definitely ping me / ask in here if you have any questions, the community is generally very helpful
23:31:01LyndsySimonI've been very happy thus far.
23:31:08LyndsySimonDo you have a repo somewhere that's using blt-nim?
23:32:31LyndsySimonI'm trying to figure out how to get bearlibterminal.dylib :)
23:32:38*couven92 quit (Quit: Client Disconnecting)
23:33:40FromGitter<zacharycarter> I don't, but it should be pretty simple to compile, one sec
23:34:11LyndsySimonNope, got it :)
23:34:24LyndsySimonIt feels weird to be so new to things.
23:34:52FromGitter<zacharycarter> awesome :D yeah I know what you mean
23:35:31FromGitter<zacharycarter> Nim comes quick though and it enables crazy productivity
23:35:51FromGitter<zacharycarter> I built https://github.com/fragworks/frag in not very much time although now I'm abandoning it
23:42:52LyndsySimonLOL, this is so frustrating.
23:42:53LyndsySimonhttps://gitlab.com/lyndsysimon/roguelike-nim/tree/blt
23:43:03LyndsySimonall I'm doing is importing blt and trying to open a terminal.
23:43:36LyndsySimonI keep getting an error, which reads in part: "main(16957,0x7fffa483c3c0) malloc: *** error for object 0x7fa149855800: pointer being freed was not allocated"
23:45:38*bjz joined #nim
23:47:07LyndsySimonOh.
23:47:19LyndsySimonThat error is happening on exit, not on terminal_open().
23:47:24LyndsySimonI can ignore it for the moment then.
23:48:45FromGitter<zacharycarter> sorry, took my dog out let me see
23:49:23LyndsySimonNo worries, IRC is async and you're not getting paid.
23:49:34FromGitter<zacharycarter> :P trut
23:49:37FromGitter<zacharycarter> truth*
23:52:47FromGitter<zacharycarter> strange I don't get that error - I just downloaded and copied the default binary too
23:52:52FromGitter<zacharycarter> what OS are you on?
23:53:08LyndsySimonmacOS Sierra
23:53:14FromGitter<zacharycarter> same
23:53:43FromGitter<zacharycarter> ah nevermind I do get the error
23:54:55FromGitter<zacharycarter> I'm guessing it has something to do with Nim's GC trying to collect memory that hasn't been allocated after the program terminates
23:55:14LyndsySimonSomeone was getting it in Python a few months ago.
23:55:26LyndsySimonhttps://www.reddit.com/r/roguelikedev/comments/5ewmrp/sharing_saturday_130/dafpd7f/
23:55:49FromGitter<zacharycarter> ah good find
23:58:37LyndsySimonMy current suspicion is that the version of Nim I'm using differs from the one you used to write blt-nim, or your environment is different.
23:59:16LyndsySimonI'm getting some odd stuff - like the fact that `terminal_open()` returns an int, but blt's API reference says it returns a bool. `terminal_close()` throws an error.