00:01:04 | * | cspar_ joined #nim |
00:01:26 | * | Trustable quit (Remote host closed the connection) |
00:03:56 | shashlick | @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:53 | FromGitter | <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:58 | FromGitter | <zacharycarter> working on some game engine code atm |
00:22:13 | noonien | hello folks |
00:22:20 | FromGitter | <zacharycarter> hi |
00:23:02 | noonien | i'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:13 | FromGitter | <zacharycarter> use c2nim |
00:23:14 | FromGitter | <zacharycarter> or nimgen |
00:23:38 | FromGitter | <zacharycarter> you need nim declarations which match the C declarations - so short answer is no you cannot |
00:23:55 | FromGitter | <zacharycarter> but that's why these tools exist - to alleviate the pain in generating all that glue code |
00:24:11 | noonien | i see |
00:24:56 | FromGitter | <zacharycarter> protip: run all your C headers through GCC preprocessor before c2niming |
00:25:13 | FromGitter | <zacharycarter> will help resolve preprocessor related code, and make c2niming easier |
00:25:18 | noonien | well, 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:39 | FromGitter | <zacharycarter> so why bind to it if it's a POS library? |
00:26:22 | shashlick | @zacharycarter I'll check it out tonight and share what I come up with |
00:26:27 | noonien | i 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:46 | FromGitter | <zacharycarter> gotcha |
00:27:08 | shashlick | Nimgen does that preprocessor trick |
00:27:21 | FromGitter | <zacharycarter> this is kinda cool - |
00:27:23 | noonien | i'll probably abstract everything I needd from the MCU as C code and just use that |
00:27:31 | shashlick | Noonien: which lib is this |
00:28:07 | * | S1tiSchu quit (Remote host closed the connection) |
00:28:09 | noonien | the sdk for the nrf51288, sec, i'll find a link if you're curious |
00:28:43 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa326ba6fba1a703aebcfd9] |
00:28:51 | * | S1tiSchu joined #nim |
00:29:01 | noonien | https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v6.x.x/nrf51_sdk_v6_1_0_b2ec2e6.zip |
00:29:43 | FromGitter | <zacharycarter> so I can declare nimscript APIs inside nim modules |
00:30:10 | FromGitter | <zacharycarter> with a simple macro |
00:30:23 | noonien | the sdk is written so that it works with multiple compilers, MCUs and boards. the selection is done via defines |
00:30:33 | FromGitter | <zacharycarter> I can even assign values to Nim variables with Nimscript results |
00:31:08 | noonien | it 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:55 | noonien | i 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:04 | noonien | i don't even know them myself tbh |
00:32:45 | FromGitter | <zacharycarter> it's not just a one and done process |
00:32:58 | FromGitter | <zacharycarter> generally you need to generate bindings in several steps through trial and error |
00:33:13 | FromGitter | <zacharycarter> but you're correct - in most cases code generated by c2nim will need manual tweaking |
00:33:35 | FromGitter | <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:58 | noonien | yeah, that wouldn't have been a problem if it wasnt driver code |
00:34:42 | noonien | would have been awesome to just use the types declared in the C files |
00:34:53 | noonien | hmm, can I generate C code from within nim? |
00:35:13 | noonien | sorry, i mean write C code from within nim |
00:36:56 | FromGitter | <zacharycarter> yes |
00:36:58 | FromGitter | <zacharycarter> emit pragma |
00:37:37 | noonien | Oh, GREAT! |
00:45:09 | ieatnerds | Araq, 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:30 | ieatnerds | only 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:05 | Araq | noonien, the more you know Nim and how it maps to C, the less you need .emit |
01:11:21 | Araq | but .emit makes for an easy start |
01:11:49 | noonien | Yup, the only reason i need emit atm is to not have to convert all the existing C code to nim |
01:13:07 | shashlick | noonien: what compiler are you targeting, OS? |
01:13:21 | noonien | arm-none-eabi-gcc |
01:14:02 | * | ftsf joined #nim |
01:28:02 | FromGitter | <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:37 | shashlick | @samdmarshall: looks like the request object has headers in it |
02:40:44 | shashlick | you 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:47 | user11101 | Is it possible to implement a concept of a string type? For example, a string can be Numeric iff certain condition is met. |
09:05:21 | Araq | probably not if you mean that the string consists of \d+ |
09:05:21 | user11101 | Numeric could be a concept |
09:05:46 | Araq | no, forget what I said |
09:05:53 | Araq | you can do |
09:06:02 | Araq | type Numeric = distinct string |
09:06:16 | user11101 | aha! thanks |
09:06:30 | Araq | proc isNumeric(s: string): bool = s.allCharsInSet({'0'..'9'}) |
09:06:50 | Araq | template 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:49 | FromGitter | <sivakon> Can I extend Nimscript to work with custom library? Is there a guide? |
12:47:38 | FromGitter | <zacharycarter> I just posted a macro which does exactly that last night |
12:47:50 | FromGitter | <zacharycarter> well - it doesn't work with a custom library |
12:47:57 | FromGitter | <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:36 | dom96 | So... `echo(@[data])` is better than `echo(data.repr)` right now |
14:22:57 | * | dddddd joined #nim |
14:24:47 | FromGitter | <gogolxdong> How to achieve this ? |
14:24:52 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3eab353c1dbb743c72cbd] |
14:31:20 | dom96 | if you need to change to seq[byte] then you're probably doing something wrong |
14:31:32 | dom96 | You should just use the string as a list of bytes |
14:35:40 | FromGitter | <gogolxdong> how |
14:36:55 | FromGitter | <gogolxdong> and does it distinguish between char and byte when sending on SOCK_RAW on wire? |
14:37:32 | * | cspar joined #nim |
14:38:01 | FromGitter | <gogolxdong> @string produce seq[char] |
14:38:25 | * | yglukhov joined #nim |
14:38:45 | Yardanico | char IS byte |
14:38:57 | * | cspar_ quit (Ping timeout: 240 seconds) |
14:39:03 | Yardanico | well, I mean, it can be used as a byte |
14:41:22 | FromGitter | <gogolxdong> which means this is right? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3ee926fba1a703aeea301] |
14:41:40 | FromGitter | <gogolxdong> when sending on SOCK_RAW on wire |
14:42:00 | Yardanico | well, try it :) |
14:42:11 | Yardanico | I didn't really use any low-level networking in nim |
14:42:18 | Yardanico | like raw sockets |
14:56:11 | miran | question about `countup`: is there a reason why step must be int? |
14:56:34 | miran | just found out i cannot do `countup(3.0, 15.0, 0.5)` |
15:04:44 | miran | oh, start and stop also cannot be floats. :( |
15:05:05 | * | Trustable joined #nim |
15:08:17 | dom96 | gogolxdong: it's pointless, just use a string. |
15:10:36 | * | yglukhov quit (Remote host closed the connection) |
15:14:27 | FromGitter | <zacharycarter> graphql parsing w/Nim ! - ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3f65253c1dbb743c760e2] |
15:16:13 | dom96 | Awesome :D |
15:22:40 | Yardanico | zacharycarter: what is "graphql_error_free" ? does it use pointers? just curious |
15:24:47 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aa3f8bf6f8b4b99460f65ec] |
15:27:22 | FromGitter | <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:16 | federico3 | zacharycarter: that was fast |
15:42:51 | FromGitter | <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:57 | FromGitter | <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:11 | FromGitter | <zacharycarter> dom96: https://nimble.directory/ is 502ing for me |
17:26:16 | FromGitter | <zacharycarter> nm |
17:26:17 | * | r3d9u11 quit (Ping timeout: 256 seconds) |
17:26:39 | dom96 | Don't ping me, ping federico3 |
17:27:11 | FromGitter | <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:55 | shashlick | @zacharycarter: which files did you wrap? I tried last night and had issues with the bison files |
17:43:56 | federico3 | zacharycarter: works for me - did it happen on a specific pkg? |
17:47:30 | * | fvs joined #nim |
17:48:53 | fvs | hi, is there a limit to how long a src line can be? |
17:49:54 | dom96 | IIRC there is |
17:49:58 | dom96 | There is an issue about that somewhere |
17:50:26 | shashlick | got a c2nim crash for this: https://pastebin.com/iDzA9CNF |
17:50:40 | shashlick | c2nim --cpp --stdcall --header:headerGraphQLParser --out:nimgraphql\GraphQLParser.nim temp-GraphQLParser.nim.c |
17:50:41 | shashlick | SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
17:50:49 | shashlick | c2nim 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:58 | FromGitter | <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:51 | girvo | It'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:47 | FromGitter | <zetashift> well it could always be worse it could just be untyped javascript! |
20:11:56 | girvo | Definitely, 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:02 | adeohluwa | say u wanted to write a nim code that uses the twilio library |
20:41:30 | adeohluwa | they have a C library & a node js library |
20:42:32 | adeohluwa | which is better to run with? 🤔 |
20:46:14 | dom96 | C 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:03 | federico3 | are deques recommended for "circular" buffers? Are addLast and popFirst O(1) ? |
21:07:51 | federico3 | aha: "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:46 | Temperance[m] | is there something like a "main" function in nim? |
22:11:13 | girvo | `when isMainModule:` |
22:12:15 | girvo | It 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:57 | girvo | Temperance[m]: https://hastebin.com/nipocetapa.nim |
22:18:47 | * | rockcavera quit (Remote host closed the connection) |
22:29:53 | Temperance[m] | thanks |
22:30:34 | Temperance[m] | can someone explain me this? window_code.nim(277, 8) Error: type mismatch: got <context, type color> |
22:30:35 | Temperance[m] | but expected one of: |
22:30:36 | Temperance[m] | proc (ctx: context, col: color){.closure.} |
22:30:47 | Temperance[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:20 | girvo | Throw the code snippet up on hastebin or something for me? |
22:32:02 | Temperance[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:48 | girvo | No 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:05 | dom96 | Temperance[m]: 'type color', you're passing a type instead of a variable of type 'color'? |
23:06:31 | dom96 | You should really begin your type names with an upper case letter |
23:06:41 | dom96 | will 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 |