00:01:18 | FromGitter | <skilchen> @Quelklef do you mean "typesafe heterogeneous containter"? |
00:02:52 | FromGitter | <Quelklef> Sounds about right |
00:03:01 | FromGitter | <Quelklef> but particularly one with very little syntactic or conceptual overhead |
00:03:31 | FromGitter | <Quelklef> Google tells me that people want them in Java, and I'm sure that exists, but I can't imagine tersely... |
00:05:52 | FromGitter | <Quelklef> I wonder how close you could get with Nim... |
00:26:18 | * | dddddd quit (Remote host closed the connection) |
00:28:21 | * | icebattle quit (Quit: leaving) |
00:35:54 | * | CodeVance__ joined #nim |
00:37:45 | * | CodeVance_ quit (Ping timeout: 260 seconds) |
00:41:48 | * | find0x90 quit (Quit: find0x90) |
00:55:08 | * | nasusiro quit (Quit: Quitting for now...) |
01:07:58 | FromGitter | <Varriount> @Quelklef Well, term rewriting macros and converters could do the wrapping and unwrapping, however there's no way to generate the types behind the scenes. |
01:08:24 | FromGitter | <Varriount> (without a compiler plugin or using a macro to generate the types) |
01:10:34 | FromGitter | <kaushalmodi> @honewatson Thanks :) I'm just trying to unbreak that module on Nim devel. |
01:12:17 | FromGitter | <kayabaNerve> @Varriount Question if you're still on |
01:12:47 | FromGitter | <Varriount> @kayabaNerve Sure, what is it? |
01:13:02 | FromGitter | <kayabaNerve> Can I simplify `ptr cuchar (addr string[0])` |
01:13:12 | FromGitter | <kayabaNerve> *cast |
01:13:28 | FromGitter | <kayabaNerve> Mobile Gitter has this weird bug if you send from the middle of a message... |
01:13:38 | FromGitter | <kayabaNerve> Is it just addr string? |
01:14:00 | FromGitter | <kayabaNerve> Or does the Nim string have some... Padding? |
01:17:11 | FromGitter | <Varriount> @kayabaNerve *Don't* do `addr stringVar`. A Nim string has a header before the character data. |
01:17:23 | FromGitter | <Varriount> I would seriously just use a `cstring` conversion. |
01:21:05 | * | francisl joined #nim |
01:22:13 | * | CodeVance joined #nim |
01:23:27 | * | CodeVance__ quit (Ping timeout: 240 seconds) |
01:26:58 | FromGitter | <kayabaNerve> Via .cstring or cstring(var) ? |
01:27:37 | FromGitter | <kayabaNerve> And that's why I did [0]. ;P |
01:37:05 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
01:37:35 | * | btbytes joined #nim |
01:38:20 | * | skrylar joined #nim |
01:40:44 | FromGitter | <Varriount> If you really want, you can put the cast into a template. |
01:41:17 | FromGitter | <Varriount> Or create a converter that automatically converts a string to a `ptr cuchar` |
01:42:19 | * | btbytes quit (Ping timeout: 265 seconds) |
01:57:36 | * | CodeVance quit (Quit: Leaving) |
02:03:29 | FromGitter | <kayabaNerve> I don't think I use it that often |
02:04:19 | FromGitter | <kayabaNerve> Question though. How does cstring() work? Isn't that a binary cast which would fail with padding/ aheader? |
02:04:31 | FromGitter | <kayabaNerve> Is there an override of sorts? |
02:04:40 | FromGitter | <kayabaNerve> Tbh I really don't understand how Nim strings work |
02:12:16 | Tanger | kayabaMerve: Nim strings are a length and a pointer to a char array. When you cast a nim string to cstring, it just returns the pointer to the content of that string. Hence if you try read a nim string by pointer, you'll get the header data |
02:13:25 | FromGitter | <Varriount> @kayabaNerve Nim strings are defined here: https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L420 |
02:13:59 | FromGitter | <Quelklef> @Varriount That's kinda disappointing. Although (in theory) couldn't you have a `heterogenous_macro` macro that's used with a block i.e. `heterogenous_macro: \n code` so you wrap it around all of the code and it inserts types that way |
02:14:13 | FromGitter | <Quelklef> Like, it'd be used at the very very top-level of the file |
02:14:55 | FromGitter | <kayabaNerve> So my question is how does the cast just return the pointer? |
02:16:04 | FromGitter | <Varriount> @Quelklef You could do that too |
02:16:08 | FromGitter | <kayabaNerve> Also, after I use alloc, all I have to do is use dealloc, right? The manual is trippy. "This procedure is dangerous! If one forgets to free the memory a leak occurs;" Shouldn't it be forgetting to use dealloc is dangerous? |
02:16:37 | FromGitter | <Varriount> @kayabaNerve `cstring` is a kind of magic conversion that does `addr stringVar[0]` for you. |
02:16:45 | FromGitter | <kayabaNerve> No comment on whether I'm looking into this because I have a memory leak because I forgot to do dealloc... |
02:17:07 | FromGitter | <kayabaNerve> K. Magic. At this point, I'll take it. I was looking for an override in the compiler or a pragma, maybe a macro, but I'll take magic. |
02:17:10 | FromGitter | <kayabaNerve> If it works... |
02:17:33 | FromGitter | <Varriount> @kayabaNerve What do you mean? The pointer still points to the original string. `cstring(stringVar)` returns a pointer to `stringVar`'s data |
02:17:50 | FromGitter | <kayabaNerve> But how does cstring skip past the length? |
02:18:18 | FromGitter | <Varriount> It doesn't. A cstring has an implicit length of the null terminator. |
02:18:55 | FromGitter | <kayabaNerve> Wouldn't a binary cast, which is cstring IIRC, treat that length, which is before the char[], as a character? |
02:19:06 | FromGitter | <Varriount> No. |
02:19:42 | FromGitter | <kayabaNerve> I'm asking how it, in the cast, only handles a single element. Is the length after the null terminator? |
02:19:48 | FromGitter | <kayabaNerve> *single member |
02:21:59 | FromGitter | <Varriount> @kayabaNerve https://nim-lang.org/docs/system.html#[],openArray[T],BackwardsIndex_2 |
02:22:34 | FromGitter | <Varriount> `addr` accepts a `var T` |
02:25:55 | FromGitter | <kayabaNerve> I'm asking how the string cast only affects the char. You said it's an implicit [0]. I'm asking how. Is that in the compiler, a macro in system.nim, or what. ⏎ ⏎ At this point, I'm fine with not knowing though. |
02:26:26 | FromGitter | <kayabaNerve> I still have the question about dealloc. I only have to use dealloc, right? The manual is trippy. "This procedure is dangerous! If one forgets to free the memory a leak occurs;" Shouldn't it be forgetting to use dealloc/using malloc is dangerous? |
02:26:42 | FromGitter | <kayabaNerve> *only have to use dealloc in order to clear malloc'd memory |
02:27:12 | FromGitter | <Varriount> @kayabaNerve Are you allocating anything with the generic memory allocation functions? |
02:27:26 | FromGitter | <kayabaNerve> alloc0 |
02:28:20 | FromGitter | <Varriount> Yes, then you need to deallocate the memory. |
02:28:31 | FromGitter | <Varriount> What are you using alloc0 for? |
02:29:48 | FromGitter | <kayabaNerve> Pointers |
02:30:34 | FromGitter | <kayabaNerve> Seriously though, libsecp256k1, a C library, uses pointers over return values (returns a status code). |
02:30:41 | FromGitter | <kayabaNerve> I'm using pointers for compatibility with it. |
02:30:56 | FromGitter | <kayabaNerve> And I'm not asking if I need to use dealloc. I'm asking if I only have to use it. |
02:31:29 | FromGitter | <Varriount> Only if you're using alloc0 |
02:31:36 | FromGitter | <Varriount> What function are you calling? |
02:31:52 | FromGitter | <kayabaNerve> Because the manual says the proc to dealloc memory is dangerous, and not to forget to free the memory, making it seem like I must call free() or something, but that's not a function, and it sounds like forgetting to use dealloc is dangerous... |
02:32:10 | FromGitter | <Varriount> If you call alloc/alloc0, you must call dealloc |
02:32:26 | FromGitter | <Varriount> What function from that C library are you calling? |
02:32:38 | FromGitter | <kayabaNerve> https://github.com/kayabaNerve/Currency/blob/master/src/lib/SECP256K1Wrapper.nim |
02:33:36 | FromGitter | <kayabaNerve> That's my wrapper around the Status-im Nim wrapper. ⏎ ⏎ And I know I must call dealloc. I was checking there isn't a third function because the manual's phrasing is trippy. I'm all caught up now. |
02:34:03 | FromGitter | <kayabaNerve> secp256k1_ec_pubkey_create ⏎ secp256k1_ecdsa_sign ⏎ secp256k1_ecdsa_verify |
02:34:49 | FromGitter | <Varriount> Why not use GC-tracked memory? You can still get pointers from GC-tracked memory, as long as the C code isn't holding onto it after the function call. |
02:36:52 | FromGitter | <kayabaNerve> Because I'm comfortable with this? That shouldn't be the case though, and it sounds like a better solution. |
02:37:37 | FromGitter | <kayabaNerve> Do you just mean using ref? |
02:39:07 | * | gangstacat quit (Read error: Connection reset by peer) |
02:42:16 | FromGitter | <Varriount> Well, addr works on any variable, including variables that are tracked by the GC |
02:44:11 | FromGitter | <kayabaNerve> I just have no idea what you're talking about. Using ref instead of ptr or some functions or... |
02:44:21 | FromGitter | <Varriount> @kayabaNerve If you can wait a couple of hours, I can give an example. |
02:44:35 | FromGitter | <kayabaNerve> Or do you mean not using ptr and just using regular vars with addr before them 24/7 |
02:45:30 | FromGitter | <Varriount> Something like that |
02:46:14 | FromGitter | <kayabaNerve> Got it |
02:59:36 | skrylar | somehow manymuffins sounds like a dumb name for a multi-serialization kit |
03:33:01 | * | leorize quit (Ping timeout: 260 seconds) |
03:33:42 | * | leorize joined #nim |
03:36:15 | FromGitter | <Varriount> @kayabaNerve https://gist.github.com/Varriount/026c85b8f6bb99e1c280466b09a22edc |
03:37:04 | FromGitter | <Varriount> For C functions that return a pointer to memory they allocate, you can use a ref containing the opaque pointer, and use `new` to attach a finalizer to the pointer. |
03:39:03 | FromGitter | <Varriount> You can also do this in a similar way using objects and destructors, however that would give the context and scratch types object-like semantics (namely, they would be destroyed when the objects exit scope, so you would need to override the assignment operator to clone the context/scratch). |
03:43:53 | * | endragor joined #nim |
03:50:59 | * | smt` quit (Read error: Connection reset by peer) |
03:51:05 | * | smt joined #nim |
03:55:42 | * | skrylar quit (Remote host closed the connection) |
04:07:29 | * | data-man quit (Ping timeout: 248 seconds) |
04:11:57 | * | mitai42 quit (Ping timeout: 240 seconds) |
04:12:05 | * | cspar__ joined #nim |
04:13:53 | * | francisl quit (Ping timeout: 248 seconds) |
04:25:01 | * | NamPNQ joined #nim |
04:38:30 | * | fjvallarino quit (Remote host closed the connection) |
04:38:58 | * | fjvallarino joined #nim |
04:43:47 | * | fjvallarino quit (Ping timeout: 256 seconds) |
04:57:10 | * | miran joined #nim |
04:57:24 | * | cspar_ joined #nim |
05:01:02 | * | cspar__ quit (Ping timeout: 276 seconds) |
05:03:41 | * | xkapastel quit (Quit: Connection closed for inactivity) |
05:11:31 | * | fjvallarino joined #nim |
05:12:49 | * | Cthalupa joined #nim |
05:16:38 | * | lompik joined #nim |
05:24:11 | * | nsf joined #nim |
05:48:35 | * | zahary joined #nim |
05:56:52 | * | skrylar joined #nim |
06:00:29 | * | cspar_ quit (Ping timeout: 260 seconds) |
06:03:59 | * | cspar_ joined #nim |
06:08:10 | * | zahary quit (Quit: Leaving.) |
06:10:08 | * | gangstacat joined #nim |
06:18:52 | * | miran quit (Ping timeout: 260 seconds) |
06:19:35 | * | zahary joined #nim |
06:27:19 | * | skrylar quit (Remote host closed the connection) |
06:31:42 | * | leorize quit (Ping timeout: 260 seconds) |
06:32:19 | * | leorize joined #nim |
06:42:19 | * | smt` joined #nim |
06:46:05 | * | smt quit (Ping timeout: 240 seconds) |
06:51:38 | * | Cthalupa quit (Read error: Connection reset by peer) |
06:51:42 | * | Cthalupa- joined #nim |
07:10:57 | * | zahary quit (Quit: Leaving.) |
07:13:57 | * | gangstacat quit (Quit: Ĝis!) |
07:16:06 | * | cspar_ quit (Ping timeout: 260 seconds) |
07:16:46 | * | Vladar joined #nim |
07:17:56 | * | Zevv left #nim (#nim) |
08:04:24 | FromGitter | <kindlychung> Is there a nimble command for compile-on-change? |
08:04:42 | FromGitter | <kindlychung> Something like `sbt ~compile` in the scala world. |
08:18:29 | FromGitter | <kindlychung> Is there an `arcsinh` proc in nim's std lib? |
08:38:01 | leorize | kindlychung: nimble build? |
08:38:47 | FromGitter | <kindlychung> That doesn't watch the project folder for change, though. |
08:39:36 | leorize | you mean recompile whenever changes occur? shouldn't your editor be in charge of that? |
08:40:45 | FromGitter | <kindlychung> ok,that's also fine. how do you do that in vscode? |
08:41:47 | leorize | and `arcsinh` was recently added to git devel, not available on any release yet |
08:41:54 | leorize | https://github.com/nim-lang/Nim/pull/7893 |
08:42:19 | leorize | kindlychung: https://github.com/pragmagic/vscode-nim |
08:43:51 | leorize | I don't use vscode myself, but hopefully that does the trick |
08:45:40 | * | crem quit (Ping timeout: 245 seconds) |
08:46:10 | FromGitter | <kindlychung> @leorize yes, that works. |
08:48:01 | * | crem joined #nim |
08:51:49 | FromGitter | <kindlychung> Glad to see arcsinh in devel. Hopefully we will also get the likes of log1p, expm1. |
08:52:11 | * | Trustable joined #nim |
09:01:21 | * | dddddd joined #nim |
09:01:24 | * | rauss quit (Read error: Connection reset by peer) |
09:01:30 | * | crem quit (Read error: Connection reset by peer) |
09:03:24 | * | rauss joined #nim |
09:03:41 | * | crem joined #nim |
10:09:33 | FromGitter | <gogolxdong> How to make a closure in a template? |
10:12:03 | FromGitter | <kindlychung> @gogolxdong What are you trying to achieve? |
10:16:56 | FromGitter | <gogolxdong> make closure in template. |
10:22:50 | * | krux02 joined #nim |
10:36:42 | crem | wow, dicts in python are now ordered. |
10:42:55 | * | mal``` quit (Quit: Leaving) |
10:43:41 | leorize | gogolxdong: do it the same way as a function would |
10:44:37 | krux02 | crem, does that mean linear insertion time? |
10:47:05 | crem | Of course not, it's O(1) amortized. |
10:53:37 | * | nasusiro joined #nim |
10:54:03 | krux02 | crem: but an orderd set needs linear insertion time |
10:55:30 | * | NamPNQ quit (Remote host closed the connection) |
10:55:55 | * | mal`` joined #nim |
10:56:15 | * | elrood joined #nim |
10:56:16 | crem | Why? Depends on data structure. |
10:56:23 | * | gangstacat joined #nim |
10:59:31 | FromGitter | <gogolxdong> @leorize couldn't ,I have a macro with bindSym, want to call it in a template, but the value is runtime determinstic. |
10:59:59 | FromGitter | <gogolxdong> `````` |
11:00:04 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b361134d2abe466889469d3] |
11:00:49 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b361160ad21887018e8b2c7] |
11:08:34 | * | noonien joined #nim |
11:51:27 | FromGitter | <kaushalmodi> Is it possible to pack all the libraries (system, etc.) in the nim binary itself? That will allow me (and many) to spread the use of Nim "scripts". |
11:52:26 | FromGitter | <kaushalmodi> I can place just that single binary in a central project location. |
11:52:26 | * | aziz joined #nim |
11:52:30 | Yardanico | I don't really think this is possible... |
11:52:34 | Yardanico | but maybe someone knows more |
11:53:20 | FromGitter | <kindlychung> How do you get the smallest float64 value? |
11:53:21 | FromGitter | <kaushalmodi> Think how easy it would be ti get someone hooked to Nim.. |
11:53:57 | FromGitter | <kindlychung> Like golang, :-) |
11:54:01 | * | aziz quit (Client Quit) |
11:54:39 | FromGitter | <kaushalmodi> "how do I run this Nim code?" "Just run this binary" |
11:54:58 | FromGitter | <kindlychung> I am looking for something like this: https://en.cppreference.com/w/cpp/types/numeric_limits/min |
11:55:12 | Yardanico | there are some tools (at least for windows) which will allow you to pack a C compiler and all nim files into one binary |
11:55:14 | Yardanico | idk about linux |
11:55:27 | FromGitter | <ephja> folders are so ubiquitous though. it's already very convenient if there's no need to manually install third party libraries. I'm sure it could be made to work, but then what if you need to read files and/or add new ones that will be used by the application? |
11:55:43 | FromGitter | <kaushalmodi> Yeah.. I'm on Linux |
11:55:58 | FromGitter | <kaushalmodi> It doesn't have to ve distributed officially.. |
11:56:31 | FromGitter | <kaushalmodi> If someone can provide a recipe, i can at least start doing that at my work. |
11:56:34 | Yardanico | but this would be very hacky |
11:56:43 | Yardanico | why would you ever need one binary? this is not unix-way :DD |
11:56:48 | FromGitter | <ephja> I suppose you could first check some imaginary filesystem in the executable before checking the real filesystem when reading/writing :p |
11:57:22 | Yardanico | @kaushalmodi you can probably try to search for a tool which allows to pack directories/binaries into one binary |
11:58:11 | Yardanico | !eval low(float64) |
11:58:11 | NimBot | Compile failed: <no output> |
11:58:17 | Yardanico | !eval echo low(float64) |
11:58:19 | NimBot | -inf |
11:58:21 | Yardanico | @kindlychung ^ |
11:58:23 | Yardanico | :D |
11:58:29 | FromGitter | <kaushalmodi> Yardanico: I use Emacs. Function > Unix philosophy ;) |
11:58:42 | Yardanico | @kaushalmodi but I don't really think this would be useful, why? |
11:59:11 | Yardanico | what's the difference with having a directory or having one binary (of the same size)? |
11:59:25 | Yardanico | if it's a directory you can easily modify files in it |
11:59:35 | FromGitter | <ephja> do these mechanism increase the chances of triggering false positives in antiviruses? |
11:59:49 | FromGitter | <ephja> *mechanisms |
11:59:59 | Yardanico | sometimes they do, not always. and you can always report a false-positive to AV vendor |
12:00:37 | FromGitter | <ephja> yeah I'm not sure how useful it is, but an interesting approach nevertheless |
12:00:58 | Yardanico | there's enigma virtual box for windows which does exactly this |
12:00:59 | FromGitter | <survivorm> !eval echo (low(float64) + 1.0) |
12:01:01 | NimBot | -inf |
12:01:07 | FromGitter | <kaushalmodi> Yardanico: Committing a single binary file would create a lot less noise in the project |
12:01:17 | Yardanico | @kaushalmodi you want to commit a binary?! |
12:01:19 | FromGitter | <kindlychung> @Yardanico -inf is not so helpful, thought. |
12:01:27 | Yardanico | (and enigma virtual box is freeware) |
12:02:23 | FromGitter | <survivorm> @Yardanico !eval echo (low(float64) + 1.0) reminds me of the old joke with the highest number... |
12:02:39 | Yardanico | @kindlychung you can use https://nim-lang.org/docs/fenv.html |
12:02:52 | Yardanico | to get some max/min values for floats |
12:03:06 | FromGitter | <kaushalmodi> Yeah, I start with that. Once a tool becomes widely adopted, I can request the central CAD team to install something company wide. |
12:03:24 | Yardanico | @kaushalmodi why not just compile it? |
12:03:26 | Yardanico | your tool |
12:04:02 | FromGitter | <kaushalmodi> That won't help propagate Nim |
12:04:13 | Yardanico | but your way is hacky |
12:04:19 | FromGitter | <kaushalmodi> People using the tool are coders |
12:04:49 | Yardanico | you can also make a thread on the forum to discuss it :) |
12:04:59 | FromGitter | <kaushalmodi> They know bash, pythom, Perl, etc |
12:05:06 | FromGitter | <kaushalmodi> Ok |
12:05:30 | Yardanico | @kaushalmodi but it's bad to present a compiled language like a scripting one :) |
12:05:43 | Yardanico | because they're different and people may get confused with compilation/etc |
12:05:56 | Yardanico | but it's just my IMO |
12:06:43 | FromGitter | <kindlychung> @Yardanico there is a minimumPositiveValue, but not minimumValue. |
12:06:48 | * | gangstacat quit (Ping timeout: 256 seconds) |
12:07:21 | FromGitter | <kindlychung> Grabbed some test binary and did this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b3620f9a288503b3de9afd7] |
12:07:50 | Yardanico | what test binary? |
12:07:51 | FromGitter | <ephja> one problem with choosing some large value that isn't inf is that if the second operand of an arithmetic operation is close enough to zero then the value might not change at all |
12:08:17 | FromGitter | <kindlychung> @Yardanico from one of my toy projects. |
12:08:31 | Yardanico | @kindlychung nim loads some libs at runtime |
12:09:05 | FromGitter | <kindlychung> And that requires nim being installed on the target machine? |
12:09:06 | FromGitter | <ephja> but inf/-inf might still be useful when performing comparisons |
12:09:52 | FromGitter | <ephja> Yardanico: again, in-executable file systems, but then you need exotic loading mechanisms :p |
12:10:08 | Yardanico | @ephja we only need to find something like "enigma virtual box" for linux :) |
12:12:15 | FromGitter | <kindlychung> @Yardanico On linux you don't need such a thing, you have docker, which is probably way more powerful than enigma. |
12:12:17 | Yardanico | well, maybe something like flatpak |
12:12:29 | Yardanico | @kindlychung but @kaushalmodi wants to pack it into one binary |
12:13:01 | FromGitter | <kindlychung> Yeah, then you have snap, appimage, flatpak, etc. |
12:13:08 | FromGitter | <kindlychung> :-) |
12:13:21 | FromGitter | <kaushalmodi> Yardanico: Go is a compiled language too. But it's so convenient for anyone to download the binary and get going. I want to start doing that at least at my team/group level. |
12:13:33 | Yardanico | @kaushalmodi download what binary? |
12:13:44 | FromGitter | <kaushalmodi> Nim binary |
12:14:00 | Yardanico | I mean for Go |
12:14:52 | FromGitter | <kaushalmodi> Hmm, you're right.. it's a tar.gz |
12:15:09 | FromGitter | <kindlychung> @Yardanico golang compiles everything into a statically linked binary, and you can just deploy that one single file. |
12:15:17 | Yardanico | @kindlychung we're not talking about deploying :) |
12:15:38 | FromGitter | <kaushalmodi> @kindlychung Yes, not talking about deploying |
12:16:02 | FromGitter | <kaushalmodi> OK, later today, let me try the tar.gz approach |
12:16:32 | FromGitter | <kaushalmodi> Thanks :) |
12:19:23 | FromGitter | <kindlychung> Ah, that. I don't feel it's too much trouble to `curl https://nim-lang.org/choosenim/init.sh -sSf | sh` |
12:19:51 | FromGitter | <kindlychung> Actually, it looks awesome. |
12:20:42 | FromGitter | <kaushalmodi> @kindlychung yeah.. I discussed that few times before, my OS RHEL 6.6 (rather the glibc) is too old for that. |
12:22:38 | FromGitter | <kindlychung> i see. |
12:23:09 | FromGitter | <ephja> it would be nice to have the ability to pass var literals. I'm not sure you can avoid declaring a local var first with a template. then there's the situation when you might want to provide a default var argument |
12:26:25 | FromGitter | <ephja> I dunno, maybe there's a proposed feature that will simplify this pattern |
12:35:29 | FromGitter | <ephja> I'm just trying to create the equivalent of seq[T] for manually managed memory. arrays have a length, but the length is specified at compile time. has anyone gone down this road? |
12:38:59 | * | data-man joined #nim |
13:04:27 | * | cspar_ joined #nim |
13:07:53 | * | francisl joined #nim |
13:10:00 | * | gangstacat joined #nim |
13:11:48 | nasusiro | time to think out loud: so...Nim's let is for instance C++'s const whereas Nim's const is C++'s constexp? |
13:14:06 | Yardanico | well, probably. I also think that Nim's logic for var/let/const is one of the best (not like in JS for instance) |
13:14:24 | Yardanico | var - runtime/mutable, let - runtime/immutable, const - compile-time/immutable |
13:14:28 | nasusiro | Yardanico: yeah, for sure. this is something I have noticed |
13:14:45 | Yardanico | (of course let variables can be actually modified with unsafe features, but that's up to the programmer) |
13:14:47 | nasusiro | the use of var is makes perfectly sense; var as of "variable" |
13:15:48 | * | gangstacat quit (Ping timeout: 256 seconds) |
13:15:55 | FromGitter | <ephja> I guess write tracking covers some of the limitations associated with the immutability model |
13:16:02 | * | awal is now known as afk |
13:16:10 | * | afk is now known as awal |
13:16:10 | * | gangstacat joined #nim |
13:17:40 | nasusiro | so far, Nim has impressed me a lot! |
13:23:27 | nasusiro | question: I'm here https://nim-lang.org/docs/nep1.html and there is no way to go to https://nim-lang.org/documentation.html |
13:23:30 | nasusiro | is this behavior normal? |
13:24:26 | Yardanico | there's no way to get back to https://nim-lang.org/documentation.html from any doc page |
13:24:29 | Yardanico | afaik |
13:24:45 | * | gangstacat quit (Ping timeout: 256 seconds) |
13:25:05 | * | gangstacat joined #nim |
13:28:22 | * | fjvallarino quit (Remote host closed the connection) |
13:28:29 | * | fjvallarino joined #nim |
13:32:52 | * | cspar_ quit (Ping timeout: 260 seconds) |
13:33:23 | * | endragor quit (Remote host closed the connection) |
13:33:52 | * | endragor joined #nim |
13:35:44 | federico3 | that should be fixed |
13:38:28 | FromGitter | <kaushalmodi> I think that the doc home page and TheIndex should be linked from every page. |
13:38:40 | * | endragor quit (Ping timeout: 268 seconds) |
13:40:30 | FromGitter | <kaushalmodi> On a related note, the JavaScript? based search.. the search box in left doesn't work on locally built web docs (koch web). Is that right? |
13:41:27 | * | fvs left #nim ("ERC (IRC client for Emacs 25.3.1)") |
13:41:47 | FromGitter | <Vindaar> @kaushalmodi yeah, that search doesn't work for me locally either |
13:47:10 | FromGitter | <kaushalmodi> Question/suggestion about nim module documentation.. How do people edit the documentation in the Nim comments? |
13:47:18 | Yardanico | nim comments? |
13:47:20 | FromGitter | <kaushalmodi> Look at the extensive documentation in https://github.com/kaushalmodi/strfmt/blob/master/strfmt.nim |
13:47:31 | Yardanico | well, you just write it in .nim file |
13:47:43 | FromGitter | <kaushalmodi> but I lose all the syntax highlighting for rst |
13:47:55 | FromGitter | <Araq> you can also use .. include:: details.rst |
13:48:07 | FromGitter | <kaushalmodi> ah, yes.. that's what I was looking for |
13:48:09 | FromGitter | <Araq> the pegs module does that, kind of, take a look |
13:48:13 | FromGitter | <kaushalmodi> Thanks |
13:48:41 | FromGitter | <Araq> but RST was designed to not need syntax highlighting :-) |
13:48:44 | FromGitter | <kaushalmodi> While I am brushing up that strfmt module, I am trying to come up with some convenience documentation guidelines |
13:48:59 | FromGitter | <kaushalmodi> Well, Emacs shows if I did the markup correctly |
13:49:15 | FromGitter | <kaushalmodi> and all the other major mode commands |
13:49:37 | FromGitter | <kaushalmodi> I am thinking of having the module documentation source in Org mode |
13:49:45 | FromGitter | <Araq> in fact, Nim comments are always in RST, so a better highlighter can just go head and look at the comments |
13:49:48 | FromGitter | <kaushalmodi> then have a nimble task to run pandoc to convert that to rst |
13:49:54 | FromGitter | <kaushalmodi> and then include that rst in the module header |
13:50:38 | FromGitter | <Araq> I don't like "pandoc" or any external tool fwiw, IMO Nim's documentation generator should just be improved to support whatever feature you need |
13:51:03 | FromGitter | <kaushalmodi> It's going to be difficult to support Org mode |
13:51:24 | FromGitter | <Araq> well or use the json output and proceed from there |
13:51:52 | FromGitter | <kaushalmodi> I didn't follow |
13:52:10 | FromGitter | <kaushalmodi> I am not talking of parsing the .nim file |
13:52:50 | Yardanico | @Araq - @kaushalmodi wants to write documentation in Org mode, which is some special emacs syntax |
13:53:12 | FromGitter | <kaushalmodi> Instead have the "main documentation" (not doc strings) for a module live in Org format in a separate file, then "somehow" (pandoc) convert that to rst so that that can be included in the .nim header for `nim doc`. |
13:53:50 | FromGitter | <kaushalmodi> Not special Emacs syntax.. but Emacs support Org mode document edit *really* convenient |
13:54:24 | FromGitter | <kaushalmodi> The Org docs are plain text.. can be editted in any editor like Markdown or rst |
13:54:54 | Yardanico | rst is plain text too :P |
13:55:08 | FromGitter | <kaushalmodi> that's what I said |
13:56:08 | * | cspar_ joined #nim |
13:59:05 | * | nuknown quit (Ping timeout: 240 seconds) |
13:59:38 | FromGitter | <kaushalmodi> Just curious.. why do the peg docs in rst format have a .txt extension? |
14:00:17 | FromGitter | <kaushalmodi> turns out all docs in doc/ have .txt extension |
14:00:20 | FromGitter | <kaushalmodi> ? |
14:01:58 | FromGitter | <Araq> because originally the point of RST was to be a spec for how to write .txt files |
14:02:18 | FromGitter | <Araq> and then programmers took over and invented .rst, missing the point, as usual. |
14:02:34 | FromGitter | <Araq> :P |
14:06:23 | FromGitter | <kaushalmodi> That at least fails auto-detection of major mode in Emacs.. not a big deal. I was curious if the .txt extension was special for nim doc |
14:13:07 | FromGitter | <kaushalmodi> Is there a nice trick to grab a nimble package's version from its .nimble file when generating docs? |
14:13:43 | FromGitter | <kaushalmodi> A the moment, I see that the version has to be manually updated in the .nimble and the rst docs comments |
14:14:05 | FromGitter | <krux02> I would like to have an official name to reference symbols in documentation string |
14:14:12 | nasusiro | -_- I have been trying for whole 5 minutes to stop my Vim from behaving weirdly...what was the catch? a file named .vim instead of .nim |
14:14:16 | nasusiro | argh |
14:14:48 | FromGitter | <krux02> I like in in emacs lisp that I can reference functions in the documentation string and they become hyper links in the help text. |
14:15:43 | FromGitter | <kaushalmodi> @krux02 Oh yeah.. miss that. I got a bit close to that with devdocs integration |
14:16:05 | FromGitter | <krux02> did you do devdocs integration? |
14:16:12 | FromGitter | <kaushalmodi> https://scripter.co/accessing-devdocs-from-emacs/ |
14:16:19 | FromGitter | <krux02> the problem is that function symbols are not unique by name |
14:16:33 | FromGitter | <krux02> at least no in nim |
14:16:45 | FromGitter | <kaushalmodi> well, devdocs will work only for the stable releases and only for the std libs |
14:18:00 | FromGitter | <kaushalmodi> I have a binding "??".. when I do that on code with "strutils", it gives me this |
14:18:07 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/iNEE/image.png) |
14:18:28 | FromGitter | <kaushalmodi> then I can further filter down that list, hit enter, and the docs for that pop up in browser |
14:19:32 | FromGitter | <krux02> @kaushalmodi that certainly looks cool |
14:19:36 | FromGitter | <krux02> I am interested |
14:19:48 | FromGitter | <krux02> I am constantly looking up documentation |
14:19:57 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/s6UL/image.png) |
14:20:34 | FromGitter | <krux02> what is the completion engine? |
14:20:50 | FromGitter | <kaushalmodi> ivy/counsel |
14:21:08 | FromGitter | <krux02> I use help |
14:21:09 | FromGitter | <krux02> helm |
14:21:15 | FromGitter | <kaushalmodi> that should work too |
14:21:29 | FromGitter | <krux02> ok |
14:21:31 | FromGitter | <kaushalmodi> I remembered that I have a GIF of this in action |
14:21:36 | FromGitter | <ephja> how do I get a backtrace following a segfault in a callback executed in a foreign thread? |
14:21:42 | FromGitter | <kaushalmodi> scroll to the bottom of that blogpost I linked above |
14:23:51 | FromGitter | <ephja> I'm trying to catch Exception in various places |
14:31:54 | FromGitter | <krux02> @ephja have you tried using a debugger? |
14:35:55 | * | miran joined #nim |
14:37:53 | FromGitter | <kaushalmodi> I see `` `foo` `` being used everywhere in doc strings to produce italics, but the rst spec doesn't use that markup.. it uses `*foo*` instead, like markdown. |
14:38:02 | FromGitter | <kaushalmodi> http://docutils.sourceforge.net/docs/user/rst/quickstart.html |
14:38:39 | FromGitter | <kaushalmodi> .. so pandoc fails at italicizing the `` `foo` ``.. where is this docstring markup spec? |
14:38:46 | FromGitter | <krux02> well I use `sym` always to reference symbols |
14:39:06 | FromGitter | <kaushalmodi> can you provide a quick link |
14:39:08 | FromGitter | <krux02> `` `sym` `` |
14:39:22 | FromGitter | <krux02> well, I have to search for it |
14:39:25 | FromGitter | <kaushalmodi> yeah.. they actually get italicized by `nim doc` |
14:39:38 | FromGitter | <kaushalmodi> for syms, it is actually ``` ``sym`` ``` |
14:39:52 | FromGitter | <kaushalmodi> See this: https://lyro.bitbucket.io/strfmt/ |
14:40:16 | FromGitter | <kaushalmodi> See how the *format* gets italicized.. ``1. the `format` functions to render a single value as a string,`` |
14:40:20 | FromGitter | <krux02> https://github.com/nim-lang/Nim/blob/master/lib/pure/algorithm.nim#L460 |
14:40:39 | FromGitter | <krux02> you are right it is ``sym`` |
14:40:43 | FromGitter | <kaushalmodi> hehe |
14:40:43 | FromGitter | <krux02> gitter |
14:40:56 | FromGitter | <kaushalmodi> you need to do ```` ``` ``sym`` ``` ```` |
14:41:03 | FromGitter | <kaushalmodi> it's plain markdown |
14:41:10 | FromGitter | <krux02> ``` ``sym`` ``` |
14:41:13 | FromGitter | <krux02> yay |
14:41:16 | FromGitter | <kaushalmodi> if you want to print `` ` ``, wrap it with n+1 quotes |
14:41:31 | FromGitter | <krux02> ```````` ```````sym``````` ```````` |
14:41:40 | FromGitter | <krux02> hmm, yea |
14:41:53 | FromGitter | <kaushalmodi> need to separate the beginning/ending backticks with space |
14:42:18 | FromGitter | <krux02> I know I used 8 backticks for that one |
14:42:24 | FromGitter | <kaushalmodi> So to print https://gitter.im/nim-lang/Nim?at=5b3644f86ceffe4eba3e022b, I did ````` ```` ``` ``sym`` ``` ```` ````` :P |
14:42:43 | FromGitter | <kaushalmodi> guess what I did to print above ^ :P |
14:43:05 | * | cryptocat1094 joined #nim |
14:43:06 | FromGitter | <ephja> @krux02 I have. I call system.alloc (manual memory allocation), and then it ends up in gc.nim followed by alloc.nim and then it crashes here "removeChunkFromMatrix2_NyesLqu7hqkgfLqcLrQpjw (a=0x7fffee6c4350, b=0x7ffff7e5b000, fl=12, sl=13) at /home/e/abs/nim-git/src/Nim/lib/system/alloc.nim:209". I have no idea why it takes this path |
14:43:17 | FromGitter | <krux02> `````` ````` ```` ``` ``sym`` ``` ```` ````` `````` |
14:47:49 | FromGitter | <krux02> @ephja what line does it crash there and what are the values of the local variables |
14:47:53 | FromGitter | <Araq> @ephja well allocation removes a chunk and would return it to you |
14:48:00 | FromGitter | <Araq> and fails. |
14:51:05 | FromGitter | <krux02> sorry you did provide the local variables |
14:51:37 | * | natrys joined #nim |
14:52:15 | * | mitai42 joined #nim |
14:57:14 | FromGitter | <ephja> https://gist.github.com/ephja/07e7255941a15b971194818ec2471680 the requested size seems about right and it's not large |
14:57:41 | FromGitter | <ephja> all that's missing is the relevant code |
15:01:38 | FromGitter | <Araq> you are calling alloc from the wrong thread |
15:01:44 | FromGitter | <Araq> a thread not under Nim's control. |
15:01:45 | * | endragor joined #nim |
15:01:52 | FromGitter | <Araq> try allocShared() etc |
15:02:10 | FromGitter | <Araq> alloc() is as thread-local as new() is. |
15:03:55 | * | zama quit (Ping timeout: 256 seconds) |
15:04:53 | * | zama joined #nim |
15:05:18 | FromGitter | <enormandeau> Hi. New to Nim. I'm trying to solve TSP. I expect many "learning opportunities" since I haven't done anything but very basic stuff in Nim following 2-3 tutorials. |
15:05:42 | FromGitter | <enormandeau> I'd like to allocate a sequence of size two arrays. Here is what I do : |
15:05:51 | FromGitter | <enormandeau> ```var random_points: seq[array[float, float]] = @[]``` |
15:06:13 | FromGitter | <enormandeau> I get a `Error: ordinal type expected` and I don't know what to change |
15:07:55 | FromGitter | <Araq> array[2, float] |
15:07:57 | FromGitter | <enormandeau> BTW, is it better to ask here or on the forum? I saw that there were more messages here... |
15:08:14 | FromGitter | <Araq> offtopic, but interesting for everybody: https://techxplore.com/news/2018-06-breakthrough-algorithm-exponentially-faster-previous.html |
15:08:39 | FromGitter | <ephja> I changed it and now I see alloc.allocShared in the stacktrace but it still crashes in the same location |
15:09:52 | FromGitter | <Araq> @enormandeau it's fine either way. you'll get feedback much faster here. |
15:11:56 | FromGitter | <ephja> #0 removeChunkFromMatrix2_NyesLqu7hqkgfLqcLrQpjw (a=0x555555788420 <sharedHeap_R3bhvQCN0d6AYpkvxfT9aGw>, b=0x7ffff7ec8000, fl=12, sl=22) at /home/e/abs/nim-git/src/Nim/lib/system/alloc.nim:209 🤔 |
15:12:36 | FromGitter | <enormandeau> thanks @Araq |
15:17:46 | FromGitter | <ephja> I'll step through everything later |
15:18:16 | FromGitter | <Araq> fl=12, sl=22 looks like a pretty big block |
15:18:50 | FromGitter | <enormandeau> I'd like to update two sequences, one empty and one with elements, such as the first 3 elements go from the non-empty one to the empty one. The non-empty one then has 3 less elements. I was thinking about something similar as `lst.pop()` in Python. Is there something similar or do I have to do 2 operations (copy then remove)? |
15:19:40 | FromGitter | <ephja> oh ok. I just looked at the obvious length parameters |
15:20:53 | FromGitter | <enormandeau> Right now, I'm doing : ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b364e55be98b1422413fa65] |
15:20:59 | FromGitter | <enormandeau> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b364e5bad21887018e96895] |
15:21:22 | FromGitter | <narimiran> @enormandeau well, there is https://nim-lang.org/docs/system.html#pop,seq[T] for popping the last element |
15:22:30 | FromGitter | <enormandeau> I would like : ⏎ ⏎ ```var solution: seq[array[2 float]] = random_points.pop(0..2)``` [https://gitter.im/nim-lang/Nim?at=5b364eb672b31d3691fe8ae5] |
15:23:23 | FromGitter | <narimiran> can you change the order of `random_points` so the wanted elements are the last three? |
15:23:48 | FromGitter | <enormandeau> In this case, yes, I could easily |
15:23:56 | FromGitter | <ephja> "castptr UncheckedArray[T (allocShared(T.sizeof * len))" -> "allocShared_sVm4rDImKK2ZDdylByayiA_4 (size=171188)" |
15:24:04 | FromGitter | <enormandeau> Since these are random, the order doesn't matter. |
15:24:31 | FromGitter | <narimiran> @enormandeau then you can loop `pop`three times and that's it, no? |
15:24:33 | FromGitter | <ephja> not that I have much of a need for UncheckedArray. the buffer is encapsulated in a type |
15:25:05 | FromGitter | <enormandeau> @narimiran Yes, but I don't feel like that solves the problem neatly. For the rest of the algo, I will use this though. |
15:27:43 | * | endragor quit (Remote host closed the connection) |
15:27:50 | FromGitter | <enormandeau> Is there something more idiomatic then : ⏎ ⏎ ```while some_sequence.len > 0: ⏎ value = some_sequence.pop() ⏎ # do something``` [https://gitter.im/nim-lang/Nim?at=5b364ff66ceffe4eba3e21c9] |
15:29:33 | FromGitter | <narimiran> if i understood you intentions correctly, my first thought was this: http://ix.io/1foB |
15:30:59 | FromGitter | <Quelklef> Just write your own `proc popT (s: seq[T], r: range[int]): void` proc |
15:32:43 | * | floppydh quit (Remote host closed the connection) |
15:32:59 | FromGitter | <Quelklef> ```code paste, see link``` ⏎ ⏎ should work, I think [https://gitter.im/nim-lang/Nim?at=5b36512baeb8fa0c074d5f7d] |
15:33:37 | * | floppydh joined #nim |
15:34:26 | FromGitter | <Quelklef> by the way, anyone, any chance that a `times` template will make it into the stdlib? For e.g. `10.times: echo("!")` |
15:34:48 | FromGitter | <Quelklef> It's trivial to write myself, but feels like it should be default |
15:35:30 | FromGitter | <ephja> no I think I do want UncheckedArray. I think it should be used in bindings when the pointee is a buffer rather than a single value. "ptr array[size, T]" is sometimes applicable, but if "size" is big enough then it won't be accepted by GCC |
15:36:51 | FromGitter | <enormandeau> @Quelklef How do you pass a `range`? I tried to call with `pop(my_seq, 0..2)` and got `Error: range expected` |
15:37:59 | FromGitter | <ephja> I dunno if the backend can generate large enough C array types even if they are not allocated on the stack |
15:38:10 | FromGitter | <enormandeau> Actualy, it is the proc declaration that trips the compiler |
15:40:42 | FromGitter | <Quelklef> @enormandeau Ah, `..` is an iterator, not a proc, so it doesn't make a range. |
15:40:45 | FromGitter | <Araq> r: Slice[int] # confusing, I know |
15:41:01 | FromGitter | <Quelklef> ah, shook. Thanks Araq |
15:47:30 | * | francisl quit (Quit: francisl) |
16:00:31 | * | dada78641 quit (Ping timeout: 255 seconds) |
16:01:45 | * | Entropic quit (Ping timeout: 260 seconds) |
16:02:32 | * | floppydh quit (Ping timeout: 256 seconds) |
16:05:32 | * | Entropic joined #nim |
16:07:20 | * | dada78641 joined #nim |
16:09:45 | * | Calinou quit (*.net *.split) |
16:09:54 | * | xomachine[m] quit (*.net *.split) |
16:09:54 | * | gh0st[m] quit (*.net *.split) |
16:09:54 | * | yglukhov quit (*.net *.split) |
16:09:54 | * | federico3[m] quit (*.net *.split) |
16:12:42 | * | floppydh joined #nim |
16:12:57 | * | nif quit (Ping timeout: 240 seconds) |
16:14:08 | * | Calinou joined #nim |
16:14:08 | * | xomachine[m] joined #nim |
16:14:08 | * | yglukhov joined #nim |
16:14:08 | * | gh0st[m] joined #nim |
16:14:08 | * | federico3[m] joined #nim |
16:14:58 | * | nif joined #nim |
16:17:44 | * | nkaramolegos[m] quit (Ping timeout: 245 seconds) |
16:17:44 | * | hitchhooker[m] quit (Ping timeout: 245 seconds) |
16:17:44 | * | pqflx3[m] quit (Ping timeout: 245 seconds) |
16:17:45 | * | Jipok[m] quit (Ping timeout: 245 seconds) |
16:17:45 | * | zielmicha[m] quit (Ping timeout: 245 seconds) |
16:17:45 | * | solitudesf quit (Ping timeout: 245 seconds) |
16:17:47 | * | tyrion[m] quit (Ping timeout: 245 seconds) |
16:17:47 | * | notdekka[m] quit (Ping timeout: 245 seconds) |
16:17:47 | * | libman[m] quit (Ping timeout: 245 seconds) |
16:17:49 | * | planetis[m] quit (Ping timeout: 240 seconds) |
16:17:49 | * | endes[m] quit (Ping timeout: 240 seconds) |
16:17:51 | * | hohlerde quit (Ping timeout: 240 seconds) |
16:17:51 | * | macsek1911[m] quit (Ping timeout: 240 seconds) |
16:17:53 | * | dyce[m] quit (Ping timeout: 240 seconds) |
16:17:53 | * | xomachine[m] quit (Ping timeout: 240 seconds) |
16:17:53 | * | gh0st[m] quit (Ping timeout: 240 seconds) |
16:17:53 | * | yglukhov quit (Ping timeout: 240 seconds) |
16:17:53 | * | federico3[m] quit (Ping timeout: 240 seconds) |
16:17:57 | * | byteflame quit (Ping timeout: 260 seconds) |
16:18:00 | * | sendell[m] quit (Ping timeout: 255 seconds) |
16:18:01 | * | Demos[m] quit (Ping timeout: 255 seconds) |
16:18:01 | * | Abnegation quit (Ping timeout: 255 seconds) |
16:18:09 | * | narimiran[m] quit (Ping timeout: 247 seconds) |
16:18:09 | * | marszym[m] quit (Ping timeout: 247 seconds) |
16:18:09 | * | Miguelngel[m] quit (Ping timeout: 247 seconds) |
16:18:10 | * | unclechu quit (Ping timeout: 281 seconds) |
16:18:10 | * | petersjt014[m] quit (Ping timeout: 256 seconds) |
16:18:10 | * | TheManiac quit (Ping timeout: 256 seconds) |
16:18:10 | * | carterza[m] quit (Ping timeout: 256 seconds) |
16:18:10 | * | sg-james[m] quit (Ping timeout: 256 seconds) |
16:18:50 | * | sroecker[m] quit (Ping timeout: 256 seconds) |
16:20:25 | * | pigmej quit (Ping timeout: 260 seconds) |
16:22:25 | * | pigmej joined #nim |
16:27:25 | Yardanico | matrix bridge down YET again, yay! |
16:30:23 | * | ashleyk quit (Ping timeout: 250 seconds) |
16:40:07 | * | ashleyk joined #nim |
16:43:09 | * | NimBot joined #nim |
16:51:48 | * | floppydh quit (Quit: WeeChat 2.1) |
16:54:54 | * | brainproxy joined #nim |
17:01:37 | * | pqflx3[m] joined #nim |
17:17:01 | * | hitchhooker[m] joined #nim |
17:17:01 | * | federico3[m] joined #nim |
17:17:02 | * | Miguelngel[m] joined #nim |
17:17:02 | * | nkaramolegos[m] joined #nim |
17:17:03 | * | dyce[m] joined #nim |
17:17:03 | * | Abnegation joined #nim |
17:17:03 | * | yglukhov joined #nim |
17:17:03 | * | unclechu joined #nim |
17:17:03 | * | Demos[m] joined #nim |
17:17:04 | * | solitudesf joined #nim |
17:17:05 | * | gh0st[m] joined #nim |
17:17:08 | * | carterza[m] joined #nim |
17:17:08 | * | narimiran[m] joined #nim |
17:17:08 | * | sg-james[m] joined #nim |
17:17:08 | * | marszym[m] joined #nim |
17:17:09 | * | Jipok[m] joined #nim |
17:17:09 | * | TheManiac joined #nim |
17:17:09 | * | sendell[m] joined #nim |
17:17:09 | * | planetis[m] joined #nim |
17:17:09 | * | byteflame joined #nim |
17:17:09 | * | libman[m] joined #nim |
17:17:09 | * | petersjt014[m] joined #nim |
17:17:10 | * | macsek1911[m] joined #nim |
17:17:10 | * | zielmicha[m] joined #nim |
17:17:10 | * | notdekka[m] joined #nim |
17:17:10 | * | endes[m] joined #nim |
17:17:10 | * | xomachine[m] joined #nim |
17:17:10 | * | hohlerde joined #nim |
17:17:11 | * | sroecker[m] joined #nim |
17:17:11 | * | tyrion[m] joined #nim |
17:19:27 | FromGitter | <ephja> share allocations sure involves a lot of operations |
17:19:36 | * | krux02 quit (Quit: Leaving) |
17:34:17 | FromGitter | <kaushalmodi> Araq: Can you please add gird-style RST table parsing in nim doc? The only thing I think that's blocking the Org -> RST -> HTML flow :) |
17:36:07 | FromGitter | <kaushalmodi> Here's (https://gist.githubusercontent.com/kaushalmodi/a1914f97833c9c6e2a45910a94ec8968/raw/22ae16e19d67ed9d37c2d70a521968e0678845cd/strfmt.rst) the auto-generated RST doc from this Org file (https://raw.githubusercontent.com/kaushalmodi/strfmt/master/docs/strfmt.org). |
17:41:48 | shodan45 | dom96: iirc you're on lobste.rs, right? |
17:41:57 | shodan45 | dom96: because https://lobste.rs/s/smuu8y/tag_suggestion_nim |
17:42:35 | shodan45 | I don't have an account, otherwise I'd upvote/post |
17:47:26 | shashlick | interesting site |
18:08:35 | miran | dom96: quoting doesn't work on forum? |
18:10:05 | bozaloshtsh | best way to convert an array of ordinals to set? |
18:10:31 | FromGitter | <Quelklef> `toSet` |
18:10:32 | FromGitter | <Quelklef> ? |
18:10:36 | FromGitter | <Quelklef> https://nim-lang.org/docs/sets.html#toSet,openArray%5BA%5D |
18:10:38 | miran | bozaloshtsh: https://nim-lang.org/docs/sets.html#toSet,openArray[A] |
18:11:03 | bozaloshtsh | miran, Quelklef: ahh, tried toSet but didn't realize I had to import sets |
18:11:05 | miran | @Quelklef was faster.... :) |
18:11:05 | bozaloshtsh | thanks |
18:11:59 | bozaloshtsh | hrm, that converts to HashSet; I want a simple set |
18:13:22 | miran | then a simple loop maybe? |
18:13:34 | bozaloshtsh | miran: yeah seems like that's the way to go |
18:13:53 | miran | btw, "simple sets" are quite limited/picky about what they can contain |
18:14:08 | bozaloshtsh | I know, but I only have (and will only ever have) ordinals |
18:14:23 | bozaloshtsh | there's no need for hashing when everything I want to put in the set is <32 bits |
18:16:06 | miran | dom96: also, here is some hidden comment: https://forum.nim-lang.org/t/3994 |
18:37:03 | * | noonien quit (Quit: Connection closed for inactivity) |
18:41:45 | * | lompik quit (Ping timeout: 264 seconds) |
18:49:41 | * | Vladar quit (Quit: Leaving) |
18:50:58 | nasusiro | question: when Nim 1.0 will get released, will we get "The Nim Programming Language", much like "Nim in Action"? |
18:56:03 | * | dvn joined #nim |
19:01:39 | FromGitter | <mvlootman> hello, how can I may a negative assert? e.g. ⏎ var numbers = toSet([1, 2, 3, 4, 5]) ⏎ assert not numbers.contains(2) |
19:01:54 | FromGitter | <mvlootman> where 2 should be a number not in the set ofcourse... |
19:06:07 | FromGitter | <kaushalmodi> I finally have a nice "nimble docs" flow to generate Nimble module docs from Org mode source. |
19:06:48 | FromGitter | <kaushalmodi> The only problem is that tables still need to be written in RST in Org mode (yes, that's possible) as Pandoc generated RST tables are not supported by `nim doc`. |
19:07:27 | Yardanico | @mvlootman can you try assert(not numbers.contains(2)) |
19:07:30 | FromGitter | <kaushalmodi> If someone is interested, have a look at https://github.com/kaushalmodi/strfmt/blob/master/strfmt.nimble |
19:07:54 | Yardanico | !eval var numbers = toSet([1, 3, 4, 5]); assert(not numbers.contains(2)) |
19:07:55 | NimBot | Compile failed: in.nim(1, 15) Error: undeclared identifier: 'toSet' |
19:08:01 | Yardanico | !eval import sets; var numbers = toSet([1, 3, 4, 5]); assert(not numbers.contains(2)) |
19:08:04 | NimBot | <no output> |
19:08:47 | FromGitter | <ephja> you need the parentheses in order to change the precedence. also, see https://nim-lang.org/docs/system.html#in.t,untyped,untyped and `notin` defined below |
19:08:50 | FromGitter | <mvlootman> @Yardanico yes that works! I tried without the enclosing parentheses which made it fail |
19:09:45 | FromGitter | <mvlootman> i see, thanks! |
19:18:46 | shashlick | so streams cannot be used in the VM? cannot use parsecfg 😞 |
19:28:40 | * | Organism joined #nim |
19:35:57 | * | arecaceae quit (Remote host closed the connection) |
19:36:22 | * | arecaceae joined #nim |
20:00:44 | * | cryptocat1094 quit (Quit: WeeChat 1.6) |
20:01:52 | FromGitter | <ephja> can you even use alloc/allocShared in foreign threads? |
20:04:42 | * | miran quit (Ping timeout: 260 seconds) |
20:04:46 | * | miran_ joined #nim |
20:05:57 | * | mitai42 quit (Ping timeout: 240 seconds) |
20:17:23 | FromGitter | <quinzor_gitlab> Hi, im new to nim and want to translate this js func to nim with performance in mind. I want a better understanding how to write real nimcode. ⏎ Anyone so kind and could help? My attempt looks so wrong with all these ints and floats and indeed does not work. This can't be right :D ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b3693d3be98b1422414ad7b] |
20:17:49 | FromGitter | <dom96> nasusiro: plan is to keep Nim 1.0 compatible with Nim in action. |
20:18:09 | nasusiro | dom96: that would be great. |
20:19:14 | nasusiro | I did a silly mistake before and now I'm pulling my hairs off lol. I opened a website or forum in incognito mode in Chromium and now that I need it to ask a question here I cannot find it O.o |
20:20:02 | nasusiro | the example code was something like proc validation(x: int, valid: (x: int) -> bool) = |
20:20:23 | nasusiro | my question is: how do I run this validation procedure, that is how do I execute it? |
20:20:36 | nasusiro | validation(10, ???) |
20:21:03 | Yardanico | valid is a proc which accepts int and returns a bool |
20:21:16 | nasusiro | yes, I presume is a lambda function |
20:21:23 | nasusiro | err...anonymous procedure? |
20:21:28 | Yardanico | nasusiro, not really |
20:21:31 | nasusiro | is this how it's called in Nim? |
20:21:39 | Yardanico | nasusiro, well, there are anonymous procs in nim, yes |
20:21:58 | nasusiro | bad habits die hard Yardanico |
20:23:43 | * | krux02 joined #nim |
20:24:30 | Yardanico | nasusiro, . |
20:24:31 | nasusiro | so Yardanico, can you provide an actual example of how to execute this piece of code? |
20:24:36 | Yardanico | nasusiro, https://gist.github.com/Yardanico/13d3f3939a951737513563b65abc9398 |
20:24:48 | Yardanico | but I changed "validation" proc a bit - it returns a bool too |
20:25:23 | nasusiro | lol, that's what I was wondering, whether should I pass an existing proc in it or not |
20:25:31 | Yardanico | nasusiro, well, you can also do it like this: |
20:25:32 | nasusiro | man...I burnt my braincells so bad today |
20:25:35 | Yardanico | replace line 12 with "echo validate(5, (x) => x in 1..10)" |
20:25:55 | Yardanico | it will work the same :) |
20:25:59 | nasusiro | nice, like a Python's list comprehension |
20:30:02 | FromGitter | <kaushalmodi> How do I do something like this in .nimble?: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b3696caad21887018ea3506] |
20:31:11 | FromGitter | <kaushalmodi> This is an arbitrary example.. I also want to mv, cp, etc. in the nimble tasks, but I believe that if import os is possible, those operations can work in any OS. |
20:31:57 | FromGitter | <Yardanico> @kaushalmodi there's some procs you can use - https://nim-lang.org/docs/nimscript.html |
20:32:22 | FromGitter | <Yardanico> it's implicitly imported |
20:32:39 | FromGitter | <kaushalmodi> thanks.. so `rmDir` it is |
20:33:16 | FromGitter | <kaushalmodi> @Yardanico Thanks! That worked. |
20:35:36 | nasusiro | Yardanico: the example you kindly shared (thank you very much for your assistance, I appreciate it!) is using a range of 1 to 10. I was wondering: does Nim has something like isnum() we have in C? |
20:35:46 | Yardanico | what is isnum() ? |
20:36:16 | nasusiro | it validates a value as of numeric type |
20:36:57 | nasusiro | apologies, I meant isdigit() |
20:37:09 | nasusiro | I confused it with isalnum |
20:37:46 | Yardanico | well, there's isDigit but it's only for numbers (chars from 0 to 9) |
20:38:27 | Yardanico | maybe you want to use parseFloat from parseutils |
20:39:50 | nasusiro | cool, I will try that. Many thanks Yardanico :) |
20:40:48 | Yardanico | nasusiro, hmm, but it won't work for strings like "135sometext" |
20:40:57 | Yardanico | (because parseFloat will just parse 135) |
20:41:15 | nasusiro | isDigit() is just fine |
20:41:21 | nasusiro | it can accept string as well |
20:41:36 | Yardanico | nasusiro, ah, if you only need to check for numbers, isDigit() is fine |
20:41:41 | nasusiro | so, I can validate large numbers such as 1234 |
20:41:56 | Yardanico | !eval import strutils; echo isDigit("1233123123124891249812748892149889124924818912489") |
20:41:59 | NimBot | true |
20:42:11 | krux02 | nasusiro, worst case you can always fall back to the C standard library from Nim |
20:42:42 | nasusiro | krux02: indeed, if I need to reach that "low level", I might go for it. |
20:42:46 | krux02 | just declare the function with some importc declaration and header and use it. |
20:42:58 | nasusiro | cool |
20:43:39 | Yardanico | ok guys, good night, bye (i'm always online in the IRC because I use a bnc/znc service) :) |
20:43:47 | krux02 | there are many importc declarations in the compiler so you can look there on how to use it |
20:47:16 | * | fjvallarino quit (Remote host closed the connection) |
20:47:43 | * | fjvallarino joined #nim |
20:52:48 | * | fjvallarino quit (Ping timeout: 268 seconds) |
20:58:52 | FromGitter | <kaushalmodi> In Nimscript, how would you use an OS-agnostic path.. like `mvFile("./path/file1", "./path2/file2")`? |
20:59:13 | FromGitter | <kaushalmodi> In `os` module, you have the `/` operator.. but I cannot import os in .nimble |
20:59:37 | krux02 | slashes also work on windos |
20:59:55 | FromGitter | <kaushalmodi> I thought windows need `\`. |
21:00:02 | krux02 | the problem is more the 'c:' on windows where on linux ':' is a path separater |
21:00:09 | krux02 | nope it doesn't need it |
21:00:27 | * | cspar_ quit (Ping timeout: 240 seconds) |
21:00:29 | FromGitter | <kaushalmodi> OK cool! then I need not worry about `./docs/index.html` and such |
21:00:37 | krux02 | the slash operator just helps you not not repeat the '/' in the final path string |
21:00:53 | FromGitter | <kaushalmodi> hmm, got it |
21:00:57 | krux02 | but even that is even handled by the os, at least on linux |
21:01:05 | dom96 | You can import ospaths in .nimble AFAIK |
21:01:26 | FromGitter | <kaushalmodi> dom96: Where would you put that? |
21:01:34 | krux02 | yea and I think the / operator should also work on nimscript |
21:01:39 | dom96 | put what? |
21:01:43 | FromGitter | <kaushalmodi> the import |
21:01:46 | FromGitter | <kayabaNerve> ```code paste, see link``` ⏎ ⏎ I have that Nim code to iterate through an array and get the Hex representation. Everytime my program, which generates 100 in a for loop, runs, the 5th time I use it, when i is 11, I get a segfault. The traceback is: ⏎ ⏎ ` ... [https://gitter.im/nim-lang/Nim?at=5b369e3a81816669a4236dfd] |
21:02:22 | FromGitter | <kayabaNerve> Sorry if that's spammy. I can always just put this on a paste service. |
21:02:49 | FromGitter | <kaushalmodi> dom96: If I put `import` inside `task`, I get: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b369e7970efc60660a05837] |
21:03:11 | FromGitter | <kayabaNerve> @Varriount We were talking about this yesterday but I don't think this is necessarily because of my manual mem management, to be honest. |
21:03:23 | dom96 | put it at the top level then |
21:03:52 | FromGitter | <kaushalmodi> dom96: Hmm.. I cannot `import os`.. but I can `import ospaths` |
21:03:53 | FromGitter | <kaushalmodi> thanks |
21:04:28 | FromGitter | <kaushalmodi> `import os` in nimble gives this error: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b369edc3c5abf52b62f59a1] |
21:13:03 | FromGitter | <skilchen> @Quin you are very close... Try this one: |
21:13:36 | FromGitter | <skilchen> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b36a100bd92d8078286ba3a] |
21:15:40 | * | Trustable quit (Remote host closed the connection) |
21:21:06 | * | fjvallarino joined #nim |
21:29:24 | FromGitter | <kaushalmodi> krux02: I forgot to reply. Yes, the `/` operator does work in . nimble too, after importing `ospaths`. Thanks. |
21:29:49 | krux02 | no problem |
21:30:23 | * | mitai42 joined #nim |
21:32:09 | FromGitter | <kaushalmodi> krux02: Do you use Org mode? I'm pretty thrilled to get the Nim module docs generation working with doc source in Org :D |
21:33:37 | krux02 | I actually use org mode. |
21:33:42 | krux02 | not too much though. |
21:33:48 | krux02 | I am not too excited about it. |
21:34:11 | krux02 | It has weird syntax here and there and does thing too automatic for my personal taste |
21:34:44 | krux02 | I like the idea that I can use it for source/text hybrid documents and I have syntax highlighting and everything for the source snippents |
21:36:14 | krux02 | but I am a bit confused on the strict distinction between source that I just want to use to generate some graphs in the output. source that I want to visualize in the output document. And sourcecode that I need to emit in form of glue so that latex/html is going to work. |
21:36:43 | krux02 | or better said the lack of the clear distinction. it als all <s magic |
21:36:53 | krux02 | And I never really know what happens |
21:39:27 | * | miran_ quit (Ping timeout: 256 seconds) |
21:40:11 | FromGitter | <ephja> @kayabaNerve you should get an exception if the allocation fails |
21:43:55 | FromGitter | <kayabaNerve> But it didn't |
21:43:58 | FromGitter | <kayabaNerve> Just when I used it |
21:44:03 | FromGitter | <kayabaNerve> Even though the pointer wasn't null |
21:44:22 | FromGitter | <kayabaNerve> And it's always on the 5th item with the 11th array index |
21:45:51 | FromGitter | <kayabaNerve> And the array in the item I have a pointer to is declared as an array, not as a pointer |
21:45:56 | FromGitter | <kayabaNerve> And I do allocate enough memory. |
21:53:12 | FromGitter | <kayabaNerve> OK. So I made it a const, instead of always calling sizeof(). Now it works 8 times and still fails on 11 |
21:53:20 | * | fjvallarino quit (Remote host closed the connection) |
21:53:27 | * | fjvallarino joined #nim |
21:53:46 | FromGitter | <kayabaNerve> And the addresses do change on each run. It's not an RNG issue. |
21:56:41 | FromGitter | <kayabaNerve> echo $i & " " & $key.data[i] <- works ⏎ result = result & key.data[i].toHex() <- doesn't work |
21:56:54 | FromGitter | <kayabaNerve> So it's either strutils or result & "ff" |
21:57:52 | FromGitter | <kayabaNerve> proc `$`*(key: PublicKey): string = ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ It's the last line. [https://gitter.im/nim-lang/Nim?at=5b36ab5f216ee2623e8f80dc] |
21:58:11 | FromGitter | <kayabaNerve> Why the hell would result & string cause this? |
22:00:57 | FromGitter | <kayabaNerve> https://pastebin.com/0iNuEgQQ |
22:01:48 | FromGitter | <kayabaNerve> TL;DR If I print the string before result & str, it works. If I don't echo it, it doesn't. It occurs on the 8th loop with the 11th str. |
22:04:31 | FromGitter | <kayabaNerve> Oh. The discard in there is also needed. |
22:15:58 | FromGitter | <kaushalmodi> > And I never really know what happens |
22:16:46 | FromGitter | <kaushalmodi> @krux02 Feel free to ping me offline this thread if that's too offtopic. I'd like to help you out with the Org magic if you want. |
22:17:32 | krux02 | yea I would be interested, but not today. |
22:18:14 | FromGitter | <kaushalmodi> Sure, any time. |
22:21:05 | krux02 | kaushalmodi: just a question how do you debug a Nim program if you encounter a bug |
22:22:28 | FromGitter | <kaushalmodi> krux02: I haven't written too serious nim programs.. for debug, the backtrace helps, and if the compiler crashes, I file a bug report |
22:23:17 | FromGitter | <kaushalmodi> I believe this is the most complex thing (https://github.com/kaushalmodi/noxhugo/blob/master/src/noxhugo.nim) I have written from scratch. |
22:24:35 | FromGitter | <kaushalmodi> .. and this (https://github.com/kaushalmodi/nim-emacs-module/blob/master/emacs_module/wrappers.nim). |
22:33:02 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
22:33:55 | nasusiro | I feel so sad that I'm complete broke, because if I had a successful job I would have funded this project like crazy. I have been experimenting for how long now and feels like...home! |
22:34:01 | * | Lord_Nightmare joined #nim |
22:38:29 | krux02 | nasusiro, write something in Nim and sell it. Then put some money you make and invest it into Nim. |
22:39:03 | nasusiro | I'm not the most confident person that would do such thing. Low self-esteem for the win :/ |
22:40:01 | krux02 | well I have to go for today. See you |
22:40:11 | nasusiro | cheers |
22:41:39 | * | krux02 quit (Quit: Leaving) |
22:46:35 | * | nsf quit (Quit: WeeChat 2.1) |
22:48:00 | * | natrys quit (Quit: natrys) |
22:49:22 | * | fjvallarino quit (Remote host closed the connection) |
22:49:49 | * | fjvallarino joined #nim |
22:54:45 | * | fjvallarino quit (Ping timeout: 260 seconds) |
22:59:00 | FromGitter | <kayabaNerve> nasusiro Join a Nim project and sell it |
22:59:25 | nasusiro | kayabaNerve: any suggestions? |
23:13:55 | * | elrood quit (Quit: Leaving) |
23:30:03 | * | nasusiro left #nim ("Leaving the channel.") |
23:36:30 | * | data-man quit (Ping timeout: 265 seconds) |
23:36:43 | * | fjvallarino joined #nim |
23:40:02 | * | fjvallarino quit (Remote host closed the connection) |
23:40:10 | * | fjvallarino joined #nim |