<< 10-03-2018 >>

00:01:04*cspar_ joined #nim
00:01:26*Trustable quit (Remote host closed the connection)
00:03:56shashlick@zacharycarter: send me what you have so far, I'll work on it later tonight and post it
00:03:57*cspar quit (Ping timeout: 264 seconds)
00:11:37*vlad1777d quit (Remote host closed the connection)
00:13:27*vlad1777d joined #nim
00:14:28*vlad1777d quit (Remote host closed the connection)
00:16:15*vlad1777d joined #nim
00:18:53FromGitter<zacharycarter> shashlick: I don't really have anything yet to share :/ I just kind of played around with nimgen and then dropped it - wasn't planning on starting on this tonight
00:18:58FromGitter<zacharycarter> working on some game engine code atm
00:22:13noonienhello folks
00:22:20FromGitter<zacharycarter> hi
00:23:02noonieni've got a C sdk for a microcontroller for which i'm trying to write nim code for. can i use the structs/globals defined in the sdk headers/code inside nim, without having to transform all the code to nim?
00:23:13FromGitter<zacharycarter> use c2nim
00:23:14FromGitter<zacharycarter> or nimgen
00:23:38FromGitter<zacharycarter> you need nim declarations which match the C declarations - so short answer is no you cannot
00:23:55FromGitter<zacharycarter> but that's why these tools exist - to alleviate the pain in generating all that glue code
00:24:11noonieni see
00:24:56FromGitter<zacharycarter> protip: run all your C headers through GCC preprocessor before c2niming
00:25:13FromGitter<zacharycarter> will help resolve preprocessor related code, and make c2niming easier
00:25:18noonienwell, the sdk is a clusterf**k, i wouldn't even rewrite the thing by hand, i wouldn't trust a generator to do a good job
00:25:39FromGitter<zacharycarter> so why bind to it if it's a POS library?
00:26:22shashlick@zacharycarter I'll check it out tonight and share what I come up with
00:26:27noonieni have no choice, it's the only sdk available for the MCU i'm using, writing a new one means reading the entire MCU datasheet, which is several hundred pages long
00:26:46FromGitter<zacharycarter> gotcha
00:27:08shashlickNimgen does that preprocessor trick
00:27:21FromGitter<zacharycarter> this is kinda cool -
00:27:23noonieni'll probably abstract everything I needd from the MCU as C code and just use that
00:27:31shashlickNoonien: which lib is this
00:28:07*S1tiSchu quit (Remote host closed the connection)
00:28:09noonienthe sdk for the nrf51288, sec, i'll find a link if you're curious
00:28:43FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa326ba6fba1a703aebcfd9]
00:28:51*S1tiSchu joined #nim
00:29:01noonienhttps://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v6.x.x/nrf51_sdk_v6_1_0_b2ec2e6.zip
00:29:43FromGitter<zacharycarter> so I can declare nimscript APIs inside nim modules
00:30:10FromGitter<zacharycarter> with a simple macro
00:30:23noonienthe sdk is written so that it works with multiple compilers, MCUs and boards. the selection is done via defines
00:30:33FromGitter<zacharycarter> I can even assign values to Nim variables with Nimscript results
00:31:08noonienit has asm code, and probably compiler specific tricks to access the CPU since it's basically a hardware abstraction layer
00:31:25*S1tiSchu quit (Remote host closed the connection)
00:31:45*S1tiSchu joined #nim
00:31:55noonieni can't say i trust an auto generator to produce nim code that exactly matches the required effects of setting certain registers or cpu states
00:32:04noonieni don't even know them myself tbh
00:32:45FromGitter<zacharycarter> it's not just a one and done process
00:32:58FromGitter<zacharycarter> generally you need to generate bindings in several steps through trial and error
00:33:13FromGitter<zacharycarter> but you're correct - in most cases code generated by c2nim will need manual tweaking
00:33:35FromGitter<zacharycarter> I think the point of nimgen is to alleviate some of that - but neither solution is perfect
00:33:56*S1tiSchu quit (Remote host closed the connection)
00:33:58noonienyeah, that wouldn't have been a problem if it wasnt driver code
00:34:42noonienwould have been awesome to just use the types declared in the C files
00:34:53noonienhmm, can I generate C code from within nim?
00:35:13nooniensorry, i mean write C code from within nim
00:36:56FromGitter<zacharycarter> yes
00:36:58FromGitter<zacharycarter> emit pragma
00:37:37noonienOh, GREAT!
00:45:09ieatnerdsAraq, just getting to looking at cpuload, but this this is definitely going to help me
00:49:33*vlad1777d quit (Ping timeout: 240 seconds)
00:50:05*vlad1777d joined #nim
00:50:30ieatnerdsonly problem with /proc/loadavg is that its averaged from 1, 5, and 10 minutes, whereas using two readings from /proc/stat can give me an average from as little as 1 second.
01:11:05Araqnoonien, the more you know Nim and how it maps to C, the less you need .emit
01:11:21Araqbut .emit makes for an easy start
01:11:49noonienYup, the only reason i need emit atm is to not have to convert all the existing C code to nim
01:13:07shashlicknoonien: what compiler are you targeting, OS?
01:13:21noonienarm-none-eabi-gcc
01:14:02*ftsf joined #nim
01:28:02FromGitter<samdmarshall> @dom96 I feel like i'm missing something obvious but I don't see any way to get the browser agent of a request from within jester. is that possible currently or would I need to make a PR on jester?
01:31:51*rauss joined #nim
01:32:16*rauss quit (Client Quit)
01:33:29*rauss joined #nim
01:56:02*MJCaley joined #nim
02:08:59*MJCaley quit (Quit: MJCaley)
02:40:37shashlick@samdmarshall: looks like the request object has headers in it
02:40:44shashlickyou could look for User-Agent in that
04:09:00*SenasOzys quit (Ping timeout: 255 seconds)
04:18:29*vlad1777d quit (Ping timeout: 240 seconds)
04:25:27*arnetheduck joined #nim
04:49:34*arnetheduck quit (Read error: Connection reset by peer)
05:14:58*noonien quit (Quit: Connection closed for inactivity)
06:05:02*dddddd quit (Remote host closed the connection)
06:27:03*xkapastel quit (Quit: Connection closed for inactivity)
07:17:14*miran joined #nim
07:37:07*sz0 joined #nim
08:18:07*r3d9u11 joined #nim
09:01:58*Ven`` joined #nim
09:02:32*user11101 joined #nim
09:03:47user11101Is it possible to implement a concept of a string type? For example, a string can be Numeric iff certain condition is met.
09:05:21Araqprobably not if you mean that the string consists of \d+
09:05:21user11101Numeric could be a concept
09:05:46Araqno, forget what I said
09:05:53Araqyou can do
09:06:02Araqtype Numeric = distinct string
09:06:16user11101aha! thanks
09:06:30Araqproc isNumeric(s: string): bool = s.allCharsInSet({'0'..'9'})
09:06:50Araqtemplate toNumeric(s: string): Numeric = Numeric(s)
09:14:25*arnetheduck joined #nim
09:20:12*rokups joined #nim
09:26:31*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:23:02*SenasOzys joined #nim
10:44:13*r3d9u11 quit (Quit: Leaving)
10:44:41*r3d9u11 joined #nim
11:09:45*sz0 quit (Quit: Connection closed for inactivity)
11:30:18*vlad1777d joined #nim
11:45:17*ipjk joined #nim
12:26:36*noonien joined #nim
12:32:33*SenasOzys quit (Ping timeout: 248 seconds)
12:37:24*metaden joined #nim
12:38:14*metaden quit (Client Quit)
12:38:41*SenasOzys joined #nim
12:39:58*elrood joined #nim
12:40:29*metaden joined #nim
12:44:04*metaden quit (Client Quit)
12:44:24*metaden joined #nim
12:45:49*metaden quit (Client Quit)
12:46:49FromGitter<sivakon> Can I extend Nimscript to work with custom library? Is there a guide?
12:47:38FromGitter<zacharycarter> I just posted a macro which does exactly that last night
12:47:50FromGitter<zacharycarter> well - it doesn't work with a custom library
12:47:57FromGitter<zacharycarter> but it does register additional callbacks with the VM through a macro
12:54:23*vlad1777d quit (Remote host closed the connection)
13:17:08*vlad1777d joined #nim
13:37:12*ipjk quit (Read error: Connection reset by peer)
13:58:36dom96So... `echo(@[data])` is better than `echo(data.repr)` right now
14:22:57*dddddd joined #nim
14:24:47FromGitter<gogolxdong> How to achieve this ?
14:24:52FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3eab353c1dbb743c72cbd]
14:31:20dom96if you need to change to seq[byte] then you're probably doing something wrong
14:31:32dom96You should just use the string as a list of bytes
14:35:40FromGitter<gogolxdong> how
14:36:55FromGitter<gogolxdong> and does it distinguish between char and byte when sending on SOCK_RAW on wire?
14:37:32*cspar joined #nim
14:38:01FromGitter<gogolxdong> @string produce seq[char]
14:38:25*yglukhov joined #nim
14:38:45Yardanicochar IS byte
14:38:57*cspar_ quit (Ping timeout: 240 seconds)
14:39:03Yardanicowell, I mean, it can be used as a byte
14:41:22FromGitter<gogolxdong> which means this is right? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3ee926fba1a703aeea301]
14:41:40FromGitter<gogolxdong> when sending on SOCK_RAW on wire
14:42:00Yardanicowell, try it :)
14:42:11YardanicoI didn't really use any low-level networking in nim
14:42:18Yardanicolike raw sockets
14:56:11miranquestion about `countup`: is there a reason why step must be int?
14:56:34miranjust found out i cannot do `countup(3.0, 15.0, 0.5)`
15:04:44miranoh, start and stop also cannot be floats. :(
15:05:05*Trustable joined #nim
15:08:17dom96gogolxdong: it's pointless, just use a string.
15:10:36*yglukhov quit (Remote host closed the connection)
15:14:27FromGitter<zacharycarter> graphql parsing w/Nim ! - ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3f65253c1dbb743c760e2]
15:16:13dom96Awesome :D
15:22:40Yardanicozacharycarter: what is "graphql_error_free" ? does it use pointers? just curious
15:24:47FromGitter<zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3f8bf6f8b4b99460f65ec]
15:27:22FromGitter<zacharycarter> ```void graphql_error_free(const char *error) { ⏎ std::free((void *)(error)); // NOLINT ⏎ }``` [https://gitter.im/nim-lang/Nim?at=5aa3f9596f8b4b99460f68bf]
15:39:23*Vladar joined #nim
15:42:16federico3zacharycarter: that was fast
15:42:51FromGitter<zacharycarter> :)
15:44:59*lowryder joined #nim
15:45:03*lowryder left #nim ("WeeChat 0.4.2")
15:53:02*gokr joined #nim
15:53:05*gokr left #nim (#nim)
16:22:05*arnetheduck quit (Remote host closed the connection)
16:25:18*xkapastel joined #nim
16:32:05*MJCaley joined #nim
16:38:57FromGitter<littleli> hi guys, what is the way to produce statically linked binary?
16:50:53*MJCaley quit (Quit: MJCaley)
16:57:24*tefter joined #nim
17:06:27*vivus joined #nim
17:26:11FromGitter<zacharycarter> dom96: https://nimble.directory/ is 502ing for me
17:26:16FromGitter<zacharycarter> nm
17:26:17*r3d9u11 quit (Ping timeout: 256 seconds)
17:26:39dom96Don't ping me, ping federico3
17:27:11FromGitter<littleli> @zacharycarter looks like ephemeral problem
17:28:16*gokr joined #nim
17:34:07*test joined #nim
17:34:30*test is now known as Guest50355
17:34:54*Guest50355 quit (Client Quit)
17:37:55shashlick@zacharycarter: which files did you wrap? I tried last night and had issues with the bison files
17:43:56federico3zacharycarter: works for me - did it happen on a specific pkg?
17:47:30*fvs joined #nim
17:48:53fvshi, is there a limit to how long a src line can be?
17:49:54dom96IIRC there is
17:49:58dom96There is an issue about that somewhere
17:50:26shashlickgot a c2nim crash for this: https://pastebin.com/iDzA9CNF
17:50:40shashlickc2nim --cpp --stdcall --header:headerGraphQLParser --out:nimgraphql\GraphQLParser.nim temp-GraphQLParser.nim.c
17:50:41shashlickSIGSEGV: Illegal storage access. (Attempt to read from nil?)
17:50:49shashlickc2nim doesn't like recursive namespaces?
17:55:35*max3 joined #nim
18:06:28*Vladar quit (Remote host closed the connection)
18:15:42*girvo waves hello
18:17:08*enigmeta quit (Read error: Connection reset by peer)
18:17:23*enigmeta joined #nim
18:40:50*miran quit (Quit: Konversation terminated!)
18:47:09*gokr quit (Ping timeout: 264 seconds)
18:48:37*fvs left #nim ("ERC (IRC client for Emacs 25.3.1)")
19:02:24*elrood quit (Quit: Leaving)
19:03:58FromGitter<zetashift> @girvo hiya! how's it going
19:09:41*nsf joined #nim
19:10:06*vlad1777d quit (Quit: Leaving)
19:13:49*Ven`` joined #nim
19:29:51*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:33:49*solitudesf quit (Quit: removing from IRC because user idle on matrix for 30+ days)
19:37:07*solitudesf joined #nim
19:44:23*watzon quit (Quit: removing from IRC because user idle on matrix for 30+ days)
19:45:33*Ven`` joined #nim
19:50:04*SenasOzys quit (Ping timeout: 260 seconds)
19:56:29*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:57:32*MJCaley joined #nim
19:58:51girvoIt's going well! Though I've been deep in React Native/Flow instead of Nim because of work recently, which sucks
20:03:29*SenasOzys joined #nim
20:09:47FromGitter<zetashift> well it could always be worse it could just be untyped javascript!
20:11:56girvoDefinitely, haha. And I've got this app using Higher Kinded Types through flow-static-land, and full runtime decoding (strongly typed with proper Flow inference) of JSON, and 99.8% coverage :D
20:24:06*hiway quit (Quit: removing from IRC because user idle on matrix for 30+ days)
20:24:33*rokups quit (Quit: Connection closed for inactivity)
20:33:04*hohlerde quit (Quit: removing from IRC because user idle on matrix for 30+ days)
20:40:42*adeohluwa joined #nim
20:41:02adeohluwasay u wanted to write a nim code that uses the twilio library
20:41:30adeohluwathey have a C library & a node js library
20:42:32adeohluwawhich is better to run with? 🤔
20:46:14dom96C library, always.
20:47:39*Jipok[m] quit (Quit: removing from IRC because user idle on matrix for 30+ days)
20:59:39*MJCaley quit (Quit: MJCaley)
21:06:03federico3are deques recommended for "circular" buffers? Are addLast and popFirst O(1) ?
21:07:51federico3aha: "double-ended queue backed with a ringed seq buffer" - from the sources
21:25:07*vivus quit (Quit: Leaving)
21:26:07*gokr joined #nim
21:26:45*gokr left #nim (#nim)
21:27:22*r3d9u11 joined #nim
22:10:16*MJCaley joined #nim
22:10:46Temperance[m]is there something like a "main" function in nim?
22:11:13girvo`when isMainModule:`
22:12:15girvoIt takes a block, and viola! You can even write your own `proc main(argv: seq[string]): int` and then call it in the `isMainModule` block :)
22:17:57girvoTemperance[m]: https://hastebin.com/nipocetapa.nim
22:18:47*rockcavera quit (Remote host closed the connection)
22:29:53Temperance[m]thanks
22:30:34Temperance[m]can someone explain me this? window_code.nim(277, 8) Error: type mismatch: got <context, type color>
22:30:35Temperance[m]but expected one of:
22:30:36Temperance[m]proc (ctx: context, col: color){.closure.}
22:30:47Temperance[m]I seem to have the same things... though obviously there are differences, but I'm not understanding them in full.
22:30:57*user11101 quit (Ping timeout: 248 seconds)
22:31:20girvoThrow the code snippet up on hastebin or something for me?
22:32:02Temperance[m]I'm mixing two files and editing code that isn't mine to test stuff, I don't think it would be much readable, let me see if I can replicate it in less lines.
22:32:48girvoNo problem :)
22:36:32*r3d9u11 quit (Ping timeout: 276 seconds)
22:39:07*icebattl1 joined #nim
22:39:17*icebattle quit (Read error: Connection reset by peer)
22:44:27*dddddd quit (Ping timeout: 240 seconds)
22:44:55*dddddd joined #nim
22:50:57*adeohluwa quit (Quit: Connection closed for inactivity)
22:54:39*max3 quit (Quit: Connection closed for inactivity)
23:06:05dom96Temperance[m]: 'type color', you're passing a type instead of a variable of type 'color'?
23:06:31dom96You should really begin your type names with an upper case letter
23:06:41dom96will make things less confusing
23:09:54*nsf quit (Quit: WeeChat 2.0.1)
23:10:26*MJCaley quit (Quit: MJCaley)
23:16:33*vegax87 quit (Ping timeout: 240 seconds)
23:16:41*vegax87 joined #nim
23:33:47*MJCaley joined #nim
23:33:48*dyln joined #nim
23:36:43*dxg quit (Ping timeout: 265 seconds)
23:41:25*dddddd quit (Ping timeout: 256 seconds)
23:46:42*dddddd joined #nim