00:04:04 | * | crem quit (Ping timeout: 240 seconds) |
00:06:31 | * | crem joined #nim |
00:19:48 | * | SenasOzys quit (Remote host closed the connection) |
00:19:51 | * | MeTheFlea20 joined #nim |
00:20:25 | * | SenasOzys joined #nim |
00:20:36 | * | localhost23 joined #nim |
00:21:18 | * | SenasOzys quit (Remote host closed the connection) |
00:22:00 | * | MeTheFlea20 quit (K-Lined) |
00:25:58 | * | localhost23 quit (Ping timeout: 272 seconds) |
00:29:45 | * | SenasOzys joined #nim |
00:34:06 | * | kapil___ quit (Quit: Connection closed for inactivity) |
00:38:48 | * | SenasOzys quit (Remote host closed the connection) |
00:39:24 | * | SenasOzys joined #nim |
00:40:36 | * | SenasOzys quit (Max SendQ exceeded) |
00:42:01 | * | SenasOzys joined #nim |
00:43:49 | * | SenasOzys quit (Remote host closed the connection) |
00:44:37 | * | ftsf joined #nim |
00:44:39 | * | SenasOzys joined #nim |
00:45:55 | * | SenasOzys quit (Max SendQ exceeded) |
00:46:27 | * | xet7 quit (Quit: Leaving) |
00:48:23 | * | SenasOzys joined #nim |
00:49:37 | * | SenasOzys quit (Max SendQ exceeded) |
00:50:15 | * | SenasOzys joined #nim |
01:17:16 | * | demotomohiro quit (Ping timeout: 272 seconds) |
01:29:12 | * | butchlugrod16 joined #nim |
01:32:16 | FromDiscord | <wenzani> hey guys |
01:32:59 | FromDiscord | <wenzani> I'm getting this error since I may have permanently deleted the karax folder after installing through nimble |
01:33:01 | FromDiscord | <wenzani> The .nimble-link file is pointing to a missing file: |
01:33:19 | FromDiscord | <wenzani> Can't uninstall or do anything with the karax package anymore, anyone know a fix? |
01:33:57 | * | butchlugrod16 quit (Remote host closed the connection) |
02:02:52 | * | abm quit (Ping timeout: 272 seconds) |
02:14:52 | FromGitter | <gogolxdong> a more generic solution is strip($JsonNode, chars = {'\"'}) instead of getInt, getStr, getFloat, getBool |
02:21:43 | * | wildlander quit (Ping timeout: 250 seconds) |
02:32:35 | * | tbmb joined #nim |
02:36:05 | * | tbmb quit (Remote host closed the connection) |
02:49:24 | FromGitter | <gogolxdong> mangkhut is striking us. |
03:05:16 | * | mal`` quit (Quit: Leaving) |
03:10:23 | * | mal`` joined #nim |
03:11:08 | * | krux02 quit (Remote host closed the connection) |
03:12:36 | FromGitter | <codenoid> @Bennyelg coz nim syntax is very different from python |
03:35:01 | * | ftsf quit (Ping timeout: 244 seconds) |
03:37:23 | FromDiscord | <Shield> bruteforcing http requests won't take me anywhere it seems, 100 continue and 206 partial content seems to be the answer to stream large files without fully loading them in memory, i'd like to know how can they be used properly |
03:43:29 | * | demotomohiro joined #nim |
04:10:10 | FromGitter | <qqtop> @gogolxdong , yep , the building is swinging during strong gusts.. |
04:10:27 | * | kungtotte quit (Remote host closed the connection) |
04:14:16 | shashlick | @AlexMax: sorry man not able to help, am traveling for the next week for work |
04:49:47 | * | miran joined #nim |
05:10:29 | * | Sammitch24 joined #nim |
05:11:08 | * | Sammitch24 quit (Remote host closed the connection) |
05:17:13 | * | SenasOzys__ joined #nim |
05:17:42 | * | SenasOzys quit (Read error: Connection reset by peer) |
05:19:48 | * | SenasOzys__ quit (Remote host closed the connection) |
05:20:34 | * | SenasOzys joined #nim |
05:30:23 | * | SenasOzys quit (Remote host closed the connection) |
05:32:43 | * | SenasOzys joined #nim |
05:33:19 | * | ARCADIVS joined #nim |
05:34:11 | FromDiscord | <wenzani> anyone about the .nimble-link? |
05:35:41 | * | nq joined #nim |
05:37:45 | * | nq quit (Client Quit) |
05:44:53 | * | stefanos82 joined #nim |
05:47:29 | * | Muzer9 joined #nim |
05:52:21 | * | Muzer9 quit (Remote host closed the connection) |
06:04:56 | FromGitter | <andrewchambers> Hi there, is there a way to import a CPP define then use it as an array size |
06:05:25 | FromGitter | <andrewchambers> ? I'm trying to do something like array[SOME_DEFINE, byte] |
06:08:15 | * | c15ade4 joined #nim |
06:11:33 | FromGitter | <andrewchambers> Also, is there a way in a template to stringify an identifier? I figured I could make a template to at least import it as a var, make a nim constant and then assert they are the same value at runtime. |
06:13:51 | FromGitter | <bung87> when define(somedefine) |
06:16:37 | FromGitter | <bung87> https://github.com/nim-lang/Nim/blob/master/lib/pure/htmlgen.nim#L39 |
06:17:42 | FromGitter | <andrewchambers> thank you, is there documentation for define ? |
06:19:09 | FromGitter | <bung87> https://nim-lang.org/docs/nimc.html#compiler-usage-compile-time-symbols |
06:20:22 | FromGitter | <andrewchambers> Oh, my question was taking a C preprocessor define |
06:20:33 | FromGitter | <andrewchambers> Im trying to make an array of |
06:20:41 | FromGitter | <andrewchambers> size matching some C preprocessor value |
06:21:36 | FromGitter | <andrewchambers> hardcoding it in nim seems risky because on a different platform the value may change. |
06:24:14 | FromGitter | <bung87> oh ,take define from c source code, hmm I have no idea sorry |
06:25:59 | FromGitter | <bung87> maybe you can write script read from c source and then generate a nim compile command. |
06:33:23 | FromGitter | <andrewchambers> hmm yeah |
06:33:57 | FromGitter | <andrewchambers> A final question, if a statement is not inside a function |
06:34:13 | FromGitter | <andrewchambers> but not in the main module, is it still run? |
06:34:31 | leorize | it will |
06:34:46 | leorize | the statement will be run before the main module the last time I tried |
06:34:50 | FromGitter | <andrewchambers> ah, i think I found a way to do this with templates now :) thank you. |
06:36:30 | * | leorize quit (Quit: WeeChat 2.2) |
06:41:11 | * | stefanos82 quit (Quit: Quitting for now...) |
06:43:18 | * | SenasOzys quit (Remote host closed the connection) |
06:44:13 | * | SenasOzys joined #nim |
06:45:09 | * | demotomohiro quit (Ping timeout: 244 seconds) |
06:48:17 | miran | is there something like `varargs` which will not a return `seq[T]` but it will allow different types (returning a tuple)? |
06:58:21 | FromGitter | <Bennyelg> Interesting |
07:10:41 | FromGitter | <alehander42> @andrewchambers I think you can just define something like |
07:11:14 | FromGitter | <alehander42> `const cPreValue {.importcpp: "Cident".}: typ` |
07:11:19 | FromGitter | <alehander42> and then use that |
07:11:28 | FromGitter | <alehander42> if i am understanding you correctly |
07:12:11 | FromGitter | <alehander42> where Cident is a c expression which evaluates to your value |
07:12:14 | FromGitter | <codenoid> |
07:12:24 | zachcarter | I am still struggling mightly with this backtick thing and importcpp / finding a way to reliably create JS template literals |
07:12:41 | zachcarter | Araq / dom96 - this is really putting a damper in me using Nim at work |
07:13:02 | FromGitter | <alehander42> can you give a short example? I am sure there is a way to at least workaround it |
07:13:36 | zachcarter | I have one lying around I believe - one moment |
07:15:46 | zachcarter | https://gist.github.com/zacharycarter/a43a326108126be9fca99325bc3135ab |
07:16:47 | zachcarter | really - I need to plug the value that resides in the variable bar - between backticks |
07:16:53 | zachcarter | in the emitted JS |
07:17:28 | zachcarter | and surround it in backticks to create a template literal |
07:20:07 | zachcarter | ideally, hello world is something like ``<h1>Hello ${this.props.name}!`` |
07:20:15 | zachcarter | which would create a JS template literal |
07:20:22 | zachcarter | so that's what I want the macro to emit |
07:20:32 | zachcarter | that would get passed to the foo proc |
07:21:14 | zachcarter | this would all work if backticks didn't screw up importcpp so badly I think |
07:23:15 | FromGitter | <alehander42> so this `<h1>..` is a string in nim's proc? |
07:23:32 | FromGitter | <alehander42> e.g. ⏎ ⏎ ```proc .. ⏎ return "<h1>Hello ${..}!"``` [https://gitter.im/nim-lang/Nim?at=5b9e04f454587954f9acf253] |
07:25:02 | FromGitter | <zacharycarter> well - in the macro / DSL it will be a variable name |
07:25:12 | FromGitter | <zacharycarter> so in the example it is - `bar` |
07:25:25 | FromGitter | <zacharycarter> but the value of bar is "Hello World!" |
07:25:53 | FromGitter | <zacharycarter> so what I need to have happen is when the JS is created - the emit produces: return foo("Hello World!") |
07:26:03 | FromGitter | <zacharycarter> err actually sory |
07:26:09 | FromGitter | <zacharycarter> return foo(`"Hello world!"`) |
07:26:19 | FromGitter | <zacharycarter> hello world - surrounded in backticks |
07:26:35 | FromGitter | <zacharycarter> I realize that that's not going to happen with what I have now - it's just going to escape the variable name and put the non mangled variable name there |
07:27:52 | FromGitter | <zacharycarter> I've tried doing something like this - ⏎ ⏎ ```proc eval*(o: JsObject, v: JsObject): JsObject {.importcpp: "eval(#`#`).}``` [https://gitter.im/nim-lang/Nim?at=5b9e05f8fcba1254fac25820] |
07:29:00 | FromGitter | <zacharycarter> but calling it like - ⏎ ⏎ ````eval`(toJs("<h1>Hello {this.props.name}"))``` [https://gitter.im/nim-lang/Nim?at=5b9e063ce5c2cc56ad9848ac] |
07:29:05 | FromGitter | <zacharycarter> produces something like this in the js code - |
07:30:43 | FromGitter | <zacharycarter> ```return eval(#`#`)(...)``` |
07:32:27 | * | nsf joined #nim |
07:34:25 | FromGitter | <alehander42> ok, something i don't quite understand in your example is |
07:34:27 | FromGitter | <alehander42> you directly emit |
07:34:30 | FromGitter | <alehander42> e.g. if i have |
07:34:43 | FromGitter | <alehander42> ```proc willCompileButHowBactick(): cstring = ⏎ return `foo`(@[2])``` [https://gitter.im/nim-lang/Nim?at=5b9e0793e5c2cc56ad9850f8] |
07:35:07 | FromGitter | <alehander42> this will emit `@[2]` anyway |
07:35:12 | FromGitter | <alehander42> which doesn't make a lot of sense to me |
07:35:37 | FromGitter | <alehander42> ah so it's supposed to be javascript |
07:35:41 | FromGitter | <zacharycarter> yes |
07:35:43 | FromGitter | <alehander42> but your want to replace only |
07:35:44 | FromGitter | <alehander42> the names |
07:35:55 | FromGitter | <alehander42> and the strings |
07:36:35 | FromGitter | <zacharycarter> well - in the ⏎ ⏎ ```example: ⏎ proc willCompileButHowBactick(): cstring = ⏎ return `foo`(`bar`)``` ⏎ ⏎ part - `example` is representing a macro that allows the user to define a ES2015 class [https://gitter.im/nim-lang/Nim?at=5b9e0803fcba1254fac262eb] |
07:36:53 | FromGitter | <zacharycarter> in that DSL they should be able to define methods on the class using Nim syntax for the method signature |
07:37:01 | FromGitter | <zacharycarter> and then in the body of the proc - they can use JS |
07:37:10 | FromGitter | <zacharycarter> but they need to be able to reference Nim variables |
07:37:36 | FromGitter | <zacharycarter> so ideally they can do - ```return `foo`(`bar`)``` |
07:37:43 | FromGitter | <zacharycarter> and foo and bar would be Nim identifiers |
07:38:33 | FromGitter | <zacharycarter> but where I'm struggling is - let's say foo is a Nim proc that produces another proc that takes in a JS template literal |
07:38:49 | FromGitter | <zacharycarter> what I've been doing is - use importcpp to bind to the JavaScript eval function |
07:39:19 | FromGitter | <zacharycarter> and I've been making the importcpp like - ```{.importcpp: "eval(#`#`)".}``` |
07:39:38 | FromGitter | <zacharycarter> which works fine - until you wrap the bound proc in backticks |
07:40:03 | FromGitter | <zacharycarter> then the JSgen seems to just put ```eval(#`#`)``` - in the compiled JS code |
07:47:46 | * | ebx1000 joined #nim |
07:54:53 | FromGitter | <alehander42> i got a version of yours working |
07:54:56 | FromGitter | <alehander42> but my only problem is |
07:55:07 | FromGitter | <alehander42> i can't get emit to not produce newlines |
07:55:27 | FromGitter | <alehander42> so now for ⏎ ⏎ ```return `foo`(\`${`bar`}\`)``` [https://gitter.im/nim-lang/Nim?at=5b9e0c6fa56b215c9745e3e8] |
07:55:34 | FromGitter | <alehander42> it generates |
07:55:51 | FromGitter | <alehander42> ```foo_141493(`${bar_141510[0]}`)``` |
07:55:59 | FromGitter | <alehander42> but with newlines between each token |
07:56:12 | FromGitter | <alehander42> like ⏎ ⏎ ```foo_141493 ⏎ (` ⏎ ${ ⏎ bar_141510[0]``` [https://gitter.im/nim-lang/Nim?at=5b9e0c9ce5c2cc56ad986a55] |
07:56:38 | FromGitter | <zacharycarter> hrm okay - that's better than what I've gotten so far :) thank you! |
07:59:49 | * | Vladar joined #nim |
08:03:11 | * | gmpreussner quit (Quit: kthxbye) |
08:03:28 | * | gmpreussner joined #nim |
08:21:57 | * | TheLemonMan joined #nim |
08:40:19 | FromGitter | <bung87> ```code paste, see link``` ⏎ ⏎ how to directly `newTableint,TableRef[Hash, HashSet[string ()` ? or am I define a wrong type? [https://gitter.im/nim-lang/Nim?at=5b9e16f254587954f9ad55c7] |
08:50:38 | FromGitter | <bung87> oh ,wrong question. how to `new Bin` works as above? |
08:58:55 | * | huphtur joined #nim |
09:03:36 | * | miran quit (Quit: Konversation terminated!) |
09:03:48 | * | huphtur quit (Remote host closed the connection) |
09:23:39 | * | wildlander joined #nim |
09:29:25 | * | ftsf joined #nim |
09:32:36 | * | dddddd joined #nim |
09:38:11 | * | ofelas quit (Quit: shutdown -h now) |
09:40:52 | * | krux02 joined #nim |
09:45:28 | * | jsn-_ quit (Quit: Reconnecting) |
09:45:35 | * | jsn- joined #nim |
09:55:14 | FromGitter | <alehander42> @zacharycarter this was my solution ⏎ https://gist.github.com/alehander42/990a0a88572072768a7c85ba60fd12a3 |
09:55:37 | FromGitter | <alehander42> there is another , maybe better solution based on asm instead of emit |
09:55:57 | FromGitter | <alehander42> there is a way to change the marker for asm, so then it doesn't interpret "`" |
09:56:32 | FromGitter | <alehander42> so you can have something like @foo@(`${@bar@}`) |
09:56:49 | FromGitter | <alehander42> the problem is I don't know how exactly one passed this marker to `asm` |
09:56:53 | FromGitter | <alehander42> @Araq ? ^ |
09:57:13 | FromGitter | <alehander42> the second thing is I am actually wondering why would one need to write js in the body |
09:57:16 | FromGitter | <alehander42> of those methods |
09:58:05 | FromGitter | <alehander42> I don't get why would you want to mix nim with js in such a way, I think you can write everything you need in pure nim translatable to the js you need |
09:58:49 | FromGitter | <alehander42> in this case it would be also easier to generate stuff like javascript format, you'll just have a macro similar to strformat , e.g. `%"a{2}"` |
10:03:09 | c15ade4 | Is there a way to dump the C code generated by nim into something like a tarball with a configure script |
10:04:03 | c15ade4 | well, configure script doesn't matter, just a way to dump the C source that can be built without nim |
10:07:11 | * | kapil___ joined #nim |
10:10:29 | FromGitter | <alehander42> if you compile with `--verbosity:3` (maybe a lower number is enough) you'll get the gcc commands used to compile it, the source itself is in `~/.cache/nim/project` by default |
10:10:37 | FromGitter | <alehander42> i guess there might be a bteter way |
10:19:07 | * | zachcarter quit (Ping timeout: 240 seconds) |
10:28:51 | * | leorize joined #nim |
10:35:43 | * | xet7 joined #nim |
10:39:22 | * | tefter quit (Remote host closed the connection) |
10:41:11 | * | nsf quit (Quit: WeeChat 2.2) |
10:45:41 | FromGitter | <dm1try> ^the generated code is platform-dependent btw |
10:46:16 | FromGitter | <dm1try> for cross-compilation use https://nim-lang.org/docs/nimc.html#cross-compilation |
11:00:22 | * | elrood joined #nim |
11:08:06 | * | chrysn8 joined #nim |
11:09:32 | c15ade4 | cool :) |
11:10:08 | * | chrysn8 quit (K-Lined) |
11:10:19 | c15ade4 | hmm another question, how do I write an array to a file - is there a way to slice it so that write will accept it? |
11:12:05 | FromGitter | <codenoid> https://forum.nim-lang.org/t/2586 |
11:18:20 | * | ebx1000 quit (Read error: Connection reset by peer) |
11:18:47 | * | ebx1000 joined #nim |
11:19:52 | c15ade4 | oh 0..^ worked |
11:33:28 | c15ade4 | no wait, that wrote it as a string lol |
11:36:02 | FromGitter | <alehander42> do you want to write an array of bytes |
11:38:57 | c15ade4 | yeah, I have array[32, byte] |
11:39:04 | c15ade4 | and want to write it to stdout |
11:44:26 | FromGitter | <alehander42> i think you can use streams module |
11:44:57 | FromGitter | <alehander42> get a stream with newFileStream(path, fmWrite) |
11:45:32 | FromGitter | <alehander42> and write with f.writeData(arr, count * <size of element>) |
11:45:38 | FromGitter | <alehander42> in your case size is 1 anyway |
11:46:43 | FromGitter | <tim-st> is there also a way to write array of chars to string without iterating each char? |
11:47:41 | FromGitter | <tim-st> like `proc add*(s: var string, data: openArray[char])`? |
11:51:26 | c15ade4 | it seems stream write does this |
11:51:30 | c15ade4 | thank you |
11:54:26 | FromGitter | <Clyybber> @tim-st I think you can cast the array to a string |
11:54:40 | FromGitter | <Clyybber> And then set the length |
11:55:22 | FromGitter | <tim-st> yes, but I have to create a new string first and cast to `result[0]` :\ |
11:59:03 | * | stefanos82 joined #nim |
12:01:42 | FromGitter | <Clyybber> Hmm, so you want to change it in place? |
12:02:39 | FromGitter | <tim-st> no I want to concat the charArray to the string without writing to much code |
12:02:55 | FromGitter | <tim-st> and still have best performance |
12:03:20 | FromGitter | <Clyybber> var somestring = caststring (addr somecharArray[0]) |
12:04:06 | FromGitter | <Clyybber> ```var somestring = caststring (addr someCharArray[0])``` |
12:04:13 | FromGitter | <Clyybber> this should do it i believe |
12:05:31 | FromGitter | <tim-st> so I would need to cast array[char] to string2 and then do strings1.add(string2) ? |
12:05:36 | FromGitter | <Clyybber> And I don't know if its really neccessary but afterwards do: ⏎ ```somestring.setLen(someCharArray.len)``` |
12:05:56 | FromGitter | <tim-st> currently I'm using this: https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 |
12:08:53 | FromGitter | <Clyybber> ```proc add*(s: var string, data: openArray[char]) = ⏎ s.add(cast[string](addr data[0]))``` [https://gitter.im/nim-lang/Nim?at=5b9e47d4f08bc22dfb65939c] |
12:09:02 | FromGitter | <Clyybber> i think this should do it |
12:09:11 | FromGitter | <Clyybber> nvrmind |
12:09:53 | FromGitter | <Clyybber> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e4810a56b215c974719fc] |
12:10:11 | FromGitter | <Clyybber> this shoud do it |
12:10:52 | FromGitter | <tim-st> it raises out of memory error |
12:11:13 | FromGitter | <tim-st> xD |
12:11:55 | FromGitter | <tim-st> https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 |
12:12:52 | FromGitter | <Clyybber> Oof |
12:12:58 | FromGitter | <Clyybber> Dont know why tho |
12:13:25 | FromGitter | <tim-st> hm, only on devel, on stable it raises `SIGSEGV: Illegal storage access. (Attempt to read from nil?) ⏎ ` |
12:13:28 | FromGitter | <alehander42> i think you need to cast to cstring? |
12:13:39 | FromGitter | <alehander42> i mean, string is not an array of chars |
12:13:45 | FromGitter | <tim-st> yes, but cstring is null terminated, not sure if it works |
12:14:07 | FromGitter | <tim-st> and I dont think that a cast makes this quicker than iterating each char? |
12:14:41 | FromGitter | <Clyybber> Ohh |
12:14:42 | FromGitter | <tim-st> @alehander42 yes, it works, thanks |
12:14:45 | FromGitter | <Clyybber> I know why |
12:15:54 | FromGitter | <alehander42> yeah I don't know how does it deal with non 0 terminated |
12:16:15 | FromGitter | <alehander42> i'd like to think openarrays add a `\0` by default but maybe it doesn't make sense |
12:16:19 | FromGitter | <data-man> @tim-st ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e4993fcba1254fac3b5f6] |
12:17:06 | FromGitter | <tim-st> thanks @data-man looks interesting |
12:17:07 | FromGitter | <dm1try> and some benchmarks pls |
12:17:12 | FromGitter | <dm1try> =) |
12:17:13 | FromGitter | <tim-st> this works: https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 |
12:17:27 | FromGitter | <tim-st> but not tested for empty openArray |
12:17:42 | FromGitter | <tim-st> well obviously it doesnt work for empty openArray |
12:18:05 | FromGitter | <tim-st> (my version) |
12:19:10 | * | ARCADIVS quit (Quit: WeeChat 2.0.1) |
12:20:43 | FromGitter | <tim-st> no, it doesnt work for const openArray :( |
12:20:56 | FromGitter | <tim-st> result = `abcdefusrToCell` |
12:21:29 | FromGitter | <tim-st> I think unsafeAddr should throw compiler error on const data |
12:22:59 | FromGitter | <tim-st> with `setLen` it works, but I think then iteration is quicker |
12:23:52 | FromGitter | <Clyybber> No it is not. |
12:24:03 | FromGitter | <data-man> Look at C code :) |
12:24:15 | FromGitter | <tim-st> tbh I'm not a c code expert :( |
12:24:22 | FromGitter | <Clyybber> One is O(1) the other is O(N) |
12:24:46 | FromGitter | <tim-st> @Clyybber the second also copies `N` chars |
12:25:04 | FromGitter | <tim-st> copying `N` chars sound very much like `O(N)` |
12:26:16 | FromGitter | <Clyybber> It is, but manually iterating over it is still slower |
12:26:54 | FromGitter | <tim-st> yes, probably, maybe somone code test and add the quicker version that works with var and const data to `system.nim` |
12:29:56 | FromGitter | <data-man> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e4cc38909f71f75e08bdc] |
12:32:18 | FromGitter | <tim-st> is that good? :D |
12:33:29 | FromGitter | <data-man> Yes. No loops. :) |
12:34:41 | FromGitter | <tim-st> ok, thanks! I think this version (with setLen) also has no loops: https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 |
12:36:38 | FromGitter | <tim-st> but I think your version is very good, would be nice to have it in stdlib I think |
12:39:38 | FromGitter | <data-man> My version for C/C++ target only. Your version works for JS. |
12:40:07 | FromGitter | <Vindaar> thanks to LemonBoy's awesome criterion: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ for shorter strings the difference becomes smaller [https://gitter.im/nim-lang/Nim?at=5b9e4f27e5c2cc56ad99cf32] |
12:40:20 | FromGitter | <dm1try> > ok, thanks! I think this version (with setLen) also has no loops: https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 ⏎ ⏎ sad story here: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e4f34d655361f7609d463] |
12:41:04 | FromGitter | <data-man> @tim-st Minor fix ```if likely(data.len > 0):``` :) |
12:41:30 | FromGitter | <dm1try> vs your first: `for c in data: s.add(c)` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e4f7a7dca3065030c1446] |
12:41:51 | FromGitter | <tim-st> @dm1try hahaha thanks, this is really sad |
12:42:39 | FromGitter | <tim-st> @Vindaar thanks for the comparision so @data-man 's version is much quicker |
12:42:55 | * | PrimHelios quit (Quit: Leaving) |
12:45:28 | FromGitter | <dm1try> > thanks to LemonBoy's awesome criterion ⏎ > @Vindaar thanks for the comparision ⏎ ⏎ +1 :) [https://gitter.im/nim-lang/Nim?at=5b9e50681ee2ca650224c5ae] |
12:53:29 | FromDiscord | <Shield> hey tim-st, did you try sending a file in chunks yet? i'm trying to do it, so far omitting the content-length keeps the browser waiting for more data, and you can keep sending it (you just send that raw data without any headers), but i'm having trouble making it stop, so far the browser keeps waiting for more data |
12:53:37 | FromGitter | <tim-st> @data-man what is the reason you used `moveMem` instead of `copyMem`? |
12:55:39 | FromGitter | <tim-st> Shield: no, not yet, If you want to send it in chunks I think you need to signalize to send in ranges: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests |
12:59:29 | * | stefanos82 quit (Quit: Quitting for now...) |
13:04:05 | FromGitter | <data-man> @tim-st Just a habit :) For movemem the destination and the source can be overlapped. For our case it doesn't matter. And copymem is a bit faster. |
13:05:23 | FromGitter | <tim-st> @data-man ok, thanks, so your example would be even fast with copyMem, I think that would be the perfect solution for stdib then :D |
13:05:26 | FromGitter | <data-man> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e5516b9531f2dfa759008] |
13:05:59 | FromGitter | <data-man> test3 with copymem |
13:05:59 | * | xet7 quit (Read error: Connection reset by peer) |
13:06:09 | FromGitter | <tim-st> ok, copymem is much faster (see cycles) |
13:06:30 | * | zachcarter joined #nim |
13:06:44 | FromGitter | <tim-st> no you changed the order^^ |
13:08:14 | FromGitter | <tim-st> Shield: also if the content is sent in ranges the main problem is still the same (of course it's better in ranges) but I dont need ranges my content that will be sent has max size and I add gzip compression |
13:13:00 | * | leorize quit (Quit: WeeChat 2.2) |
13:13:19 | * | leorize joined #nim |
13:13:57 | * | zachcarter quit (Ping timeout: 252 seconds) |
13:14:01 | FromDiscord | <Shield> yeah ranges seems to work with a plain text, it's time to test it with an image |
13:15:44 | FromDiscord | <Shield> btw, inserting a GC_fullCollect right after being done with a request does make the gc reuse that memory instead of allocating more, so far it cuts the memory usage by half |
13:17:36 | FromGitter | <data-man> @tim-st What about extracting the server's code from nim-zim to standalone app? |
13:25:28 | * | arecaceae quit (Remote host closed the connection) |
13:26:09 | * | arecaceae joined #nim |
13:30:36 | * | xet7 joined #nim |
13:31:01 | FromGitter | <tim-st> Shield: ok, good to hear |
13:31:16 | FromGitter | <tim-st> @data-man you mean something like a gui app, basically the same as kiwix? |
13:35:10 | * | SenasOzys quit (Ping timeout: 246 seconds) |
13:39:28 | * | SenasOzys joined #nim |
13:39:43 | FromGitter | <data-man> @tim-st Yes. Or some CLI tool like zim-tools. |
13:41:09 | FromGitter | <bung87> https://docs.python.org/2/library/itertools.html#itertools.combinations I have a HashSet I want to do this |
13:41:44 | * | FichteFoll16 joined #nim |
13:43:38 | FromGitter | <tim-st> @data-man Yes, maybe I will extend it, but I'm not very skilled with gui's ^^, if you want to add some code or fork or other things you're very welcome, atleast I wanted to add a zimwriterfs implementation because I want to build a zim file and there is no single version that works on windows :\ |
13:45:10 | FromGitter | <tim-st> for me the main purpose was feeding my nlp system with data and checking correctness |
13:45:20 | * | demotomohiro joined #nim |
13:46:58 | * | stefanos82 joined #nim |
13:47:47 | * | FichteFoll16 quit (Ping timeout: 240 seconds) |
13:55:54 | FromGitter | <data-man> @bung87 https://bitbucket.org/nimcontrib/nimcombinatorics Adapt it for your needs. |
13:57:17 | FromGitter | <data-man> @tim-st I don't use Windows :( ⏎ Or :) |
13:57:49 | FromGitter | <bung87> very nice! :) thanks |
14:06:59 | * | elrood quit (Quit: Leaving) |
14:11:25 | * | miran joined #nim |
14:13:28 | ng0 | I have a question about the folder 'compiler'. in my install procedure, using install.sh, it gets installed automatically to $out/compiler (and afterwards I move it).. reading the document about the internals I thought I need this, but Debian ships their nim build without 'compiler'. Is this just for development, new c_code? |
14:15:08 | dom96 | yeah, it's not important. You can install it via nimble too |
14:15:29 | FromGitter | <Bennyelg> How Do I iterate over untyped inside macro ? :| |
14:15:54 | TheLemonMan | Bennyelg, it depends on what kind of NimNode you have |
14:16:07 | ng0 | dom96: so removing it from $out will have no impact on existing applications and libaries I am building? |
14:16:17 | dom96 | indeed |
14:16:22 | federico3 | ng0: it's not used during application bulids |
14:16:22 | ng0 | just trying to understand the exact role of 'compiler' |
14:16:37 | federico3 | it's used during the build of the compiler itself |
14:16:56 | ng0 | ok. thanks dom96, federico3 |
14:16:56 | FromGitter | <Bennyelg> @TheLemonMan StmtList in example |
14:17:33 | TheLemonMan | BennyElg, then `for x in y` works just fine there |
14:18:56 | FromGitter | <Bennyelg> @TheLemonMan `false` Invalid node kind nnkProcDef for macros.`$ |
14:19:44 | FromGitter | <Bennyelg> pinging @juancarlospaco are you going to fix inim soon |
14:20:06 | FromGitter | <Bennyelg> ?* |
14:21:02 | TheLemonMan | with no context I can't help, check out the node content by using treeRepr |
14:26:20 | * | mosh\14 joined #nim |
14:26:31 | FromGitter | <Vindaar> @Bennyelg you're not just trying to `echo` the elements you iterate over, right? Because then you'd get that error ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ gotta e.g. replace that `echo y` by `echo y.repr`, if echoing is all you want to do [https://gitter.im/nim-lang/Nim?at=5b9e6817b4990c30eec37d01] |
14:29:01 | * | mosh\14 quit (Remote host closed the connection) |
14:35:29 | FromGitter | <tim-st> @data-man ok^^ when I have the time I will implement some features |
14:36:16 | FromGitter | <tim-st> I would really like to use linux but I cannot since the battery usage is only 1/3 on linux |
14:36:33 | FromGitter | <tim-st> (battery time) |
14:37:30 | TheLemonMan | that makes you more productive since you have to do more work in less time |
14:38:40 | FromGitter | <tim-st> no, it sets me under more preassure, more preassure -> more errors |
14:39:44 | TheLemonMan | carbon + pressure = diamonds, how comes tim-st + pressure = more errors? |
14:39:58 | * | nsf joined #nim |
14:40:29 | ng0 | seems like nimble, building outside of nim, needs 'compiler/': |
14:40:31 | ng0 | /tmp/guix-build-nimble-0.8.10.drv-0/nimble-0.8.10/src/nimblepkg/nimscriptsupport.nim(8, 11) Error: cannot open 'compiler/ast' |
14:40:34 | ng0 | compiler/ast, compiler/modules, compiler/passes, compiler/passaux, |
14:40:57 | ng0 | but when compiler/ exists, nim itself complains about duplicate module names |
14:44:56 | ng0 | since my build is not really canonical - the canonical way to build nimble is to checkout / copy its repository into the nim repository and build it from there, assuming from the standalone errors and the documentation |
15:02:54 | * | zachcarter joined #nim |
15:05:38 | ng0 | okay, got it. |
15:15:13 | FromGitter | <Bennyelg> @Vindaar thanks |
15:15:27 | FromGitter | <Bennyelg> @dom96 httpbeast not compile? ⏎ lib/system.nim(414, 10) Error: type mismatch: got <RawHeaders, nil> |
15:15:48 | dom96 | nimble install httpbeast@#head |
15:17:19 | FromGitter | <kungtotte> @bung87 casting to a uint8 array did the trick with my issue. Thanks for the help :) My code still doesn't work because it's reading a 0 where there shouldn't be a 0 in the file, but it's always something :P |
15:19:05 | FromGitter | <Bennyelg> I think I have a problem with devel :\ |
15:19:21 | FromGitter | <Bennyelg> this is not compile anymore ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9e747954587954f9af4967] |
15:20:21 | FromGitter | <bung87> @kungtotte good to know. |
15:21:10 | FromGitter | <kungtotte> It had to be uint8 though, when I tried it with a char I got ASCII characters in the output. |
15:21:13 | dom96 | Bennyelg: strings cannot be nil anymore |
15:21:22 | FromGitter | <Bennyelg> O so "" ? |
15:21:41 | FromGitter | <Bennyelg> thanks |
15:22:08 | FromGitter | <Bennyelg> Now it's jester ```/Users/benny/.nimble/pkgs/jester-0.4.0/jester.nim(82, 14) template/generic instantiation from here ⏎ lib/system.nim(414, 10) Error: type mismatch: got <RawHeaders, nil>``` |
15:22:32 | FromGitter | <bung87> ah, so you got `124` instead of `\x124` |
15:25:00 | dom96 | update jester too |
15:25:18 | FromGitter | <Bennyelg> done & worked thanks @dom96 |
15:26:21 | * | abm joined #nim |
15:38:36 | * | sagax quit (Ping timeout: 252 seconds) |
15:40:02 | * | edcragg quit (Quit: ZNC - http://znc.in) |
15:40:41 | * | edcragg joined #nim |
15:41:01 | * | Cthalupa quit (Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in) |
15:46:53 | * | Cthalupa joined #nim |
15:52:07 | * | ebx1000 quit (Quit: Leaving) |
15:52:21 | * | ebx1000 joined #nim |
15:54:05 | * | ebx1000 quit (Client Quit) |
15:56:16 | * | sagax joined #nim |
15:57:11 | * | ebx1000 joined #nim |
16:01:15 | FromGitter | <razuit> does anyone develop on OS X/macOS using Nim? |
16:03:50 | FromGitter | <bung87> ```code paste, see link``` ⏎ ⏎ how do I compare in simple way.. [https://gitter.im/nim-lang/Nim?at=5b9e7ee60cfe7f30f1a25f74] |
16:08:54 | * | ftsf quit (Ping timeout: 250 seconds) |
16:09:17 | FromGitter | <tim-st> the nim implementation for copying openArray to seq uses the slowest way: https://github.com/nim-lang/Nim/blob/0330fb2e1322e0b41d406cfbd42c34031b6bda83/lib/system.nim#L1516 |
16:09:34 | FromGitter | <tim-st> is this always safe (because of unsafeAddr)? https://gist.github.com/tim-st/baea83ad188d587b80a05bbd93d869a3 |
16:10:28 | * | brainproxy quit (Ping timeout: 245 seconds) |
16:11:52 | TheLemonMan | I guess |
16:12:32 | FromGitter | <tim-st> I heard that gc can free it before or something and that's because it's unsafe? |
16:14:09 | * | qenthus1ast joined #nim |
16:15:28 | TheLemonMan | eh? the gc doesn't free objects that are still alive (unless you hit a bug) |
16:16:31 | FromGitter | <tim-st> ok, thanks |
16:20:34 | * | zachcarter quit (Ping timeout: 240 seconds) |
16:25:45 | FromGitter | <data-man> @tim-st `T` type can have its own implementation of `=`, so the way is slowest but more correct, I think. |
16:27:06 | FromGitter | <tim-st> ok, so I'd need to check fist if `=` implementation is default for type `T` |
16:31:39 | FromGitter | <razuit> trying to compile the latest version of Nim from source, but I get this: ⏎ ⏎ ```but expected one of: ⏎ proc `==`(a, b: Port): bool`````` [https://gitter.im/nim-lang/Nim?at=5b9e856b54587954f9afa95c] |
16:34:43 | TheLemonMan | my fault (I guess?)... try changing the definition of TSa_family in lib/posix/posix_other.nim from `cuint16` to `cint` |
16:35:01 | * | qenthus1ast quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
16:35:18 | * | SenasOzys quit (Remote host closed the connection) |
16:36:01 | * | enthus1ast joined #nim |
16:37:59 | * | brainproxy joined #nim |
16:43:42 | * | SenasOzys joined #nim |
16:50:40 | * | SenasOzys quit (Remote host closed the connection) |
16:52:10 | dom96 | razuit: I do |
16:52:47 | FromGitter | <razuit> @dom96 what do you use for debugging Nim code? what’s your environment? |
16:53:01 | dom96 | I use VS code |
16:53:09 | dom96 | For debugging I just sprinkle echos around my code |
16:53:32 | FromGitter | <razuit> I see, so no debugger involved, no breakpoints |
16:56:22 | FromGitter | <razuit> TheLemonMan: that fixed it, thanks |
17:00:53 | AlexMax | Question, what's going on here? |
17:00:56 | AlexMax | https://paste.ee/p/XZ5pA |
17:01:36 | AlexMax | I _think_ I saw something where I needed to tag certain fp struct members and functions as pragma cdecl |
17:01:54 | AlexMax | But is that correct? |
17:02:08 | dom96 | razuit: yeah, I almost never use debuggers |
17:02:19 | AlexMax | I also noticed that --cdecl didn't tag _all_ function pointer types as cdecl |
17:02:27 | AlexMax | in c2nim |
17:02:39 | AlexMax | and actually, one of the structs didn't even convert over |
17:02:54 | AlexMax | I just saw the struct declaration, no definition |
17:03:09 | enthus1ast | i want to construct jester routes from different places (to let modules register jester routes) any idea how this could work out? The closest thing to what i want to achieve seems to be "router" but the issue i have is that i must `extend` the module routes in a main routes block. |
17:04:11 | AlexMax | Also, why do I need to tag function pointers as cdecl in the first place? Doesn't Nim basically compile functions to normal C functions? |
17:04:43 | AlexMax | Basically reusing the compiler's internal calling convention, which is usually cdecl? |
17:05:06 | enthus1ast | i thing it uses nimcall by default |
17:06:40 | AlexMax | I realize that pastebin leaves out the most important thing - the contents of the nimnuklear nim file |
17:07:33 | AlexMax | But yeah, I did a google search for the GCC error concerning ClE_0 and I found https://github.com/nim-lang/Nim/issues/8526 |
17:08:51 | AlexMax | Still doesn't answer why c2nim --cdel doesn't tag some fp's and functions as cdecl though. |
17:09:11 | AlexMax | But before I got into that nitty-gritty I thought I should check in here and see if I was even in the right ballpark |
17:09:17 | FromDiscord | <Shield> btw I managed to send a 320mb file with 150mb of ram only |
17:10:05 | * | SenasOzys joined #nim |
17:12:34 | * | demotomohiro quit (Quit: Leaving) |
17:14:48 | FromDiscord | <Shield> actually it only takes 20mb now and stable |
17:17:57 | * | elrood joined #nim |
17:28:47 | FromGitter | <Clyybber> @Araq @zah @TheLemonMan ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ test1 succeeds, test2 fails with type mismatch, got int but expected uint64 [https://gitter.im/nim-lang/Nim?at=5b9e92cfbe4f300626a24e0d] |
17:35:58 | ng0 | is there a native equivalent to python-qr already for nim? |
17:37:53 | federico3 | ng0: nimble search qrcode |
17:38:36 | federico3 | meh https://github.com/achesak/nim-qrcode uses a service :( |
17:38:39 | ng0 | yes, the only result there is not really something I'd use for this project. I was just checking how much I'd need to write |
17:39:07 | dom96 | enthus1ast: https://github.com/dom96/jester/blob/master/tests/alltest.nim#L30 |
17:39:34 | TheLemonMan | ng0, you can just use python-qr via nimpy if you just want to get up to speed |
17:40:55 | ng0 | my take is that I want to get rid of python in gnunet. new tests get to be no longer python, and we have this optional(?) 'gnunet-qr' part which uses python-qr and its dependency chain |
17:41:01 | enthus1ast | dom96: the problem i have then is that i must add an extends line for every module |
17:41:40 | dom96 | that's not much of a problem :P |
17:42:00 | enthus1ast | my goal is to load the modules at runtime :) |
17:42:12 | FromGitter | <Clyybber> TheLemonMan Do you have an idea why the above happens? |
17:42:19 | dom96 | Then use a custom router |
17:42:31 | dom96 | https://github.com/dom96/jester/blob/master/tests/example2.nim |
17:42:55 | dom96 | the `router` macro creates a proc similar to this |
17:43:06 | dom96 | you should be able to call it inside that proc depending on which you've loaded |
17:43:51 | ng0 | TheLemonMan: we have around 172 lines of python remaining, I think the biggest file is this small qr script. |
17:44:03 | * | thor77 left #nim ("Leaving") |
17:46:08 | federico3 | https://www.thonky.com/qr-code-tutorial/introduction that's quite a mess |
17:48:47 | ng0 | https://gnunet.org/git/gnunet.git/tree/src/util/gnunet-qr.py.in right now we use zbar, which depends on python-qr iirc. |
17:52:11 | TheLemonMan | Clyybber, the first sizeof resolves to an integer literal while the second doesn't |
17:52:43 | TheLemonMan | therefore the compiler is unable to silently convert an int into a uint64 |
17:52:58 | FromGitter | <Clyybber> Hmm, ok I shall report this then |
17:53:27 | TheLemonMan | not really, sizeof for objects is not constant-folded |
17:54:00 | TheLemonMan | and since sizeof and len both return `int` the error is correct |
17:54:00 | FromGitter | <Clyybber> Means? |
17:54:26 | FromGitter | <Clyybber> But it is an inconsistency, right? |
17:54:35 | FromGitter | <Clyybber> Which could be considered a bug? |
17:56:08 | FromGitter | <Clyybber> Why is sizeof for objects not constant-folded? |
17:56:43 | TheLemonMan | it's inconsistent because the compiler is smart, change the type to uint8 and the expression on the right into (sizeof(someNumbers[0]) * someNumbers.len * 100) and you'll see a similar error (coming from fitNode this time too) |
17:57:44 | TheLemonMan | see #5564 |
17:57:56 | TheLemonMan | well fuck, I meant #5664 |
17:58:23 | * | joselo joined #nim |
17:58:35 | TheLemonMan | ng0, the script is small because that qrcode lib is quite feature-packed heh |
17:58:43 | ng0 | yes |
17:59:24 | TheLemonMan | you can probably replace it with a shell script if you really want to get rid of it |
18:00:22 | FromGitter | <Clyybber> TheLemonMan Does that mean that sizeof(objecttype) is not available at compile time, while sizeof(int) is? |
18:00:37 | FromGitter | <Clyybber> If so would #5664 fix that? |
18:00:41 | * | joselo quit (K-Lined) |
18:01:48 | TheLemonMan | yes x2 |
18:01:55 | ng0 | TheLemonMan: I'd have to read more into what we do next time I have time for it. |
18:02:13 | ng0 | but you are probably right. |
18:02:40 | TheLemonMan | of course if you feel like writing a library for qrcode generation that'd be cool |
18:03:46 | ng0 | i feel like it, but first I want to get the nim integration done, which should be done next week or so. |
18:04:26 | ng0 | i have more than a couple of large projects, so it'd be shared time.. but fun project. |
18:05:47 | * | nsf quit (Quit: WeeChat 2.2) |
18:09:41 | enthus1ast | https://github.com/ricmoo/QRCode/blob/master/src/qrcode.c |
18:10:43 | ng0 | thanks |
18:11:54 | TheLemonMan | razuit, how did you manage to get that error? |
18:12:54 | FromGitter | <dm1try> ./koch tools ^ |
18:13:26 | FromGitter | <dm1try> reproducilble on Mac OS with on latest devel branch |
18:14:51 | * | Jesin quit (Quit: Leaving) |
18:16:15 | TheLemonMan | aha, the CI didn't catch it because the osx build is allowed to fail |
18:18:38 | * | Jesin joined #nim |
18:21:04 | * | enthus1ast quit (Ping timeout: 240 seconds) |
18:29:26 | * | aziz joined #nim |
18:43:38 | * | gartral3 joined #nim |
18:46:47 | * | aziz quit (Quit: Ex-Chat) |
18:49:15 | * | gartral3 quit (Ping timeout: 272 seconds) |
18:49:53 | * | miran quit (Ping timeout: 272 seconds) |
18:51:47 | * | miran joined #nim |
18:59:02 | FromGitter | <kayabaNerve> Just double checking, I can't read from stdin with async right? |
19:01:07 | * | sorressean11 joined #nim |
19:01:33 | * | lordheavy11 joined #nim |
19:02:15 | * | lordheavy11 quit (Remote host closed the connection) |
19:04:22 | FromDiscord | <Shield> i think you can only do it by spawning stdin.readLine() in a new thread |
19:08:30 | * | sorressean11 quit (Ping timeout: 252 seconds) |
19:15:46 | FromGitter | <kayabaNerve> But then you have to check the result in a while true loop which has the same issue |
19:20:55 | FromDiscord | <Shield> https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim |
19:21:43 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
19:22:03 | FromDiscord | <Shield> it has no issue |
19:24:30 | FromDiscord | <Shield> i don't think you can do it in another way, getting the file descriptor for stdin is tricky depending on the os, not sure tho |
19:25:37 | FromGitter | <Bennyelg> what do I miss? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9eae311ee2ca650226dc16] |
19:29:58 | FromGitter | <Vindaar> @Bennyelg you're only iterating the tree level below the `ProcDef`, so all you count is `Ident "testProcFirst" |
19:31:18 | FromGitter | <Vindaar> If you actually want to count `echo` you should probably only count `nnkCall` and check whether element 0 of that is the ident `echo`. But first you need to iterate over the `StmtList` (index 6 of `x` here). But you might wanna do that recursively |
19:31:32 | FromGitter | <Vindaar> check `treeRepr` of the input to get an idea |
19:32:40 | FromGitter | <Bennyelg> @Vindaar how do I iterate over StmtList ? |
19:32:59 | FromGitter | <Bennyelg> case e.kind ⏎ of nnkStmtList : then what? |
19:33:52 | FromGitter | <Vindaar> well, in principle in that case branch you just do `for a in e` |
19:34:32 | FromGitter | <Vindaar> but you might want to have some proc that does the traversal of one level for you, which you call whenever you want to go one level deeper.. |
19:34:58 | FromGitter | <Vindaar> (says inexperienced me :P) |
19:36:11 | FromGitter | <Vindaar> talking about something like this: https://github.com/Vindaar/nimhdf5/blob/master/src/nimhdf5/util.nim#L33-L53 |
19:37:00 | FromGitter | <bung87> what’s the purpose? these codes |
19:37:14 | FromGitter | <Bennyelg> practice ; |
19:37:19 | FromGitter | <Bennyelg> I am bad bad bad in procs |
19:37:24 | FromGitter | <Bennyelg> thanks @Vindaar |
19:37:25 | FromGitter | <bung87> ok |
19:37:51 | FromGitter | <Vindaar> no worries. It just takes a while to wrap ones head around it :) |
19:38:02 | FromGitter | <Bennyelg> I'll evnatually |
19:46:21 | * | smt_ joined #nim |
19:49:24 | * | smt quit (Ping timeout: 252 seconds) |
20:05:48 | * | LibrarianMage16 joined #nim |
20:06:24 | * | LibrarianMage16 quit (Remote host closed the connection) |
20:08:26 | FromDiscord | <Shield> how can I use opengl glGetString? it returns a ptr GLubyte which is a pointer to static string, how can I convert it to nim string? |
20:09:27 | * | dddddd quit (Remote host closed the connection) |
20:09:38 | FromGitter | <tim-st> is it zero terminated string or do you have the length of the string? |
20:10:22 | FromDiscord | <Shield> it doesn't have a length, so i guess it may be zero terminated |
20:10:40 | FromGitter | <tim-st> then cast ptr to ptr cstring |
20:11:46 | FromGitter | <tim-st> if you have length you would use copyMem: https://github.com/tim-st/nim-lmdb/blob/46abbfb8fcffee390ca0f230012fe7e1febd06ea/lmdb.nim#L46 |
20:13:10 | FromGitter | <tim-st> Shield: it's null terminated: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetString.xhtml |
20:15:49 | FromDiscord | <Shield> like this? var version = cast[ptr cstring](opengl.glGetString(GL_VERSION)) |
20:17:57 | FromGitter | <tim-st> `var s = castcstring (otherPtr)` I would try, or with ptr before cstring |
20:19:48 | FromDiscord | <Shield> it works, thanks! |
20:19:59 | FromGitter | <tim-st> nice |
20:20:17 | * | dddddd joined #nim |
20:20:44 | FromGitter | <tim-st> I still have not found a solution how to zero copy buffers with length to NimString :( |
20:23:12 | * | miran quit (Ping timeout: 252 seconds) |
20:25:43 | * | freeflying16 joined #nim |
20:29:47 | * | freeflying16 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
20:36:02 | * | SenasOzys quit (Remote host closed the connection) |
20:37:35 | * | SenasOzys joined #nim |
20:42:08 | * | zachcarter joined #nim |
21:03:07 | FromGitter | <Bennyelg> Where can I find any example using Channles on nim |
21:25:44 | * | Guest90010 joined #nim |
21:28:32 | * | Guest90010 quit (Remote host closed the connection) |
21:34:07 | FromGitter | <kayabaNerve> @Bennyelg Be the change you want to see |
21:38:41 | FromGitter | <Vindaar> https://github.com/nim-lang/Nim/pull/8611 |
21:38:44 | FromGitter | <Vindaar> ^ |
21:52:09 | * | MyMind joined #nim |
21:52:10 | * | Sembei quit (Ping timeout: 246 seconds) |
22:03:42 | * | Vladar quit (Remote host closed the connection) |
22:13:52 | * | ldlework is now known as ldlework[MIA] |
22:16:17 | * | kapil___ quit (Quit: Connection closed for inactivity) |
22:35:22 | * | sagax quit (Quit: Konversation terminated!) |
22:37:36 | * | qwertfisch is now known as hcsiftrewq |
22:51:07 | * | gangstacat quit (Ping timeout: 240 seconds) |
22:55:21 | * | gangstacat joined #nim |
22:56:26 | FromGitter | <drewp> https://gist.github.com/drewp/d299548fd28c9db22dc1c8f0b1cf8f8a main.nim(44, 14) Error: type expected ⏎ ?? |
22:57:18 | FromGitter | <drewp> newKnob returns Knob, which is a ref object type, and that's all good, right? |
22:58:07 | * | wildlander quit (Quit: Konversation terminated!) |
23:05:00 | * | gangstacat quit (Ping timeout: 252 seconds) |
23:06:40 | FromGitter | <dm1try> newKnob(37,38) ? |
23:06:57 | FromGitter | <dm1try> or newKnob(pin1 = 37, pin2 = 38) |
23:07:13 | FromGitter | <dm1try> https://nim-lang.org/docs/tut1.html#procedures-named-arguments |
23:13:05 | FromGitter | <drewp> oh wow, i was only looking at the left side. thanks |
23:13:07 | * | Jesin quit (Read error: Connection reset by peer) |
23:15:15 | * | Jesin joined #nim |
23:18:20 | FromGitter | <dm1try> actually I just remembered similar error; was doing the same thing - own constructor =) |
23:19:04 | FromGitter | <dm1try> and stumbled across the same problem with colon/equal sign |
23:28:37 | * | elrood quit (Quit: Leaving) |
23:29:09 | * | PI4GV15 joined #nim |
23:33:58 | * | PI4GV15 quit (Remote host closed the connection) |
23:43:28 | FromGitter | <drewp> https://gist.github.com/drewp/d299548fd28c9db22dc1c8f0b1cf8f8a (updated) main.nim(29, 5) Error: illegal capture 'result' |
23:44:30 | FromGitter | <drewp> i see some forum talk about that error, but not a workaround i understand, like https://forum.nim-lang.org/t/2653#16411 |
23:49:54 | FromDiscord | <awr> i've been thinking about maybe making an RFC for a `{.scopepush.}` pragma as an alternative to `{.push/pop.}` that implicitly pops when the scope is left. i remember if you forget to use `{.pop.}` for certain pragmas the compiler can get very fussy and give you weird non obvious error statemtns (or at least, it used to the last time i did that) |
23:54:36 | * | BlaXpirit joined #nim |
23:54:52 | * | oprypin quit (Ping timeout: 244 seconds) |
23:54:58 | * | BlaXpirit is now known as oprypin |