<< 27-10-2017 >>

00:16:12GitDisc<treeform> Any one run into the "Except? File descriptor not registered." runtime print error before?
00:17:35GitDisc<treeform> its coming from asyncdispatch.nim
00:20:21*ipjk quit (Quit: Leaving)
00:21:51FromGitter<zacharycarter> would love ppl's thoughts - https://imgur.com/a/TWG1d
00:22:05FromGitter<zacharycarter> @Varriount esp yours <#
00:23:50FromGitter<Gooseus> @Varriount heyo, ya, wanted to see what your experience was with working on an aws sdk, assuming the rumor was true
00:27:00FromGitter<Gooseus> I've been working on a s3 download/upload tool and been spending most the time working through the the signaturev4 signing stuff
00:28:39FromGitter<Gooseus> I saw there is a signature_v4 module in here - https://github.com/aidansteele/aws_sdk.nim but I didn't test it and thought the exercise would be good for me to get more familiar with the language
00:30:04*dhalinar2 quit (Quit: Konversation terminated!)
00:30:26FromGitter<Gooseus> one thing I was curious about was how much curating and attention is being paid to the nimble ⏎ ecosystem and how it's organized/structured?
00:30:31FromGitter<Varriount> @Gooseus If you can get it working, that would be great
00:30:50FromGitter<Varriount> Nimble is mainly curated by @dom96
00:31:25FromGitter<Gooseus> for instance, if I got the signaturev4 implementation working well, would that be a good standalone module? Or would that be too minor for a module and should be included as an exported function of an AWS module?
00:32:33FromGitter<Gooseus> would an AWS module be a full package with an interface to every service, or would each service be best as their own standalone module that includes a separate generalized aws-core module that implements the aws client / request signing?
00:33:20FromGitter<Gooseus> @Varriount what did you do with regards to aws? were you involved in that aws_sdk.nim project?
00:37:52FromGitter<Varriount> @Gooseus No, I had a different project
00:38:52FromGitter<Varriount> The progress I made mainly centered around using Nim's macro system to generate the API data types from a JSON file.
00:51:34FromGitter<Varriount> @Gooseus The problem is that the AWS API uses both XML and JSON for different services, and among those there are 2 different ways to send parameters.
00:51:55FromGitter<Varriount> Which means one has to implement a generic way to send 4 different HTTP requests.
00:55:29FromGitter<Gooseus> yeah, it'd be quite a task to try and implement the full AWS SDK... I was thinking of applying an 80/20 rule to that where I imagine the 80% of AWS SDK traffic involves S3
00:58:10FromGitter<Gooseus> also was thinking that releasing a separate module that was just an AWSClient that didn't care so much about the xml/json format for each service and just signed the request and sent it over
00:59:01FromGitter<Gooseus> focus on making that good and useful for people to build service-specific modules on top of
01:00:30FromGitter<Varriount> S3 is also a... special service, as far as the API goes.
01:00:47FromGitter<Varriount> That being said, if we can implement one service, that would be great.
01:01:04FromGitter<Gooseus> but small, composable modules is sort of a node thing that I'm used to... not sure that's really the nim model, one complaint in the node community is over just how many NPM modules are just one liners and how there are like different modules that do the same stupid thing poorly
01:01:30FromGitter<Varriount> @Gooseus I looked into wrapping the C++ AWS library once, however it uses Boost and a ton of templates.
01:01:53FromGitter<Gooseus> yeah, I was seeing that the S3 sigv4 has it's own page and there are some service specific caveats
01:02:02FromGitter<Varriount> Nim is (relatively) good at wrapping C++, but the thought of dealing with all those templates was daunting.
01:02:22FromGitter<Gooseus> yeah, I wouldn't even know where to start on that end
01:03:16FromGitter<Gooseus> I was thinking it'd be cool to see how an Nim AWS SDK compiled to JS would compare with the official JS AWS SDK
01:04:21FromGitter<Varriount> It might be slower, since many procedures built into the javascript VM wouldn't be utilized.
01:04:46FromGitter<Varriount> @Gooseus Hm, I could have sworn that I had a public repo with my AWS code on it.
01:05:08FromGitter<Varriount> Ah, here it is: https://gist.github.com/Varriount/9e84c48baa4fd5ea22558031bfab3554
01:06:49FromGitter<Varriount> There are 3 files in that gist. The first is a translation of the Python signing example (which somehow is broken), the second and third are files that generate API types based on a JSON file describing the API.
01:06:58FromGitter<Gooseus> nice @Varriount , I'll take a look and reference this as I move along... and yeah, that makes sense from a performance point of view, I haven't looked at any js that has been compiled from nim yet
01:07:02darkn0deVarriount, very cool, fokring now
01:13:58FromGitter<Varriount> @Gooseus , darkn0de: You'll need a JSON file describing the API
01:14:48FromGitter<Varriount> https://gist.github.com/Varriount/32bd7343010de3ca66f47dde2995b188
01:15:14FromGitter<Varriount> The schema.nim code isn't perfect - it still chokes on some of the input data
01:16:13darkn0dereally awesome
01:16:48darkn0denice work!!
01:17:07FromGitter<Varriount> Still, it shows that Nim makes it possible to ingest such data, then create an entire API off of it.
01:17:34FromGitter<Varriount> First though, we need a core API that's able to make basic requests when given the raw data.
01:28:09darkn0deagreed
01:33:32FromGitter<Gooseus> ok... so this would take in any JSON description of a REST API at compile time and generate a rest client with all the appropriate methods?
01:33:54FromGitter<Gooseus> kind of like swagger?
01:36:05*vivus quit (Quit: Leaving)
01:38:09FromGitter<Gooseus> cause, if so, that's definitely pretty damn awesome... I mean, assuming there is an API description in this format for all their services then yeah a full aws sdk doesn't seem as far off as I was thinking
01:42:19FromGitter<Varriount> @Gooseus Theoretically, yes
01:43:52captainkraftIs there some sort of font rendering library available in Nim?
01:43:54FromGitter<Varriount> @Gooseus As I said, if we could have a core procedure that takes input data (say, an endpoint, data encoding type, parameters, etc) then we would be about 50% there.
01:44:45FromGitter<Varriount> @Gooseus The AWS SDK for Python, Boto3, generates all its API types and procedures at runtime.
01:45:49FromGitter<Varriount> Unfortunately I don't have much time to do anything until the summer. I have University classes.
01:58:02captainkraftOh, SDL comes with the ttf lib.
02:03:48FromGitter<Varriount> captainkraft: What are you a working on?
02:15:00FromGitter<Gooseus> @Varriount cool cool, I dig it... let me see how this s3 thing turns out, I could be down to make an attempt, <darkn0de> you working on something similar for aws?
02:16:10FromGitter<Varriount> @Gooseus I would work on getting the v3 authentication to work first.
02:18:15FromGitter<Gooseus> v4? that's what I'm doing now... don't feel like I'm too far off
02:18:52captainkraftVarriount: a debugger
02:19:27FromGitter<Varriount> @Gooseus Sorry, I meant v4
02:20:42FromGitter<Gooseus> would an aws_signature_v4 module be welcome in the nimble ecosystem @dom96 ? if I separated it out with tests and whatnot?
02:21:37watzonIs there a list of internal libraries that are ok to use with JS compileation
02:21:41watzoncompilation*
02:23:22*vlad1777d quit (Ping timeout: 260 seconds)
02:25:45FromGitter<Varriount> watzon: Anything that doesn't interface with C. :3
02:31:38watzonI noticed that some libraries like httpclient don't work because they depend on the os module which kinda sucks
02:32:26watzonI like the way haxe handles compiling to other languages, but I hate their Http implementation
02:37:31*dddddd quit (Remote host closed the connection)
02:54:14watzonSo I'm working on wrapping the entire GitHub API into a nim package
02:54:14watzonhttps://github.com/watzon/github-api-nim
02:54:32GitDisc<awr> hm, you can define custom setters with proc`foo=`(bar: Baz)
02:54:54GitDisc<awr> is it possible to do something like proc `foo+=`(bar: Baz)
02:55:17GitDisc<awr> to overload other reassigning operators
03:02:43FromGitter<Varriount> I would like something like Python's "requests" module, but for Nim
03:03:31FromGitter<Varriount> awr: Try `proc \`+=\`...`
03:08:34FromGitter<Varriount> @Gooseus It wouldn't hurt to put the aws_signature_v4 code in a single module, though I would just bundle it with the general library.
03:12:00*Snircle quit (Ping timeout: 246 seconds)
03:15:37*koranza quit (Quit: Connection closed for inactivity)
03:21:33GitDisc<awr> i'm trying to do overload `+=` for a specific field
03:21:55GitDisc<awr> well not a field exactly, but an imitation of one
03:34:14FromGitter<Varriount> procedures are bound to types,
03:34:17FromGitter<Varriount> not fields
03:38:17*nchambers joined #nim
03:45:38GitDisc<awr> now that i think about it, it might be possible to do a term-rewriter to do it, but it's more trouble than it's worth
03:46:19GitDisc<awr> writing bar.foo = bar.foo + x instead of bar.foo += x isn't *that* bad
03:51:05*Jesin quit (Quit: Leaving)
03:51:31watzon@Varriount something like Python's requests module would be great
03:52:43FromGitter<Varriount> watzon: I said that almost an hour ago. :3
03:53:03watzonYeah lol, I had to eat dinner :p
03:55:35FromGitter<Varriount> We have a very basic http request library, emphasis on basic
03:55:46FromGitter<Varriount> Perhaps something modeled on Go?
04:03:55watzonAre you thinking for the standard library?
04:06:01*craigger quit (Ping timeout: 240 seconds)
04:07:13GitDisc<awr> i used the nim http library once for a really simple thing and i couldn't get it to work, don't really remember why though
04:07:37*craigger joined #nim
04:07:52GitDisc<awr> instead i just fixed this other person's perl script, and eugh, perl
04:09:25GitDisc<awr> don't really understand why anyone uses perl anymore
04:09:58GitDisc<awr> i like using nim for small scripts though
04:11:47*Mooo_ joined #nim
04:12:03Mooo_guys how can i get the maximum possible value of an uint64 ?
04:12:33GitDisc<awr> uint64.max?
04:12:36GitDisc<awr> i mean
04:12:39GitDisc<awr> uint64.high
04:12:54Mooo_let me try
04:13:55Mooo_it says invalid argument for high
04:14:26GitDisc<awr> hmm that's very strange
04:14:33GitDisc<awr> it works for int64 but not uint64
04:14:56Mooo_yea, that is true
04:15:05Mooo_someone hates unsigned ints
04:15:33Mooo_then i can't get the max value?
04:15:35GitDisc<awr> yeah nim used to require `import unsigned`
04:17:02Mooo_okay well
04:17:37Mooo_but i want to do network programming
04:18:17*Mooo_ quit (Remote host closed the connection)
04:18:50GitDisc<awr> you can do uh
04:19:11GitDisc<awr> i think let maximum = not 0'u64
04:21:01GitDisc<awr> or let maximum = 0'u64 - 1
04:21:06GitDisc<awr> whichever looks cleaner to you
04:25:17FromGitter<gogolxdong> how to set jester listenning port
04:26:28FromGitter<Gooseus> @Varriount one thing I noticed real quick going through you sigv4 code is ``` amzdate = format(t, "yyyymmdd'T'hhmmss'Z'")``` you're using the minutes formatting code for the month section and the 12-hour hour formatting for the hour which I think needs to be 24
04:27:06FromGitter<Varriount> Woods
04:27:12FromGitter<Varriount> *woops
04:30:10FromGitter<gogolxdong> Port:5001 and Port:Port(5001) is nnkStmtListExpr while here expected a node of kind nnkStmtList
04:31:44FromGitter<Gooseus> yeah, I'm messing with the test suite that AWS provides and can't seem to get the signature coming out right even though the string to sign looks perfect and the previous hashes come out right... I'm wondering if it's a problem calculating the signing key, both our code does the hmac_sha256 and converts to string before putting it back into the the next hash, not sure if that would create a problem
04:39:13*libman quit (Quit: Connection closed for inactivity)
04:43:01FromGitter<Gooseus> @Varriount did you ever test this hmac implementation? I assume you're using this one - https://github.com/OpenSystemsLab/hmac.nim
04:44:15*craigger quit (Ping timeout: 248 seconds)
04:44:22FromGitter<Varriount> Well, I tested that it compiled. I didn't test that it produced correct results
04:46:09*craigger joined #nim
04:46:33*salewski joined #nim
04:48:21salewskiConverting some code from Ruby: t0 = (mx * hx + my * hy).fdiv(mx ** 2 + my ** 2)
04:48:54salewski** is square, do we have something in Nim for that? From
04:49:06salewskihttps://github.com/nim-lang/Nim/blob/master/lib/pure/basic2d.nim#L374
04:49:26salewskiit seems that there is no sqr()? That is sad.
04:50:22salewskiAnd what can we do for the fdiv -- in the brackets that seems to be integer expressions.
04:50:35*GaveUp quit (Ping timeout: 240 seconds)
04:50:45salewskiDo we have to write ().float / ().float?
04:52:02salewskit0 = (mx * hx + my * hy).float / (mx * mv + my * my).float
04:53:34FromGitter<Varriount> @Gooseus Any other questions?
04:55:32*salewski quit (Quit: WeeChat 1.9.1)
04:57:43FromGitter<Gooseus> @Varriount nope, I just replaced it with this implementation - https://github.com/aidansteele/sph and got the same results
05:00:16FromGitter<Varriount> @Gooseus Hm. Perhaps the Python version of the code could be compared? The output of each step could be compared to see where deviation occurs.
05:03:35*GaveUp joined #nim
05:10:07FromGitter<Gooseus> yeah, I was doing that a little bit with the node sdk
05:13:55FromGitter<Gooseus> oh snap, I'm an idiot and pretty sure I got the easiest test suite example working...
05:14:51FromGitter<Gooseus> I was using `s3` for the service and the example just had `service`... somehow I missed that difference in the scope even though I was staring at for 5 min straight
05:22:43FromGitter<gogolxdong> what should a nnkStmtList node be like?
05:51:30*Vladar joined #nim
05:51:41*miran_ joined #nim
05:53:39watzonOk here's an interesting question. I have a proc that takes a type `T` and I want to check if `T` is a `seq`. If it is a `seq` I need to get the type of `seq`, or the T in `seq[T]`
05:53:45watzonIs that possible?
05:56:55watzonIt's these types of questions that keep me awake at night
05:58:58FromGitter<Varriount> watzon: When in doubt, comb through the manual.
05:59:12watzonOh I'm looking lol
05:59:29FromGitter<Varriount> If you can wait, I'll do some digging and find an answer in the morning, however I bed to get to bed.
05:59:46watzonBut I don't even know what to look for really. Right now I'm just searching the index for `: typedesc`
06:00:35*craigger quit (Ping timeout: 240 seconds)
06:00:57FromGitter<Gooseus> I'm new here but maybe genericHead in https://nim-lang.org/docs/typetraits.html
06:01:09FromGitter<Varriount> Watson: Are you sure overloading might not work?
06:01:33FromGitter<Gooseus> what are you trying to do?
06:02:01*craigger joined #nim
06:02:21watzonGooseus that looks like the opposite of what I need, but so close
06:02:34FromGitter<Gooseus> cause I think that the genericHead will take an instantiated type and return the generic type, so maybe a case on that across the expected types?
06:02:36watzonI want to be able to take `seq[int]` and get `int`
06:02:57watzongenericHead will take `seq[int]` and return `seq`
06:03:20FromGitter<Gooseus> I think it'll take @[1,2,3] and return seq[int]
06:06:28*craigger quit (Ping timeout: 240 seconds)
06:07:14*craigger joined #nim
06:07:39watzonYeah I just want the int part. I hope there's some way to do this
06:07:41*salewski joined #nim
06:07:43FromGitter<Gooseus> ok, right, I was reading that all wrong... I get the feeling if there was something in the stdlib it'd be in that module though
06:08:57watzonIs dom96 on? I feel like if anyone would know it would be him
06:09:42salewskiIndeed we have ^ for ** and now even / for proc `/`*(x, y: int): float
06:09:46*salewski quit (Client Quit)
06:10:24FromGitter<mratsim> @watzon I raised a feature request for a genericTail
06:10:48watzonWhy thank you mratsim
06:11:07watzonI'll have to look at the source and see if I can get a PR in
06:11:13FromGitter<mratsim> https://github.com/nim-lang/Nim/issues/6454
06:11:46FromGitter<mratsim> it’s compiler magic but you can use that instead: https://github.com/mratsim/Arraymancer/blob/master/src/private/ast_utils.nim#L42
06:11:57FromGitter<gogolxdong> What should jester settings macros to be ,like setting listening port?
06:11:59FromGitter<mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59f2ce2fd6c36fca31a12f37]
06:15:35watzonThanks for that workaround mratsim, I'll test it out in a bit. Really the only reason I need it is because of https://github.com/nim-lang/Nim/issues/6604
06:16:35*miran_ quit (Ping timeout: 240 seconds)
06:21:27*darkn0de quit (Ping timeout: 240 seconds)
06:21:58*gokr joined #nim
06:22:36*PMunch joined #nim
06:25:34GitDisc<treeform> hmm seems like when i send 272k of data down a socket at once, it throws an exception and closes.
06:25:49GitDisc<treeform> not sure how to debug this, async dispatch stack traces are hard to read
06:27:09FromGitter<gogolxdong> Would anyone shed some light on how to use jester settings macro?
06:38:20*nsf joined #nim
06:39:16PMunchgogolxdong what's the problem?
06:42:00PMunchIt's nothing more complicated than "settings:" followed by the name and a value for any of the fields in the Settings object found here https://github.com/dom96/jester/blob/master/jester.nim#L24
06:42:26PMunchLook here for example: https://github.com/dom96/jester/blob/master/tests/alltest.nim#L5
06:42:41PMunch@gogolxdong ^
06:42:50PMunchIs gitter highlighting still not implemented?
06:43:15PMunchtreeform, what exception?
06:44:55FromGitter<gogolxdong> @PMunch thanks anyway, I put it after route: section
06:47:43PMunchAh yeah, the route macro outputs a statement "jester.serve(matcher, settings)" so any settings below there won't be applied
06:48:46FromGitter<gogolxdong> :)
06:49:55PMunchdom96, maybe you should close this: https://github.com/dom96/jester/issues/43
06:57:50*Arrrr joined #nim
06:57:50*Arrrr quit (Changing host)
06:57:50*Arrrr joined #nim
06:59:32*Andris_zbx joined #nim
07:00:20*ibutra joined #nim
07:00:54GitDisc<treeform> PMunch, no exception the stocket just closes (which throws exception)
07:01:53GitDisc<treeform> Error: unhandled exception: socket closed
07:02:25GitDisc<treeform> like it can't send that much data at once? it seems to be around 20k
07:02:47gokrwatzon: There?
07:03:33watzonI'm here. What's up?
07:04:37PMunchtreeform, do you have a minimal example?
07:04:39gokrI just played with that listRepos thing
07:05:07watzongokr: yeah?
07:05:12gokrAnd you know, it works just fine if... well, give me 1 sec to verify a thing.
07:05:48*yglukhov joined #nim
07:05:59gokrBut one thing I noted - if you write it like "var n = parseJson(res.body)" and then "result = n.to(seq[Repository])" - it seems to work just fine.
07:06:56watzongokr: really now? I'll have yo try that
07:09:36GitDisc<treeform> PMunch, I do not, i get the error at exaclty 32766 bytes which is 2^15 - 2
07:09:49watzonI'm still trying to figure out the best way to handle that anyway. I'd like to return an object that represents the data structure rather than returning the response object, but I need each and every method to be able to return either the requested object type (say Repository), or one of a few error types
07:12:43*Viktor_ joined #nim
07:12:47PMunchtreeform, could you create a minimal example? This sounds pretty serious if it is indeed a bug
07:15:12gokrwatzon: Anyway, this seems to work: https://gist.github.com/gokr/577b3afe5d814580cbdfc3d00338cbfd
07:15:51gokrwatzon: But... funny enough the JSON has a lint issue, not sure why that is.
07:16:27gokrRegarding why it hung - I did note there are two "to", one in marshal and one in json - not sure if that's pertinent.
07:19:24watzonHmm interesting. I'll have to try it again
07:20:15gokrOh, forget that JSON linting problem.
07:20:50gokrYou had a loop there - but you can just do "echo(%*repos)". Then it produces a proper JSON array of course.
07:20:54*claudiuinberlin joined #nim
07:21:19*ibutra quit (Quit: My iMac has gone to sleep. ZZZzzz…)
07:21:41GitDisc<treeform> PMunch small example works, some thing in this websocket library is not working
07:22:16watzongokr: this is why I'm here. You learn all kinds of good things
07:28:28PMunchtreeform, I meant small example as in small code. It could have a large data file to send of course
07:28:30GitDisc<treeform> PMunch smallest example: https://gist.github.com/treeform/b0ab6b7e3803a5f8dda3b54b944f1c83
07:29:47GitDisc<treeform> breaking it into multiple writes also does not help
07:31:21PMunchtreeform, and how are you reading from that socket?
07:31:40GitDisc<treeform> verifyWebsocketRequest reads from it
07:31:49GitDisc<treeform> and the http server reads from it too
07:32:08GitDisc<treeform> oh with Chrome
07:32:13PMunchAh
07:33:00PMunchHmm, I just get "sending\nsent" when I do that
07:33:06PMunchDoesn't crash for me..
07:33:48PMunchTried with 50_000 as well, works fine
07:34:19GitDisc<treeform> well it closes the socket
07:35:07gokrwatzon: There is obviously something wrong with the "to" macro, but not sure what.
07:35:11gokrI am no macro expert.
07:35:46*floppydh joined #nim
07:35:59PMunchtreeform, it does the exact same thing for with 32767 as it does with 50000 here. So I'm not sure what the issue is
07:36:08watzongokr: nor am I haha. So I'm not likely to be the one to fix it
07:37:16GitDisc<treeform> Do you get the frame in Chrome?
07:37:30GitDisc<treeform> both of them the 50k and the smaller one?
07:37:56PMunchHold on
07:38:36PMunchWell, I just get a ERR_INVALID_HTTP_RESPONSE in chrome
07:38:44PMunchWhen I point it at localhost:8080
07:40:37GitDisc<treeform> http://jsfiddle.net/j5c7or3w/
07:41:01GitDisc<treeform> i get a bunch of aaaa when it smaller then 32767
07:41:50GitDisc<treeform> run it again you should see a ton of aaaaa
07:41:56GitDisc<treeform> inthe js console
07:42:35*Arrrr quit (Ping timeout: 258 seconds)
07:43:37GitDisc<treeform> did you see a bunch of aaaa?
07:43:46GitDisc<treeform> I made it send 1 byte smaller
07:44:08PMunchHmm, indeed
07:44:18PMunchI don't get anything when it's larger than 32767
07:44:24GitDisc<treeform> yep
07:44:33GitDisc<treeform> i read on ws frames and they can be as big as you want
07:44:47GitDisc<treeform> I tried to write a chunker and that seems not to work
07:45:09GitDisc<treeform> i also tried sending it as multiple writes
07:45:12GitDisc<treeform> also does not work
07:47:00PMunchaah
07:47:24GitDisc<treeform> gist update
07:47:25GitDisc<treeform> https://gist.github.com/treeform/b0ab6b7e3803a5f8dda3b54b944f1c83
07:47:32GitDisc<treeform> did you find some thing?
07:47:34PMunchIf I copy the line "await req.client.send" twice it sends two packets
07:47:50GitDisc<treeform> yeah
07:47:54GitDisc<treeform> got to break the packet up
07:48:48GitDisc<treeform> brb
07:50:18gokrwatzon: It seems, although I got a bit lost in the macro code, that the macro doesn't check properly that the passed in NimNode in fact can be an unevaluated expression, and not a variable.
07:51:06PMunchdom96, I'm looking through the route macro in Jester and was wondering if it would be a big loss to not have the outsideStmts thing?
07:51:10*yglukhov quit ()
07:51:28PMunchAs I understand it it's just to allow you to have code between your routes that would get moved outside the matching proc
07:52:11*Andris_zbx left #nim ("Leaving")
07:53:41PMunchI've pulled the creation of the matching proc out of the routes macro and created a separate matcher macro that it calls instead. That way you can define matchers with the same syntax and have the ability to run multiple matchers
08:02:05GitDisc<treeform> PMunch, did you find anything with the websocket thing?
08:02:15PMunchNot really
08:02:55GitDisc<treeform> i am going to bed, i can open a bug on the ws lib, but it has not been updated in a long time
08:03:23GitDisc<treeform> not sure what to do
08:04:18PMunchYeah, report it and see what happens
08:04:48*ARCADIVS joined #nim
08:07:25FromGitter<alehander42> are there any magic vars in nim e.g. name of current function ?
08:09:49FromGitter<dom96> @zacharycarter Looks super awesome. I wonder if you could model Nim's crown? :)
08:10:32euantor@alehander42: In Nim we use `instantiationInfo`: https://nim-lang.org/docs/system.html#instantiationInfo,
08:10:57euantorTHough that doesn't give function name
08:12:12FromGitter<dom96> I'm seeing some people saying that Nim's httpclient module could be improved or that they had trouble with it, please report issues for this otherwise we have no idea what needs to be improved
08:12:55FromGitter<dom96> I think @awr, @Gooseus and @Varriount mentioned this to some extent :)
08:13:41euantorI used to find the fact that the async client returned the full body in a string odd, but that's been fixed since then :)
08:14:08PMunchdom96, did you see my questions about Jester?
08:17:15*adeohluwa joined #nim
08:21:43FromGitter<alehander42> @ euantor thank you, useful!
08:25:49FromGitter<dom96> @Gooseus almost everything (malicious code is not, but that's really the only thing) is welcome in the Nimble ecosystem
08:26:54FromGitter<dom96> @PMunch just saw it, no idea :)
08:30:42*Tanger joined #nim
08:31:25Tangerdom96, Hey mate, just picked up Nim in Action. Real good read!
08:33:43FromGitter<dom96> @Tanger Thanks for picking it up, glad you like it :)
08:35:39*Ven joined #nim
08:36:03*Ven is now known as Guest275
08:39:38*darkn0de joined #nim
08:42:08*Guest275 is now known as Ven``
08:47:53*yglukhov joined #nim
08:48:54PMunchdom96, so would you mind if I removed it to support having multiple matchers?
08:53:33livcdsomehow i wish nim in action would be MEAP
08:56:05*Ven`` quit (Ping timeout: 240 seconds)
08:58:56*couven92 joined #nim
09:00:17*vqrs joined #nim
09:01:22*fredrik92 joined #nim
09:04:31*couven92 quit (Ping timeout: 248 seconds)
09:04:36*fredrik92 is now known as couven92
09:04:45livcdoh can anyone confirm that code in Nim in Action is readable on kindle ?
09:05:19*zolk3ri joined #nim
09:06:35*dddddd joined #nim
09:11:06watzonAnyone else feel like Response.status should be an enum or at least just the integer representation of the status? "200 OK" feels kind of redundant and isn't as easy to use inside of a case statement
09:12:44Araqyup, enums are better
09:13:49*Ven joined #nim
09:14:12*Ven is now known as Guest35603
09:16:22watzonEven just an int would be better than a string
09:16:34watzonAnd a bit easier to implement probably
09:16:44watzonBut enums would be ideal
09:16:53*Arrrr joined #nim
09:16:53*Arrrr quit (Changing host)
09:16:53*Arrrr joined #nim
09:17:22euantoryeah, the string value seemed odd to me last time I looked at it
09:18:12euantorYou can do `response.code()` to get an enum value of the status though
09:19:31watzonWell that's good to know
09:40:11*Guest35603 quit (Ping timeout: 255 seconds)
09:42:47*tdc joined #nim
09:46:20*Ven_ joined #nim
09:49:37*Arrrr quit (Ping timeout: 260 seconds)
09:50:07PMunchJester is in need of some cleaning up
09:52:09dom96PMunch: feel free to create more PRs :)
09:52:17dom96I'll try to review yours today
09:53:08PMunchI'm actually about to create a new one :)
09:53:24dom96Yeah, we have an enum for HttpCode. The string is available for backwards compatibility and as a nice side effect it means that codes which are not in the enum are supported :)
09:54:06*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:54:47PMunchYeah I just saw that. There are quite a bit of other things though. E.g. replacing all stmt and expr with typed and untyped
09:55:22*gangstacat quit (Read error: Connection reset by peer)
09:58:17*claudiuinberlin joined #nim
09:58:18*gangstacat joined #nim
09:58:55Araqyeah give jester some love please
10:03:37watzondom96: yeah now that I know that `code()` exists I'm much more ok with the strings
10:04:56PMunchhttps://github.com/dom96/jester/pull/128
10:05:05watzonNim doesn't have decorators right?
10:05:16PMunchThere, now Jester has a way to create multiple route blocks
10:05:55PMunchI might have a go at cleaning up Jester later today, making the code-base a little more up to par with how Nim code looks nowadays.
10:06:07*gangstacat quit (Remote host closed the connection)
10:08:05*Ven_ quit (Ping timeout: 240 seconds)
10:09:21*Ven joined #nim
10:09:44*Ven is now known as Guest10069
10:11:52*gangstacat joined #nim
10:11:56*ipjk joined #nim
10:17:23GitDisc<GooRoo> @watzon unfortunately seems like no decorators, however, they can be replaced by marcos I guess
10:21:34Araq@deco def foo
10:21:35Araqis
10:21:42Araqproc foo {.deco.}
10:23:56GitDisc<GooRoo> not as beautiful as in Python in my opinion, but definitely acceptable
10:25:43watzonKinda forgot about pragmas
10:25:55watzonI have no clue how to make one lol
10:26:18FromGitter<mratsim> I find decorators ugly though ....
10:26:43watzonmratsim personally I like them
10:26:46*Guest10069 quit (Ping timeout: 264 seconds)
10:27:41GitDisc<GooRoo> I like that decorators are put before funtion definition and each one is on its own line
10:28:10GitDisc<GooRoo> it is just a little bit more readable
10:28:16GitDisc<GooRoo> perhaps…
10:30:46FromGitter<mratsim> But multiple decorators for the same function is so-so. + When you grep a function you don't know if a decorator is applied and if you grep a decorator you don't know which function it applies to
10:33:39GitDisc<GooRoo> I have my own opinion regarding this, but usually not many people think the same way:
10:33:39GitDisc<GooRoo> it's a tool problem  `grep` is too old, it works with plain text and knows nothing about your code structure
10:34:10GitDisc<GooRoo> 1/5th of 21st century is almost passed and we still rely on plain text for code 
10:36:52watzonI agree there. I don't really care about what grep understands
10:37:04*Ven_ joined #nim
10:37:09watzonI rarely use it unless I'm grepping help text or something
10:37:54GitDisc<GooRoo> I believe that at some point programmers end up with something like mbeddr https://vimeo.com/78341172
10:38:13GitDisc<GooRoo> it's implemented using JetBrains MPS. Just take a look if you didn't have a chance before
10:39:06dom96Araq: This is currently on top of HN, sounds like something you could recreate in karax https://news.ycombinator.com/item?id=15566873
10:40:06*elrood joined #nim
10:40:43*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:41:21FromGitter<zacharycarter> thanks dom96! I might be able to
10:41:31dom96zacharycarter: that would be awesome :D
10:41:55FromGitter<zacharycarter> I'll give it a shot after I finish this up
10:44:21Araqdom96, alright next livestream will be karax+ormin
10:44:54dom96cool
10:50:46*voiceftp quit (Remote host closed the connection)
10:51:03*voiceftp joined #nim
10:53:43*vqrs quit (Read error: Connection reset by peer)
10:55:54*tdc quit (Read error: Connection reset by peer)
10:56:53*tdc joined #nim
11:00:19*vqrs joined #nim
11:00:32ipjkAraq: strawpoll-clone?
11:02:34*Snircle joined #nim
11:03:19Araqdunno, maybe
11:09:13FromGitter<gokr> @dom96 Regarding redoing that todo-list thing in Nim/karax - which part in Nim would do the websocket stuff? Is that the stuff from Onionhammer?
11:10:32*Arrrr joined #nim
11:10:32*Arrrr quit (Changing host)
11:10:32*Arrrr joined #nim
11:13:41*pyloor quit (Quit: Leaving)
11:34:37FromGitter<gokr> @GooRoo "plain text for code"... yeah. Smalltalk FTW! :)
11:36:37*adeohluwa quit (Quit: Connection closed for inactivity)
11:40:09*claudiuinberlin joined #nim
11:41:19*Ven_ quit (Ping timeout: 248 seconds)
11:54:41FromGitter<mratsim> Unit testing / Integration testing discussion on HN going wrong: https://news.ycombinator.com/item?id=15567415
12:01:28PMunchmratsim, didn't you hear unit testing is a conspiracy by the church of scientology?
12:07:32Arrrri woudln't be surprised
12:15:50dom96TDD always reminds me of this little competition a company in Uni had
12:15:57dom96They said the first one to complete it would win an Apple Watch
12:16:14dom96I won third place for some unknown reason and got an iPad mini instead
12:16:15dom96sad times
12:16:21dom96(even though I finished first)
12:19:18*PMunch_ joined #nim
12:21:51*PMunch quit (Ping timeout: 248 seconds)
12:34:29*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:38:02*gokr quit (Ping timeout: 255 seconds)
12:41:02*claudiuinberlin joined #nim
12:48:22*vlad1777d joined #nim
12:53:54FromGitter<mratsim> @Pmunch lol =}
13:15:10*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:17:15*claudiuinberlin joined #nim
13:20:41FromGitter<mratsim> Btw this is a very interesting post on how DarkShikari became the x264 and video encoding guy in the whole world even though he was still in college: https://news.ycombinator.com/item?id=320102 (x264 is used by ffmpeg, VLC, and hundreds of video products)
13:21:04*Arrrr quit (Quit: Leaving.)
13:29:49subsetparkI thought unit testing was the one true church, and static typing was a conspiracy by stupid, lazy programmers
13:30:17*PMunch__ joined #nim
13:30:35*PMunch__ is now known as PMunch
13:33:02*PMunch_ quit (Ping timeout: 252 seconds)
14:00:18*miran quit (Quit: Page closed)
14:03:39*PMunch quit (Quit: Leaving)
14:05:38*Arrrr joined #nim
14:05:38*Arrrr quit (Changing host)
14:05:38*Arrrr joined #nim
14:05:45*Jesin joined #nim
14:07:00dom96ooh, sshfs is pretty awesome
14:08:37ipjkWhat's the age for college?
14:12:10*arecaceae quit (Remote host closed the connection)
14:12:28*arecaceae joined #nim
14:22:24floppydhit would be cool if, when getting a typemismatch on a proc with a very long argument list, it would show among the procs it suggests which fields match and which don't
14:22:57floppydhbecause theres only one proc and I seem to call it wrong, but theres like 10 arguments and it's really tiresome to find the ones that dont match, also requiring you to know which one would implicitly be converted and which dont
14:28:57*claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:31:04GitDisc<GooRoo> @floppydh please submit this as an issue on GitHub
14:31:20GitDisc<GooRoo> 'cause I would also like to have such a feature
14:31:36Araqno
14:31:42Araqit's already an issue
14:31:49Araqand somebody is working on it, I think
14:32:22floppydhthat's good to hear
14:34:25*gokr joined #nim
14:36:10floppydhhttps://github.com/nim-lang/Nim/issues/1761 ?
14:37:00GitDisc<GooRoo> the best error messages I've ever seen so far are in Elm I guess
14:37:12GitDisc<GooRoo> example: https://pbs.twimg.com/media/CiuJyriXAAEiZnd.jpg
14:37:19Araqyup
14:39:09AraqElm lacks meta programming and overloading, it's not hard to give good error messages when you have a simpler language
14:40:10Araqplus you didn't show how the error message looks like when you have a mismatch in a call with 10 arguments
14:41:10GitDisc<GooRoo> @Araq, http://elm-lang.org/assets/blog/error-messages/0.16/big-record.png
14:41:45GitDisc<GooRoo> just googled it
14:42:15Araqthat's not a call with 10 arguments but close enough
14:42:28*miran_ joined #nim
14:42:45GitDisc<GooRoo> right, not exactly the same
14:43:27GitDisc<GooRoo> But I don't use Elm, just know that they have pretty error messages
14:44:04Araqyeah I know
14:45:48GitDisc<GooRoo> I was amazed when I first saw it (especially when recalled some error messages from Boost.Spirit in my mind)
14:46:49Araqclang has good error messages too and so does Rust.
14:47:46GitDisc<GooRoo> probably not so "bookish" and user-friendly, but acceptable, yes
14:48:16GitDisc<GooRoo> well, I'm fine with current Nim's error messages in most cases
14:49:11GitDisc<GooRoo> but there is always something that can be improved. And in this case it worths a try
14:49:18AraqI'm tired of this "error message is bad" bullshit
14:49:27Araqso go ahead and improve it
14:49:33AraqI'm sure it's easy
14:49:55AraqI mean
14:49:56floppydhwell error messages are hard no
14:50:12Araqthe only reason Nim's are bad is because Araq doesn't know Elm
14:50:18floppydh:D
14:51:01GitDisc<GooRoo> yep, everything is Araq's fault
14:51:13ipjkI wouldn't call rusts error messages good, it's better than it used to be though.
14:51:30Araqyes, exactly, it's my "fault"
14:51:59Araqnot a conscious design tradeoff when I went after a more powerful language
14:52:30GitDisc<GooRoo> Any fulltime positions available? I'd like to be a Senior Error Messages Improver
14:53:29Araqwell this issue has a bounty ;-)
14:54:00ipjkDidn't gcc lack colored output just a few years back?
14:54:19floppydhye
14:54:20*chemist69 joined #nim
14:54:27GitDisc<treeform> Hey Araq, I am struggling with this issue where I can't send more then 32768 bytes of data via async socket. https://gist.github.com/treeform/b0ab6b7e3803a5f8dda3b54b944f1c83 Maybe you can thing of some thing to try?
14:55:06ipjkMost of the time when I get an error from a compiler, I look at it as a vauge hint, as some can be so incorrect
14:55:14GitDisc<GooRoo> @Araq, wow, 12$! I'm on it! 
14:55:34GitDisc<GooRoo> Does gcc have colored output now?
14:56:07Araqtreeform: could be an OS limitation?
14:56:23GitDisc<treeform> nodejs can do it?
14:56:39GitDisc<treeform> its normal ubutu box
14:56:45*Vladar quit (Quit: Leaving)
14:56:53Araqyes, I mean, we might need to split it into chunks for the OS
14:57:00Araqand nodejs already does that
14:57:03GitDisc<treeform> yeah I tried that. does not work
14:57:10ipjkGooRoo: they added it after clang
14:57:27Araqbut I am not a sockets expert
14:57:33Araqdom96, ping
15:00:27GitDisc<GooRoo> @ipjk cool, didn't know
15:07:42GitDisc<treeform> Araq, here is an example were I do multiple writes, they don't work: https://gist.github.com/treeform/ed31201722a3e426dd41e58f5322d89d
15:10:31*Viktor_ quit (Quit: Viktor_)
15:11:58floppydhI can't pass nil as argument for a "var X" no ?
15:12:01dom96treeform: maybe you should try a raw socket to reproduce this
15:12:07dom96I wouldn't be surprised if websocket package is at fault here
15:14:09GitDisc<treeform> agreed
15:15:08GitDisc<treeform> hopefully I can fix this ws lib
15:15:56floppydhI need to pass nil to a proc as a parameter that is of type "var Foo", Manual doesn't specifically say that "Var parameters" can't take nil, but they don't - any pointers ? :/
15:16:09floppydhpun not intended
15:16:21ipjkJust curious, why do you have to pass nil?
15:16:24Araqyou can't pass nil to a var T
15:16:31floppydhipjk: it's a c interface thing
15:16:36floppydhAraq: thanks
15:16:54Araqyou need patch the C interface, maybe introduce an overload that takes 'ptr'
15:17:35floppydhsure, np
15:18:14ipjkAh, there are some weird uses of nil in c
15:18:36ipjkIsn't like, blahtime(NULL) a thing?
15:19:36Araqwe have times.nim
15:20:04ipjkI'm refering to c
15:20:19ipjkThat it's rather weird
15:20:27floppydhipjk: what's weird
15:20:49ipjkfloppydh: why not use, like an enum for time()?
15:20:59ipjkfloppydh: time(currentTime)?
15:21:15ipjkfloppydh: makes more sense than time(NULL)
15:21:29floppydhnot really
15:21:55ipjkAre you really going to argue about null making more sense than currentTime?
15:22:21FromGitter<data-man> @Araq https://github.com/nim-lang/Nim/pull/6600#issuecomment-339998832
15:22:29floppydhare you really going to argue that usage of NULL in C APIs is "weird"?
15:23:08Araqhi data-man, tried to get your new tinyC to compile and failed :-)
15:23:11ipjkAs a parameter, yes.
15:23:20Araqyou need to boot with -d:tinyC
15:23:28floppydhipjk: so you're going to make an enum which as a value is NULL?
15:23:33Araqthe tests don't cover tinyc
15:23:46ipjkofcourse not, it'd be 0
15:24:44Araqbtw #define NULL 0 is possible iirc
15:24:44ipjkif c had immutable's I'd just make it a public variable
15:25:30ipjkor just currentTime()
15:25:54ipjknull in a parameter just makes no sense to me.
15:26:43floppydhhow so, it's often used for optional arguments
15:29:04FromGitter<data-man> @Araq Hmm, "nim -v" show to me: "active boot switches: -d:release -d:tinyc"
15:29:06ipjkhow often something's used doesn't mean is right
15:29:47floppydhbut it usually means there's more to it then just everyone being weird
15:30:48ipjkIf c was just a few years old, yes. But things have changed over all those years, and the style.
15:31:10floppydhdepends where you dwelve
15:31:32ipjkCheck out the winapi and cry.
15:31:53floppydhI'm actually trying to wrap parts of WINAPI atm :)
15:32:06ipjkAnd it's absoulutely horrid.
15:32:12floppydhhard to say
15:32:22floppydhneeds some getting used to like everything
15:32:56*floppydh quit (Quit: WeeChat 1.9.1)
15:34:14ipjkHow old is the winapi, 25y?
15:37:23couven92some parts are, yes
15:38:05*ARCADIVS quit (Ping timeout: 240 seconds)
15:38:30*nchambers left #nim (#nim)
15:39:50*gokr quit (Ping timeout: 258 seconds)
15:42:52*Trustable joined #nim
15:46:52*claudiuinberlin joined #nim
15:47:15Araqdata-man: your PR also misses i386-link.c etc
15:55:16*ARCADIVS joined #nim
15:59:25FromGitter<data-man> @Araq: Sorry, I'm newibe to git. Pushed.
16:01:34Araqso ... are you on Linux?
16:01:50FromGitter<data-man> Yes
16:02:26FromGitter<data-man> ArchLinux
16:03:24GitDisc<awr> which part of winapi?
16:03:53FromGitter<alehander42> I'd also love to help with the error messages if I get better with the compiler, I remember Araq has written that in some cases having very informative error messages would complicate in a bad way the compiler code, but I still think there should be some way to have the cake and eat it here (to separate more involved easy-errors mode handling logic in a separate module without polluting the main codebase)
16:04:43GitDisc<awr> i've noticed there's little parts here and there that are absent from oldwinapi
16:04:50FromGitter<alehander42> are there any real examples of error handling situations that would add a lot of complication ?
16:05:10GitDisc<awr> for example, SYSTEM_POWER_STATUS is defined
16:05:29GitDisc<awr> actually wait nvm
16:05:43GitDisc<awr> GetSystemPowerStatus is defined...
16:05:47GitDisc<awr> which one was i thinking of
16:07:19GitDisc<awr> i remember there were a few instances of a type being defined in oldwinapi while the only function associated with that type wasn't
16:07:30GitDisc<awr> but i can't seem to find them now
16:11:54*Viktor joined #nim
16:23:25GitDisc<treeform> wow after like 5 hours of debuggin I found a problem
16:23:34GitDisc<treeform> proc ntohl*(x: uint32): uint32 = I need one for 64 bits
16:24:02GitDisc<treeform> the websocket module used 32 bit one when they needed to use 64 bit one
16:24:07GitDisc<treeform> but 64 bit one does not exist
16:24:40GitDisc<treeform> https://github.com/nim-lang/Nim/blob/master/lib/pure/nativesockets.nim#L250
16:25:23FromGitter<data-man> @Araq: My current task is to make the Nim compiler able to produce executable files without an external C compiler.
16:25:46FromGitter<Yardanico> how?
16:26:36*PMunch joined #nim
16:28:05*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
16:28:53FromGitter<data-man> With fully integrated TinyC
16:29:12FromGitter<Yardanico> what's the point?
16:29:15*Vladar joined #nim
16:31:24FromGitter<data-man> This is the fastest C compiler
16:31:27*zolk3ri quit (Ping timeout: 248 seconds)
16:31:56FromGitter<Yardanico> I know, aaand what's the point? :)
16:32:30FromGitter<data-man> Faster compilation :)
16:32:43GitDisc<treeform> faster compilation could be good
16:32:59FromGitter<dom96> Treeform: nice. Thanks for investigating :)
16:33:00GitDisc<treeform> then you use some ting like VC to do relase builds
16:33:17GitDisc<treeform> dom96, thanks, still not done yet
16:33:37GitDisc<awr> if you want faster compilation maybe try using zapcc as c compiler
16:34:10FromGitter<Yardanico> is it faster at compiling C than TCC?
16:34:15GitDisc<awr> i've never used it but it's a fork of clang
16:34:26GitDisc<awr> that's supposedly focused on faster compilation
16:34:33FromGitter<Yardanico> well it's for C++
16:34:37FromGitter<Yardanico> and nim's main target is C
16:35:02FromGitter<Yardanico> (zapcc is a C++ compiler, well it should support C too)
16:35:07FromGitter<Yardanico> but IDK if it's faster than tcc
16:35:13*Arrrr quit (Ping timeout: 248 seconds)
16:36:16FromGitter<Yardanico> " ⏎ The optimizer is not disabled, few global optimizations are. The speedup is mostly the result of not having to reparse the headers, reinstantiate and codegen the generated templated code rather than skip minor opts. "
16:36:33FromGitter<Yardanico> so it precompiled all C headers
16:36:37FromGitter<Yardanico> which isn't very useful for Nim
16:36:58FromGitter<Yardanico> ah, and also: it's a closed-source(!) fork of clang
16:37:49FromGitter<Yardanico> "Zapcc uses in-memory compilation cache in client-server architecture, remembering all compilation information between runs. ‘zapcc’ is the client while ‘zapccs’ is the server. Each zapcc run will reuse an existing server, or if none available will start a new one."
16:38:12FromGitter<Yardanico> and the main one: "Will Zapcc accelerate C projects as well? No."
16:38:31*Jesin quit (Quit: Leaving)
16:38:56GitDisc<GooRoo> Can I encounter some problems if I use C++ as a target language for Nim compilation?
16:39:24GitDisc<awr> i have in the past
16:39:49GitDisc<awr> at least when i tried to use MSVC++
16:39:54FromGitter<Yardanico> GooRoo: yes
16:40:00GitDisc<GooRoo> shi~~~
16:40:01GitDisc<treeform> yes, all fixed. ws library did not follow the spec
16:40:04FromGitter<Yardanico> for example SLL doesn't work with C++ target and clang
16:40:07FromGitter<Yardanico> *SSL
16:40:36GitDisc<GooRoo> thanks for the information, guys
16:40:40FromGitter<Yardanico> @GooRoo you can check here: https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+label%3A%22C%2B%2B+codegen%22
16:40:42*Arrrr joined #nim
16:40:42*Arrrr quit (Changing host)
16:40:42*Arrrr joined #nim
16:41:45GitDisc<GooRoo> I see
16:42:02GitDisc<GooRoo> okay then, it's time to switch my settings back to C 
16:44:39*Jesin joined #nim
16:45:23FromGitter<Yardanico> why do you want C++ btw?
16:47:03GitDisc<awr> does using nim cpp with the c++ exceptions turned off return code that could be accepted by a plain C compiler?
16:47:21GitDisc<awr> or does nim cpp use operator new and delete and other c++ things
16:48:09GitDisc<awr> (pretend that we're not using any fancy bindings to c++ libraries)
16:48:54FromGitter<Yardanico> it uses C++ exceptions
16:49:08FromGitter<Yardanico> so now, nim's generated cpp code can't be compiled by a C compiler
16:49:13GitDisc<GooRoo> @Yardanico because I like C++ and do not like C. In fact, I don't care much which language Nim is compiled to unless it works.
16:49:27FromGitter<Yardanico> just use C then
16:49:34FromGitter<Yardanico> you wouldn't have any benefits with C++
16:49:50GitDisc<GooRoo> Yep, got it
16:49:52FromGitter<Yardanico> (as nim target backend)
16:50:00FromGitter<Yardanico> unless you need to use some large C++ library
16:50:07GitDisc<awr> there's a compiler option to turn cpp exceptions off while using nim cpp
16:50:56GitDisc<awr> i don't actually want to use nim cpp for anything, but it piqued my curiosity
16:51:09Araqwe need to use 'nim cpp' way more often
16:51:18Araqmuch faster exceptions
16:51:30Araqand better backend typechecking
16:52:15couven92Araq, as I understand using the winapi on Windows to get exception handling isn't even that difficult to pull off in C either
16:52:40couven92I know a guy who did for fun, complaining that getting exceptions in Linux is way much harder
16:53:51GitDisc<GooRoo> /me switching back to C++ backend
16:54:08GitDisc<GooRoo> Dumb Discord
16:54:21PMunchOh couven92, I was wondering something about Windows. You ever done DLL loading?
16:54:32couven92yup
16:54:42couven92fire away
16:54:43FromGitter<Yardanico> Araq: but these exceptions can'be catched from Nim side
16:54:46FromGitter<Yardanico> AFAIK
16:56:00Araqcouven92, that's about win32 which uses the slow model
16:56:16Araqwin64 is the "zero cost" exception model I'm after
16:56:20couven92Araq probably
16:56:23Araq*uses
16:56:56GitDisc<awr> structured exception handling
16:57:17PMunchI've got a system that works great on Linux. I compile my binary with the GCC flag `-rdynamic` which makes sure that symbols are added to the file. Then I load a DLL (or rather a .so) which has symbols that are not defined. When it is loaded the symbols are fetched from the global symbols table and it's able to use functions from the main binary. This means that the DLL only needs to compile in the symbols it actually uses which keeps the size down. But on
16:57:17PMunchWindows this doesn't work and I haven't figured out how to properly do this
16:58:47couven92PMunch, that's usually what statically linked libraries do, they make function shunts that are filled with proper addresses at runtime
16:59:18*ARCADIVS quit (Quit: ARCADIVS)
16:59:44PMunchYeah, but that requires recompilation
17:00:03couven92But if you want to do that manually, you use GetFunctionAddress (or sth. like that) which takes the a library handle and a function name as a string and returns the function pointer to the appropriate function
17:00:21PMunchhttps://stackoverflow.com/a/17083153, that's pretty much what I'm doing now
17:01:05couven92yeah, exactly as you do in Windows, the kernel functiosn just have different names
17:01:21couven92and that is actually the code that lies in statically linked libraries
17:02:30couven92PMunch, https://msdn.microsoft.com/en-us/library/ms683212(v=vs.140).aspx
17:02:42PMunchNot quite, look at the lib.c file. It just defined exported_callback and then calls it without actually having an implementation for it. The main.c file includes the implementation which is made available to the dynlib when it's loaded
17:02:54GitDisc<awr> do dynlibs in the nix world have any weird restrictions on what you can or cannot do in the entry point
17:03:07GitDisc<awr> because windows has this https://msdn.microsoft.com/en-us/library/windows/desktop/dn633971(v=vs.85).aspx#general_best_practices
17:03:24PMunchcouven92, yeah that's the other way around. So a main program finding a function in a dll to call
17:03:45couven92yeah that's what you want, isn't it
17:03:47GitDisc<awr> which is why i do --nomain on windows and call NimMain() manually
17:03:49PMunchLook at the second and third answer in that stack exchange
17:04:10FromGitter<data-man> New release imgui
17:04:26PMunchNo, I want to do it the other way round. The main program implements functions and the dll makes calls to these functions
17:05:09couven92I don't understand the problem. Just send a function pointer from your main program then, don't even need any extra code for that
17:07:38PMunchcouven92, ah there are two problems with that. First I have 80-90 functions. Sure I could wrap them in a structure of some kind but that only hides the real problem. Any way that includes passing pointers or structures will require the dll to know of all the functions the main program exposes. With the method I use for Linux the so file only needs to know of the few functions it uses as the main program only makes the symbols available.
17:07:51PMunchThis means a much smaller size
17:08:35couven92I don't get the problem... But the trick with the GetFunctionProc works the other way round as well!
17:08:42PMunchI could of course create my own symbols table, and pass a pointer to the table and include functions to read the table in each DLL, I was just wondering if there was a native way of doing this for Windows
17:09:18couven92You just pass the HINSTANCE handle of your main program to the library and then the library can discover everything it wants on its own
17:09:19PMunchOh I can GetFunctionProc from a DLL to get a function implemented in the main executable?
17:09:27PMunchAah
17:09:32couven92Sure, of course you can!
17:09:54PMunchHmm, that still means I have to manually do it though. It's not automatic..
17:09:56PMunchOh well
17:10:28couven92Even on Linux libraries and executable are not that different, they're both have executable headers with import and export tables, anyone can do lookups in those!
17:11:13PMunchYes, but you can also just define symbols that the dynamic library will automatically resolve when it's loaded
17:11:24PMunchSo you don't have to do anything special to get them
17:11:28GitDisc<awr> https://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx
17:11:36PMunchWith a file like this: https://github.com/PMunch/min/blob/dynloading/dynamic/mindyn.nim#L112
17:11:52PMunchYou can create a dynamic library like this: https://github.com/PMunch/min/blob/dynloading/dynamic/dynamicadd.nim
17:12:02GitDisc<awr> i'm interpreting this as MSDN saying that exes don't have export tables
17:12:27GitDisc<awr> which i'm not sure is completely true
17:13:03PMunchWhen compiled with -d:release it will simply compile away all the symbols it doesn't need, and only keep those it actually needs. When the DLL is loaded it will find these symbols in the global symbols table define by the main executable and will be able to call the procedures
17:14:22couven92awr, sure exes have export tables, you just normally don't put anything in those!
17:14:41GitDisc<awr> you can export variables at the very least, i know that for a fact
17:15:19couven92awr, on Windows there is absolutely NOTHING different between a dll and exe. That is a fact
17:15:41couven92Dlls even got entry points! (That don't do anything)
17:15:45GitDisc<awr> i know that
17:16:01GitDisc<awr> DllMain() has a number of restrictions though on what you can do in it
17:16:09GitDisc<awr> i linked it earlier
17:17:28couven92sure, but that comes just from the fact that they don't get access to the preinitiialzed runtime environment the Windows process loader makes for a normal executable, arguments, the a clear main thread, and all those main entry point stuff
17:18:22couven92There is nothing actually stopping you from doing all that stuff and treat a dll as a regular program, and vice-versa
17:18:28GitDisc<awr> can you straight up just call LoadLibrary on an EXE then?
17:18:35couven92Sure you can
17:19:07GitDisc<awr> that's interesting
17:19:21*claudiuinberlin joined #nim
17:19:30couven92But as you pointed out, in most cases the export table is empty, so you won't actually be able to do much with an exe loaded as a library
17:20:14couven92If you however instruct the linker to export symbols, then you will be able to GetProcAddress anything in the exe as well
17:21:16couven92Note that the main function (or rather the entry point) is special, and is placed in its own field in the executable header, but normally is NOT in the export table
17:21:55PMunchCan you tell the linker to export all symbols?
17:22:02PMunchOr do you have to specify one by one?
17:22:15couven92depends on the linker
17:22:22FromGitter<data-man> @PMunch: See http://www.dyncall.org and http://hg.dyncall.org/pub/dyncall/dyncall/file/ ⏎ It's awesome.
17:23:20couven92In Nim you only have to do {.exportc.} or sth. like that and you instruct the linker to export it depending on what compiler backend you use
17:23:23GitDisc<awr> PMunch: are you doing this in nim or c
17:23:31PMunchNim of course :)
17:23:44GitDisc<awr> you can do {.push exportc, dllexport.} and {.pop.} around the functions you want exported
17:23:44couven92(e.g. the ominous `__declspec(dllexport)` marker used in VCC)
17:24:13GitDisc<awr> not dllexport
17:24:19GitDisc<awr> sry
17:24:25GitDisc<awr> i think the pragma is dynlib
17:24:43PMunchhttps://github.com/h3rald/min/pull/8/files
17:24:44couven92awr nope, dynlib is for import only!
17:24:48PMunchThis is what I'm doing by the way
17:24:53FromGitter<mratsim> @Araq C++ exceptions are fixed?https://github.com/nim-lang/Nim/issues/6512
17:24:56couven92{.exportc.} will suffice
17:25:51GitDisc<awr> https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export
17:25:51couven92Oh! yeah, be sure to specify a calling convention when exporting! That is kinda important!
17:26:18couven92awr, oh, sorry, my mistake
17:28:46*MyMind joined #nim
17:30:02GitDisc<awr> {.push.} is weird
17:30:05*Sembei quit (Ping timeout: 240 seconds)
17:30:16GitDisc<awr> i've tried to use it to apply pragmas to a bunch of types but they never applied
17:30:55GitDisc<awr> it works for function decls though
17:30:57GitDisc<awr> and vars
17:32:08couven92I like to do a macro that applies the pragmas for me, instead of using {.push.}
17:32:17couven92in my mind that is safer :P
17:32:27PMunchYou also have the pragma pragma
17:32:32miran_i'm using re module and trying to match some subgroups. is there a better way than this?
17:32:37miran_var matches: array[7, string]; discard line.match(pattern, matches)
17:33:06PMunchhttps://nim-lang.org/docs/manual.html#pragmas-pragma-pragma
17:34:57GitDisc<awr> "pragmas-pragma-pragma"
17:35:03GitDisc<awr> That's a little rendudant
17:35:20couven92PMunch, yes that is nice, but you still have to apply the pragma on every proc
17:35:55PMunchOh yeah, I though that's what you was doing with the macro
17:36:31couven92nope, i recuse through an entire ast block and put everything I want annotated in it :P
17:36:50PMunchHmm, is there a way to call getAst on a NimNode
17:36:50couven92that way I can annotate several hundred symbols all in one go! :D
17:37:09PMunchIf I find a template in my AST tree
17:37:17couven92PMunch, yes so?
17:37:28PMunchHuh?
17:43:17*Arrrr quit (Ping timeout: 260 seconds)
17:45:26PMunchcouven92, do you know how to call a NimNode with getAst?
17:45:50*miran_ quit (Ping timeout: 255 seconds)
17:46:04couven92huh? elaborate? and why would you do that, and most importantly: what the hell is getAst?
17:46:45PMunchOh sorry, I though you were commenting on my last question :P
17:47:20PMunchWell, I have a macro that looks at some AST. When it finds a template I would like to evaluate it and get the AST it has
17:47:27PMunchSo I can look at that AST as well
17:49:52couven92PMunch, my usual pragma looks like this: https://github.com/couven92/nim-windowssdk/blob/master/src/windowssdk/ansiwide.nim
17:50:07FromGitter<data-man> Does anyone have any experience of writing Nim compiler plugins?
17:50:21PMunchcouven92, I've moved on to a completely different subject :P
17:50:24*tdc quit (Read error: Connection reset by peer)
17:50:47FromGitter<Yardanico> @data-man probably @Araq :P
17:51:30*tdc joined #nim
17:51:57FromGitter<data-man> Of course excluding him :)
17:52:14FromGitter<Yardanico> why you don't ask him directly?
17:52:21FromGitter<Yardanico> he knows everything about nim compiler :P
17:52:40FromGitter<Yardanico> there are not many compiler plugins: https://github.com/nim-lang/Nim/tree/devel/compiler/plugins
17:53:22FromGitter<data-man> I'm sure that he has so many more important tasks
17:53:45FromGitter<Yardanico> ask on the forum
17:53:45FromGitter<Yardanico> he'll answer when he has free time :)
17:54:33FromGitter<Yardanico> @data-man btw, where did you find Nim ? :)
17:55:40FromGitter<mratsim> I hate C++ with its extra long build time to just to fail right during linking
17:55:41FromGitter<data-man> A new live stream should be about the compiler plugins! :)
17:56:49FromGitter<Yardanico> it'll probably be about karax & ormin
17:57:36FromGitter<data-man> @Yardanico: I do not remember where, maybe in Google :)
17:58:31*miran_ joined #nim
18:06:30FromGitter<data-man> A few years ago I was looking for a better replacement for C++. ⏎ Tried the Nim, but eventually chose D. ⏎ Now I'm back to nim. :)
18:15:34GitDisc<treeform> Yardanico, https://github.com/Araq/ormin looks pretty cool I did not see that before
18:15:58GitDisc<treeform> this is the one I found https://github.com/nanoant/nim-orm
18:16:34GitDisc<treeform> it only seems to support the were clause
18:27:22*nsf quit (Quit: WeeChat 1.9)
18:37:06*JappleAck joined #nim
18:56:24Araqbtw I uploaded the new video to youtube
18:56:42Araqstill waiting for you guys to send me a better mic ;-)
19:01:03*Vladar quit (Remote host closed the connection)
19:20:50FromGitter<mratsim> “Google Summer of Code, mentor: Araq, task: find a better mic"
19:26:49FromGitter<data-man> Autumn or winter closer :)
19:42:52Araqdata-man: if tinyc works for you, I'll merge it but it sucks it doesn't work on Windows
19:43:03Araqbut I don't remember if it ever worked on windows
19:48:32*Jesin quit (Quit: Leaving)
19:48:36*nsf joined #nim
19:52:39FromGitter<Yardanico> Araq: your opinion on https://github.com/nim-lang/Nim/issues/6618 ?
19:53:29FromGitter<data-man> @Araq: No, tinyc doesn't work on Linux as expected. I will continue to work on this.
19:54:25Araqok
19:54:39FromGitter<data-man> After merging :)
19:59:57*dddddd quit (Ping timeout: 240 seconds)
20:01:36*dddddd joined #nim
20:03:38FromGitter<data-man> Wow! https://github.com/jangko/nimJIT ⏎ Very interesting, like the xbyak.
20:06:41*JappleAck quit (Quit: Leaving)
20:12:42FromGitter<data-man> @Araq: What tools do you use to debug the compiler? I found this: https://github.com/petermora/nimTracelog
20:13:13FromGitter<mratsim> @data-man JIT in 1000 lines? is that a code golf? xD
20:14:11*yglukhov quit (Read error: Connection reset by peer)
20:14:17GitDisc<treeform> probably not a full jit
20:14:47*yglukhov joined #nim
20:14:56*miran_ quit (Quit: Leaving)
20:15:13FromGitter<data-man> Yes, it looks like the author abandoned the project :(
20:21:04FromGitter<Yardanico> well he just made a PoC
20:21:09FromGitter<Yardanico> maybe he didn't want to create a full JIT
20:21:45PMunchThere should be a pragma for macros and templates that evaluates them before passing the AST to a macro
20:21:49GitDisc<treeform> why do we need a jit? I would find straight x86 code generation cool, but I guess that would work for a jit too...
20:22:58Araqdata-man: I use 'koch temp' plus writeStackTrace, if cond: echo n
20:25:50*gokr joined #nim
20:34:14*rauss quit (Read error: Connection reset by peer)
20:34:49FromGitter<data-man> @Araq: Thanks!
20:35:30Araqyou can watch me debug the compiler on youtube lol
20:38:00*rauss joined #nim
20:39:01FromGitter<data-man> I'm now downloading all your videos using youtube-dl :) ⏎ There are only 4 of them?
20:39:35couven92more to come in the future :)
20:41:27FromGitter<data-man> @Araq: In which video are you talking about debugging the compiler?
20:41:39Araq"random bugfixing"
20:43:25FromGitter<data-man> Thanks, before going to bed I'll take a look. Probably, after watching, I will not sleep at all. :)
20:43:35GitDisc<treeform> link to youtube video?
20:43:59FromGitter<data-man> https://www.youtube.com/watch?v=E2qlDKm_WzE
20:44:20GitDisc<treeform> thanks!
20:58:02FromGitter<data-man> Also, see Dominik's channel: https://www.youtube.com/user/d0m96
21:00:08*nsf quit (Quit: WeeChat 1.9)
21:00:48FromGitter<stisa> uh, float32 comparisons with float literals are interesting https://play.nim-lang.org/?gist=857d0d9bd1d41ac1fc167d755432f1c1 , I'm guessing the compiler optimizes the second `echo` to `echo true` ?
21:09:18*tdc quit (Ping timeout: 246 seconds)
21:10:57*cspar_ joined #nim
21:13:52*cspar quit (Ping timeout: 260 seconds)
21:17:59*Viktor quit (Quit: Viktor)
21:26:10FromGitter<data-man> https://github.com/alehander42/roswell looks promising
21:26:29FromGitter<Gooseus> oh man, finally got a successful s3 download using this sigv4 I've been messing with for a day or
21:32:42*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
21:45:32Araqhttp://cr.yp.to/antiforgery/cachetiming-20050414.pdf
21:56:13PMunchGooseus, yeah the s3 signing thing is insane..
21:56:41PMunchHad to implement it once, in Action Script..
21:59:42*voiceftp quit (Remote host closed the connection)
22:00:00*voiceftp joined #nim
22:00:07FromGitter<data-man> It would be nice to add mbedtls support to Nim. Curl can use this library.
22:07:52PMunchhttps://nim-lang.org/docs/manual.html#pragmas-immediate-pragma
22:08:04PMunchHmm, the link here points to something which isn't it the manual any longer
22:11:16*voiceftp quit (Remote host closed the connection)
22:11:45*voiceftp joined #nim
22:13:19*PMunch quit (Quit: leaving)
22:17:01*zolk3ri joined #nim
22:18:24FromGitter<Varriount> @Gooseus Yay!
22:18:35FromGitter<Varriount> What was wrong with the original code?
22:19:59*Trustable quit (Remote host closed the connection)
22:22:45FromGitter<Gooseus> <PMunch> yeah, I did it a long time ago and it was the v2 and was slightly less of a pain in the ass
22:24:19FromGitter<Gooseus> @Varriount I mostly used your code for reference, but what was wrong with mine was just being dumb with my patterns... I was adding the headers for the request to the client.headers and then processing the client.headers.table to get the canonical header string and sending the request off
22:25:13FromGitter<Gooseus> problem was that the the Host header I was adding was being added directly by the HttpClient and then my Host header was being added as extraHeaders
22:25:34FromGitter<Gooseus> I don't know how AWS processed that, but having two host headers is 403 Forbidden
22:28:38FromGitter<Gooseus> actually, don't know if how i described it was how it was happening... but I finally found it by writing a low level node server to output the raw request it was receiving
22:29:54FromGitter<Gooseus> the node http module doesn't expose the raw request and the req.headers is a dictionary that would just copy over the same key if there were two
22:33:25FromGitter<Gooseus> I'm trying to formalize a couple of these AWS test suite examples they have with the sign_aws4.nim module... or maybe aws4sig.nim... is there a naming convention for modules?
22:38:41*NimBot joined #nim
22:41:50Araqaws4sig seems better
23:14:09*couven92 quit (Quit: Client Disconnecting)
23:15:15*elrood quit (Quit: Leaving)
23:15:20*nsf joined #nim
23:15:57dom96I tend to avoid underscores for module when possible
23:16:58dom96*module names
23:21:52Araqgood news, looks like 'no nil' for strings and seqs will come for v0.18
23:31:24*yglukhov quit (Remote host closed the connection)
23:31:59*yglukhov joined #nim
23:37:37*yglukhov quit (Ping timeout: 248 seconds)