00:04:13 | * | jmdaemon quit (Ping timeout: 256 seconds) |
00:13:37 | FromDiscord | <Elegantbeef> `import std/genasts` or just use `macros.quotedo` |
00:15:13 | FromDiscord | <SrMordred> sent a code paste, see https://play.nim-lang.org/#ix=4w9S |
00:15:39 | FromDiscord | <Andreas> `choosenim update devel` |
00:15:44 | FromDiscord | <Elegantbeef> `choosenim devel` |
00:18:56 | FromDiscord | <SrMordred> sent a code paste, see https://play.nim-lang.org/#ix=4w9U |
00:19:14 | FromDiscord | <Elegantbeef> Use andreas' command |
00:19:23 | FromDiscord | <SrMordred> ah |
00:19:24 | FromDiscord | <SrMordred> wait |
00:21:07 | FromDiscord | <SrMordred> old nim version lurking my path, my bad đ |
00:28:38 | * | jmdaemon joined #nim |
00:39:35 | * | jmdaemon quit (Ping timeout: 240 seconds) |
00:59:38 | * | derpydoo joined #nim |
01:04:43 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4w9X |
01:05:18 | FromDiscord | <spoon> side note, running on devel, compiling with orc gives me 0 immediately and running with --mm:refc has it just hang |
01:07:45 | * | nanxiao joined #nim |
01:09:19 | FromDiscord | <spoon> the expected output should be 10, but it gives 0 (only on arc/orc) and hangs on other models |
01:29:49 | FromDiscord | <Rika> get last value is wrong |
01:29:56 | FromDiscord | <amadan> sent a code paste, see https://paste.rs/p75oz |
01:30:05 | FromDiscord | <amadan> So its actually returning the current instead of nâ”and its using the same type |
01:30:06 | FromDiscord | <Rika> Thats still technically wrong |
01:30:14 | FromDiscord | <Rika> current = current.next[] |
01:30:22 | FromDiscord | <Elegantbeef> People need to stop using cast |
01:30:23 | FromDiscord | <Elegantbeef> I swear |
01:30:27 | FromDiscord | <amadan> current is `ref node[T]` |
01:30:34 | FromDiscord | <Rika> Why |
01:30:45 | FromDiscord | <Rika> It doesnt have to be |
01:31:01 | FromDiscord | <amadan> guess not yeah |
01:31:04 | FromDiscord | <Elegantbeef> Current is a stack node |
01:32:51 | NimEventer | New thread by noah: Clarification on nim v2 removal of parallel & spawn, see https://forum.nim-lang.org/t/10205 |
01:34:28 | FromDiscord | <spoon> what's with the `[]` when using reference types? |
01:34:40 | FromDiscord | <Elegantbeef> It's the dereference operator |
01:34:48 | FromDiscord | <spoon> ah, makes sense |
01:34:55 | FromDiscord | <sOkam!> @amadan cast is only for when you want to explictely jump over the type system, because there is no other way around it (like C interop). i saw you removed that part, but just for future cases |
01:35:14 | FromDiscord | <Elegantbeef> I sure hope amadan know's what cast is for |
01:35:15 | FromDiscord | <spoon> alright, that works |
01:35:39 | FromDiscord | <sOkam!> In reply to @spoon "what's with the `[]`": like C's `myPointer`, but with a symbol that actually makes sense |
01:35:41 | FromDiscord | <spoon> i realized the dumb mistake later, but i do wonder what's causing the difference between arc/orc and the other mm models |
01:35:42 | FromDiscord | <amadan> In reply to @sOkam! "<@259999449995018240> cast is only": dw I didn't have a castâ”The original problem was I was using a ref when it wasn't needed |
01:36:11 | FromDiscord | <amadan> (edit) "In reply to @sOkam! "<@259999449995018240> cast is only": dw I didn't have a castâ”The original problem ... was" added "(in my answer to spoon)" |
01:36:29 | FromDiscord | <sOkam!> In reply to @amadan "dw I didn't have": oh sry, the code that had a cast was by @spoon |
01:36:35 | FromDiscord | <sOkam!> my bad |
01:38:16 | FromDiscord | <spoon> In reply to @sOkam! "like C's `*myPointer`, but": now that i think about it, i guess it does considering indexing an array is just dereferencing |
01:38:47 | FromDiscord | <sOkam!> yep |
01:39:40 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4w9Z |
01:40:07 | FromDiscord | <spoon> alright, i think i got the hang of it, thanks |
02:24:41 | * | nanxiao quit (Quit: Client closed) |
02:55:44 | FromDiscord | <Catting> Hi everyone! I am new in there.â”Is there any IDE recommendations? |
02:56:33 | FromDiscord | <Catting> I am try to use my IntelliJ or Clion to write Nim, but it seems they aren't support |
03:03:57 | FromDiscord | <JJ> vscode and `saem/vscode-nim`, or any ide with lsp support and `nimlangserver` |
03:04:49 | FromDiscord | <JJ> tooling is unfortunately a weakness of nim: but those will give you code completion and error highlighting |
03:08:18 | FromDiscord | <Catting> Oh god, an unfortunate news, I rely heavily on ideđ |
03:08:44 | FromDiscord | <Catting> Thanks, I will try your recommends |
03:22:00 | FromDiscord | <sOkam!> In reply to @Catting "Oh god, an unfortunate": that made it sound much worse than it actually isâ”sure, it can be better. but its definitely not in "unfortunate" level of bad in any way |
03:23:12 | FromDiscord | <sOkam!> It has way more stuff out of the box than pure C. Or even cpp I would sayâ”It only falls behind (and not that much, in reality) if you compare it with rust or similar ecosystems |
03:24:52 | FromDiscord | <sOkam!> vscode-nim will get you covered for all your ide needs |
04:17:49 | FromDiscord | <Catting> Ok,thanks |
04:18:52 | FromDiscord | <michaelb.eth> In reply to @Catting "Hi everyone! I am": Emacs and nimlangserver work pretty well together, but not everyone is willing to the Strange Side of the Force |
04:19:02 | FromDiscord | <michaelb.eth> (edit) "In reply to @Catting "Hi everyone! I am": Emacs and nimlangserver work pretty well together, but not everyone is willing to ... the" added "turn to" |
04:19:14 | FromDiscord | <Elegantbeef> emacs users are the vegans of text ediditors |
04:19:16 | FromDiscord | <Elegantbeef> editors even |
04:21:27 | FromDiscord | <that_dude> Beef's got beef |
04:21:28 | FromDiscord | <michaelb.eth> true, and all the parens in the e-lisp provide the nutrients we'd otherwise be missing out on |
04:23:58 | FromDiscord | <Elegantbeef> Nah just shitty jokesâ”(@that_dude) |
04:24:54 | FromDiscord | <that_dude> I bet you get that pun a lot |
04:30:52 | * | rockcavera quit (Remote host closed the connection) |
05:39:49 | FromDiscord | <voidwalker> any updated guide for nim debugging in vs code ? |
05:40:55 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/e09UR |
05:41:41 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4was" => "https://play.nim-lang.org/#ix=4war" |
06:23:57 | * | nanxiao joined #nim |
06:42:13 | * | PMunch joined #nim |
07:12:08 | * | azimut quit (Ping timeout: 240 seconds) |
07:44:23 | * | derpydoo quit (Ping timeout: 240 seconds) |
07:45:22 | * | FromDiscord quit (Remote host closed the connection) |
07:45:36 | * | FromDiscord joined #nim |
07:51:49 | FromDiscord | <voidwalker> :\ |
08:10:55 | * | lucasta quit (Remote host closed the connection) |
08:27:28 | * | Notxor joined #nim |
09:25:23 | FromDiscord | <tea> sent a long message, see http://ix.io/4waR |
09:26:00 | FromDiscord | <tea> (Also, I am not sure if this is the correct channel to discuss this. Internals seems to be related to development only so I was not willing to post there and disturb everyone đ
) |
09:46:54 | FromDiscord | <rakgew> @tea \: regarding nim-metprogramming, I enjoyed these\:â”â https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/â”â https://flenniken.net/blog/nim-macros/ |
09:47:30 | FromDiscord | <rakgew> and there is also the "mastering nim" book which expands on meta programming. |
09:47:38 | FromDiscord | <Rika> In reply to @tea "(Also, I am not": This is the correct channel |
09:53:01 | * | nanxiao quit (Quit: Client closed) |
09:55:29 | FromDiscord | <ⶠZeno> Hello world, how can i set timeout for a Future ? |
09:56:15 | FromDiscord | <ⶠZeno> Nevermind, i should have read documentation, thank anyway |
09:58:31 | FromDiscord | <voidwalker> @tea there is also this https://ssalewski.de/nimprogramming.html#_advanced_nim |
09:59:03 | FromDiscord | <tea> In reply to @rakgew "<@122399590031818754> \: regarding nim-metprogrammi": Thanks ! Is there a way that I can read this book online ? It seems that I can not pay for an ebook (from what I have seen so far) |
09:59:19 | FromDiscord | <tea> In reply to @voidwalker "<@122399590031818754> there is": Thanks ! đ |
10:48:00 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wbd |
10:48:43 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wbe |
11:14:49 | FromDiscord | <voidwalker> Is is possible that the way this array is constructed is problematic, with a template ? |
11:20:46 | * | Notxor quit (Ping timeout: 268 seconds) |
11:34:17 | * | junaid_ joined #nim |
11:38:35 | PMunch | What does alloca do voidwalker? |
11:41:22 | Amun-Ra | allocates memory on the heap in an uncontrollable way |
11:41:43 | PMunch | Huh? |
11:42:24 | Amun-Ra | (I can't access play.nim) |
11:42:33 | PMunch | I'm updating and rebooting it |
11:42:35 | PMunch | https://man7.org/linux/man-pages/man3/alloca.3.html |
11:42:48 | PMunch | Hmm, so alloca apparently allocates memory in the stack frame of the caller |
11:43:11 | Amun-Ra | right, I meant stack |
11:43:24 | Amun-Ra | alloca is almost never a good idea |
11:43:45 | FromDiscord | <voidwalker> I am trying to integrate this method: https://github.com/bpr/vla/blob/27580a5023e9411d9608b79d9e191a632c8e17e4/src/vla.nim#L26 in my code |
11:43:49 | PMunch | So the memory allocated there will be freed once the procedure is over, which is probably why the `len` stuff causes an issue |
11:44:09 | Amun-Ra | and why that needs to be template |
11:44:16 | FromDiscord | <voidwalker> ohh that makes sense now |
11:44:30 | PMunch | Well it it wasn't then `alloca` would free the memory once it returned |
11:44:35 | FromDiscord | <voidwalker> although I create it in my main code (not a proc) |
11:44:51 | PMunch | It might be that Nim makes a proc of it under the hood |
11:44:57 | PMunch | Have a look at the C source code |
11:45:02 | Amun-Ra | right |
11:45:33 | PMunch | Why do you want to do this though? Aren't you just reinventing the seq-wheel |
11:46:04 | FromDiscord | <voidwalker> Just for fun mostly, I am trying to get as many base types on which to store a bit array as possible : ) |
11:46:19 | Amun-Ra | that's reinventing seq with -d=danger always on ;) |
11:46:23 | FromDiscord | <voidwalker> I got array, seq, and now I'm trying allocated at runtime size array |
11:46:59 | Amun-Ra | the problem with alloca is you don't know how much size is too much |
11:47:01 | FromDiscord | <voidwalker> oh and mratsim suggested I use "ceilDiv" for this `S div (sizeof(B) 8) + int(S mod (sizeof(B) 8) != 0` |
11:47:28 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wbp |
11:47:35 | FromDiscord | <voidwalker> I get `/home/sgm/.choosenim/toolchains/nim-#devel/lib/pure/math.nim(915, 17) Error: cannot generate VM code for and` |
11:48:06 | FromDiscord | <voidwalker> Is there a reason I cannot use ceilDiv in the type definition ? |
11:48:15 | * | Notxor joined #nim |
11:48:26 | PMunch | By the way Amun-Ra, the Discord bot will auto-convert multi-line messages to code pastes and share them through the playground |
11:48:48 | PMunch | Not everything you see as a playground link actually makes sense there :P |
11:49:02 | Amun-Ra | :> |
11:49:13 | PMunch | And since it uses ix.io as the storage you can always use `ix.io/<four digit code>` to see the paste |
11:49:27 | void09 | oh I am on irc too, I didn't know |
11:50:04 | PMunch | That's why you get so many red dots in playground pastes, it's the Discord bot not converting them back to `*` |
11:50:57 | FromDiscord | <voidwalker> I supposed things used in type definitions should be "compile time". maybe ceilDiv is not compile time for some reason ? |
11:51:05 | FromDiscord | <voidwalker> (edit) "supposed" => "suppose" |
11:55:42 | NimEventer | New Nimble package! StripeKit - Stripe API wrapper for Nim, see https://github.com/vfehring/StripeKit |
11:58:14 | FromDiscord | <chmod222> Just to be sure, if I have `proc foo(bar: Bar)` and `proc foo[T](bar: T)`, the concrete `bar: Bar` overload will be resolved before the generic `[Bar](bar: Bar)`? |
11:58:15 | FromDiscord | <chmod222> Quick test says yes, specific overload |
11:59:55 | PMunch | That is correct |
12:00:06 | PMunch | And it's because it has a higher specificity |
12:15:56 | * | Onionhammer quit (Read error: Connection reset by peer) |
12:17:59 | * | Onionhammer joined #nim |
12:18:41 | * | junaid_ quit (Remote host closed the connection) |
12:18:48 | FromDiscord | <voidwalker> well it's not that it's not compile time-able, `const x = ceilDiv(1,2)` works |
12:28:06 | * | lucasta joined #nim |
12:40:52 | FromDiscord | <mratsim> In reply to @voidwalker "oh and mratsim suggested": The `B: Units` might be problematic, can use use `B: SomeUnsignedInt` instead? |
12:41:18 | FromDiscord | <mratsim> And if it still doesn't work, try making ceilDiv a template |
12:41:22 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wby |
12:41:23 | FromDiscord | <voidwalker> still gives the same error |
12:42:02 | FromDiscord | <mratsim> Try with a template, sometimes operations at type level work better with kne |
12:42:05 | FromDiscord | <mratsim> One |
12:47:55 | * | rockcavera joined #nim |
12:55:44 | FromDiscord | <voidwalker> still the same error |
12:55:45 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wbA |
13:32:23 | * | PMunch quit (Quit: Leaving) |
13:33:38 | * | krux02_ joined #nim |
13:34:44 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4wbQ |
13:35:11 | FromDiscord | <voidwalker> implement my own ceildiv ? |
13:35:19 | FromDiscord | <mratsim> or do (S+(sizeof(B)-1))/sizeof(B) |
13:35:26 | FromDiscord | <voidwalker> is this a compiler bug or what ? |
13:35:31 | FromDiscord | <mratsim> (edit) "(S+(sizeof(B)-1))/sizeof(B)" => "(S+(sizeof(B)8-1))/sizeof(B)" |
13:35:54 | * | myrix joined #nim |
13:36:07 | FromDiscord | <mratsim> In reply to @voidwalker "is this a compiler": The compiler can give up on comoile-time evaluation sometimes |
13:38:45 | * | progranner joined #nim |
13:43:48 | FromDiscord | <voidwalker> this also doesn't work |
13:43:48 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4wbV |
13:44:16 | FromDiscord | <voidwalker> nvm, it does work |
13:44:28 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4wbV" => "https://play.nim-lang.org/#ix=4wbW" |
14:06:51 | FromDiscord | <voidwalker> oh now I understand what you meant by div/shr, I always have to divide by a power of two and I can use shr instead of div : ) |
14:10:39 | * | lucasta quit (Remote host closed the connection) |
14:10:47 | Amun-Ra | voidwalker: tbh there shouldn't be any difference in the code, gcc/clang will produce shifts in the resulting code |
14:11:03 | * | lucasta joined #nim |
14:14:35 | Amun-Ra | well, there is a difference with signed types, https://godbolt.org/z/Ph6ehWaa5 |
14:20:33 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=4wc8 |
14:20:58 | FromDiscord | <spoon> nothing should be pointing to current, right? do i have to do a manual `=destroy` in this case? |
14:22:45 | FromDiscord | <spoon> oh latest devel fixed it |
14:22:54 | FromDiscord | <voidwalker> sent a code paste, see https://paste.rs/6l04Y |
14:29:05 | NimEventer | New post on r/nim by MetaMindWanderer: Is it possible to use this novel unit testing approach in nim?, see https://reddit.com/r/nim/comments/13lx1y5/is_it_possible_to_use_this_novel_unit_testing/ |
14:34:32 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzzâŠ) |
14:37:46 | * | progranner joined #nim |
14:40:06 | * | lucasta quit (Remote host closed the connection) |
15:55:50 | NimEventer | New post on r/nim by qtless: RestAPI Request Models In Nim, see https://reddit.com/r/nim/comments/13lzj83/restapi_request_models_in_nim/ |
16:22:38 | FromDiscord | <AsbjĂžrn> sent a code paste, see https://play.nim-lang.org/#ix=4wcC |
16:26:15 | FromDiscord | <demotomohiro> Do you want to export Nim function to C that takes a pointer to C function and call it? |
16:28:47 | FromDiscord | <firasuke> What's the preferred method to bootstrap Nim from source? and what dependencies are needed? |
16:31:16 | FromDiscord | <demotomohiro> In reply to @firasuke "What's the preferred method": https://github.com/nim-lang/Nimâ”You need a git to download source and gcc to compile csource.â”After download, just run build_all.sh or build_all.bat |
16:34:13 | FromDiscord | <michaelb.eth> In reply to @firasuke "What's the preferred method": choosenim can be helpful for that, just depending on your setup; e.g. `choosenim '#version-1-6'` will fetch latest commit on the `version-1-6` branch of nim-lang/Nim on github and build the compiler and the other tools from source |
16:35:11 | FromDiscord | <michaelb.eth> but as @demotomohiro notes can you also just clone the repo, checkout what you want, and use the build script |
16:38:48 | FromDiscord | <firasuke> thanks for the pointers |
16:39:00 | FromDiscord | <firasuke> it's for packaging nim in a recipe file for a custom distribution |
16:39:06 | FromDiscord | <firasuke> I prefer not to use choosenim for this purpose |
16:39:19 | FromDiscord | <firasuke> I read some recipes from mainstream distributions that use koch |
16:39:31 | FromDiscord | <firasuke> don't know if it's still relevant |
16:40:23 | FromDiscord | <demotomohiro> @AsbjĂžrnâ”Here is minimum example:â”https://play.nim-lang.org/#ix=4wcD |
16:41:12 | FromDiscord | <AsbjĂžrn> yes, exactlyâ”(@demotomohiro) |
16:41:15 | FromDiscord | <AsbjĂžrn> Awesome!! thanks đ«â”(@demotomohiro) |
16:41:20 | FromDiscord | <AsbjĂžrn> I'm gonna go play around with it a bit |
16:41:28 | FromDiscord | <demotomohiro> In reply to @firasuke "I prefer not to": build_all.sh or build_all.bat calls koch to build nim from source. |
16:42:06 | FromDiscord | <AsbjĂžrn> nim is so powerfull.. it keeps amazing me that I can be like "I wonder if I could..." and usually the answer is yes |
16:42:25 | FromDiscord | <firasuke> In reply to @demotomohiro "build_all.sh or build_all.bat calls": koch is nim's maintenance script, so if I understood correctly I only need a modern C compiler and shell as dependencies |
16:43:12 | FromDiscord | <demotomohiro> It seems Nim can do anything what C can do. |
16:44:08 | FromDiscord | <AsbjĂžrn> but with real types |
16:45:25 | FromDiscord | <firasuke> In reply to @demotomohiro "It seems Nim can": well yeah, I am just using my custom C compiler to cross compile a nim software I wrote, and it just works |
16:45:36 | FromDiscord | <firasuke> (edit) "my" => "a" | "acustom ... C" added "cross compiled" |
16:47:51 | FromDiscord | <demotomohiro> In reply to @firasuke "well yeah, I am": Yes, Nim is good at cross compiling as long as you have a C compiler for cross compiling. |
16:48:10 | FromDiscord | <Arathanis> does Nim have built in pointer arithmetic somewhere or do i need to roll my own? |
16:48:35 | FromDiscord | <Arathanis> its not hard, just dont want to reinvent the wheel if there is a `std/ptrarithmetic` library |
16:49:16 | FromDiscord | <demotomohiro> In reply to @Arathanis "does Nim have built": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-can-nim-do-pointer-arithmeticqmark |
16:50:57 | FromDiscord | <demotomohiro> Nim language itself doesn't have much pointer arithmetic. |
16:51:10 | FromDiscord | <Arathanis> ohh ok, so for some use cases i can use Unchecked array |
16:51:10 | FromDiscord | <Arathanis> got it |
16:51:13 | FromDiscord | <Arathanis> i was doing this: |
16:51:53 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4wcI |
16:53:40 | FromDiscord | <voidwalker> there is this: https://github.com/kaushalmodi/ptr_math |
16:54:30 | FromDiscord | <Arathanis> oh cool, his is pretty much what i was doing too |
16:55:47 | * | azimut joined #nim |
17:08:44 | FromDiscord | <firasuke> In reply to @demotomohiro "build_all.sh or build_all.bat calls": ok running build_all.sh seems to be fetching csources v1, I have 2 questions here, why is not using v2? also is it possible to provide the sources for an offline build? |
17:09:02 | Amun-Ra | I have a funny case where quit() does not really quit the app (and the thread support is off) |
17:10:13 | FromDiscord | <firasuke> In reply to @firasuke "ok running build_all.sh seems": unless the versions actually specify csources v1 for nim 1.x and csources v2 for nim 2.x |
17:16:04 | FromDiscord | <demotomohiro> In reply to @firasuke "ok running build_all.sh seems": I don't know why it is not v2.â”About offline build, i never tried it before.â”You would need to learn what build_all.sh do. |
17:16:32 | FromDiscord | <firasuke> oh ok |
17:16:35 | FromDiscord | <firasuke> makes sense |
17:18:50 | FromDiscord | <demotomohiro> I think, you build csources first.â”https://github.com/nim-lang/csources_v2â”Then build koch in Nim source and run koch to build Nim and Nim tools. |
17:19:24 | FromDiscord | <firasuke> yup, I think that might work |
17:33:23 | FromDiscord | <jmgomez> Is CSources basically the result c compilation of the Nim compiler? |
17:41:39 | FromDiscord | <demotomohiro> It looks like so:â”https://github.com/nim-lang/csources_v2/tree/master/c_code/1_1 |
18:01:47 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4wcW |
18:11:50 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=4wcY |
18:12:00 | FromDiscord | <SirOlaf> (edit) "https://play.nim-lang.org/#ix=4wcY" => "https://play.nim-lang.org/#ix=4wcZ" |
18:12:36 | FromDiscord | <SirOlaf> Way I know of would be storing it in a temp variable, taking addr and converting pointer to seq[byte] |
18:13:18 | FromDiscord | <SirOlaf> (edit) "temp" => "second" |
18:14:21 | FromDiscord | <SirOlaf> But that still copies if you try to use it |
18:16:06 | FromDiscord | <demotomohiro> In reply to @Arathanis "is there a batteries": Probably `sizeof(mySeq) + sizeof(mySeq[0]) mySeq.len` is shortest way.â”But it doesn't contains all allocated heap size. |
18:18:15 | FromDiscord | <demotomohiro> In reply to @SirOlaf "Any way to avoid": Probably sink is not used because you use cast. |
18:18:31 | FromDiscord | <SirOlaf> Yeah but I wouldn't expect cast to cause a copy |
18:18:48 | FromDiscord | <SirOlaf> Isn't it meant to be dangerous and lower level |
18:21:21 | FromDiscord | <demotomohiro> I think `toOpenArray` or `toOpenArrayByte` is what you need.â”https://nim-lang.org/docs/system.html#toOpenArrayByte%2Cstring%2Cint%2Cint |
18:24:45 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4wd1 |
18:26:50 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=4wd2 |
18:26:58 | FromDiscord | <SirOlaf> `Error: invalid type: 'openArray[byte]' in this context: 'A' for let` |
18:28:04 | FromDiscord | <SirOlaf> Makes sense that it doesn't work, but error is not helpful |
18:30:00 | FromDiscord | <demotomohiro> How about to use `readBytes`?â”https://nim-lang.org/docs/io.html#readBytes%2CFile%2CopenArray%5B%5D%2CNatural%2CNatural |
18:31:16 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=4wd3 |
18:31:16 | FromDiscord | <SirOlaf> But you're right, readBytes would work |
18:31:18 | FromDiscord | <SirOlaf> Thanks |
18:34:18 | FromDiscord | <Arathanis> In reply to @demotomohiro "Probably `sizeof(mySeq) + sizeof(mySeq[0])": im unaware of the allocated heap size, where is that coming from? also I used `elementType` to cover the 0 len case where mySeq[0] would explode |
18:35:41 | FromDiscord | <demotomohiro> In reply to @Arathanis "im unaware of the": `sizeof` should not run given code. |
18:36:25 | FromDiscord | <demotomohiro> !eval var x = @[1]; echo sizeof(x[100000]) |
18:36:29 | NimBot | 8 |
18:36:52 | FromDiscord | <Arathanis> OH ok |
18:37:19 | FromDiscord | <Arathanis> so it doesnt care about the index in sizeof lol |
18:38:03 | FromDiscord | <Arathanis> !e import std/typetraits; var x = @[1, 2, 3, 4, 5, 6]; echo sizeof(x) + sizeof(elementType(x))x.len |
18:38:17 | FromDiscord | <demotomohiro> `sizeof` just get the type of given expression and calculate the size at compile time. |
18:38:19 | FromDiscord | <Arathanis> !eval import std/typetraits; var x = @[1, 2, 3, 4, 5, 6]; echo sizeof(x) + sizeof(elementType(x))x.len |
18:38:22 | NimBot | Compile failed: /usercode/in.nim(1, 92) Error: invalid token: (\29) |
18:38:47 | FromDiscord | <Arathanis> !eval import std/typetraits; var x = @[1, 2, 3, 4, 5, 6]; echo (sizeof(x) + sizeof(elementType(x))x.len) |
18:38:50 | NimBot | Compile failed: /usercode/in.nim(1, 93) Error: invalid token: (\29) |
18:38:52 | FromDiscord | <Arathanis> đ |
18:39:20 | FromDiscord | <Arathanis> !eval var x = @[1, 2, 3, 4, 5, 6]; echo (sizeof(x) + sizeof(x[0])x.len) |
18:39:23 | NimBot | Compile failed: /usercode/in.nim(1, 60) Error: invalid token: (\29) |
18:40:11 | FromDiscord | <demotomohiro> Maybe some of characters in your code doesn't work on discord bridge. |
18:41:16 | FromDiscord | <Arathanis> !eval import std/typetraits; var x = @[1,2,3,4,5,6]; let s = sizeof(x) + sizeof(elementType(x))x.len; echo s |
18:41:20 | NimBot | Compile failed: /usercode/in.nim(1, 90) Error: invalid token: (\29) |
18:41:27 | FromDiscord | <Arathanis> you must be right |
18:41:31 | FromDiscord | <demotomohiro> !eval echo 1 2 |
18:41:33 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: invalid token: (\29) |
18:41:52 | FromDiscord | <demotomohiro> it seems '' doesnt work |
18:41:53 | FromDiscord | <Arathanis> !eval import std/typetraits; var x = @[1,2,3,4,5,6]; let s = sizeof(x) + sizeof(elementType(x))\x.len; echo s |
18:41:56 | NimBot | Compile failed: /usercode/in.nim(1, 91) Error: invalid token: (\29) |
18:42:10 | FromDiscord | <Arathanis> (edit) "sizeof(elementType(x))\x.len;" => "sizeof(elementType(x))\\x.len;" |
18:42:22 | FromDiscord | <Arathanis> oh its a format character |
18:42:28 | FromDiscord | <Arathanis> !eval import std/typetraits; var x = @[1,2,3,4,5,6]; let s = sizeof(x) + sizeof(elementType(x))\\x.len; echo s |
18:42:31 | NimBot | Compile failed: /usercode/in.nim(1, 92) Error: invalid token: (\29) |
18:45:06 | FromDiscord | <Arathanis> !eval `import std/typetraits; var x = @[1,2,3,4,5,6]; let s = sizeof(x) + sizeof(elementType(x))x.len; echo s` |
18:45:09 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: identifier expected, but got ';' |
18:45:47 | FromDiscord | <Arathanis> theres probably some secret tech for using `` |
18:50:32 | FromDiscord | <ⶠZeno> sup people, what purpose is pcre64.dll in nim's bin directory ? i couldn't find it's purpose online |
18:50:34 | FromDiscord | <michaelb.eth> !eval `echo (NimMajor, NimMinor, NimPatch)` |
18:50:36 | NimBot | Compile failed: /usercode/in.nim(1, 16) Error: identifier expected, but got ',' |
18:51:12 | FromDiscord | <michaelb.eth> !eval `(NimMajor, NimMinor, NimPatch)` |
18:51:14 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: identifier expected, but got ',' |
18:51:24 | FromDiscord | <michaelb.eth> hmm |
18:51:31 | FromDiscord | <Arathanis> !eval (NimMajor, NimMinor, NimPatch) |
18:51:33 | NimBot | Compile failed: /usercode/in.nim(1, 1) Error: expression '(NimMajor, NimMinor, NimPatch)' is of type '(int, int, int)' and has to be used (or discarded) |
18:51:45 | FromDiscord | <Arathanis> !eval echo (NimMajor, NimMinor, NimPatch) |
18:51:48 | NimBot | (1, 6, 12) |
18:52:04 | FromDiscord | <demotomohiro> In reply to @ⶠZeno "sup people, what purpose": I think it is used to implement regular expression in stdlib. |
18:52:40 | FromDiscord | <ⶠZeno> In reply to @demotomohiro "I think it is": makes sense |
18:53:00 | FromDiscord | <michaelb.eth> yeah, it's an external dep for one/both of Nim's regex libs |
18:53:21 | FromDiscord | <voidwalker> where can I see the nim code after template expansion ? |
18:53:27 | FromDiscord | <ⶠZeno> In reply to @michaelb.eth "yeah, it's an external": thanks |
18:53:37 | FromDiscord | <demotomohiro> In reply to @ⶠZeno "makes sense": https://github.com/nim-lang/Nim/blob/devel/lib/wrappers/pcre.nim#L318 |
18:54:26 | FromDiscord | <ⶠZeno> In reply to @demotomohiro "https://github.com/nim-lang/Nim/blob/devel/lib/wrap": thanks to you too |
18:54:40 | FromDiscord | <michaelb.eth> on non-Windows, you'd normally get it via package manager (`apt`, `brew`, whatever) but on Windows the simplest course is arguably just to provide a bundle of DLLs along with Nim and its tools |
18:55:12 | FromDiscord | <ⶠZeno> In reply to @michaelb.eth "on non-Windows, you'd normally": yea agreed |
18:55:26 | FromDiscord | <demotomohiro> In reply to @voidwalker "where can I see": https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctypedâ”This might work for template. |
18:55:37 | FromDiscord | <michaelb.eth> I say arguably because I think there'd be merit in MSYS2 becoming the recommended way to get up and running with Nim on Windows, but others strongly disagree |
18:56:54 | FromDiscord | <michaelb.eth> with MSYS2 you'd just install libpcre with pacman if you need it, just like using a package manager on non-Windows |
18:58:57 | FromDiscord | <voidwalker> @demotomohiro I am not quite sure if I am using it wrong or what, but it's not working |
18:59:47 | FromDiscord | <voidwalker> ah nevermind, the code was way before the last terminal output, it works |
19:00:56 | FromDiscord | <michaelb.eth> @voidwalker if the other compiler output gets distracting while debugging your template/macro, you can try compiler flags like `--hints:off` to cut down on some of the noise |
19:02:03 | FromDiscord | <voidwalker> ok now I finally see what I might have been doing wrong with that alloca call. It's supposed to free the memory after the calling proc is finished, and I thought I call it in main() but nope, it was in a proc called from main that called the template |
19:02:06 | FromDiscord | <demotomohiro> In reply to @voidwalker "<@288750616510201856> I am not": `expandMacros` outputs at compile time. |
19:02:46 | FromDiscord | <voidwalker> so I need a template within a template |
19:03:56 | FromDiscord | <voidwalker> is it still a proc if I mark it with inline ? |
19:03:58 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4wd8 |
19:04:03 | FromDiscord | <voidwalker> in the C sense |
19:04:18 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1109194840685678662/image.png |
19:12:24 | FromDiscord | <demotomohiro> In reply to @voidwalker "is it still a": If I remember correctly, It become a c function with `inline`. |
19:12:57 | FromDiscord | <voidwalker> I tested with inline and it still messes up, I need a nested template.. ugh, i'm not good with templates |
19:17:43 | FromDiscord | <kcvinker> How to use unicode character literal in nim ? |
19:17:56 | FromDiscord | <Chronos [She/Her]> I'm unsure on how I should implement my event system honestly |
19:18:22 | FromDiscord | <Chronos [She/Her]> I want to support events being called asynchronously but that won't exactly matter in a WASM env, would it? |
19:19:44 | FromDiscord | <huantian> In reply to @kcvinker "How to use unicode": like this kind? |
19:19:45 | FromDiscord | <huantian> !eval echo "\u6211" |
19:19:48 | NimBot | æ |
19:20:16 | FromDiscord | <Chronos [She/Her]> Hey beef, how would I run multiple WASM envs simultaneously? Would I just use threads for it? Since if that's the case, passing data may be problematic |
19:26:51 | FromDiscord | <demotomohiro> !eval echo ""ââłâĄâ" |
19:26:53 | NimBot | Compile failed: /usercode/in.nim(1, 20) Error: closing " expected |
19:27:06 | FromDiscord | <demotomohiro> !eval echo "ââłâĄâ" |
19:27:09 | NimBot | ââłâĄâ |
19:34:10 | FromDiscord | <voidwalker> https://play.nim-lang.org/#ix=4wde - what's wrong with this template ? doesn't compile |
19:52:58 | * | Figworm joined #nim |
19:53:10 | * | Figworm quit (Client Quit) |
20:10:51 | * | Zevv left #nim (#nim) |
20:37:53 | * | rockcavera quit (Read error: Connection reset by peer) |
20:38:28 | * | rockcavera joined #nim |
20:38:28 | * | rockcavera quit (Changing host) |
20:38:28 | * | rockcavera joined #nim |
20:44:42 | FromDiscord | <Elegantbeef> @voidwalker\: inside a template all usages of the template parameters are replaced so that's `bv.10 = 10` |
21:05:14 | FromDiscord | <voidwalker> ah crap yeah that's not a proc : P |
21:06:51 | FromDiscord | <voidwalker> finally that's working |
21:07:26 | FromDiscord | <voidwalker> Now I have to figure out how useful that array will be if it dies when the proc it's created in returns |
21:15:54 | * | progranner quit (Quit: My Mac has gone to sleep. ZZZzzzâŠ) |
21:17:25 | * | myrix quit (Ping timeout: 240 seconds) |
21:28:17 | * | noxnivi joined #nim |
21:28:26 | noxnivi | good day |
21:28:57 | FromDiscord | <Elegantbeef> Hello |
21:29:25 | noxnivi | i'm having issues with the forum, nim-forum, i mean |
21:29:35 | noxnivi | i can't post because i need to confirm email |
21:29:45 | noxnivi | but i can't find where to confirm email |
21:29:49 | FromDiscord | <Elegantbeef> that's seriously still a thing |
21:29:52 | FromDiscord | <Elegantbeef> Someone needs to ping @moderators |
21:30:55 | FromDiscord | <Elegantbeef> It's supposed to send a confirmation email, but it seems very buggy in that it fails a majority of the time |
21:31:08 | noxnivi | i see... |
21:31:21 | noxnivi | funny thing though is that i posted before |
21:31:35 | noxnivi | just today it stopped working asking for the email confirmation thing |
21:31:50 | noxnivi | but no option to resend the confirmation email |
21:32:11 | noxnivi | didn't know that Elegantbeef |
21:36:53 | noxnivi | looks like forum needs some enhancements |
21:37:08 | FromDiscord | <Elegantbeef> To quote what they say "PRs welcome" |
21:38:26 | FromDiscord | <voidwalker> "The forum is written in Nim" : D |
21:42:46 | FromDiscord | <jmgomez> I wonder if is the forum didnt exists and people asked in stack overflow Nim would have make into any of the "famous langs indexes" based on stack overflow popularity |
21:43:35 | noxnivi | oh well... |
21:43:50 | noxnivi | in the meantime, I mean, while i get that solved |
21:44:20 | noxnivi | i need help with packing Nim+QML software |
21:44:33 | noxnivi | that is what i was trying to ask in the forum |
21:44:59 | FromDiscord | <Elegantbeef> Copy all the required DLLs next to the binary zip it and ship it |
21:45:42 | noxnivi | my issue is with the .qml files |
21:46:17 | noxnivi | if I do that then when unzipped there will be a bunch of .qml files floating around |
21:46:23 | noxnivi | doesn't look nice |
21:46:25 | noxnivi | :) |
21:47:15 | FromDiscord | <Elegantbeef> `staticRead` them and hope there is a proc to load them from memory |
21:50:35 | noxnivi | aha... staticRead, I'll look into that |
21:50:40 | noxnivi | thanks Elegantbeef |
21:50:53 | FromDiscord | <Elegantbeef> If you cannot load from memory use `memfiles` then |
21:56:21 | noxnivi | will review both methods, see which works |
21:56:27 | noxnivi | thanks |
21:56:37 | noxnivi | :) |
21:57:24 | FromDiscord | <Elegantbeef> Also looking around seems you can make a `.qrc` if you do not want many files |
22:03:29 | noxnivi | yes that .qrc file I already have |
22:03:43 | noxnivi | nimqml docs and examples already point to that |
22:03:54 | noxnivi | that is what i was trying to write in the forum |
22:04:04 | noxnivi | with a tree of the project files |
22:04:07 | noxnivi | :D |
22:04:10 | noxnivi | but was a no go |
22:04:13 | noxnivi | XD |
22:17:34 | * | lucasta joined #nim |
22:22:13 | * | Notxor quit (Remote host closed the connection) |
23:07:55 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to import all files from a folder? https://media.discordapp.net/attachments/371759389889003532/1109256147195662406/image.png |
23:12:56 | noxnivi | bye all |
23:13:01 | * | noxnivi quit (Quit: Leaving) |
23:13:09 | FromDiscord | <huantian> Bye |
23:17:18 | FromDiscord | <Rika> In reply to @System64 "Is it possible to": Not built in, either manually or make a macro I think |
23:39:07 | FromDiscord | <@theperfectcomputer-628303036da0> why does the function signature for satisfy have a function signature in it? |
23:39:30 | FromDiscord | <@theperfectcomputer-628303036da0> https://schneiderfelipe.github.io/microparsec/microparsec/internals.html#satisfy,,openArray[string] |
23:39:34 | FromDiscord | <@theperfectcomputer-628303036da0> sorry |
23:39:35 | FromDiscord | <@theperfectcomputer-628303036da0> semicolon |
23:39:50 | FromDiscord | <@theperfectcomputer-628303036da0> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1109264001055072286): why does the function signature for satisfy have a function semicolong in it? |
23:39:54 | FromDiscord | <@theperfectcomputer-628303036da0> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1109264001055072286): why does the function signature for satisfy have a function semicolon in it? |
23:43:20 | FromDiscord | <@theperfectcomputer-628303036da0> chatGPT says that after semicolon is for parameters that aren't regular |
23:43:28 | FromDiscord | <@theperfectcomputer-628303036da0> so I guess that's solved |
23:43:50 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "Not built in, either": ah alright, and how can I get type of an object please? It is for a Case statement |
23:54:57 | FromDiscord | <System64 ~ Flandre Scarlet> Alright so I struggle with inheritence hereâ”It is supposed to be an OscillatorModule that inherits from SynthModule, but it doesn't display OscillatorModule, why? https://media.discordapp.net/attachments/371759389889003532/1109267985635483658/image.png |
23:55:24 | FromDiscord | <huantian> `of` not `is` I think |
23:55:59 | FromDiscord | <System64 ~ Flandre Scarlet> oh alright |
23:56:13 | FromDiscord | <huantian> `of` does runtime type check, `is` is static type check |
23:56:26 | FromDiscord | <System64 ~ Flandre Scarlet> Aaaah it works! thanks! |
23:57:14 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @huantian "`of` does runtime type": and how can I use case: of with that? |
23:58:31 | FromDiscord | <Rika> In reply to @@theperfectcomputer-628303036da0 "chatGPT says that after": semicolon and comma are roughly equivalent in function signatures |
23:58:49 | FromDiscord | <Rika> In reply to @System64 "and how can I": you dont |
23:59:36 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "you dont": Uh oh! So YandereDev moment I guess? |